In the example above, we're asking contacts to send their name, which will look up their PID using a webhook with Airtable.
Webhooks simply POST flow data structured as JSON to an external service every time a contact reaches a Call Webhook action. When a contact reaches this node, we'll call the URL you've configured, passing it all of the variables collected up to that point in the flow. See the Flow Event webhook documentation for a full list of the values included. If your service returns a JSON object, we will save its values and allow you to access the last webbook response in the flow using the
@webhook variable prefix.
For example, the Order Status Checker sample flow in your account asks the contact for their order number, then looks it up by POSTing it to an example external service that we've configured. That service responds with a JSON object similar to the following:
"name": "Ben Haggerty",
"ship_date": "October 9th",
"delivery_date": "April 3rd",
"description": "Vogue White Wall x 4"
You're then able to reference these keys anywhere in the flow via an extra variable using
Configuring a 'Call Webhook' Action
In this example, we'll show you how to add a webhook to a flow. You can follow along using the Order Status Checker sample flow located on the flows tab within your account.
Generate a Flow Field
Create a Wait for Response action that collects the target value from your contacts and saves it as a flow variable. In the example below, the Wait for Response action collects our contacts' order numbers and save them as a flow variable which will then be called later in the flow using
@webhook.lookup_response to get the last webhook response.
Make a Request
Create a Call Webhook action, toggle the request to "POST", and enter your URL:
If your service returns JSON, it'll be stored to the Lookup Webhook variable using
@webhook.lookup_webhook to get the last webhook response. The action log within the simulator will show you the returned JSON object:
Evaluate the External Variable
Next, create a Split by Expression action that evaluates one of the returned values against a response rule. In the example below, because the status key (legacy_extra.status) can only contain one of three values (shipped, pending or cancelled), we can use the has all of the words response rule to discern which value is present for the contact:
If the returned status value matches "shipped", "pending" or "cancelled", the contact will be directed accordingly. Otherwise, the contact will pass through the "other" category and receive a prompt to resubmit a value called by using
Viewing Webhook Events
To view Webhook events, navigate to your account page, click the Webhook icon, then click the "Webhook Log" button in the bottom right corner:
Your recent events will be listed chronologically:
You can click an event to view the contents of the request and the corresponding JSON properties:
Unsuccessful requests are captured by the "Failed" category. We connecting it to a Send Email action to ensure they you're alerted the moment an error occurs.
There are lots of tools available that can help you to mimic, intercept and capture webhook requests so you can understand and fix problems, here are just a few of them:
Give it a Try
Use the simulator to test your URL's performance when called.