slack
slack copied to clipboard
API to post messages to Slack
No matter how many features we build into the GitHub + Slack integration, there are going to be use cases and workflows we don't support. Someone somewhere will want something related to their work on GitHub to show up in their Slack channel that may not be broadly applicable, and they don't want to implement their own Slack integration just to make it work.
It would be awesome if the could leverage the fact that GitHub already integrates with Slack and post messages into any channel subscribed to a specific repository.
curl -xPOST -H "Authorization: token $token" \
https://slack.github.com/repos/:owner/:repo/:type
-d "$message"
Where:
$tokenis any valid GitHub token (personal access token, OAuth token, GitHub App token) that has write access to:owner/:repo:typeis a user-defined type for the message (liketickets) that can be subscribed/unsubscribed to in the channel (/github subscribe myorg/myrepo tickets)$messageis any valid payload for a slack message
TODOs:
- [x]
POST /repos/:owner/:repo - [x] Authenticate with user token
- [ ] Authenticate with app token
- [ ] Add
:type - [ ] Add footer with information about the user/app that was used to post it
Estimate: 0.5 weeks
This is now available for people to start experimenting with: https://github.com/integrations/slack/blob/master/docs/api.md
Feedback is welcome here!
It doesn't work for me - permissions seem to be okay, but none of the posted messages appear the subscribed channels, even if the slack side is subscribed to any possible feature.
Furthermore I would really like to see this :type feature, as this is what developers have been asking me for (more granular and more interactive notifications)