Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d427f7b

Browse files
authoredFeb 26, 2025··
Update webhook docs (#227)
1 parent c218c4a commit d427f7b

File tree

1 file changed

+38
-16
lines changed

1 file changed

+38
-16
lines changed
 

‎monitor-data/custom-webhook-notifier.mdx

Lines changed: 38 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,37 @@ To create a custom webhook notifier, follow these steps:
2424
- `.QueryStartTime` is the start time applied in the monitor query that gave rise to the notification.
2525
- `.Timestamp` is the time the notification was generated.
2626
- `.Title` is the name of the monitor associated with the notification.
27-
- `.Value` is the value that gave rise to the monitor triggering or resolving when the notification corresponds to a threshold monitor.
28-
- `.MatchedEvent` is the event that matched the criteria of a match monitor.
27+
- `.Value` is the value that gave rise to the monitor triggering or resolving. It’s only applicable if the notification corresponds to a threshold monitor.
28+
- `.MatchedEvent` is a JSON object that represents the event that matched the criteria of the monitor. It’s only applicable if the notification corresponds to a match monitor.
29+
- `.GroupKeys` and `.GroupValues` are JSON arrays that contain the keys and the values returned by the group-by attributes of your query. They are only applicable if the APL query of the monitor groups by a non-time field.
30+
You can fully customize the content of the webhook to match the requirements of your environment.
2931
1. Optional: Add headers to the POST request sent to the webhook URL.
3032
1. Click **Create**.
3133

3234
## Examples
3335

34-
The example below is a custom webhook notification generated from a threshold monitor triggering. The body of a POST request sent to the webhook URL using the default template is the following:
36+
The example below is the default template for a custom webhook notification:
37+
38+
```json
39+
{
40+
"action": "{{.Action}}",
41+
"event": {
42+
"monitorID": "{{.MonitorID}}",
43+
"body": "{{.Body}}",
44+
"description": "{{.Description}}",
45+
"queryEndTime": "{{.QueryEndTime}}",
46+
"queryStartTime": "{{.QueryStartTime}}",
47+
"timestamp": "{{.Timestamp}}",
48+
"title": "{{.Title}}",
49+
"value": {{.Value}},
50+
"matchedEvent": {{jsonObject .MatchedEvent}},
51+
"groupKeys": {{jsonArray .GroupKeys}},
52+
"groupValues": {{jsonArray .GroupValues}}
53+
}
54+
}
55+
```
56+
57+
Using the template above, the body of a POST request sent to the webhook URL for a threshold monitor triggering:
3558

3659
```json
3760
{
@@ -45,7 +68,9 @@ The example below is a custom webhook notification generated from a threshold mo
4568
"timestamp": "2024-06-28 14:55:57 +0000 UTC",
4669
"title": "Axiom Monitor Test Triggered",
4770
"value": 57347,
48-
"matchedEvent": null
71+
"matchedEvent": null,
72+
"groupKeys": null,
73+
"groupValues": null
4974
}
5075
}
5176
```
@@ -54,17 +79,14 @@ The example template below formats the webhook message to match the [expectation
5479

5580
```json
5681
{
57-
"action": "Open",
58-
"event": {
59-
"title": "{{.Title}}",
60-
"description": "{{.Body}}",
61-
"deduplication_key": "{{.MonitorID}}",
62-
"status": "{{ if eq .Action "Open" }}firing{{ else }}resolved{{ end }}",
63-
"metadata": {
64-
"description": "{{.Description}}",
65-
"value": {{.Value}},
66-
"url": "https://app.axiom.co/{your-org-id-here}/monitors/{{.MonitorID}}"
67-
}
68-
}
82+
"title": "{{.Title}}",
83+
"description": "{{.Body}}",
84+
"deduplication_key": "{{.MonitorID}}",
85+
"status": "{{ if eq .Action "Open" }}firing{{ else }}resolved{{ end }}",
86+
"metadata": {
87+
"description": "{{.Description}}",
88+
"value": {{.Value}}
89+
},
90+
"source_url": "https://app.axiom.co/{your-org-id-here}/monitors/{{.MonitorID}}"
6991
}
7092
```

0 commit comments

Comments
 (0)
Please sign in to comment.