Configure a webhook

How to configure a webhook for a trigger or a module that can accept a webhook

Webhooks are defined as a condition of a trigger. Add a new trigger that represents the webhook.

  • Supported methods are the HTTP Verbs that should be accepted by the webhook URI

  • The debounce period can be used to prevent multiple triggers occurring over a short period of time. (in seconds)

Once configured this trigger needs to be applied to a system before it's active.

Once you've added the trigger, you can obtain the webhook URL by clicking the link icon

The webhook URL

The webhook URL will look something like:

https://my.placeos.domain/api/engine/v2/webhook/trig-DHgkU1~p/notify?secret=kfwu5WYc3a1su

Webhooks that map to module functions

If this webhook is intended to provide data to modules in the system, not just as a condition to execute the trigger actions, then it needs a little more configuration.

  1. in the System trigger list, click the edit button

  2. ensure execute enabled is selected

  3. click save

You will have to be aware of the methods that support Webhooks, which might involve looking at the driver code or driver documentation. Examples of webhook methods

To build the execute URL you'll need the following information:

  • Module name, i.e. Display

  • Module index, i.e. 1, 2, 3 (Display_2 is index 2)

  • Module method name: i.e. request

Then you can update the Webhook URL from above with this information

/api/engine/v2/webhook/trig-DHgkU1~p/notify?secret=kfwu5WYc3a1suZ&exec=true&mod=Display&index=2&method=request

An alternative form of this URL is (note that the secret is part of the route)

/api/engine/v2/webhook/trig-DHgkU1~p/notify/kfwu5WYc3a1suZ/Display/2/request

This URL can then be used to pass HTTP data to the module and should be provided to the service that uses websockets.

Last updated