It is possible to integrate Bridge with a Slack app that can easily be published or shared with the end users only requiring the Add to Slack button to integrate the app with their team.
We support integration with Slack in two ways, User and Channel, but they share the same basic set up.
Set up the Slack integration
Create a new app on Slack or manage an existing one.
- You will need the Client ID and Client Secret to link your Slack app with the Bridge Slack channel.
- You may also add the verification token for additional security, which is recommended.
The verification token field in Slack may not appear until you have added the Request URL to either Interactive Messages or Event Subscriptions. Leave this blank in Bridge until you have the valid value from Slack or the calls may fail, including the initial call made by Slack to validate the request URL for interactive messages and events.
The Bot Type selection is determined by the differences detailed below but can be changed before you start conversing with the bot without causing any additional difficulties later on.
Changing the Bot Type will regenerate the Add to Slack button HTML.
Group Channel users
Group Channel Users checkbox is used if you want all users conversing in a single channel to be treated as a single user by the bot. This means that any user can continue a conversation started by another, and that the normal behaviour of being able to determine a user's name is not available.
This does not affect the behaviour of a user conversing with a bot user inside the DM channel to the bot user.
Saving the registration
When saving the integration registration details, it will generate a Redirect URL, Request URL, and the Add to Slack button HTML that can be shared for anyone to add your Slack app.
- The Redirect URL is required for the OAuth process and should be added in your Slack app settings under OAuth & Permissions.
- The Request URL is required for events (to know when the bot has been spoken to) and interactive messages (to know if a button in a Slack message has been pressed).
- Add the Request URL to your Slack app under Interactive Messages and Event Subscriptions. The events you need to subscribe to are defined by your choice of bot type detailed below.
User Bot Type
This allows you to add a Slack bot user to any team that will be able to integrate with users either through direct messages or on any channel the bot user has been added to.
To use the bot user integration type, you would select the Bot Type value User when registering your application with Bridge.
- Under Bot User you must create a bot user.
- Under Event Subscriptions you must add the two Bot Events:
- message.channels: listens for messages posted to a channel
- message.im: listens for messages posted as a direct message
Channel Bot Type
This allows you to interact with the Slack app within a specific channel, which is selected by the user that authenticated the app.
To use the channel bot integration type, you would select the Bot Type value Channel when registering your application with Bridge.
- Under Event Subscriptions you must add the following Team Events
- message.channels: listens for messages posted to the channel
The Add to Slack button HTML generated will include all the scopes that are needed to properly use the Slack integration. You do not need to be concerned about what is needed for the button to work properly, just select your bot type and save the settings and the HTML will be generated for you.
If you define additional scopes for another aspect of your app, or want to request access without using the button, you will need to include the following scopes for the Bridge integration to function correctly:
- bot (only for bot user integration)
- incoming-webhook (only for channel bot integration)
- channels:history (only for channel bot integration)
- chat:write:bot (only for channel bot integration)
It is possible to add additional scopes that expand the capability of Bridge. Adding the additional permissions will add the new scopes to the generated Add to Slack button.
- User Profile: adds the users:read scope - this grants the ability to get the users profile information.
- User Email: adds the users:read.email scope - this grants the ability to get the users email address. This will also automatically grant the users:read permission.
- Channel Information: adds the channels:read scope - this grants the ability to get the channel information that is being used.
- Slash Commands: adds the commands scope - this grants the ability to add Slash Commands from your Slack app to the authenticated team.