Incident.io Webhook Integration
8 minute read
Trustgrid can be integrated with Incident.io using the generic webhook channel to send alerts based on Trustgrid events. This allows for streamlined incident management and improved response times. The guide below outlines the steps to set up this integration along with suggestions on gathering additional attributes for the alerts.
Setting Up the Integration
Step 1 - Start Creating the Incident.io Alert Source
- Log in to your Incident.io account.
- Click on your organization name at the top and then select Settings.
- Under
On Call, click onAlerts. - Click the
+to the right ofSourcesto create a new source.
Creating a new Alert source in Incident.io - Follow these steps to create the source

Steps to create the source in Incident.io - Search for
http. - Select the HTTP type from the list and provide a unique name.
- For
Type of HTTP Sourceselect custom. This allows the source to use the native Trustgrid JSON payload which can be transformed into the Incident.io format. - Click Continue to proceed to the next step.
- Search for
- Capture the generated webhook URL and save it for later use.
- Select the
Query Authenticationtab. - Click the copy icon to the right of the URL. Save this as you will need it later .
- Select the
- Set the
Transform ExpressionandDeduplication key path- Scroll down until you see the
Transform expressionsection. There will be existing JavaScript there. Select all and delete. - Copy and paste the following code into the
Transform expressionsection:var resolvedFlag = !!$.resolved; // force boolean var statusValue = resolvedFlag ? "resolved" : "firing"; return { title: $.nodeName + " - " + $.eventType, description: $.message, status: statusValue, deduplication_key: $.uid, metadata: { nodeName: $.nodeName, eventType: $.eventType, level: $.level, domain: $.domain, tags: $.tags, timestamp: $.timestamp } };
Transform expression in Incident.io - Scroll below to the
Deduplication key pathsection and set the value to$.uid. - Click Save configuration to finish creating the webhook source.

Saving the webhook configuration in Incident.io
- Scroll down until you see the
- On the right side, you should see a section saying
No alerts received yet. In the next section, you will create a Webhook channel in Trustgrid and trigger events to generate sample Alerts for Incident.io to use to complete the configuration.
Step 2 - Create Webhook Channel in Trustgrid
To complete the below step it is idea to identify a node that you can use to generate test events, ideally by performing an action such as restarting the node. In the example below we will create a new Alarm Filter for a specific node and test by restarting it.
- Login to the Trustgrid portal.
- Navigate to Alarms > Channels.
- Click the
+Create Channelbutton. (Or optionally select and choose Edit from Actions to add to an existing Channel) - In the channel configuration, set the following:
- Name: Give your channel a descriptive name.
- Generic Webhook: Paste the URL you copied from Incident.io.
- Click Save to create the channel.

Creating a new Webhook channel in Trustgrid
- Setup an Alarm Filter to test the new channel. (If you have an existing Alarm Filter that you can use for testing, just edit and select the channel created above and save. Then proceed to the next step.)
- Navigate to Alarms > Alarm Filters.
- Click the
+Create Alarmbutton. - In the filter configuration, set the following:
- Name: Give your filter a descriptive name. This example is just for testing.
- Make sure Enabled is checked.
- Node name: Select the node you identified for testing.
- Severity Threshold: Change to
INFOso that all relevant events match the filter includingResolvednotifications. - Channels: Select the channel you created above.
- Click Save to create the filter.

Creating a new Alarm Filter in Trustgrid
- To test the filter, restart the node you selected in the filter. This will generate a
Node Restartevent, then aNode Disconnectevent followed by aNode Connectevent.
The Trustgrid system will only send out matching alerts if there are no unresolved events of that type. If the test node has unresolved events, use the Alert Center to clear the:
- Click the Alert Center icon in the top right corner of the Node’s detail page.
- You can use the check marks to resolve individual Alerts, or
- Click the Mark All As Resolved button to clear all unresolved Alerts of that type.

Step 3 - Complete Alert Source config in Incident.io
To complete the configuration we will use the generated Alerts to extract additional useful attributes from the example events to surface in Incident.io. Feel free to modify the Attribute names to fit your needs.
- Return to the Alert sources setup page in Incident.io
- You should now see example alert in the bottom right.
- Click Continue.

Example alert in Incident.io
- On the
Configure your setuppage, you can map the attributes from the incoming alerts to the fields in Incident.io. Use the example alert to help you identify the relevant fields.- Leave the default
Alert titleandDescriptionmappings unless you need to customize them. - Click the Edit pencil icon to the right of
Attributes.
Editing attributes in Incident.io - In the
Alert Payloadsection, click +“nodeName”. As the name implies, this will include the name of the Node the event relates to.
Adding a new attribute in Incident.io - Unless you have an existing relevant attribute defined, such as
Server Name, you can create a new one. Scroll down and select+ Add new attribute.
Adding a new attribute in Incident.io - In the new attribute configuration:
- Give the attribute something descriptive, like
Node Name. Leave all other settings at their defaults. - Click Add

