Calling a Webhook

In the previous example, the system prompts contacts to provide their name, which is then used to retrieve their PID via a webhook integration with Airtable.

Webhooks transmit flow data formatted as JSON to an external service via a POST request whenever a contact triggers a Call Webhook action. As the contact arrives at this node, the configured URL is called, forwarding all variables gathered up to that stage in the flow. Refer to the Flow Event webhook documentation for a complete overview of included values. If the service responds with a JSON object, these values are stored and can be accessed later in the flow using the @webhook variable prefix.

For instance, the Order Status Checker sample flow included in your account requests the contact’s order number, then queries it by POSTing to an example external service we’ve set up. This service returns a JSON object similar to the one below:

{
“status”: “Shipped”,
“number”: “CU001”,
“name”: “Ben Haggerty”,
“ship_date”: “October 9th”,
“delivery_date”: “April 3rd”,
“description”: “Vogue White Wall x 4”
}

You can then reference these keys anywhere in the flow using an extra variable via @run.results.

Configuring a ‘Call Webhook’ Action

This section illustrates how to integrate a webhook into a flow. You can practice using the Order Status Checker sample flow available in the flows tab of your account.

Generate a Flow Field

Set up a Wait for Response action that captures the desired value from contacts and stores it as a flow variable. In the example below, this action collects order numbers and saves them as a flow variable. This variable is later retrieved in the flow using @webhook.json.lookup_response to access the most recent webhook response.

Make a Request

Create a Call Webhook action, switch the request method to “POST”, and enter your URL:

Note: The result variable can store a maximum of 640 characters.

If your service returns JSON, it will be saved to the Lookup Webhook variable using @webhook.json.lookup_webhook to fetch the last webhook response. The simulator’s action log will display the returned JSON object.

Evaluate the External Variable

Next, create a Split by Expression action to assess one of the returned values based on a response rule. In the example below, since the status key webhook.json.status can only be one of three values (“shipped”, “pending”, or “cancelled”), the has all of the words response rule is used to determine which value applies to the contact:

If the returned status matches “shipped”, “pending”, or “cancelled”, the contact is routed accordingly. Otherwise, the contact proceeds through the “other” category and receives a prompt to resubmit a value accessed via @webhook.json.lookup_webhook.

Viewing Webhook Events

To review Webhook events, navigate to the flows tab, then click the Webhook button on the left-hand side:

 

Your recent events will appear in chronological order:

 

Click on any event to inspect the contents of the request and its corresponding JSON properties:

Troubleshooting

Failed requests are captured under the “Failed” category. Connect this to a Send Email action to receive immediate alerts when errors occur.

A variety of tools are available to simulate, intercept, and capture webhook requests, helping you diagnose and resolve issues. Some popular options include:

Give it a Try

Use the simulator to evaluate your URL’s performance when called.