Webhook trigger node

Angel Cheung
Angel Cheung
  • Updated

The webhook trigger node listens for information in real-time from an external application to trigger a Pendula flow. 

Quick links

What is a Webhook?

Create a Webhook trigger

Add a custom reference to a payload for incoming webhooks

Notes to consider

Sample payload for incoming webhooks

Validate payloads and use webhook merge fields


What is a Webhook?

A webhook is a way for an app to automatically provide other applications with real-time data. 


Create a Webhook trigger

  1. In a new flow, drag and drop the webhook trigger node onto the canvas to open up the settings panel.
    Screen_Shot_2022-09-07_at_2.09.56_pm.png
  2. Follow the prompts to set up your API token if you have forgotten it or it hasn't been generated before.
  3. Copy the “POST URL” found under Configure Webhook trigger URL. This URL identifies this specific Pendula flow.
  4. Paste link as the ‘POST URL’ in the Webhook configuration settings of the third party application. Learn more about which configuration method should be used.

Add a custom reference to a payload for incoming webhooks

You may wish to tag a request from an incoming webhook to reference where this request is coming from or what it's for. This is possible by adding 'Custom context' in the header as a value with the key X-PENDULA-CUSTOM-CONTEXT.

Here's an example of how to a custom context injected in the header:

-H "X-PENDULA-CUSTOM-CONTEXT: this-is-a-custom-context-value" \

Notes to consider

  • Request should be in JSON format
  • The minimum recommended payload inclusions are:
    1. First name
    2. Last name
    3. Mobile number

Sample payload for incoming webhooks

Here's an example of how to format your payload:

curl -X POST --location "http://localhost:9081/inbound/helloasmr" \
    -H "Authorization: Bearer {insert token}" \
    -H "Content-Type: application/json" \
    -H "X-PENDULA-CUSTOM-CONTEXT: this-is-a-custom-context-value" \
    -d "{
        "user-id": "harrison-example",
"firstname": "harrison",
"lastname": "koenig",
"mobile": "+61400000000" }"

Validate payloads and use webhook merge fields

To validate your webhook and use the webhook data as merge fields later in the flow, Pendula allows you to paste a sample payload into the Merge fields tab of the webhook trigger node. Learn more about Pendula and merge fields.

When manually typing out mergefields, mergefield with hyphens - or a full stop . need a square bracket to be valid. For example, {{inboundMessageTrigger.[user-id]}} is valid, and {{inboundMessageTrigger.user-id}} would cause an error.

Simply copy the request body of the payload (not including headers) and paste into the sample payload field. The sample payload must be in JSON format (key value pairs with hierarchy)

Here's an example of the request body of the payload above, in JSON format:

{
"user-id": "harrison-1a2b3c4d",
"firstname": "harrison",
"lastname": "koenig",
"mobile": "+61400000000"
}

Screenshot 2023-10-16 at 10.03.02 am.png