Skip to content

Slack bot setup

Patrick Connolly edited this page Nov 20, 2018 · 25 revisions

A Matterbridge integration for your Slack Workspace

Contents

Bot-based Setup
Legacy Setup


Bot-based Setup

Slack's model for bot users and other third-party integrations revolves around Slack Apps. They have been around for a while and are the only and default way of integrating services like Matterbridge going forward.

Slack Docs: Bot user tokens

Create the Slack App

  1. Navigate to your Apps page. You'll need to be logged in with an account that has administrative permissions over the Slack Workspace (server) that you want to sync with Matterbridge.

    Slack's App page

  2. Click on the Create App button and fill in the app's name and select the right Slack Workspace before validating.

    Create a Slack App

  3. Navigate to the Bot Users page via the menu on the left side of the page. Click on the Add a Bot User, fill in the bot's details and validate to create the required bot.

    Add a Bot User

Grant scopes and install the Slack App

Now that we have a bot we need to give your new Slack App (and thus the bot) the right permissions on your Slack Workspace.

  1. Via the menu on the left side of the page navigate to the OAuth & Permissions page and scroll down to the Scopes section.

  2. Successively add the following permission scopes to your app:

    • Modify your public channels (channels:write)
    • Send messages as <App name> (chat:write:bot)
    • Send messages as user (chat:write:user)

    Click on the Save changes button below the scopes once all scopes have been added.

    Add permission scopes

  3. Scroll to the top of the same OAuth & Permissions page and click on the Install App (or Reinstall App) button. This will give a pop-up menu summarising the permission scopes that you just added and will ask for your confirmation to add the new App with its bot to your Workspace.

    Install the new Slack App

  4. Once the App has been installed the top of the OAuth & Permissions page will show two tokens: an OAuth Access Token starting with xoxp-... and a Bot User OAuth Access Token starting with xoxb-.... You will need to use the second in your Matterbridge configuration.

Invite the bot to channels synced with Matterbridge

The only thing that remains now is to set up the newly created bot on the Slack Workspace itself.

  1. On your Slack server you need to add the newly created bot to the relevant channels. Simply use the /invite @<botname> command in the chatbox.

    Invite the bot user to a channel

  2. Repeat the invite process for each channel that Matterbridge needs to sync.

Now you are all set to go. Just configure and start your Matterbridge instance and see the messages flowing.

All done!

Legacy setup

🛑 This setup is not recommended and will disappear in future versions of Matterbridge. Please use it only if you are absolutely sure that you can not use the normal setup. Legacy tokens are, as their name indicates, a legacy feature and Slack can in the future deprecate them at short notice as they have a weak security model and give access to a wide-range of privileged actions. Always store your token securely!

Slack Docs: Legacy tokens


In order to use this setup your channel configuration should use the slack-legacy setup instead of slack:

[slack-legacy]
[slack-legacy.myslack]
Token="xoxp-123456789-mytoken"

Steps to follow:

  1. First create a dedicated user (a new account specifically for the bot) in Slack.

  2. Next log in as this user and go to the legacy tokens page and click "Create token" for your team and your new user. Create token screen The token will look something like xoxp-123456789-LowerAndUPpercase.

  3. Use the obtained token in your configuration file for the channel setup as in the example above.

Clone this wiki locally