Skip to content

Commit 4ad6ab0

Browse files
committed
edits to Destination Insert Functions
1 parent 5249045 commit 4ad6ab0

File tree

3 files changed

+23
-40
lines changed

3 files changed

+23
-40
lines changed

src/_includes/content/functions/runtime.md

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,10 @@
1-
On March 26, 2024, Segment is upgrading the Functions runtime environment to Node.js v18, which is the current long-term support (LTS) release.
1+
On March 26, 2024, Segment upgraded the Functions runtime environment to Node.js v18, which is the current long-term support (LTS) release.
22

33
This upgrade keeps your runtime current with industry standards. Based on the [AWS Lambda](https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html){:target="_blank"} and [Node.js](https://nodejs.org/en/about/previous-releases){:target="_blank"} support schedule, Node.js v16 is no longer in *Maintenance LTS*. Production applications should only use releases of Node.js that are in *Active LTS* or *Maintenance LTS*.
44

5-
All new functions will use Node.js v18 starting March 26, 2024.
5+
For existing functions, this change automatically occurs as you update and deploy an existing function. Segment recommends that you check your function post-deployment to ensure everything's working. Your function may face issues due to the change in syntax between different Node.js versions and dependency compatibility.
66

7-
For existing functions, this change automatically occurs as you update and deploy an existing function. Segment recommends that you check your function post-deployment to ensure everything's working. Your function may face issues due to the change in sytax between different Node.js versions and dependency compatibility.
8-
9-
<div class="premonition warning"><div class="fa fa-check-square"></div><div class="content"><p class="header">Limited time opt-out option </p><p markdown=1>
10-
If you need more time to prepare, you can opt out of the update before March 19, 2024. <br><br> Note that if you opt out: <br>
11-
- The existing functions will continue working on Node.js v16. <br>
12-
- You won't be able to create new functions after July 15, 2024. <br>
13-
- You won't be able to update existing functions after August 15, 2024. <br>
14-
- You won't receive future bug fixes, enhancements, and dependency updates to the functions runtime. <br><br>
15-
[Contact Segment](https://segment.com/help/contact/){:target="_blank"} to opt-out or with any questions. </p></div></div>
16-
17-
18-
<div class="premonition success"><div class="fa fa-check-square"></div><div class="content"><p class="header">Node.js 18 </p><p markdown=1>Segment strongly recommends updating to Node.js v18 to benefit from future runtime updates, the latest security, and performance improvements.</p></div></div>
19-
20-
Functions do not currently support importing dependencies, but you can [contact Segment Support](https://segment.com/help/contact/){:target="_blank"} to request that one be added.
7+
Functions don't currently support importing dependencies, but you can [contact Segment Support](https://segment.com/help/contact/){:target="_blank"} to request that one be added.
218

229
The following dependencies are installed in the function environment by default.
2310

src/_includes/content/functions/settings.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
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.
44

5-
First, add a setting in **Settings** tab in the code editor:
5+
To use settings:
66

7-
![A screenshot of the functions settings tab](/docs/connections/functions/images/settings-tab-empty.png){:width="500"}
7+
1. Add a setting in the **Settings** tab in the code editor:
88

9-
Click **Add Setting** to add your new setting.
9+
![A screenshot of the functions settings tab](/docs/connections/functions/images/settings-tab-empty.png){:width="500"}
1010

11-
![A screenshot of the "Add Setting" section of the functions settings tab, with apiKey settings included](/docs/connections/functions/images/add-setting-dialog.png)
11+
2. Click **Add Setting** to add your new setting.
1212

13-
You can configure the details about this setting, which change how it's displayed to anyone using your function:
13+
3. Configure the details about this setting, which change how it's displayed to anyone using your function:
1414

1515
- **Label** - Name of the setting, which users see when configuring the function.
1616
- **Name** - Auto-generated name of the setting to use in function's source code.
@@ -21,8 +21,6 @@ You can configure the details about this setting, which change how it's displaye
2121

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

24-
Click **Add Setting** to save the new setting.
24+
4. Click **Add Setting** to save the new setting.
2525

2626
Once you save a setting, it appears in the **Settings** tab for the function. You can edit or delete settings from this tab.
27-
28-
![A screenshot of the functions settings tab, showing the apiKey setting](/docs/connections/functions/images/settings-tab-non-empty.png){:width="500"}

src/connections/functions/insert-functions.md

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,18 @@ title: Destination Insert Functions
55

66
Use Destination Insert Functions to enrich, transform, or filter your data before it reaches downstream destinations.
77

8-
**Implement advanced data computation**: Write custom computation, operations, and business logic on streaming data that you send to downstream destinations.
8+
With Destination Insert Functions you can:
9+
* **Implement advanced data computation**: Write custom computation, operations, and business logic on streaming data that you send to downstream destinations.
10+
* **Enrich your data**: Use destination insert functions with Segment's Profile API or third party sources to add additional context to your data and create personalized customer experiences.
11+
* **Support data compliance**: Use destination insert functions to support data masking, encryption, decryption, improved PII data handling, and tokenization.
12+
* **Customize filtration for your destinations**: Create custom logic with nested if-else statements, regex, custom business rules, and more to filter event data.
913

10-
**Enrich your data**: Use destination insert functions with Segment's Profile API or third party sources to add additional context to your data and create personalized customer experiences.
11-
12-
**Support data compliance**: Use destination insert functions to support data masking, encryption, decryption, improved PII data handling, and tokenization.
13-
14-
**Customize filtration for your destinations**: Create custom logic with nested if-else statements, regex, custom business rules, and more to filter event data.
15-
16-
> info "Destination Insert Functions are not compatible with IP Allowlisting"
14+
> info "Destination Insert Functions aren't compatible with IP Allowlisting"
1715
> For more information, see the [IP Allowlisting](/docs/connections/destinations/#ip-allowlisting) documentation.
1816
1917
## Create destination insert functions
2018

21-
There are two ways you can access destination insert functions from your Segment space:
19+
There are 2 ways you can access destination insert functions from your Segment space:
2220
- From the Connections [catalog](#using-the-catalog).
2321
- From the [Destinations](#using-the-destinations-tab) tab.
2422

@@ -78,9 +76,9 @@ Insert functions can define handlers for each message type in the [Segment spec]
7876
- `onDelete`
7977
- `onBatch`
8078

81-
Each of the functions above accepts two arguments:
79+
Each of the functions above accepts 2 arguments:
8280

83-
- **event** - Segment event object, where fields and values depend on the event type. For example, in "Identify" events, Segment formats the object to match the [Identify spec](/docs/connections/spec/identify/).
81+
- **event** - Segment event object, where fields and values depend on the event type. For example, in Identify events, Segment formats the object to match the [Identify spec](/docs/connections/spec/identify/).
8482
- **settings** - Set of [settings](#create-settings-and-secrets) for this function.
8583

8684
The example below shows a function that listens for "Track" events, and sends some details about them to an external service.
@@ -104,16 +102,16 @@ async function onTrack(event) {
104102
}
105103
```
106104

107-
To change which event type the handler listens to, you can rename it to the name of the message type. For example, if you rename this function `onIdentify`, it listens for "Identify" events instead.
105+
To change which event type the handler listens to, you can rename it to the name of the message type. For example, if you rename this function `onIdentify`, it listens for Identify events instead.
108106

109-
To ensure the Destination processes an event payload modified by the function, return the `event` object at the handler's end.
107+
To ensure the destination processes an event payload modified by the function, return the `event` object at the handler's end.
110108

111109
> info ""
112110
> Functions' runtime includes a `fetch()` polyfill using a `node-fetch` package. Check out the [node-fetch documentation](https://www.npmjs.com/package/node-fetch){:target="_blank"} for usage examples.
113111
114112
### Variable scoping
115113

116-
When declaring settings variables, make sure to declare them in the function handler rather than globally in your function. This prevents you leaking the settings values across other function instances.
114+
When declaring settings variables, make sure to declare them in the function handler rather than globally in your function. This prevents you from leaking the settings values across other function instances.
117115

118116
The handler for insert functions is event-specific, for example, `onTrack()`, `onIdentify()`, and so on.
119117

@@ -208,9 +206,9 @@ You may want to consider the [context object's](/docs/connections/spec/common/#c
208206

209207
{% include content/functions/settings.md %}
210208

211-
Next, fill out this setting's value in the **Test** tab, so you can run the function and verify that the correct setting value is passed. (This value is only for testing your function.)
209+
5. Fill out this setting's value in the **Test** tab, so you can run the function and verify that the correct setting value is passed. (This value is only for testing your function.)
212210

213-
Now that you've configured a setting and entered a test value, you can add code to read its value and run the function, as in the example below:
211+
6. Add code to read its value and run the function, as in the example below:
214212

215213
```js
216214
async function onTrack(request, settings) {

0 commit comments

Comments
 (0)