From 82edc4160c607c8de0d6a33edc9abf70655053b6 Mon Sep 17 00:00:00 2001 From: Sharon Adewusi <sadewusi@twilio.com> Date: Wed, 18 Jun 2025 15:29:49 +0100 Subject: [PATCH 01/22] Source Insert Functions doc added to Functions --- .../functions/source-insert-functions | 102 ++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 src/connections/functions/source-insert-functions diff --git a/src/connections/functions/source-insert-functions b/src/connections/functions/source-insert-functions new file mode 100644 index 0000000000..7ed4981200 --- /dev/null +++ b/src/connections/functions/source-insert-functions @@ -0,0 +1,102 @@ +--- +title: Source Insert Functions +--- + +> info "Source Insert Function is in Public Beta" +> Source Insert Function is in public beta, and Segment is actively working on this feature. Some functionality may change before it becomes generally available. + +## Create source insert functions + +There are two ways you can access source insert functions from your Segment workspace: +- From the [Connections catalog](#using-the-catalog). +- From the [Sources tab](#using-the-sources-tab). + +### Using the catalog + +To create a source insert function from Segment’s catalog: + +1. Navigate to **Connections** > **Catalog** > **Functions** and click **New Function**. + +2. In the Select Function Type screen, select **Source Insert** and click **Next: Build Function**. + +3. Write and test your function code. Enter a sample event and click **Run** to test the function. + +4. Click **Next: Configure & Create** to add a function name, description (optional), and function logo (optional). + +5. Click **Create Function** to save your insert function. The new source insert function will be displayed in the Functions tab. + +#### Coding the source insert function + +Insert functions can define handlers for the following message types: +- `onIdentity` +- `onTrack` +- `onPage` +- `onScreen` +- `onGroup` +- `onAlias` +- `onDelete` + +The default source code template includes handlers for all event types. Just implement the types you need and skip the ones you don’t. For event types you want to send through, return the event in the respective event handler. + +### Using the Sources tab + +You can also create a source insert function from Sources. + +1. Navigate to **Connections** > **Sources**. +2. Select your source and go to the **Functions** tab. +3. Click **Create insert function** to create your insert function from scratch. + +### Connecting a source insert function to a source + +For data to flow downstream after transformation, you need to connect your source insert function to a source. To do this, follow the steps below: + +1. Select the insert function you want to connect to the source. You can edit, delete, and connect the insert function in the side pane. +2. Click *Connect a source**. +3. Select the source you want to connect from the dropdown and click **Connect to Source** to connect. + +### Errors and error handling + +Segment considers a function’s execution successful if it completes without error. You can `throw` an error to create a failure on purpose. Use these errors to validate event data before processing to make sure the function works as expected. + +You can `throw` the following pre-defined error types to indicate that the function ran successfully, but the data was not deliverable: + +- `EventNotSupported` +- `InvalidEventPayload` +- `ValidationError` +- `RetryError` +- `DropEvent` + +This is similar to Source, Destination, and Insert Functions. + +The errors listed are all permanent errors, except `RetryError`. When a `RetryError` is thrown, Segment will reattempt to run the function a set number of times before permanently erroring out. + +### Source insert functions FAQs + +**The Delivery Overview tab does not display any errors that occur within the source insert function.** +If errors arise or events are dropped, they will appear as if the events never flowed from the source. + +**Can I test the function with different event types?** +You can test the function with different event types from the **Test** tab in the code editor, similar to other functions. + +**Can I use source insert functions for all types of Source?** +Source insert functions only work for event sources, not object sources or rETL. + +**What is the expected latency for a source insert function?** +Typically, it takes a source insert function between 200 milliseconds to 5 seconds to complete, based on the complexity of the function. The default timeout is 5 seconds but can be increased to 60 seconds. + +**What is the runtime environment?** +Segment supports Node.js V18. The dependencies listed [here](https://segment.com/docs/connections/functions/insert-functions/#runtime-and-dependencies){:target=”_blank”} are installed in the function. The following dependencies are also installed: +- `@azure/identity` exposed as `azure.identity` +- `@azure/event-hubs` exposed as `azure.eventHubs` +- `@azure/synapse` exposed as `azure.synapse` +- `jsftp` exposed as `jsftp` +- `crypto-js` exposed as `cryptojslib.cryptojs` +- `akeyless` exposed as `akeylessLabs.akeyless` +- `akeyless-cloud-id` exposed as `akeylessLabs.akeylessCloudId` +- `@onesignal/node-onesignal` exposed as `oneSignal.oneSignal` +- `pg` exposed as `pg.pg` +- `snowflake-sdk` exposed as `snowflakesdk.snowflakesdk` +- `@clickhouse/client` exposed as `clickHouseClient.clickHouseClient` +- `aws4` exposed as `aws4.aws4` +- `@sentry/node` exposed as `sentrylib.sentry` + From 3a1c8507b4ca3da7aac7215a73882d5fe8bfce0a Mon Sep 17 00:00:00 2001 From: Sharon Adewusi <sadewusi@twilio.com> Date: Wed, 18 Jun 2025 15:33:37 +0100 Subject: [PATCH 02/22] added whitespace for [netlify-build] --- src/connections/functions/source-insert-functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/connections/functions/source-insert-functions b/src/connections/functions/source-insert-functions index 7ed4981200..71bd46f043 100644 --- a/src/connections/functions/source-insert-functions +++ b/src/connections/functions/source-insert-functions @@ -5,7 +5,7 @@ title: Source Insert Functions > info "Source Insert Function is in Public Beta" > Source Insert Function is in public beta, and Segment is actively working on this feature. Some functionality may change before it becomes generally available. -## Create source insert functions +## Create source insert functions There are two ways you can access source insert functions from your Segment workspace: - From the [Connections catalog](#using-the-catalog). From e0f2a2069fac0cf6fa2e8d78acd940334ff2f979 Mon Sep 17 00:00:00 2001 From: Sharon Adewusi <sadewusi@twilio.com> Date: Wed, 18 Jun 2025 16:25:02 +0100 Subject: [PATCH 03/22] Update source-insert-functions [netlify-build] --- src/connections/functions/source-insert-functions | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/connections/functions/source-insert-functions b/src/connections/functions/source-insert-functions index 71bd46f043..5ce79df4ac 100644 --- a/src/connections/functions/source-insert-functions +++ b/src/connections/functions/source-insert-functions @@ -1,5 +1,6 @@ --- title: Source Insert Functions + --- > info "Source Insert Function is in Public Beta" @@ -73,18 +74,23 @@ The errors listed are all permanent errors, except `RetryError`. When a `RetryEr ### Source insert functions FAQs **The Delivery Overview tab does not display any errors that occur within the source insert function.** + If errors arise or events are dropped, they will appear as if the events never flowed from the source. **Can I test the function with different event types?** + You can test the function with different event types from the **Test** tab in the code editor, similar to other functions. **Can I use source insert functions for all types of Source?** + Source insert functions only work for event sources, not object sources or rETL. **What is the expected latency for a source insert function?** + Typically, it takes a source insert function between 200 milliseconds to 5 seconds to complete, based on the complexity of the function. The default timeout is 5 seconds but can be increased to 60 seconds. **What is the runtime environment?** + Segment supports Node.js V18. The dependencies listed [here](https://segment.com/docs/connections/functions/insert-functions/#runtime-and-dependencies){:target=”_blank”} are installed in the function. The following dependencies are also installed: - `@azure/identity` exposed as `azure.identity` - `@azure/event-hubs` exposed as `azure.eventHubs` From 44c6a6f8bc220b36cd8c797550f351b87ea2e69a Mon Sep 17 00:00:00 2001 From: Sharon Adewusi <sadewusi@twilio.com> Date: Wed, 18 Jun 2025 16:35:32 +0100 Subject: [PATCH 04/22] Rename source-insert-functions to source-insert-functions.md --- .../{source-insert-functions => source-insert-functions.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/connections/functions/{source-insert-functions => source-insert-functions.md} (100%) diff --git a/src/connections/functions/source-insert-functions b/src/connections/functions/source-insert-functions.md similarity index 100% rename from src/connections/functions/source-insert-functions rename to src/connections/functions/source-insert-functions.md From ea6525899f521f201c47531accb2e40f01489d9f Mon Sep 17 00:00:00 2001 From: Sharon Adewusi <sadewusi@twilio.com> Date: Wed, 18 Jun 2025 16:36:21 +0100 Subject: [PATCH 05/22] Update source-insert-functions.md [netlify-build] solving why build didn't work --- src/connections/functions/source-insert-functions.md | 1 - 1 file changed, 1 deletion(-) diff --git a/src/connections/functions/source-insert-functions.md b/src/connections/functions/source-insert-functions.md index 5ce79df4ac..3a82fbac69 100644 --- a/src/connections/functions/source-insert-functions.md +++ b/src/connections/functions/source-insert-functions.md @@ -1,6 +1,5 @@ --- title: Source Insert Functions - --- > info "Source Insert Function is in Public Beta" From 92b80f0fe5e9582f644bc6665b51365f5a877d08 Mon Sep 17 00:00:00 2001 From: Sharon Adewusi <sadewusi@twilio.com> Date: Wed, 18 Jun 2025 16:49:20 +0100 Subject: [PATCH 06/22] formatting --- src/connections/functions/source-insert-functions.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/connections/functions/source-insert-functions.md b/src/connections/functions/source-insert-functions.md index 3a82fbac69..4639cd59a5 100644 --- a/src/connections/functions/source-insert-functions.md +++ b/src/connections/functions/source-insert-functions.md @@ -72,23 +72,23 @@ The errors listed are all permanent errors, except `RetryError`. When a `RetryEr ### Source insert functions FAQs -**The Delivery Overview tab does not display any errors that occur within the source insert function.** +##### The Delivery Overview tab does not display any errors that occur within the source insert function. If errors arise or events are dropped, they will appear as if the events never flowed from the source. -**Can I test the function with different event types?** +##### Can I test the function with different event types? You can test the function with different event types from the **Test** tab in the code editor, similar to other functions. -**Can I use source insert functions for all types of Source?** +##### Can I use source insert functions for all types of Source? Source insert functions only work for event sources, not object sources or rETL. -**What is the expected latency for a source insert function?** +##### What is the expected latency for a source insert function? Typically, it takes a source insert function between 200 milliseconds to 5 seconds to complete, based on the complexity of the function. The default timeout is 5 seconds but can be increased to 60 seconds. -**What is the runtime environment?** +##### What is the runtime environment? Segment supports Node.js V18. The dependencies listed [here](https://segment.com/docs/connections/functions/insert-functions/#runtime-and-dependencies){:target=”_blank”} are installed in the function. The following dependencies are also installed: - `@azure/identity` exposed as `azure.identity` From 90eb4b8e025922117865079e171d30bf4f8fc10f Mon Sep 17 00:00:00 2001 From: Sharon Adewusi <sadewusi@twilio.com> Date: Thu, 19 Jun 2025 22:37:55 +0100 Subject: [PATCH 07/22] Update src/connections/functions/source-insert-functions.md Co-authored-by: stayseesong <83784848+stayseesong@users.noreply.github.com> --- src/connections/functions/source-insert-functions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/connections/functions/source-insert-functions.md b/src/connections/functions/source-insert-functions.md index 4639cd59a5..a32b6d92ac 100644 --- a/src/connections/functions/source-insert-functions.md +++ b/src/connections/functions/source-insert-functions.md @@ -23,7 +23,7 @@ To create a source insert function from Segment’s catalog: 4. Click **Next: Configure & Create** to add a function name, description (optional), and function logo (optional). -5. Click **Create Function** to save your insert function. The new source insert function will be displayed in the Functions tab. +5. Click **Create Function** to save your insert function. The new source insert function displays in the Functions tab. #### Coding the source insert function From d10eb7e15b68959605faa6486e029a7140f57e18 Mon Sep 17 00:00:00 2001 From: Sharon Adewusi <sadewusi@twilio.com> Date: Thu, 19 Jun 2025 22:38:03 +0100 Subject: [PATCH 08/22] Update src/connections/functions/source-insert-functions.md Co-authored-by: stayseesong <83784848+stayseesong@users.noreply.github.com> --- src/connections/functions/source-insert-functions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/connections/functions/source-insert-functions.md b/src/connections/functions/source-insert-functions.md index a32b6d92ac..0ca7c543d9 100644 --- a/src/connections/functions/source-insert-functions.md +++ b/src/connections/functions/source-insert-functions.md @@ -36,7 +36,7 @@ Insert functions can define handlers for the following message types: - `onAlias` - `onDelete` -The default source code template includes handlers for all event types. Just implement the types you need and skip the ones you don’t. For event types you want to send through, return the event in the respective event handler. +The default source code template includes handlers for all event types. Implement the types you need. For event types you want to send through, return the event in the respective event handler. ### Using the Sources tab From 3e252044dd9cd7269290bb9341c92a1e4ff521de Mon Sep 17 00:00:00 2001 From: Sharon Adewusi <sadewusi@twilio.com> Date: Thu, 19 Jun 2025 22:40:12 +0100 Subject: [PATCH 09/22] Update src/connections/functions/source-insert-functions.md Co-authored-by: stayseesong <83784848+stayseesong@users.noreply.github.com> --- src/connections/functions/source-insert-functions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/connections/functions/source-insert-functions.md b/src/connections/functions/source-insert-functions.md index 0ca7c543d9..300b07790f 100644 --- a/src/connections/functions/source-insert-functions.md +++ b/src/connections/functions/source-insert-functions.md @@ -86,7 +86,7 @@ Source insert functions only work for event sources, not object sources or rETL. ##### What is the expected latency for a source insert function? -Typically, it takes a source insert function between 200 milliseconds to 5 seconds to complete, based on the complexity of the function. The default timeout is 5 seconds but can be increased to 60 seconds. +The source insert function typically completes in 200 milliseconds to 5 seconds, depending on its complexity. The default timeout is 5 seconds but can be increased to 60 seconds. ##### What is the runtime environment? From 629b0ee1c2136b1e8f373f09486f905424ef2b08 Mon Sep 17 00:00:00 2001 From: Sharon Adewusi <sadewusi@twilio.com> Date: Thu, 19 Jun 2025 22:40:34 +0100 Subject: [PATCH 10/22] Update src/connections/functions/source-insert-functions.md Co-authored-by: stayseesong <83784848+stayseesong@users.noreply.github.com> --- src/connections/functions/source-insert-functions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/connections/functions/source-insert-functions.md b/src/connections/functions/source-insert-functions.md index 300b07790f..3a1f2e0fc4 100644 --- a/src/connections/functions/source-insert-functions.md +++ b/src/connections/functions/source-insert-functions.md @@ -90,7 +90,7 @@ The source insert function typically completes in 200 milliseconds to 5 seconds, ##### What is the runtime environment? -Segment supports Node.js V18. The dependencies listed [here](https://segment.com/docs/connections/functions/insert-functions/#runtime-and-dependencies){:target=”_blank”} are installed in the function. The following dependencies are also installed: +Segment supports Node.js V18 and installs the dependencies listed [here](https://segment.com/docs/connections/functions/insert-functions/#runtime-and-dependencies){:target=”_blank”} in the function. Segment also installs the following dependencies: - `@azure/identity` exposed as `azure.identity` - `@azure/event-hubs` exposed as `azure.eventHubs` - `@azure/synapse` exposed as `azure.synapse` From 4b86de0a2dd68bd502d500987208fac7a93a3cd2 Mon Sep 17 00:00:00 2001 From: Sharon Adewusi <sadewusi@twilio.com> Date: Thu, 19 Jun 2025 22:40:44 +0100 Subject: [PATCH 11/22] Update src/connections/functions/source-insert-functions.md Co-authored-by: stayseesong <83784848+stayseesong@users.noreply.github.com> --- src/connections/functions/source-insert-functions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/connections/functions/source-insert-functions.md b/src/connections/functions/source-insert-functions.md index 3a1f2e0fc4..02c9e6ffe8 100644 --- a/src/connections/functions/source-insert-functions.md +++ b/src/connections/functions/source-insert-functions.md @@ -80,7 +80,7 @@ If errors arise or events are dropped, they will appear as if the events never f You can test the function with different event types from the **Test** tab in the code editor, similar to other functions. -##### Can I use source insert functions for all types of Source? +##### Can I use source insert functions for all types of sources? Source insert functions only work for event sources, not object sources or rETL. From a39114d9b18d8301704bf6067126cd624e5bbcdf Mon Sep 17 00:00:00 2001 From: Sharon Adewusi <sadewusi@twilio.com> Date: Thu, 19 Jun 2025 22:53:21 +0100 Subject: [PATCH 12/22] Update src/connections/functions/source-insert-functions.md Co-authored-by: stayseesong <83784848+stayseesong@users.noreply.github.com> --- src/connections/functions/source-insert-functions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/connections/functions/source-insert-functions.md b/src/connections/functions/source-insert-functions.md index 02c9e6ffe8..278e32e5f2 100644 --- a/src/connections/functions/source-insert-functions.md +++ b/src/connections/functions/source-insert-functions.md @@ -72,7 +72,7 @@ The errors listed are all permanent errors, except `RetryError`. When a `RetryEr ### Source insert functions FAQs -##### The Delivery Overview tab does not display any errors that occur within the source insert function. +##### Why does the Delivery Overview tab not display any errors that occur within the source insert function? If errors arise or events are dropped, they will appear as if the events never flowed from the source. From 628241a624c6f4cb358587226fb4ce8d0416c91c Mon Sep 17 00:00:00 2001 From: Sharon Adewusi <sadewusi@twilio.com> Date: Thu, 19 Jun 2025 22:53:28 +0100 Subject: [PATCH 13/22] Update src/connections/functions/source-insert-functions.md Co-authored-by: stayseesong <83784848+stayseesong@users.noreply.github.com> --- src/connections/functions/source-insert-functions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/connections/functions/source-insert-functions.md b/src/connections/functions/source-insert-functions.md index 278e32e5f2..0c37f99ea1 100644 --- a/src/connections/functions/source-insert-functions.md +++ b/src/connections/functions/source-insert-functions.md @@ -74,7 +74,7 @@ The errors listed are all permanent errors, except `RetryError`. When a `RetryEr ##### Why does the Delivery Overview tab not display any errors that occur within the source insert function? -If errors arise or events are dropped, they will appear as if the events never flowed from the source. +If errors arise or events are dropped, they appear as if the events never flowed from the source. ##### Can I test the function with different event types? From 35332e075f5ead947a9866df8de3763837c9cbaf Mon Sep 17 00:00:00 2001 From: Sharon Adewusi <sadewusi@twilio.com> Date: Thu, 19 Jun 2025 22:54:13 +0100 Subject: [PATCH 14/22] Update src/connections/functions/source-insert-functions.md Co-authored-by: stayseesong <83784848+stayseesong@users.noreply.github.com> --- src/connections/functions/source-insert-functions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/connections/functions/source-insert-functions.md b/src/connections/functions/source-insert-functions.md index 0c37f99ea1..9ec3953b92 100644 --- a/src/connections/functions/source-insert-functions.md +++ b/src/connections/functions/source-insert-functions.md @@ -70,7 +70,7 @@ This is similar to Source, Destination, and Insert Functions. The errors listed are all permanent errors, except `RetryError`. When a `RetryError` is thrown, Segment will reattempt to run the function a set number of times before permanently erroring out. -### Source insert functions FAQs +### FAQs ##### Why does the Delivery Overview tab not display any errors that occur within the source insert function? From 4a813e20bc9a2d525a3e50035f4f2d9ad154772d Mon Sep 17 00:00:00 2001 From: Sharon Adewusi <sadewusi@twilio.com> Date: Fri, 20 Jun 2025 11:33:04 +0100 Subject: [PATCH 15/22] Update source-insert-functions to include review fixes.md --- .../functions/source-insert-functions.md | 32 ++++++++----------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/src/connections/functions/source-insert-functions.md b/src/connections/functions/source-insert-functions.md index 9ec3953b92..f2726fdc6a 100644 --- a/src/connections/functions/source-insert-functions.md +++ b/src/connections/functions/source-insert-functions.md @@ -2,16 +2,16 @@ title: Source Insert Functions --- -> info "Source Insert Function is in Public Beta" -> Source Insert Function is in public beta, and Segment is actively working on this feature. Some functionality may change before it becomes generally available. +Use Source Insert Functions to enrich, transform, or filter your data before it flows downstream to destinations. -## Create source insert functions +> info "Source Insert Function is in public beta" +> Source Insert Function is in public beta, and Segment is actively working on this feature. Some functionality may change before it becomes generally available. There are two ways you can access source insert functions from your Segment workspace: -- From the [Connections catalog](#using-the-catalog). -- From the [Sources tab](#using-the-sources-tab). +- From the Connections catalog. +- From the Sources tab. -### Using the catalog +## Creating a Source Insert Function To create a source insert function from Segment’s catalog: @@ -23,9 +23,11 @@ To create a source insert function from Segment’s catalog: 4. Click **Next: Configure & Create** to add a function name, description (optional), and function logo (optional). -5. Click **Create Function** to save your insert function. The new source insert function displays in the Functions tab. +5. Click **Create Function** to save your insert function. The new source insert function displays in the Functions tab. + +You can also go to **Conections** > **Sources** to create a source insert function. -#### Coding the source insert function +### Coding the source insert function Insert functions can define handlers for the following message types: - `onIdentity` @@ -36,15 +38,7 @@ Insert functions can define handlers for the following message types: - `onAlias` - `onDelete` -The default source code template includes handlers for all event types. Implement the types you need. For event types you want to send through, return the event in the respective event handler. - -### Using the Sources tab - -You can also create a source insert function from Sources. - -1. Navigate to **Connections** > **Sources**. -2. Select your source and go to the **Functions** tab. -3. Click **Create insert function** to create your insert function from scratch. +The default source code template includes handlers for all event types. Implement the types you need. For event types you want to send through, return the event in the respective event handler. ### Connecting a source insert function to a source @@ -68,9 +62,9 @@ You can `throw` the following pre-defined error types to indicate that the funct This is similar to Source, Destination, and Insert Functions. -The errors listed are all permanent errors, except `RetryError`. When a `RetryError` is thrown, Segment will reattempt to run the function a set number of times before permanently erroring out. +The errors listed are all permanent errors, except `RetryError`. When a `RetryError` is thrown, Segment reattempts to run the function a set number of times before permanently erroring out. -### FAQs +## FAQs ##### Why does the Delivery Overview tab not display any errors that occur within the source insert function? From 6676e9f05e007c4e7100b0c037a6b1ed4cd3b7ea Mon Sep 17 00:00:00 2001 From: Sharon Adewusi <sadewusi@twilio.com> Date: Fri, 20 Jun 2025 11:33:35 +0100 Subject: [PATCH 16/22] Update src/connections/functions/source-insert-functions.md Co-authored-by: stayseesong <83784848+stayseesong@users.noreply.github.com> --- src/connections/functions/source-insert-functions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/connections/functions/source-insert-functions.md b/src/connections/functions/source-insert-functions.md index f2726fdc6a..6b4e89a252 100644 --- a/src/connections/functions/source-insert-functions.md +++ b/src/connections/functions/source-insert-functions.md @@ -42,7 +42,7 @@ The default source code template includes handlers for all event types. Implemen ### Connecting a source insert function to a source -For data to flow downstream after transformation, you need to connect your source insert function to a source. To do this, follow the steps below: +For data to flow downstream after transformation, connect your source insert function to a source. To do this: 1. Select the insert function you want to connect to the source. You can edit, delete, and connect the insert function in the side pane. 2. Click *Connect a source**. From d6c6cc3de955abd0fe8182b24840ee7c532ec225 Mon Sep 17 00:00:00 2001 From: Sharon Adewusi <sadewusi@twilio.com> Date: Fri, 20 Jun 2025 11:33:51 +0100 Subject: [PATCH 17/22] Update src/connections/functions/source-insert-functions.md Co-authored-by: stayseesong <83784848+stayseesong@users.noreply.github.com> --- src/connections/functions/source-insert-functions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/connections/functions/source-insert-functions.md b/src/connections/functions/source-insert-functions.md index 6b4e89a252..7fe3adafc1 100644 --- a/src/connections/functions/source-insert-functions.md +++ b/src/connections/functions/source-insert-functions.md @@ -44,7 +44,7 @@ The default source code template includes handlers for all event types. Implemen For data to flow downstream after transformation, connect your source insert function to a source. To do this: -1. Select the insert function you want to connect to the source. You can edit, delete, and connect the insert function in the side pane. +1. Select the insert function you want to connect to the source. You can edit, delete, and connect the insert function on the side pane. 2. Click *Connect a source**. 3. Select the source you want to connect from the dropdown and click **Connect to Source** to connect. From 6d86db6c820e4783861c987c8c64aa8dffa837fd Mon Sep 17 00:00:00 2001 From: Sharon Adewusi <sadewusi@twilio.com> Date: Fri, 20 Jun 2025 11:34:06 +0100 Subject: [PATCH 18/22] Update src/connections/functions/source-insert-functions.md Co-authored-by: stayseesong <83784848+stayseesong@users.noreply.github.com> --- src/connections/functions/source-insert-functions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/connections/functions/source-insert-functions.md b/src/connections/functions/source-insert-functions.md index 7fe3adafc1..8e133484ec 100644 --- a/src/connections/functions/source-insert-functions.md +++ b/src/connections/functions/source-insert-functions.md @@ -46,7 +46,7 @@ For data to flow downstream after transformation, connect your source insert fun 1. Select the insert function you want to connect to the source. You can edit, delete, and connect the insert function on the side pane. 2. Click *Connect a source**. -3. Select the source you want to connect from the dropdown and click **Connect to Source** to connect. +3. Select the source you want to connect to and click **Connect to Source**. ### Errors and error handling From f4a974cdced1a3787f13a78788cf468029997f8c Mon Sep 17 00:00:00 2001 From: Sharon Adewusi <sadewusi@twilio.com> Date: Fri, 20 Jun 2025 12:30:58 +0100 Subject: [PATCH 19/22] Added PM changes + settings + testing section --- .../functions/source-insert-functions.md | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/src/connections/functions/source-insert-functions.md b/src/connections/functions/source-insert-functions.md index 8e133484ec..fc289bde81 100644 --- a/src/connections/functions/source-insert-functions.md +++ b/src/connections/functions/source-insert-functions.md @@ -25,7 +25,7 @@ To create a source insert function from Segment’s catalog: 5. Click **Create Function** to save your insert function. The new source insert function displays in the Functions tab. -You can also go to **Conections** > **Sources** to create a source insert function. +You can also go to **Conections** > **Sources** to create a source insert function in the Sources tab. ### Coding the source insert function @@ -40,13 +40,33 @@ Insert functions can define handlers for the following message types: The default source code template includes handlers for all event types. Implement the types you need. For event types you want to send through, return the event in the respective event handler. +### Settings + +You can add and edit settings for source insert functions in the code editor. Settings allow you to configure the behavior of your source insert function, which changes how it is displayed to anyone using your function. To set up: + +1. Go to the **Settings** tab in the code editor and click **Add Setting**. +2. Add the details about this setting. +3. Click **Add Setting** to save the configuration. + +As you change values, such as **Label**, **Name**, **Type**, and **Description**, a preview updates showing how your setting will look and work. Once saved, the new setting appears in the **Settings** tab of the function. Here, you can edit or delete the setting. + +### Testing + +You can test your source insert function with sample events or a manual configuration in the code editor. This allows you to test the functions behavior with real incoming data. To do this: + +1. Go to the **Test** tab in the code editor and click **Use Sample Event** or **customize the event yourself** to set up your test data. +2. Click **Run** to execute the test. + +Test results appear under **Output**, showing whether the function ran successfully or failed. + + ### Connecting a source insert function to a source For data to flow downstream after transformation, connect your source insert function to a source. To do this: 1. Select the insert function you want to connect to the source. You can edit, delete, and connect the insert function on the side pane. -2. Click *Connect a source**. -3. Select the source you want to connect to and click **Connect to Source**. +2. Click **Connect a source**. +3. Select the source you want to connect to and click **Connect to Source**. ### Errors and error handling @@ -68,7 +88,7 @@ The errors listed are all permanent errors, except `RetryError`. When a `RetryEr ##### Why does the Delivery Overview tab not display any errors that occur within the source insert function? -If errors arise or events are dropped, they appear as if the events never flowed from the source. +Errors in the Delivery Overview tab are not yet visible and is a work in progress. ##### Can I test the function with different event types? From 52bae26c34a910f91586eec20e2c175db60d4609 Mon Sep 17 00:00:00 2001 From: Sharon Adewusi <sadewusi@twilio.com> Date: Sat, 21 Jun 2025 00:36:31 +0100 Subject: [PATCH 20/22] Update src/connections/functions/source-insert-functions.md Co-authored-by: stayseesong <83784848+stayseesong@users.noreply.github.com> --- src/connections/functions/source-insert-functions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/connections/functions/source-insert-functions.md b/src/connections/functions/source-insert-functions.md index fc289bde81..d1d1b84461 100644 --- a/src/connections/functions/source-insert-functions.md +++ b/src/connections/functions/source-insert-functions.md @@ -11,7 +11,7 @@ There are two ways you can access source insert functions from your Segment work - From the Connections catalog. - From the Sources tab. -## Creating a Source Insert Function +## Create a Source Insert Function To create a source insert function from Segment’s catalog: From 3f29890798c65b0d71564c277567fda565578a7a Mon Sep 17 00:00:00 2001 From: Sharon Adewusi <sadewusi@twilio.com> Date: Sat, 21 Jun 2025 00:36:39 +0100 Subject: [PATCH 21/22] Update src/connections/functions/source-insert-functions.md Co-authored-by: stayseesong <83784848+stayseesong@users.noreply.github.com> --- src/connections/functions/source-insert-functions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/connections/functions/source-insert-functions.md b/src/connections/functions/source-insert-functions.md index d1d1b84461..8e811401a0 100644 --- a/src/connections/functions/source-insert-functions.md +++ b/src/connections/functions/source-insert-functions.md @@ -15,7 +15,7 @@ There are two ways you can access source insert functions from your Segment work To create a source insert function from Segment’s catalog: -1. Navigate to **Connections** > **Catalog** > **Functions** and click **New Function**. +1. Navigate to **Connections > Catalog > Functions** and click **New Function**. 2. In the Select Function Type screen, select **Source Insert** and click **Next: Build Function**. From 426060cd785edc3a2f85bbaf9ac2f08bd1fccefe Mon Sep 17 00:00:00 2001 From: Sharon Adewusi <sadewusi@twilio.com> Date: Sat, 21 Jun 2025 00:36:46 +0100 Subject: [PATCH 22/22] Update src/connections/functions/source-insert-functions.md Co-authored-by: stayseesong <83784848+stayseesong@users.noreply.github.com> --- src/connections/functions/source-insert-functions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/connections/functions/source-insert-functions.md b/src/connections/functions/source-insert-functions.md index 8e811401a0..e95a942626 100644 --- a/src/connections/functions/source-insert-functions.md +++ b/src/connections/functions/source-insert-functions.md @@ -60,7 +60,7 @@ You can test your source insert function with sample events or a manual configur Test results appear under **Output**, showing whether the function ran successfully or failed. -### Connecting a source insert function to a source +### Connect a source insert function to a source For data to flow downstream after transformation, connect your source insert function to a source. To do this: