Integrations
Sources
Legacy
HTTP

HTTP source (legacy)

The legacy HTTP source accepts events using the Segment track spec. For new integrations, use the custom source instead.

The legacy HTTP source creates a generic event ingestion endpoint that accepts events structured according to the Segment track spec. The events you stream into the HTTP source can be used to trigger Knock notification workflows.

Knock can receive any structured event data via the legacy HTTP source, as long as you format the payload as JSON and make an HTTP request from the service that produces or consumes events.

Getting started

#

To get started you can create a new HTTP source by going to Integrations > Sources under your account settings and clicking "Create source." You'll have the opportunity to name the HTTP source and give it a description.

Once your source is created, you'll have a unique ingestion endpoint per environment to send events to. You can get each environment's endpoint by clicking the "Copy webhook destination URL" button.

Sending event data

#

To start sending events to Knock, structure a JSON payload that matches the event schema below and submit it via a POST request to the ingestion endpoint. A well-formed event payload receives a 204 response code.

You also need to send the following headers with your request:

You need to send a single event at a time. There is no batch event ingestion endpoint.

Event schema

#

Your events must be structured as JSON with the following schema:

NameTypeDescription
typestring (required)The type of event to send. Must be set to track.
eventstring (required)The name of the event you're sending to Knock.
propertiesmapA set of properties associated with the event.
userIdstringAn optional userId to be used as the recipient or actor for the triggered workflow.
messageIdstringAn optional unique identifier for the event message, to be used as a deduplication key.
timestampstringAn optional ISO-8601 timestamp indicating when the event occurred. If omitted, defaults to the time of ingestion.

Triggering workflows from received events

#

Received events can be configured as workflow triggers directly in the workflow editor. Click on the workflow's trigger step and change the type from "API" to "Source Event." Then you can select the event and map its properties into the data the workflow needs.

Disabling a trigger

#

Triggers are automatically enabled when you create them. If you want to stop an event from triggering a workflow, go to the trigger page and toggle its status to "Inactive." This disables that trigger for the current environment only. When you're ready to trigger the workflow again, set it back to "Active."

Mapping workflow trigger properties

#

When creating workflow triggers from your events, you can optionally configure the schema mapping Knock uses to map your event properties into the corresponding workflow trigger properties.

To target any items under the properties key, prefix the schema mapping with data.propertyKey. As an example, if you have a property properties.recipientId you would map this as data.recipientId.

Debugging events

#

You can see a log of all events received per source under Integrations > Sources in the Knock dashboard under the "Logs" page for your configured source. You can also see any workflow triggers that were configured as part of the event ingestion, and any workflow runs that were triggered.

Frequently asked questions

#

No, the legacy HTTP source only accepts track events and not user identifies. Please use the user identify API instead.

Yes. You can use inline identification with the source events that you send to Knock. You need to ensure that the schema mapping for your event maps the Recipients of your workflow to the same field where you provide the recipient object.

There's no rate limit for the event ingestion endpoint, but we ask that if you're going to be sending more than 1,000 events per second you reach out to us first so that we can provision additional capacity.

No, the HTTP endpoint only accepts single events at a time.

New chat