Skip to main content

Segment

Segment as a data source

You can set up Dopt as a destination for Segment identify and group calls by using WebHooks as a destination.

Setup

Step 1: Add webhook destination

Log in to your Segment account, open workspace, and select source. Click on Add Destination and search and select Webhooks.

Step 2: Edit settings

Enter Dopt details under the Settings tabs in your newly created destination, then modify the connection setting and other settings as shown.

Step 3a: Edit connection settings

In Connection Settings:

Enter Webhook URL as: https://users.dopt.com/identify/segment

In Headers, specify the header key as: x-api-key

In the value field, paste the API key you received from https://app.dopt.com/

Step 3b: Edit other settings

In the Other SettingsWebhook URL specify the same Dopt Webhook URL: https://users.dopt.com/identify/segment

Step 4: Enable the destination

Enable the destination on Segment and monitor the events being sent from Segment to Dopt.

Once successfully sent you can also verify identified users in Dopt on the users page.

Event formats

Here’s what Dopt expects from Segment and how we handle exceptions:

Event types

We currently support receiving identify and group events. If you have other types of events (like track) you can filter the events Segment sends us (requires Segment Business). If you send us other types of events you’ll get a server error back. We use userId and groupId from Segment's identify and group specs to map to user identifier and group identifier respectively in Dopt.

Nested traits

Traits can have string, integer, boolean, or null values. Dopt doesn’t accept traits with nested objects as values.

References

Segments webhook destination docs: https://segment.com/docs/connections/destinations/catalog/webhooks/

Segment as a data destination

Send events from Dopt to Segment.

Setup

  1. Create an HTTP API source on the Segment dashboard.
  2. Select your HTTP API source and select the 'Settings' tab, then on the side bar, select API Keys.
  3. Find your Write Key and copy it. Here’s how to find your write key.
  4. In Dopt, navigate to Settings > Integrations.
  5. Click “Create Integration” and select Segment, select the Dopt environment you wish to send events from, paste in the Write Key, and click Create.

When configuring Segment as a destination, you can also send a test event to check if the integration is set up correctly. If you do, Dopt will send a dopt_segment_test track event.

Events

Dopt sends 3 events downstream as track calls.

flow_state_change

This event is fired whenever the state of a flow changes.

Example event

{
type: 'track',
userId: $userID,
event: 'flow_state_change',
properties: {
environment: 'development',
flow_id: 'getting-started',
flow_name: 'Getting started',
flow_version: 1,
flow_state: 'started', //started, stopped, finished, or reset
workspace: 'acme.com'
},
};

block_state_change

This event is fired whenever the state of a block changes.

Example event

{
type: 'track',
userId: $userID,
event: 'block_state_change',
properties: {
block_id: 'example-app-tutorial',
block_name: 'example app tutorial',
block_state: 'EXITED', //ENTERED or EXITED
block_type: '' // start, webhook, etc
environment: 'development',
flow_id: 'getting-started',
flow_name: 'Getting started',
flow_version: 1,
workspace: 'acme.com'
},
};

path_transition

This event is fired whenever a path is transitioned.

Example event

{
type: 'track',
userId: $userID,
event: 'path_transition',
properties: {
path_transition: 'default',
block_id: '00015', //block the path originates from
block_name: 'Start',
block_type: 'entry'
environment: 'development',
flow_id: 'getting-started',
flow_name: 'Getting started',
flow_version: 1,
workspace: 'acme.com'
},
};