Skip to content

Instantly share code, notes, and snippets.

@ar2pi
Last active July 7, 2025 11:10
Show Gist options
  • Select an option

  • Save ar2pi/32040600a1f45e13b2cbec025c2d08fd to your computer and use it in GitHub Desktop.

Select an option

Save ar2pi/32040600a1f45e13b2cbec025c2d08fd to your computer and use it in GitHub Desktop.
grafana-irm-google-chat-webhook

grafana-irm-google-chat-webhook

A guide to configure Grafana IRM OnCall outgoing webhooks to send notifications to Google Chat.

Expected output example:
threaded-chat-v2

See Google Chat docs on how to send threaded messages.

In Grafana IRM > Integrations, create 2 advanced outgoing webhooks to handle:

  1. Sending a message whenever an alert group is created
  2. Reply on status changes

image

Webhook #1

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 }}"},
}

Webhook #2

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 }}"},
}

Docs and references

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment