slack icon indicating copy to clipboard operation
slack copied to clipboard

API to post messages to Slack

Open bkeepers opened this issue 7 years ago • 2 comments

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:

  • $token is any valid GitHub token (personal access token, OAuth token, GitHub App token) that has write access to :owner/:repo
  • :type is a user-defined type for the message (like tickets) that can be subscribed/unsubscribed to in the channel (/github subscribe myorg/myrepo tickets)
  • $message is 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

bkeepers avatar Mar 19 '18 22:03 bkeepers

This is now available for people to start experimenting with: https://github.com/integrations/slack/blob/master/docs/api.md

Feedback is welcome here!

bkeepers avatar Apr 23 '18 21:04 bkeepers

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)

kwavnet avatar Jun 13 '22 07:06 kwavnet