Skip to content

Update function settings to match the UI updates #7740

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/_includes/content/functions/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ You can configure the details about this setting, which change how it's displaye
- **Type** - Type of the setting's value.
- **Description** - Optional description, which appears below the setting name.
- **Required** - Enable this to ensure that the setting cannot be saved without a value.
- **Encrypted** - Enable to encrypt the value of this setting. Use this setting for sensitive data, like API keys.
- **Secret** - Enable this to ensure that sensitive data, like API key values or passwords, are not displayed in the Segment UI.

As you change the values, a preview to the right updates to show how your setting will look and work.

Expand Down
28 changes: 28 additions & 0 deletions src/_includes/content/functions/source-settings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!-- usually placed under a heading called "Settings and Secrets" -->

Settings allow you to pass configurable variables to your function, which is the best way to pass sensitive information such as security tokens. For example, you might use `settings` as placeholders to use information such as an API endpoint and API key. This way, you can use the same code with different settings for different purposes. When you deploy a function in your workspace, you are prompted to fill out these settings to configure the function.

First, add a setting in **Settings** tab in the code editor:

![A screenshot of the functions settings tab](/docs/connections/functions/images/settings-tab-empty.png){:width="500"}

Click **Add Setting** to add your new setting.

![A screenshot of the "Add Setting" section of the functions settings tab, with apiKey settings included](/docs/connections/functions/images/add-source-setting-dialog.png)

You can configure the details about this setting, which change how it's displayed to anyone using your function:

- **Label** - Name of the setting, which users see when configuring the function.
- **Name** - Auto-generated name of the setting to use in function's source code.
- **Type** - Type of the setting's value.
- **Description** - Optional description, which appears below the setting name.
- **Required** - Enable this to ensure that the setting cannot be saved without a value.
- **Encrypted** - Enable to encrypt the value of this setting. Use this setting for sensitive data, like API keys.

As you change the values, a preview to the right updates to show how your setting will look and work.

Click **Add Setting** to save the new setting.

Once you save a setting, it appears in the **Settings** tab for the function. You can edit or delete settings from this tab.

![A screenshot of the functions settings tab, showing the apiKey setting](/docs/connections/functions/images/settings-tab-non-empty.png){:width="500"}
6 changes: 3 additions & 3 deletions src/connections/functions/destination-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ All functions are scoped to your workspace, so members of other workspaces can't

1. From your workspace, go to **Connections > Catalog** and click the [Functions tab](https://app.segment.com/goto-my-workspace/functions/catalog){:target="_blank"}.
2. Click **New Function**.
3. Select **Destination** as the function type and click **Build**.
3. Select **Destination** as the function type and click **Next: Build Function**.

After you click **Build**, a code editor appears. Use the editor to write the code for your function, configure settings, and test the function's behavior.
After you click **Next: Build Function**, a code editor appears. Use the editor to write the code for your function, configure settings, and test the function's behavior.

> success ""
> **Tip:** Want to see some example functions? Check out the templates available in the Functions UI, or in the open-source [Segment Functions Library](https://github.com/segmentio/functions-library){:target="_blank"}. (Contributions welcome!)
> **Tip:** Want to see some example functions? Check out the templates available in the Functions UI, or in the open-source [Segment Functions Library](https://github.com/segmentio/functions-library){:target="_blank"}.


## Code the destination function
Expand Down
Binary file modified src/connections/functions/images/add-setting-dialog.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/connections/functions/source-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ The handler for Source functions is `onRequest()`.

## Create settings and secrets

{% include content/functions/settings.md %}
{% include content/functions/source-settings.md %}

Next, fill out this setting's value in **Test** tab, so that you can run the function and check the setting values being passed.

Expand Down
Loading