Integrations
Sources
Segment

Segment source

Receive Segment webhook events in Knock to trigger workflows and keep user data in sync with track and identify events.

The Segment source enables you to receive Segment webhook events directly in Knock. Segment sends webhook callbacks when track and identify events flow through your workspace. Knock verifies each payload using your Segment webhook signing secret, identifies the event type, and executes the actions you configure.

This integration is useful for triggering notification workflows from track events, such as alerting users when key actions happen in your product, or syncing user data into Knock from identify events so recipient profiles stay up to date.

Knock supports ingesting any of Segment's supported events, so you can map them to actions as your needs evolve.

Prerequisites

#
  • A Knock account with at least one environment configured.
  • A Segment workspace with access to webhook or destination settings.

Getting started

#
1

Create the source in Knock

Navigate to Platform > Sources in the Knock dashboard. Make sure you're in the correct environment. Select the Segment template as the source type.

The Sources page in the Knock dashboard
2

Select default action mappings

Once you've selected Segment as a source, you can select your desired action mappings. These are helpful defaults to get you started, but Knock can ingest any event Segment sends and you can adjust your mappings at any time. Click the Connect Segment button to continue.

The Segment source creation modal showing default action mappings for incoming events
3

Copy the webhook URL

After creating the source, copy the webhook URL from the setup wizard for the environment you want to configure.

The Segment source setup wizard showing the webhook URL to copy
4

Add a webhook destination in Segment

In your Segment workspace, navigate to Destinations and click "Add Destination." Search for Webhooks (Actions) and select it. This is the destination type you will use to send events to Knock. Paste the Knock webhook URL you copied in the previous step.

The Segment Destinations page showing the Webhooks (Actions) destination
5

Configure event mappings in Segment

Set up the mapping to forward the desired track and identify events to Knock. You can add conditions to filter which event types are sent, such as Event type is Track or Event type is Identify.

The Segment webhook mapping configuration showing event type conditions
6

Copy the signing secret into Knock

If Segment provides a signing secret for the webhook destination, copy this value and paste it into the Signing secret field in your Knock source environment configuration.

The Segment webhook destination detail page showing the signing secret

Once configured, Segment sends webhook events to Knock in real time. You can verify that events are arriving by checking the event logs on the source environment page.

Pre-configured events

#

Segment sends events based on the Segment spec. Below are common event types you might map to actions in Knock.

Event typeDescription
trackA user performed an action
identifyUser traits were created or updated

See the Segment spec documentation for the full list of available event types and their schemas.

Customization

#

You can modify the default action mappings or add new ones for any event type Knock receives from Segment. For details on how field mapping works with dot-notation paths, see the custom source page.

If you need to map Segment events to actions beyond triggering workflows, see the full list of available actions in the sources overview.

Event idempotency

#

Knock uses the messageId field from the Segment event spec as the idempotency key. Segment includes a messageId in every track and identify event by default, so no additional field configuration is needed.

You can change the idempotency key field or disable idempotency checks from the Settings tab in your source environment configuration. Events without an idempotency key attribute are processed normally.

For details on how Knock handles idempotent events, key validation rules, and the default 24-hour idempotency window, see the source event idempotency section of the sources overview.

New chat