Skip to main content

Incoming Webhook using Postman

Webhooks can be integrated with Conductor to facilitate communication with other third-party systems such as Slack, Pagerduty, Zendesk, etc.

In this article, let’s look at creating a webhook in Conductor and passing an incoming request to the webhook using Postman.

Creating Workflow

Consider the following workflow that waits for a webhook event from Postman:

Workflow with webhook task

To create a workflow:

  1. Navigate to Definitions > Workflows from the left menu.
  2. Click Define Workflow and create a workflow including a WAIT_FOR_WEBHOOK task.

For the WAIT_FOR_WEBHOOK task, the input matches are defined as:

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

The complete workflow JSON looks like this:

{
"name": "sample-webhook",
"version": 1,
"tasks": [
{
"name": "http_task_uzpd9",
"taskReferenceName": "http_task_uzpd9_ref",
"inputParameters": {
"http_request": {
"uri": "https://orkes-api-tester.orkesconductor.com/api",
"method": "GET",
"connectionTimeOut": 3000,
"readTimeOut": "3000",
"accept": "application/json",
"contentType": "application/json"
}
},
"type": "HTTP",
"optional": false
},
{
"name": "webhook_task_myey4",
"taskReferenceName": "webhook_task_myey4_ref",
"inputParameters": {
"matches": {
"$['data']['recipientId']": "${workflow.input.recipientId}"
}
},
"type": "WAIT_FOR_WEBHOOK",
"optional": false
}
],
"inputParameters": [
"recipientId"
],
"schemaVersion": 2,
"ownerEmail": "riza.farheen@orkes.io"
}

Next, create a webhook to invoke this workflow.

Creating Webhook in Conductor

  1. From your Conductor server, navigate to Definitions > Webhooks from the left menu.
  2. Click the New Webhook button and create the webhook with the following configurations.

Webhook example

Under the field “Workflows to Receive Webhook Event”, choose the workflow that includes your webhook task created earlier. Since the platform is Postman, let’s choose the Source Platform as Custom.

Provider a header key and value. Let’s also configure to start the workflow “start-http-task” when the webhook event comes from Postman.

On saving the webhook, an unverified URL will be generated. Since this is a header-based verifier, the URL will be verified once the first Webhook event comes with all the header keys and values configured.

Run Workflow

Next, you must run the workflow by clicking the Run Workflow button from the left menu.

When the execution reaches the “WAIT_FOR_WEBHOOK” task, it waits for the event to come from Postman.

Workflow execution waiting for webhook event

Now, open Postman, create a new request with your webhook URL, and change the method to POST.

Provide the header key and value, and the input matches in JSON format.

Configuring headers in Postman request

Sending POST request from Postman

Click Send, and it should return a 200 OK.

Now, if we return to the webhook, you can see that the event has been received. This triggered the workflow in which the webhook task was added.

Workflow with webhook task triggered on receiving webhook event

You can see that the webhook URL has been verified now. And if you check the previous workflow execution, you can verify that it has been completed successfully.

Sample webhook workflow completed

We have also configured to start the workflow “start_http_task” on receiving this webhook event. You can verify the same from the Executions > Workflow page.

Workflow triggered when request came from Postman