alertmanager icon indicating copy to clipboard operation
alertmanager copied to clipboard

Slack notifier is using a legacy attachment message format

Open gburek-fastly opened this issue 10 months ago • 2 comments

Alertmanager documents the slack_config as (linking to v0.27 due to formatting issue that may have been fixed in #4247) https://prometheus.io/docs/alerting/0.27/configuration/#slack_config :

The notification contains an attachment.

That link no longer goes to a section about attachments (https://api.slack.com/messaging/composing/layouts#attachments) but forwards to https://api.slack.com/reference/surfaces/formatting#rich-layouts

The documentation for attachments now is at https://api.slack.com/reference/surfaces/formatting#attachments and has the following note:

This feature is a legacy part of messaging functionality for Slack apps. We recommend you stick with Block Kit as above, but if you still want to use attachments, read our caveats below.

The caveats section is as follows:

Secondary attachments are a legacy part of the messaging functionality. While we aren't deprecating them, you should understand that they might change in the future, in ways that reduce their visibility or utility.

We've already mentioned that we recommend the attachments array only contain secondary content that is less important to the intent of the published message. Any content displayed within attachments may be wrapped, truncated, or hidden behind a "show more" style option by Slack clients. This isn't the case with the top-level blocks field.

In short, we recommend you use Block Kit for as much of your message composition as you can, and avoid using attachments if possible. Blocks have many more visual and interactive capabilities available.

Recently, attachments no longer render markdown links for the iOS client, but appear to be fine for desktop and android clients.

While the guidance from Slack is not clear cut (legacy but not deprecated?), moving to the more modern format would help to keep message rendering fully supported in all clients.

gburek-fastly avatar Feb 25 '25 20:02 gburek-fastly

Please do feel free to open a PR that updates the link in the docs. There are a couple of PRs that looked at adding BlockKit support (including one from me), but I don't see those being merged in the immediate future as more work is needed there.

grobinson-grafana avatar Feb 27 '25 11:02 grobinson-grafana

Hi @grobinson-grafana , Since there is no linked PRs, I would like to know if this issue is still open.

If Yes, I would like to fix it.

ADITYATIWARI342005 avatar Aug 30 '25 12:08 ADITYATIWARI342005