Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle errors in Slack's postMessage API #3160

Closed

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