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.

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:

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:

Search for the Webhooks (Actions) type:

You'll need to select your source (here happens to be a JS app):

Name your destination:

3. Configure Webhook Mappings

To actually pipe things through properly, you'll need to set up a mapping:

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):

For the purposes of setup, it's helpful to have a sample event for reference (sometimes Segment can autograb an example for you):

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.

Then make sure you have an API key available to set the auth headers:

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.

Now you can test a possible input:

If it's successful, you should see something like:

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":

To confirm that this is working, you can check the "Event Tester" tab:

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):