-
Notifications
You must be signed in to change notification settings - Fork 617
Slack bot setup
Bot-based Setup
Legacy Setup
Issues
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
It's important that you create a "Slack App (Classic)". Don't use the "Create New App" button, and don't opt in to the "granular permissions" feature.
-
Navigate to Slack's "Your Apps" page and log into an account that has administrative permissions over the Slack Workspace (server) that you want to sync with Matterbridge.
-
Use THIS LINK to create a "Slack App (Classic)". Choose any name for your app and select the desired workspace, and then submit.
⚠️ USE THE LINK AND DON'T CLICK THE "Create New App" BUTTON. -
Navigate to the "App Home" page via the menu on the left. Click "Add Legacy Bot User", fill in the bot's details, and submit.
You'll need to give your new Slack App (Classic), and thus the bot, the right permissions on your Slack Workspace.
-
Click "OAuth & Permissions" in the menu on the left, and scroll down to the "Scopes" section. Don't click the prominent "Update Scopes" button. Instead, click "Add an OAuth Scope".
-
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
) - Access user’s profile and workspace profile fields (
users.profile:read
)
- Modify your public channels (
-
Scroll to the top of the same "OAuth & Permissions" page and click on the "Install to Workspace" (or "Reinstall to Workspace") button:
Confirm that the authorizations you just added are OK:
-
Once the App has been installed, the top of the
OAuth & Permissions
page will show two tokens: a "User OAuth Token" starting withxoxp-...
and a "Bot User OAuth Token" starting withxoxb-...
. You will need to use the second in your Matterbridge configuration:
The only thing that remains now is to set up the newly created bot on the Slack Workspace itself.
-
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. -
Repeat the invite process for each channel that Matterbridge needs to sync.
⚠️ Also, don't forget to do this in the future when you want to sync more channels.
Now you are all set to go. Just configure and start your Matterbridge instance and see the messages flowing.
Update: 2020-04-03 - this setup is not working anymore. (See https://github.com/42wim/matterbridge/issues/964#issuecomment-607629250)
🛑 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:
-
First create a dedicated user (a new account specifically for the bot) in Slack.
-
Next log in as this user and go to the legacy tokens page and click "Create token" for your team and your new user. The token will look something like
xoxp-123456789-LowerAndUPpercase
. -
Use the obtained token in your configuration file for the channel setup as in the example above.
If you get the message: ERROR slack: Connection failed "not_allowed_token_type" &errors.errorString{s:"not_allowed_token_type"}
For more information look at https://github.com/slackapi/node-slack-sdk/issues/921#issuecomment-570662540 and https://github.com/nlopes/slack/issues/654 and our issue https://github.com/42wim/matterbridge/issues/964
Getting started
How to create your config
Discord bot setup
Slack bot setup
MS Teams setup
Deploy
DigitalOcean
Azure
Docker
Heroku
Gateways
Config: basic
Config: channel rules
Discord
Gitter
Hipchat
IRC
Keybase
Matrix
Mattermost
Microsoft Teams
Mumble
Nextcloud Talk
RocketChat
Slack
Sshchat
Steam
Telegram
Twitch
VK
WhatsApp
XMPP
Zulip
Advanced
Mediaserver setup
Service files
Developer
API
Tengo scripting
Making gateways