Creating webhooks
FireHydrant enables you to create webhooks that react instantaneously to events in your account. When you set up a webhook, FireHydrant sends a POST request to the endpoints you configure, and includes all of the information about the event formatted as JSON. This article describes how to create a webhook that sends notifications to an HTTP endpoint.
Creating a webhook
If you are an owner of the organization, you can create webhooks!
- Click "Settings" in the top navigation of FireHydrant
- Click "Webhooks" on the left subnavigation
- Click "Create" in the webhooks page
That's it! All event notifications will now be sent to the URL you entered for the events you have subscribed to.
Note: To disable a webhook, locate it on the Webhooks page and click the edit (pencil) icon. From the Status dropdown, select Inactive.
Verifying Requests
It's important to verify that the requests you're receiving on your webhook URL are coming from FireHydrant. To do this, compare the signature provided in the headers of the request to an HMAC signature generated from the request body sent to you.
For example, this is the pseudocode for verifying the request:
signature = request.headers['fh-signature']
body = request.body
secret = 'your webhook secret'
if HMAC.generate('sha256', secret, body) == signature
// request is valid
end
There are tools that are helpful for generating signatures while you develop an endpoint, such as HMAC generator.
Incident Event Payloads
{
"data": {
"incident": {
"conference_bridges": [
{
"id": "efb3a79f-5d11-45dc-94cc-955bbc72afb5",
"name": "Webex Bridge",
"url": "https://meet123.webex.com/meet191/j.php"
}
],
"counts": {
"starred_events": 0,
"starred_messages": 0
},
"created_at": "2023-07-25 13:34:49 UTC",
"current_milestone": "resolved",
"customer_impact_summary": "",
"description": "",
"follow_ups": [],
"id": "04d9fd1a-ba9c-417d-b396-58a6e2c374de",
"impacts": [],
"incident_channels": [
{
"id": "C05J7JSEA23",
"name": "inc-602-hark-i-hear-an-incident-subscription-webhook",
"source": "slack",
"status": "operational",
"url": "https://app.slack.com/client/TABC123/CABC123"
}
],
"labels": [],
"milestones": [
{
"created_at": "2023-07-25 13:34:49 UTC",
"duration": "",
"occurred_at": "2023-07-25 13:34:49 UTC",
"type": "started",
"updated_at": "2023-07-25 13:34:49 UTC",
"updated_by_id": "2af3339f-9d81-434b-a208-427d6d85c124",
"updated_by_type": "User"
},
{
"created_at": "2023-07-25 13:34:49 UTC",
"duration": "0",
"occurred_at": "2023-07-25 13:34:49 UTC",
"type": "acknowledged",
"updated_at": "2023-07-25 13:34:49 UTC",
"updated_by_id": "2af3339f-9d81-434b-a208-427d6d85c124",
"updated_by_type": "User"
},
{
"created_at": "2023-07-25 13:37:04 UTC",
"duration": "134",
"occurred_at": "2023-07-25 13:37:04 UTC",
"type": "mitigated",
"updated_at": "2023-07-25 13:37:04 UTC",
"updated_by_id": "2af3339f-9d81-434b-a208-427d6d85c124",
"updated_by_type": "User"
},
{
"created_at": "2023-07-25 13:38:17 UTC",
"duration": "73",
"occurred_at": "2023-07-25 13:38:17 UTC",
"type": "resolved",
"updated_at": "2023-07-25 13:38:17 UTC",
"updated_by_id": "2af3339f-9d81-434b-a208-427d6d85c124",
"updated_by_type": "User"
}
],
"name": "Hark I hear an incident subscription webhook",
"number": 602,
"role_assignments": [],
"severity": {
"description": "Primary product functionality is severely impacted and unusable. Customers are unable to utilize a common feature to its fullest ability. Data may not be displayed as expected but not lost. There is no workaround for customers.",
"slug": "SEV2",
"type": "unexpected_downtime"
},
"started_at": "2023-07-25 13:34:49 UTC",
"summary": "",
"tags": [],
"tasks": [
{
"assigned_to": [],
"state": "open",
"summary": "Post an update to the internal status page"
},
{
"assigned_to": [],
"state": "open",
"summary": "Assign a role for a mitigator"
}
],
"team_assignments": [],
"updated_at": "2023-07-25 13:38:17 UTC"
}
},
"event": {
"operation": "UPDATED",
"resource_type": "incident"
}
}
Change Event Payloads
In a change event JSON payload, you receive 2 top-level keys: event and data. The event key contains the operation type and resource type. You can use these to determine which type of event notification you just received.
{
"data": {
"attachments": [],
"created_at": "2019-05-31T16:16:11.728Z",
"description": "",
"duration_iso8601": null,
"duration_ms": null,
"ends_at": null,
"environments": [
{
"created_at": "2019-04-17T12:00:54.620Z",
"description": "",
"id": "b73d1a05-6e6f-4e17-9c3e-2b119342c583",
"name": "Production"
}
],
"id": "489d7b90-a9d7-43d2-99be-d33c5acb59f8",
"identities": [],
"labels": {
"stack": "rails"
},
"related_changes": [],
"services": [
{
"created_at": "2019-04-17T12:00:54.772Z",
"description": "",
"functionalities": [
{
"created_at": "2019-04-17T13:38:06.631Z",
"description": "",
"id": "cf13435c-b246-4ffc-9f04-55552cca3d53",
"services": [
{
"created_at": "2019-04-17T12:00:54.772Z",
"description": "",
"id": "355411a9-bbb0-4b58-ad2c-0257d8995f9d",
"labels": {},
"name": "firehouse",
"slug": "firehouse",
"updated_at": "2019-04-17T12:00:54.772Z"
},
{
"created_at": "2019-04-17T13:38:41.625Z",
"description": "",
"id": "bd865254-aea2-4aa0-afa4-2bfb659f0252",
"labels": {},
"name": "laddertruck",
"slug": "laddertruck",
"updated_at": "2019-04-17T13:38:41.625Z"
}
],
"summary": "REST API",
"updated_at": "2019-04-17T13:38:06.631Z"
},
{
"created_at": "2019-04-17T13:39:18.147Z",
"description": "",
"id": "95db369a-186f-4245-86e1-e13dead5cd73",
"services": [
{
"created_at": "2019-04-17T12:00:54.772Z",
"description": "",
"id": "355411a9-bbb0-4b58-ad2c-0257d8995f9d",
"labels": {},
"name": "firehouse",
"slug": "firehouse",
"updated_at": "2019-04-17T12:00:54.772Z"
},
{
"created_at": "2019-04-17T13:38:41.625Z",
"description": "",
"id": "bd865254-aea2-4aa0-afa4-2bfb659f0252",
"labels": {},
"name": "laddertruck",
"slug": "laddertruck",
"updated_at": "2019-04-17T13:38:41.625Z"
}
],
"summary": "Web UI",
"updated_at": "2019-04-17T13:39:18.147Z"
}
],
"id": "355411a9-bbb0-4b58-ad2c-0257d8995f9d",
"labels": {},
"name": "firehouse",
"slug": "firehouse",
"updated_at": "2019-04-17T12:00:54.772Z"
}
],
"starts_at": "2019-06-01T00:12:12.000Z",
"summary": "Production Deploy ",
"updated_at": "2019-05-31T16:33:26.932Z"
},
"event": {
"operation": "updated",
"resource_type": "change_event"
}
}