In this lesson we will cover:
– How to setup a webhook to trigger a runbook
Within the Runbooks module of Halo you can generate a link to the runbook from which you can send payloads to. To begin configuring this, create a new runbook by navigating to Configuration>Integrations>Custom Integrations and then click into the module, the screen shown will be:
Fig 1. Custom integrations page
Click into "Integration Runbooks" and then click "New" in the top right hand side. From here you will be redirected to the details tab of the new runbook, from which you can set the Runbook start access field:
Fig 2. Runbook start access
The access can be set to "Can only be started from Halo and from a public endpoint" this will generate the URL for the runbook, which is used to allow a runbook to be triggered from a POST being made to the endpoint. After saving the runbook, the URL will display like this:
Fig 3. Obtain URL for the runbook
This can be set as the Payload URL of a webhook. To create a webhook navigate to Configuration > Integrations > Webhooks and then click new from the top right hand side of the screen. The Payload URL can be populated with the runbook URL and set the method to Post:
Fig 4. Populate payload URL for webhook with runbook URL
For this example the event trigger for the webhook will be "Invoice Created":
Fig 5. Trigger for webhook
This will send the Payload for the newly created invoice to the runbook endpoint, which will then trigger the runbook. At the point of the runbook starting, the runbook level variables can be adjusted accordingly. After creating the runbook, the webhook and then creating a new invoice, you will be able to see the payload for your runbook via the "Log" tab of the runbook:
Fig 6. Log tab of runbook
This log can be clicked into, and the payload is visible within the request data tab of the log:
Fig 7. Payload within log
Within the request tab, you will see the Payload:
Fig 8. Payload in request tab
We can then create a runbook level variable, which in this case is the Invoice ID, which displays as the object_id in the above payload:
Fig 9. Creating runbook level variable
The variable for the runbook will now display as <<Name>> which in the above example would be <<Invoice ID>>, as of v2.174 it is important to include the << >> before and after the value you are extracting from the request payload.