Skip to main content

Wait For Webhook

A webhook is an HTTP-based callback function that facilitates communication between the Conductor and other third-party systems. It can be used to receive data from other applications to the Conductor. Conductor supports webhook integration with the following platforms:

  • GitHub
  • Microsoft Teams
  • SendGrid
  • Slack
  • Stripe

Additionally, the Custom option can be used to integrate other systems.

For a full guide on how to use webhook tasks, refer to Webhook Integrations.

Task parameters

Configure these parameters for the Wait for Webhook task.

ParameterDescriptionRequired/ Optional
inputParameters.matchesThe conditions that incoming event payloads must meet to trigger the webhook. Can be string, number, boolean, null, or object/array.
Note: When you update the matches, there will be a default caching period of 60 seconds, causing the updates to reflect with a delay of up to 60 seconds.
Required.

Writing custom matches​

In the example below, the matches are described as follows:

"matches":
{
"$['event']['type']": "message"
}

Any custom JSON path based on the incoming event payload can be defined to write matches accordingly. This configuration means that the incoming event payload must have a JSON path event.type, and it must be a message to match the webhook event with this task.

The input payload for the webhook task to align with the above matches must be:

"inputParameters": {
"event": {
"type": "message"
}
}

Multiple matches can also be added within the matches section. All the matches will be calculated as AND operations within the matches.

   "matches" : {
"$['event']['type']": "message",
"$['event']['text']": "hello"
}

For example, the configuration above will match the webhook event payload where event.type is message AND event.text is hello.

The input payload for the webhook task to align with the above matches must be:

"inputParameters": {
"event": {
"type": "message",
"text": "hello"
}
}

Task configuration

This is the task configuration for a Wait for Webhook task.

{
"name": "webhook",
"taskReferenceName": "webhook_ref",
"inputParameters": {
"matches": {
"$['event']['type']": "message",
"$['event']['text']": "Hello"
}
},
"type": "WAIT_FOR_WEBHOOK"
}

Task output

During execution, the task processes incoming webhook events based on the configured criteria. The task will return parameters depending on the specific event payload received, such as the event identifier, event type, and event data containing relevant details.

Adding a Wait for Webhook task in UI

To add a Wait for Webhook task:

  1. In your workflow, select the (+) icon and add a **Wait for Webhook **task.
  2. Add the Input matches.

Webhook UI

Examples

Here are some examples for using the Wait for Webhook task.

Incoming webhook using cURL
Incoming webhook using Postman
Sample Workflow for Slack webhook - Creating standup bot
Sample workflow for Slack webhook - Automating Slack greetings
Single webhook triggering multiple workflows

Multiple workflows can wait for and respond to the same webhook event. This example demonstrates how two workflows, each containing a Wait for Webhook task, are triggered by a single webhook event.

The following workflows include a Wait for Webhook task configured with the same matches:

Workflow 1

{
"name": "Workflow1",
"description": "Sample workflow",
"version": 1,
"tasks": [
{
"name": "webhook",
"taskReferenceName": "webhook_ref",
"inputParameters": {
"matches": {
"$['data']['recipientId']": "${workflow.input.recipientId}"
}
},
"type": "WAIT_FOR_WEBHOOK"
}
],
"inputParameters": [
"recipientId"
],
"schemaVersion": 2,
"ownerEmail": "john.doe@acme.com"
}

Workflow 2

{
"name": "Workflow2",
"description": "Sample workflow",
"version": 1,
"tasks": [
{
"name": "http",
"taskReferenceName": "http_ref",
"inputParameters": {
"uri": "https://orkes-api-tester.orkesconductor.com/api",
"method": "GET",
"accept": "application/json",
"contentType": "application/json",
"encode": true
},
"type": "HTTP"
},
{
"name": "webhook",
"taskReferenceName": "webhook_ref",
"inputParameters": {
"matches": {
"$['data']['recipientId']": "${workflow.input.recipientId}"
}
},
"type": "WAIT_FOR_WEBHOOK"
}
],
"inputParameters": [
"recipientId"
],
"schemaVersion": 2,
"ownerEmail": "john.doe@acme.com"
}

Run the workflows with the same input values.

Running different webhook based workflows with same matches

The workflows are now in a running state, waiting for the webhook event.

Workflows in running state awaiting Webhook events

Next, create a custom webhook in Conductor to receive events, ensuring that both workflows are included and the headers are set.

Webhook configurations in Conductor

Next, send a Postman request using the same input payload defined in the Wait for Webhook tasks.

The matches in the Wait for Webhook tasks are defined as:

     "inputParameters": {
"matches": {
"$['data']['recipientId']": "${workflow.input.recipientId}"
}
},

Both workflows are triggered with the following input:

{
"recipientId": "2"
}

To ensure the request is matched, send the Postman request with a payload that aligns with these matches.

Sending Postman request

Make sure the request includes the same headers as set in the Conductor webhook.

Configuring matching headers in Postman

Once the webhook receives the event, both workflows are triggered.

Workflows triggered

Click on the workflow IDs to confirm that the Wait for Webhook tasks have been completed.

Workflows completed