# Import from Segment

URL: https://www.digia.tech/docs/user/connect-your-data/segment

Stream Segment Engage audiences to Digia Engage through a webhook destination, with optional traits.

This guide sends your **Segment Engage audiences** to Digia Engage. Digia gives you a webhook URL, and you add it to Segment as a destination. Segment then tells Digia whenever someone enters or leaves an audience, and Digia keeps the matching audience up to date.

By the end, you should have:

- Segment connected under **Data → Connectors** , with its webhook URL
- a Segment webhook destination connected to your audiences
- one Digia audience per Segment audience, created automatically on the first batch

## Before you start

Make sure you have:

- Audiences enabled for your Digia Engage project (see [Before you start](/docs/user/connect-your-data/#before-you-start) ).
- A Segment workspace with **Engage** (audiences) and permission to add destinations.
- The user ID your app passes to Digia's `setUserId` . Usually this is Segment's `userId` . See [Match your users](/docs/user/connect-your-data/#match-your-users) .
- To import traits: [user verification](/docs/user/connect-your-data/#turn-on-user-verification) turned on.

## Step 1: Generate the webhook in Digia

1. Open **Data → Connectors** .
2. On the **Segment** card, click **+ Connect** .
3. Optional: enter a **Signing Secret / Shared Secret** . Segment uses it to sign each request, and Digia rejects requests whose signature doesn't match. Use the same value in Segment in step 3.
4. Click **Generate Inbound Webhook** .
![Segment Inbound Webhook Required dialog with the optional shared secret](/docs/img/engage/user-guides/data/segment-generate.webp) Generate a webhook URL dedicated to this project.
## Step 2: Copy the URL and choose the match field

The next screen shows the **Inbound Webhook URL** . Click **Copy URL** .

warning
Treat this URL like a password. Anyone who has it can send audience data to your project.

Under **Match users by** , keep **Default: userId** if your app passes Segment's `userId` to `setUserId` . Otherwise pick `anonymousId` , `email` , or type a trait name, and click **Save** .

![Connect Segment screen with Inbound Webhook URL, Match users by and setup instructions](/docs/img/engage/user-guides/data/segment-webhook-url.webp) Copy the webhook URL and confirm which field matches your app's user ID.
## Step 3: Add the destination in Segment

1. In Segment, go to **Connections → Destinations** and add **Webhooks (Actions)** or **Webhooks** .
2. Set the **Webhook URL** to the URL you copied.
3. If you set a shared secret in step 1, enter the same value as the destination's **Shared Secret** . Segment then signs each request in an `X-Signature` header.
4. Enable the destination.
Screenshot coming soon
Segment: the webhook destination's settings with the **Webhook URL** and **Shared Secret** . Until then, see Segment's [Webhooks destination](https://segment.com/docs/connections/destinations/catalog/webhooks/) docs.

## Step 4: Connect your audiences

1. In Segment, open **Engage → Audiences** and pick an audience.
2. Add the webhook destination to it.
3. To use traits in campaign text, add them as **additional traits** on the audience.
Screenshot coming soon
Segment: connecting an Engage audience to the webhook destination. Until then, see Segment's [Engage audiences](https://segment.com/docs/engage/audiences/) docs.

Segment sends an `identify` call when a person enters or leaves the audience, and Digia adds or removes them. There's nothing to set up per audience in Digia: it is created when the first batch arrives, named after the Segment audience.

Back in Digia, click **Done** .

## Step 5: Check the audience

Open **Data → Audiences** . Until Segment sends its first batch, the source shows *Waiting for first batch from Segment* . Then the audience appears with its size and match rate.

![Segment audience expanded on the Audiences tab, showing its source, delivery and webhook URL](/docs/img/engage/user-guides/data/segment-audience-detail.webp) The audience appears after Segment\'s first batch. Delivery shows when the last batch arrived.Webhook audiences have no **Sync now** button; they update whenever Segment sends a change.

If membership drifts
If a batch from Segment is missed, Digia can't recover it on its own. If an audience looks out of step with Segment, re-run the initial sync for that audience in Segment.

Now [use the audience in a campaign](/docs/user/connect-your-data/#use-your-data-in-a-campaign) .

## Import traits

Once data has arrived, open **Data → Connectors** and click **Settings** on the Segment row. Pick the traits to import and name each one, then click **Save variables** . Digia fills them in for people already imported. You can also change **Match users by** here.

![Connector settings dialog with Match users by and received properties](/docs/img/engage/user-guides/data/webhook-settings.webp) Pick which received traits become campaign variables.Segment sends a person when they join or leave, not when a trait changes. Values are as of when they joined, so prefer traits that rarely change, such as city or plan.

## Troubleshooting

| Symptom | What to do | **Waiting for first batch from Segment** for a long time | Check the destination is enabled, the URL is exactly the one Digia showed, and the audience is connected to the destination. | Segment shows `401 Invalid signature` | The shared secret in Segment doesn't match the one in Digia. | Segment shows `403 Audiences feature not enabled` | Audiences were turned off for the project. Contact Digia. | Segment shows `404` | The URL is wrong, or the Segment source was removed from Digia. Copy the URL again. | **Only {n}% match an app user** | Check **Match users by** against what your app passes to `setUserId` .
