Sending a webhook from a Runbook

If you have internal systems that perform tasks like rolling back deployments, you may want to dispatch an HTTP request from FireHydrant to those systems. This article explains how to set up a Runbook step that sends a webhook to an endpoint of your choice.

Adding the webhook step

  1. In the left nav, click Runbooks.
  2. Click the Runbook where you want the webhook to originate.
  3. On the edit page for the Runbook, from the Available Steps section, scroll down to the Send a Webhook step and click Add
    webhook.step.png
      • Endpoint: the target URL you for the webhook.
      • HMAC Secret: a short string you can then use to verify that the webhook came from FireHydrant in your application.
      • JSON Payload: FIreHydrant uses liquid templating syntax to interpolate values into a JSON string to send to your endpoint. For more information about template syntax, you can always visit the FireHydrant API to see your incidents and the payload structure.

JSON Payload Templating

You can format the payload to be sent to your endpoint however you like, as long as the result is in valid JSON format. If you'd like to include a JSON version of certain parts of the payload, you can also use liquid filters to convert input to JSON. For example:

#{{ incident.labels | toJSON }}

This converts the labels attribute on the incident to JSON so it can easily be sent in the JSON payload:

{
"incident_id": "#{{incident.id}}",
"labels": #{{ incident.labels | toJSON }}
}

This lets you easily include whatever data you'd like in the payload.

Signature Verification

Every payload request you receive from FireHydrant will have a fh-signature header containing the computed signature of your HMAC Secret and the JSON payload. FireHydrant uses SHA256 to compute the signature.

Using Ruby as an example, you could use the following code to calculate the signature with the secret key and check it against the one received:

key = "super-secret-key" 
data = request.body
signature = headers['Fh-Signature']

if signature == OpenSSL::HMAC.hexdigest("SHA256", key, data)
# perform task
end
Was this article helpful?
0 out of 0 found this helpful
Register your product
You can get support that’s tailored to you, owner exclusives and more
Our helpline hours:
8:00am - 8:00pm CST Monday to Friday; 9:00am - 6:00pm CST Saturday
Follow us on Twitter
Get the latest news and updates first