Tags | Slack | Integrations |
ADMIN PRIVILEGES REQUIRED
This documentation is for Stack Overflow for Teams Enterprise. Free, Basic, and Business users can access their documentation here. Find your plan.
Overview
Stack Overflow for Teams Enterprise (SOE) offers a simple method to create or update a Slack integration using an app manifest. A manifest holds the configuration details of a Slack integration "bot". SOE generates this manifest, then Slack imports it and creates the bot. This simplifies the setup process and reduces errors.
THIS ARTICLE APPLIES TO STACK OVERFLOW FOR TEAMS ENTERPRISE ONLY.
Other Stack Overflow for Teams users should read this article instead. Find your plan.
Interactive Slack bot
Enabling two-way communication with the Slack servers may require you to reconfigure your firewall. Slack varies their IP addresses, making a simple IP whitelist ineffective. Instead, you can set up a reverse proxy to allow incoming connections only to the /integrations/slack/ routes. These include /integrations/slack/commands, /integrations/slack/events, and /integrations/slack/actions.
Prerequisites
Before setting up a Slack integration, it's important that:
You’re signed into the Slack workspace you'll integrate SOE with.
You’re allowed to create apps in your Slack workspace. This is Slack’s default setting, but your workspace admin can disallow it.
Your SOE server has a valid SSL certificate installed from a reputable certificate authority (CA).
You've established two-way communication between SOE and Slack (if you're creating an interactive bot).
Bot install/upgrade process
If you're creating a new Slack bot, go to the Slack API page and create a new bot. Then follow the steps below. If you're updating an existing bot, open the Slack bot you've already created. Follow the steps below, but skip steps where you don't need to make changes.
Configuring a Slack bot requires multiple steps in both Slack and SOE. We recommend having both sites open in separate browser tabs or windows.
As an SOE admin, click Admin Settings in SOE's left-hand menu. Then click Slack. In a separate browser tab or window, go to your Slack bot.
With a new bot created or an existing bot opened:
In Slack's "OAuth Tokens & Redirect URLs" section, click Add New Redirect URL.
Enter your site's URL.
Click Add.
Click Save URLs.
Switch to the Slack bot's "Basic Information" section.
Copy the App ID value from Slack to SOE.
Copy the Client ID value from Slack to SOE.
Click Show in the Client Secret field, then copy the Client Secret value from Slack to SOE.
Click Show in the Signing Secret field, then copy the Signing Secret value from Slack to SOE.
Click Save Credentials on SOE.
In SOE, configure the following required options for your Slack bot:
Enable two way communication Enable this so the interactive bot can search SOE from Slack, create new questions from Slack, and unfurl SOE links.
Automatically join public channels Enable this to allow the bot to automatically join public Slack channels on the workspace.
NOTE: The Automatically join public channels option is convenient, but will generate a notification for every public channel in your workspace when the bot is initially created. After that, the bot will generate an alert as it joins each newly-created public channel. Though it can be noisy for Slack workspaces with many public channels, we recommend you enable this option.
Private channel notifications, private SOE Teams
Several Slack integration options address the use of private Slack channels and private SOE Teams. Understanding these options will help ensure a successful Slack integration.
Automatically map users on Slack and Stack Overflow Enterprise
The Slack integration maps (connects) Slack and SOE user accounts based on their email address. This option allows the integration to automatically search for email addresses to connect accounts. This automatic mapping can cause a security risk with private Teams, so it's disallowed by SOE in certain configurations (see below).
Allow the bot to access basic info for private Slack channels it is a member of
Enable this option if using private channel notifications (it's off by default).
This option allows the bot to view basic info about private Slack channels in order to support private notifications. The bot can access only the private channels you've added it to, and only those channels' names. With this option disabled, users will not see channel names when adding channels for private notifications. Instead, users will see the channel ID (for example: "Private channel (G017HAH2RAT)").
Allow users to create notifications against private Teams from within Slack
This option gives Slack permission to access private teams in SOE, so it only applies if you're using private Teams. This option is off by default.
With this option enabled for an SOE integration with Private Teams, the /stack notify
command allows users to choose to receive notifications from the main SOE site or any private team they're a part of. This requires users to map (connect) their Slack account to their SOE account by email address. Slack will prompt users to perform this mapping when required.
NOTE: Because of security concerns with mis-mapped email addresses and private Teams, you can't enable the Allow users to create notifications against private Teams from within Slack and Automatically map users on Slack and Stack Overflow Enterprise options at the same time.
Below are the required configuration settings if you're using private Slack channels, SOE Private Teams, or both.
Option | Slack private channels only | SOE private Teams only | Private channels and private Teams |
Private channel notifications | Enable | Disable | Enable |
Allow bot to access private Slack channel info | Enable | Disable | Enable |
Automatically map users | Enable | Disable | Disable |
Notifications against private Teams | Disable | Enable | Enable |
Import the manifest into Slack
With all integration options set, follow the directions on the SOE Slack integration page to generate a manifest and import it into Slack. This completes the bot integration setup process.