DEV Community

Cover image for Webhooks & Conductor - Perfect Duo for Automation
Riza Farheen for orkes

Posted on • Originally published at orkes.io

Webhooks & Conductor - Perfect Duo for Automation

In the modern digital era, applications are the staple to everything, from ordering foods to automating subscriptions. To truly tackle the power of applications, seamless communication and real-time data updates between them are crucial.

Sharing real-time data updates between applications simplifies business processes, eliminates manual intervention, and synchronizes information instantly. It allows you to maintain accurate inventory levels, provide proper customer support, and ensure a seamless customer experience.

While traditional API methods can enable communication between applications, webhooks offer a perfect solution when it comes to real-time updates. Webhooks function as event-driven triggers initiating communication and sharing information between the applications. Instead of constantly polling for updates, webhooks allow applications to notify instantly when an event triggers.

Orkes Conductor, built over the battle-tested Netflix Conductor, is a platform for building distributed applications 10x faster. With Conductor-Webhook integration, you can seamlessly connect Conductor with other applications.

In this blog post, let’s dive deeper into the power of webhooks and discover how they can revolutionize the way your applications communicate and collaborate.

Orchestrating your Workflows/Applications with Webhooks

Webhook is an HTTP-based callback function that facilitates the communication between Conductor and other third-party systems. It can be used to receive data from other applications to the Conductor.

Webhook can be used with Conductor in 2 different ways.

  1. You can start a workflow on receiving an event from other applications via Webhook.
  2. You can start a task inside a workflow on receiving an event from external applications.

Example Workflow

Let’s see an example workflow that receives an event from Postman.

Step 1 - Create a Workflow with Webhook Task

Initially, you need to create a workflow in Conductor with the “WAIT_FOR_WEBHOOK” task. For this, navigate to Workflow > Definitions from Conductor UI, and click Define Workflow.

Creating a workflow with webhook task

Add the WAIT_FOR_WEBHOOK task at the point where you want to receive an event from Webhook. When the workflow reaches this point, it waits for the webhook event. Ensure to provide the input matches as per your requirement. Matches act as the correlation between the incoming webhook events and running workflows to find the instance that should be updated based on the payload from the event.

In this example, I’ve defined the input matches as:

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

Let’s say there are 1000 running instances of a workflow with different recipient IDs; when an incoming webhook request comes, it will find and match //data/recipientId field from the incoming message’s JSON with the running workflow, find the matching instance and mark that particular workflow instance’s task as completed.

Step 2 - Create a Webhook in Conductor

Next, let’s create a webhook in Conductor.

You can create a webhook by navigating to the Webhooks option from the left menu.

Creating new webhook for integration

Provide a webhook name. Under the field Workflows To Receive Webhook Event, you must provide the workflow name, which includes the webhook task. So, this is the case where a task within a workflow begins with events received from Webhook.

You can choose a source platform from the Conductor-supported list. In this example, we are sending the request from Postman, so let's choose the platform as Custom. Provide a header key and value.

While creating a webhook, there is an option to run other workflows on receiving the webhook event. This is the case where a workflow is triggered on receiving a webhook event.

Webhook with URL unverified

Saving the webhook generates the URL, which will be “Unverified”.

The verification process of the webhook URLs depends on the supported verification methods from Conductor. The Custom type is header-based verifiers, where the URL is verified when the first Webhook event comes with all the header keys and values configured.

Step 3 - Run Workflow

Let’s run the workflow now!

From the Conductor UI left menu, click Run Workflow.

Running Webhook workflow from UI

You can click on the workflow ID generated to view the execution.

Workflow execution in running state

It is clear from the workflow diagram that the workflow is now waiting for the webhook event.

Step 4 - Send Request from Postman

Next, send the request from the Postman. Create a new request, provide your webhook URL, and change the method to POST.

Provide the header key and value, and the input matches in JSON format. Click Send, and it should return a 200 OK, meaning it was sent successfully.

Sending post request from Postman

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

Webhook with verified URL

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

Completed workflow execution

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

Triggered workflow execution from Webhook event

Ta-da🎉! You have successfully executed your workflow now!

Webhook Security Mechanism

Conductor allows securing the webhook endpoints using different mechanisms. We support the incoming webhooks over HTTPS with the following verification methods:

  • Header Verification - Validated based on the predefined header and value.
  • Signature Verification - Validated based on the payload signature, which requires configuring the secret and header key on the Conductor side. When the request comes, the Conductor will calculate the request payload hash and match it with the predefined header value.
  • Challenge Verification - Validated when the third-party system sends a challenge request that the Conductor server responds to establish trust.

Check out our Webhook documentation to know more details on how the URLs are verified.

Out-Of-Box Webhook Integrations from Conductor

So far, you have understood the configuration steps and the security mechanism provided by Conductor. Now, let’s quickly look at the ready-to-use configurations from Conductor. Conductor supports the Webhook integration with the following third-party applications:

Supported integration platforms for Webhooks in Conductor

Use Cases: Webhook as a Service

Conductor provides Webhook as a Service, where you can orchestrate different business use cases. This helps streamline the integration and communication between different systems, enabling automation within your organization.

Let’s have a quick look at various use cases:

GitHub

  • Enable automated alerts for newly created issues in your repository and establish a system for automated replies.
  • To trigger automated deployments whenever a new commit is pushed to the repository.
  • Triggering CI builds whenever changes are pushed to the repository.

Slack

  • Creating chatbots.
  • Employee onboarding.
  • Automating scrum updates.
  • Automating issue creation messages on support channels.

Twilio

  • Notify customers about order updates, payment confirmations, or appointment reminders via SMS.

Stripe

  • Automatically email customers for failed payments.
  • Get notified when someone pays via your application.

Pagerduty

  • When an incident triggers in your Pagerduty account.
  • When an incident escalates in your Pagerduty account.

Zendesk

  • Keep your team informed and agile by setting up automated Slack alerts whenever new tickets are created.
  • Automatically transferring ticket details to your documentation team in Asana once a ticket is resolved.

Twitter

  • Send messages to your Slack channel when someone mentions your company on Twitter.

Facebook

  • Send notifications whenever someone comments on your Facebook page.

Sendgrid

  • Send information about events that occur as SendGrid processes your email. You can use this data to remove unsubscribers, react to spam reports, determine unengaged recipients, identify bounced email addresses, or create advanced analytics of your email program.

We built our daily stand-up bot for our engineering team using this integration. Employees post their updates in the application integrated with the Slack app, which is posted on the stand-up channel.

Standup bot created for Orkes engineering team

No more messing up with wrong channels, and no worries about missing the updates. That’s how our managers stay informed about the progress and activities of the engineering team.😎

Why don’t you try automating your daily activities like this using Conductor-Webhook integration?

Wrapping Up

In conclusion, webhooks are an incredibly powerful tool that can be effectively leveraged to meet your business requirements. Integrating webhooks with a robust platform like Orkes Conductor can unlock even greater potential to enhance your business efficiency and productivity.

What to wait for? Give a try on Orkes Conductor now! If you are looking forward to trying Conductor for free, leverage Playground - a free tool from Orkes.

Do reach out to our community Slack channel for any queries. Our vibrant team is always here to help you!

Top comments (0)