Adding a new attribute configuration in Incident.io
- Give the attribute something descriptive, like
- Unless you have an existing relevant attribute defined, such as
- Repeat the above steps to add the following attributes:
- +eventType - This will include the type of event that triggered the alert.
- +description - This will copy the Description, which is the original Event’s message, into an attribute. This will allows this to be displayed when the Alert is forwarded to a tool like Slack without having to open the actual alert.
- +level - This will include the severity level of the event.
- +domain - This is only useful if your company has multiple Trustgrid organizations with different domains. This will allow you to potentially filter and route differently based on this attribute.
- +tags - This will include all configured [Tags] /docs/nodes/shared/tags/. For this attribute, change the
Choose what results should be parsed intotoLabels.
Adding a new attribute configuration in Incident.io
- In the
- Click Apply in the bottom right to complete adding Attributes.
- Leave the default
- Click Save and finish to complete the Alert configuration in Incident.io
- At this point you can follow the Incident.io documentation to Create a new Alert route from the new alert source.
Addition Information
Understanding the transformations
1 var resolvedFlag = !!$.resolved; // force boolean
2 var statusValue = resolvedFlag ? "resolved" : "firing";
3
4 return {
5 title: $.nodeName + " - " + $.eventType,
6 description: $.message,
7 status: statusValue,
8 deduplication_key: $.uid,
9 metadata: {
10 nodeName: $.nodeName,
11 eventType: $.eventType,
12 level: $.level,
13 domain: $.domain,
14 tags: $.tags,
15 timestamp: $.timestamp
16 }
17 };- Lines 1-2 are responsible for determining the alert’s status based on its resolution state. This is then convert into Incident.io’s syntax of
firingfor new alerts andresolvedfor resolved alerts. - Lines 4-20 define the structure of the alert object that will be sent to Incident.io.
- Line 5 sets the title of the alert using the node name and event type.
- Line 6 sets the description of the alert using the message from the original event.
- Line 7 sets the status of the alert using the resolved flag to determine if it is
firingorresolved. - Line 8 sets the deduplication key for the alert using the unique ID from the original event. This allows Incident.io to match a
firingalert with its correspondingresolvedalert. - Lines 9-20 set various metadata fields for the alert, including the node name, event type, level, domain, tags, and timestamp.
Testing via Curl
If you want to test the webhook integration, you can use Curl to send a sample payload to the Incident.io webhook URL.
This can be useful if you are not seeing the expected alerts in Incident.io after triggering events in the Trustgrid portal as the curl command may return any HTTP error Incident.io is responding with.
Here’s an example command:
curl -X POST <WEBHOOK_URL> \
-H "Content-Type: application/json" \
-d '{
"nodeName": "edge1",
"expires": 1604801325,
"level": "INFO",
"eventType": "Test Event",
"source": "EKG",
"message": "This is just a test event. It is not real.",
"type": "Alert",
"orgId": "8e1c2c05-2c86-4b1b-a0cc-############",
"GS1PK": "Org#8e1c2c05-2c86-4b1b-a0cc-############",
"_ct": {},
"uid": "1jwV1R2R6itQUjPza9yqTE8a8zu",
"GS1SK": "Alert#1jwV1R2R6itQUjPza9yqTE8a8zu",
"_md": {},
"domain": "example.trustgrid.io",
"SK": "Alert#Node Disconnect",
"_tp": "Alert",
"PK": "Node#0895b104-5434-447b-8577-############",
"state": "UNKNOWN",
"nodeId": "0895b104-5434-447b-8577-############",
"timestamp": 1604714923,
"channelID": "bc47ca84-1d04-454b-bedc-a55d1a917c0e",
"notes": ["Text from Description Field"],
"tags": { "prod_status":"production","site_name":"Main Datacenter"},
"resolved": false
}
Replace <WEBHOOK_URL> with the actual URL of your Incident.io webhook. This command will simulate an alert being sent to Incident.io, allowing you to verify that the integration is working correctly.
If everything is working you should see a message like {"status":"accepted","message":"Event accepted for processing","deduplication_key":"735cbacc3f07e740d26ff364a19f856aa5af95f929017538214093afb132006e"} and then the Alert will show in Incident.io.
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.