Skip to content

Latest commit

 

History

History
 
 

slack-post-message

slack-post-message

slack-post-message adds a "Post a message" button in the slack shortcuts section. This can be used to post a message in multiple channels. The message will be posted in the channels selected, by the bot on behalf of the user. Only the users part of the slack usergroups given in the config file are permitted to use the bot. This app uses Slack modals rather than dialogs

screenshot of a blank send message modal

Configuration

slack-post-message requires a configuration file, by default called config.json in the working directory. If the location of the config.json is different, change the mount path accordingly in deployment.yaml. The configuration file must look like this:

{
  "signingSecret": "some_slack_signing_secret",
  "accessToken": "xoxp-some-slack-access-token-these-are-very-long-and-start-with-xoxp",
  "userGroups": ["UsergroupID1", "UsergroupID2"]
}

signingSecret, accessToken are all values provided by Slack when creating and installing the app. Check out the slack app creation guide for more details.

For userGroups, from slack browser view find the ID(s) of the usergroups in the URL placeholder of the browser

Slack setup

  • slack-post-message requires the following OAuth scopes:

    • usergroups:read
    • channels:read
    • groups:read
    • chat:write
  • slack-post-message requires the following interactive components:

    • Callback ID: write_message
    • Recommended action name: "Post message"
    • The location required is 'Global'
  • Set the request URL for the interactive component appropriately. The URL is currently configured as $PATH_PREFIX/webhook. PATH_PREFIX is set as environment variable in deployment.yaml

  • slack-post-message does not require any event subscriptions

The slack app creation guide explains what to do with these values.

Deployment

Kubernetes runs slack-post-message in a Kubernetes cluster; check out the config.

slack-post-message can also run on Google App Engine. To do this, create a config.json file in this directory as described above and then run gcloud app deploy, using a Google Cloud Platform project that has App Engine enabled. For most Slack teams, slack-post-message should fit in the free quota.