Webhooks

Connect a third party service in a couple of clicks πŸͺ

Webhooks are automated messages sent from apps when something happens. They have a messageβ€”or payload (in json format)β€”and are sent to a unique URL. You can create such URLs in Directual to receive those messages.

Creating a Webhook

Go to API section β†’ Webhooks β†’ + New webhook and enter system name of a new webhook. In 99% of cases you will need a scenario for parsing incoming objects. Such a scenario can be created automatically right here.

Copy Webhook URL to your external service to send messages to Directual.

Storing incoming messages

If you create a webhook, data structure for it is created automatically in Integrations/Webhooks/ folder (you can also find a link to it right here, in webhooks table). The first object is created by Directual itself β€” that one is for test purposes.

There are the following fields in webhook data structure:

  • id β€” usual unique field

  • body, headers, urlData β€” fields in JSON format. One or a few of them contain data (depending on a specific third party service).

Dealing with incoming messages

Objects coming via Webhooks contain data in JSON-format. The best way to deal with them is to apply JSON-step or to apply templating techniques for parsing JSON.

Changing API-response

The default response is:

{
"result": null,
"status": "OK"
}

Sometimes a third-party system requires another response, in JSON or even in XML format. So, that is not a problem, you can compose any API-response you need! Here is how:

1. Add a synchronic scenario for your webhook

Note, that scenario have to be published and started.

2. Setup an API-response step in the scenario

Have a look at the API-response step documentation.