Chat with us, powered by LiveChat

Action - Webhook

The Webhook action allows you to call your own API when a contact reaches a certain point in a journey.

The Webhook action is aimed at technical users. If you think you need it but don't understand the details, it would be best to involve your developer in its implementation.

To set up a Webhook action, drop the shape on the journey canvas:



 Click on the shape to configure it:


At a minimum you need to provide a URL to your endpoint and a HTTP method to set up the webhook.

You can optionally provide headers to your system to use for request verification, such as a pre-shared key. We also allow you to do HTTP basic auth if you would prefer.

We have also included a custom payload, enabling you to send additional content (for instance, information regarding the contact’s position in the customer journey that may be too detailed for the Header).

When a contact or contacts reach this shape, Autopilot will call your URL with the provided HTTP method and a payload as follows:

Sample Payload

 { records:
[ { company_priority: false,
Name: 'Peter AddToList',
LastName: 'AddToList',
FirstName: 'Peter',
Email: '',
Company: '',
updated_at: '2020-04-27T00:18:55.000Z',
created_at: '2020-04-26T23:09:25.000Z',
Status: 'Insights',
Website: '',
lists: [Array],
contact_id: 'person_637C329C-4398-47BF-BA0E-AC19FC7A8117' },
{ Name: 'Peter FormStack',
LastName: 'FormStack',
FirstName: 'Peter',
Email: '',
anywhere_form_submits: [Object],
lastTimezone: 'America/New_York',
lastLocation: 'US',
lastEngagement: '2020-04-26T19:36:31.386736701-04:00',
updated_at: '2020-04-27T00:18:55.000Z',
created_at: '2020-04-26T23:36:25.000Z',
Status: 'Insights',
Website: '',
first_visit_at: '2020-04-26T23:35:50.765Z',
first_conversion_at: '2020-04-26T23:36:25.393Z',
anywhere_page_visits: [Object],
anywhere_utm: [Object],
lists: [Array],
custom_fields: [Array],
mail_received: [Object],
contact_id: 'person_80F2D685-EACB-4561-8D0A-CE5259994414' } ],
{ name: 'New Journey 2',
id: 'campaign_A230A520-D08E-4E19-BAD4-F22C76A667A0' }
custom: "lsdfjsdlkfjsdlkfjsldkjfl",

Note that as you can see in the sample, if multiple contacts reach the shape at the same time, they will be sent together in the "records" array. A payload can contain up to 200 records. You also receive information about the journey.

If you need more context about the position in the journey in case you have multiple webhooks in the same journey, you can use headers to identify the particular shape which has been reached, or the custom payload.

How retries are handled

Your webhook has 5 seconds to accept the request sent. If this fails, the system will retry another 2 times to connect. Once a webhook is missed and the retries exhausted, it will not try again. It is therefore important that your webhook processing server is reliable.

What is advanced mode? 

Advanced mode is a new option intended to allow advanced users to integrate with applications that require a particular structure of content. In advanced mode each contact is sent an individual payload consisting of ONLY the custom payload. The options for auth and headers still work, but none of the other metadata usually in the body will be sent. In this mode liquid templating in the custom payload is supported. Please see this article for a more detailed overview of how to use liquid variables with autopilot.

If after liquid variables are evaluated the resulting custom payload is valid JSON then the request will be sent as Content-Type: application/json. If the resulting payload is not valid JSON then we will send it as Content-Type: text/plain.

Here is an example custom payload that might be helpful:

"name":"{{contact.FirstName}} {{contact.LastName}}",
"information":"This user just took flight"

Which if set would come to your web server as JSON like this:
"name":“Jane Smith”,
"information": "This user just took flight"

You do not have to use JSON, but it is recommended and we will escape JSON special characters in filled variables in order to make it as easy as possible to use as JSON.

Can I change what is in the payload?

Outside of advanced mode, you can only change the headers and custom payload portion of the webhook request