Amplitude's Webhook integration enables you to forward your Amplitude events and users to custom webhooks. This is a light-weight way to set a stream of event and user data out of Amplitude, to a URL of your choosing to enable any of your use cases.
newsletters
, an array with market
and newsletter_names
, into a format suitable for Braze. Webhooks also enable you to format event data for Braze, to ensure correct processing as purchase events.To configure streaming from Amplitude to your webhook, you need the following information.
Enter the URL endpoint for the webhook. For example, https://mycompany.com/webhook
.
Note that Amplitude doesn't have a single IP address for forwarding events and users, so ensure that your URL can receive payloads from any Amplitude hosts.
See details on Amplitude's retry mechanism in case a webhook call fails.
There are two preset headers for every webhook sync:
Content-Type
: application/json
User-Agent
: Amplitude/Webhook/1.0
After these preset headers, you can define five more headers. To create a new header:
Under Send Events, make sure the toggle is enabled ("Events are sent to Webhook") if you want to stream events to the webhook. When enabled, events are automatically forwarded to the webhook when they're ingested in Amplitude. Events aren't sent on a schedule or on-demand using this integration.
Define the event payload you want to receive in the webhook. You can choose to:
In Select and filter events choose which events you want to send. Choose only the events you need in the webhook. Transformed events aren't supported.
Under Send Users, make sure the toggle is enabled ("Users are sent to Webhook") if you want to stream users and their properties to the webhook. When enabled, users are sent to the webhook when an event is sent to Amplitude. Amplitude Identify API calls are also forwarded to the webhook. Users aren't sent on a schedule or on-demand using this integration.
When satisfied with your configuration, at the top of the page toggle the Status to "Enabled" and click Save.
Amplitude makes a delivery attempt first on each event or user, and then on failures, Amplitude make nine more attempts over 4 hours, regardless of the error. Amplitude also has a retry mechanism within each attempt: on 5xx errors and 429 throttling. Amplitude does attempt an immediate retry with these policies
Amplitude uses Apache FreeMarker templates to customize your event payloads that you send to webhook.
device_id
instead of user_id
in your identify calls, you will not see user_id
in the payload).See the FreeMarker guide to creating templates for more help.
1{ 2 <#if input.user_id??> 3 "external_id" : "${input.user_id}", 4 </#if> 5 "name" : "${input.event_type}", 6 "time" : "${input.event_time}", 7 "properties" : { 8 "email" : "${input.user_properties.email!}" 9 }10}
Using this template results in sending this JSON payload to the Webhook endpoint:
1{2 "external_id" : "some user id", // if `input.user_id` exists3 "name" : "click event",4 "time" : "2022-10-24T20:07:32.123",5 "properties" : {6 "email" : "some@email.com"7 }8}
1{ 2 <#if input.user_id??> 3 "external_id" : "${input.user_id}", 4 </#if> 5 <#if input.device_id??> 6 "device_id" : "${input.device_id}", 7 </#if> 8 "time" : "${input.event_time}", 9 "properties" : {10 "email" : "${input.user_properties.email!}"11 }12}
Using this template results in sending this JSON payload to the Webhook endpoint:
1{2 "external_id" : "some user id", // if `input.user_id` exists3 "device_id" : "some user id", // if `input.user_id` exists4 "time" : "2022-10-24T20:07:32.123",5 "properties" : {6 "email" : "some@email.com"7 }8}
Amplitude by default sends the time as a UTC ISO-8601 formatted string such as "2022-02-28 20:07:01.795"
.
To modify this in different formats:
<#setting datetime_format="yyyy-MM-dd HH:mm:ss.S">
"${input.event_time?datetime?string["dd.MM.yyyy, HH:mm"]}"
"28.02.2022, 20:07"
"${input.event_time?datetime?long}"
"1646107621000"
${ ... }
constructs with the actual value of the expression inside the curly braces.input
is a reserved variable that refers to the event as an object, as defined in the Export API docs.input.event_type
refers to the event_type
field of event.input.user_properties
refers to the user properties dictionary.input.user_properties.email
refers to the email
field in user properties.if
directive is used to check wether the field exists. if it doesn't, the field is omitted from the output.!
mark in the expression after input.user_properties.email
can be used to include a default value if there is no such field in the input
. If you don't add a default value, the output contains an empty string instead.Thanks for your feedback!
June 20th, 2024
Need help? Contact Support
Visit Amplitude.com
Have a look at the Amplitude Blog
Learn more at Amplitude Academy
© 2024 Amplitude, Inc. All rights reserved. Amplitude is a registered trademark of Amplitude, Inc.