Using Custom Webhook Payloads
While the Slack trigger message format cannot be directly customized when using Honeycomb's Slack integration, you can utilize webhooks to create fully personalized notifications. Here's how:
1. Set up a webhook as your trigger recipient instead of using the native Slack integration.
2. Configure an incoming webhook in your company's Slack workspace.
3. Customize your webhook to include additional data such as:
Custom links to other systems
Additional context from external data sources
Formatted template messages
Interactive elements like custom buttons
This approach provides complete control over the content and appearance of your Slack notifications.
For detailed instructions on creating a custom webhook, please refer to our documentation:
https://docs.honeycomb.io/integrations/webhooks/
Here's an example of what an alert can look like in Slack, using the custom webhook payload:
Here's the code for that webhook payload, which utilizes the GROUP_BY data in the trigger to be able to pass information to the webhook:
{
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": {{- if gt (len .Result.GroupsTriggered) 0 -}}
":us::chart_with_upwards_trend: Teams currently being rate limited"
{{- else -}}
":us::chart_with_downwards_trend: No team is being rate limited, congratulations!"
{{- end }}
}
}
{{- if gt (len .Result.GroupsTriggered) 0 -}}
,{
"type": "section",
"fields": [
{
"text": "*Team*",
"type": "mrkdwn"
},
{
"text": "*Environment*",
"type": "mrkdwn"
}
]
},
{
"type": "divider"
}
{{- range $i, $group := .Result.GroupsTriggered -}}
,{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "<{{ range $g := $group.Group }}{{if eq $g.Key "dc.admin_link_team"}}{{$g.Value}}{{end}}{{end}}|{{ range $g := $group.Group }}{{if eq $g.Key "app.team.name"}}{{$g.Value}}{{end}}{{end}}>"
},
{
"type": "mrkdwn",
"text": "{{ range $g := $group.Group }}{{if eq $g.Key "app.environment.name"}}{{$g.Value}}{{end}}{{end}}"
}
]
}
{{- end }}
,
{
"type": "divider"
},
{
"type": "actions",
"elements": [
{
"type": "button",
"style": "primary",
"text": {
"type": "plain_text",
"text": "See Volume"
},
"url": "{{ .Result.URL }}"
}
]
}
{{- end }}
]
}
Note: Honeycomb Support is available to assist with general webhook functionality but cannot help with writing custom payloads or troubleshooting issues specific to your Slack app configuration.
Alternatively, for a more straightforward solution:
If you only need one specific field displayed in the Slack trigger alert, use the GROUP BY in the trigger setup. Adding a field to GROUP BY will display it in the default Slack alert format.
Here is an example of the same alert without a GROUP BY:
And the extra detail when adding GROUP BY response.status_code
: