A guide to configure Grafana IRM OnCall outgoing webhooks to send notifications to Google Chat.
See Google Chat docs on how to send threaded messages.
In Grafana IRM > Integrations, create 2 advanced outgoing webhooks to handle:
- Sending a message whenever an alert group is created
- Reply on status changes
Trigger Type: Alert Group Created
Webhook URL: https://chat.googleapis.com/v1/spaces/SPACE_ID/messages?key=KEY&token=TOKEN&messageReplyOption=REPLY_MESSAGE_FALLBACK_TO_NEW_THREAD
Note: Replace url with your own but keep
&messageReplyOption=REPLY_MESSAGE_FALLBACK_TO_NEW_THREAD
Headers: {"Content-Type": "application/json; charset=UTF-8"}
Customised forwarded data:
{
"text": "{% if alert_group.state == 'acknowledged'%}π {% elif alert_group.state == 'resolved'%}π’{% elif alert_group.state == 'silenced'%}βͺ{% else %}π¨{% endif %} *{{ alert_group.title }}*\n\nMessage: {{ alert_payload.message }} {{ alert_payload.oncall.message }}\n\n_{{ integration.name }}_\n{% if event.type == 'acknowledge' %}\n*Acknowledged by: {{ user.username }}*\n{% endif %}{% if event.type == 'resolve' %}\n*Resolved by: {{ user.username }}*\n{% endif %}{% if event.type == 'silence' %}\n*Silenced by: {{ user.username }} (until {{ event.until }})*\n{% endif %}\n<{{ alert_group.permalinks.web }}|View in Grafana OnCall>",
"thread": {"threadKey": "{{ alert_group_id }}"},
}Trigger Type: Status Change
Webhook URL: https://chat.googleapis.com/v1/spaces/SPACE_ID/messages?key=KEY&token=TOKEN&messageReplyOption=REPLY_MESSAGE_FALLBACK_TO_NEW_THREAD
Note: Replace url with your own but keep
&messageReplyOption=REPLY_MESSAGE_FALLBACK_TO_NEW_THREAD
Headers: {"Content-Type": "application/json; charset=UTF-8"}
Customised forwarded data:
{
"text": "{% if alert_group.state == 'acknowledged'%}π {% elif alert_group.state == 'resolved'%}π’{% elif alert_group.state == 'silenced'%}βͺ{% else %}π΄{% endif %} _{{ alert_group.state.upper() }}_\n{% if event.type == 'acknowledge' %}\n*Acknowledged by: {{ user.username }}*\n{% endif %}{% if event.type == 'resolve' %}\n*Resolved by: {{ user.username }}*\n{% endif %}{% if event.type == 'silence' %}\n*Silenced by: {{ user.username }} (until {{ event.until }})*\n{% endif %}\n<{{ alert_group.permalinks.web }}|View in Grafana OnCall>",
"thread": {"threadKey": "{{ alert_group_id }}"},
}
