Skip to content

Handle errors in Slack's postMessage API#3160

Closed
carlpett wants to merge 1 commit intoprometheus:mainfrom
carlpett:handle-slack-postmessage-errors
Closed

Handle errors in Slack's postMessage API#3160
carlpett wants to merge 1 commit intoprometheus:mainfrom
carlpett:handle-slack-postmessage-errors

Conversation

@carlpett
Copy link
Member

@carlpett carlpett commented Dec 2, 2022

For larger organisations, using the postMessage API has advantages over webhooks, such as not being tied to a specific user (who might leave the company at some point, resulting in the webhook integration becoming disabled), and posting to multiple channels.

Alertmanager's Slack integration actually works with this endpoint out of the box, by setting the URL path to /api/chat.postMessage. However, error handling works a bit differently on this endpoint, always returning 200 OK even when the posted message is rejected.

This commit handles the response format from this endpoint, so that errors are reported correctly.

Note for the review: This doesn't seem like a super-elegant approach, so very open for opinions on other ways to structure this.

For larger organisations, using the postMessage API has advantages over
webhooks, such as not being tied to a specific user (who might leave the
company at some point, resulting in the webhook integration becoming
disabled), and posting to multiple channels.

Alertmanager's Slack integration actually works with this endpoint out of the
box, by setting the URL path to /api/chat.postMessage. However, error
handling works a bit differently on this endpoint, always returning 200 OK
even when the posted message is rejected.

This commit handles the response format from this endpoint, so that errors are
reported correctly.
@knyar
Copy link
Contributor

knyar commented Dec 22, 2022

This seems like a duplicate of #3121.

@carlpett carlpett closed this Sep 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants