Send data from Segment (or any CDP) to Tidepool
If you are already using Segment as a CDP, you can easily configure a webhook destination action to automatically start sending your user inputs to Tidepool. E.g.
![](https://files.readme.io/3e722f0-Screenshot_2023-07-24_at_11.22.23_PM.png)
We walk through the steps below:
1. Verify your Source
The following assumes that you already have a Segment source setup that is capturing
track
events (specifically logging what freeform text users are submitting to your LLM app).
In the following example, we have an analytics.js
source set up to capture track actions (note that it's possible to do something similar with any other type of source, e.g. server-side).
Say that the main UI input for our LLM app is a freeform text field. We are already logging all submissions using Segment's analytics.track
call, tagging each with the event name text_input
. (FYI you may want to have multiple event names, if your app has multiple input flows).
The Segment source debugger allows us to make sure the intended events are coming through:
![](https://files.readme.io/40a993f-Screenshot_2023-07-24_at_11.15.27_PM.png)
In the example above, we are explicitly passing the session_id
from the app — note that this field is optional for Tidepool's /track
endpoint .
2. Create Destination Action (Webhook)
There are official Segment docs for this, but you should essentially be running through the following. Add a destination:
![](https://files.readme.io/38a9989-Screenshot_2023-07-24_at_11.24.31_PM.png)
Search for the Webhooks (Actions)
type:
![](https://files.readme.io/74f0c3d-Screenshot_2023-07-24_at_11.27.28_PM.png)
You'll need to select your source (here happens to be a JS app):
![](https://files.readme.io/29b9950-Screenshot_2023-07-24_at_11.27.58_PM.png)
Name your destination:
![](https://files.readme.io/d9d1bf5-Screenshot_2023-07-24_at_11.28.26_PM.png)
3. Configure Webhook Mappings
To actually pipe things through properly, you'll need to set up a mapping:
![](https://files.readme.io/173f796-Screenshot_2023-07-24_at_11.30.02_PM.png)
In the following section, we're filtering specifically to the event name we care about (text_input
in our case, but perhaps in your case, filtering to "Track" events is enough):
![](https://files.readme.io/b162a83-Screenshot_2023-07-24_at_11.30.34_PM.png)
For the purposes of setup, it's helpful to have a sample event for reference (sometimes Segment can autograb an example for you):
![](https://files.readme.io/d415982-Screenshot_2023-07-24_at_11.32.00_PM.png)
In our case, the relevant fields (omitting the others) are:
{
"anonymousId": "d6ba4938-eb14-4d6e-b96b-e7fbea314498",
"event": "text_input",
"messageId": "ajs-next-12ade8aff3b579788071eb43fc4c647a",
"properties": {
"session_uuid": "b5766cc9-3173-4e18-9426-564ea0caad58",
"text": "plan a hakone itinerary"
},
"timestamp": "2023-07-24T22:19:40.738Z",
"type": "track",
"userId": null
}
The relevant endpoint to integrate with is https://shoreline.tidepool.so/api/v1/events/track
(although you may want to first use https://shoreline.tidepool.so/api/v1/events/validate
when using the "Send Test Event" option in the mapping setup).
Make sure to set Batch Size to at least "1" here — Tidepool's API expects to receive a list of metadata, and will fail otherwise.
![](https://files.readme.io/10ea7bc-Screenshot_2023-07-24_at_11.33.48_PM.png)
Then make sure you have an API key available to set the auth headers:
![](https://files.readme.io/44529b5-Screenshot_2023-07-24_at_11.33.53_PM.png)
And finally, map the expected fields like so (you can omit session_uuid
if it's not something you're including in your track
call, see the list of possible fields to include):
Make sure to set "Enable Batching?" to "Yes" — Tidepool's API expects to receive a list of metadata, and will fail otherwise.
![](https://files.readme.io/221e4a9-Screenshot_2023-07-24_at_11.35.43_PM.png)
Now you can test a possible input:
![](https://files.readme.io/7fad081-Screenshot_2023-07-24_at_11.35.58_PM.png)
If it's successful, you should see something like:
![](https://files.readme.io/ee77128-Screenshot_2023-07-24_at_11.52.25_PM.png)
4. Enable the Destination Mapping
You're not done quite yet—you'll need to make sure to toggle the mapping from "Disabled" to "Enabled":
![](https://files.readme.io/169e388-Screenshot_2023-07-24_at_11.56.26_PM.png)
To confirm that this is working, you can check the "Event Tester" tab:
![](https://files.readme.io/89a9720-Screenshot_2023-07-24_at_11.58.45_PM.png)
5. See your Results in Tidepool
It may take some time your CDP events to be visible in Tidepool.
You should eventually be able to see your events in the Tidepool UI (as a result of setting up your Segment destination):
![](https://files.readme.io/2900ce5-Screenshot_2023-07-24_at_6.43.23_PM.png)
Updated 5 months ago