Set up Slack integration
Set up Slack integration for your self-hosted Measure instance. Configure the Slack app with OAuth, slash commands and events for crash alerts and the query agent.
Use this guide to setup Slack integration to receive Measure alert notifications on Slack and to ask the Measure query agent questions from Slack.
Configure Slack settings for new installation
-
Slack App. Create a Slack app following the official Slack guide. You may choose any name, logo and description you wish for your app.
-
Basic Information. Go to
Basic Informationsection and copy client id, client secret and signing secret and paste them into the prompts. (If you're upgrading an existing Measure installation you will paste these variables into your environment variables file. See section for existing users below) -
OAuth & Permissions. Go to the
OAuth & Permissionssection of your app and underRedirect URLs, add your Measure Slack authentication callback URL. This should be something likehttps://[measure.yourcompany.com]/auth/callback/slack. Replace[measure.yourcompany.com]with your actual Measure Dashboard domain. -
In the same
OAuth & Permissionssection of your app, underScopes, request the following permissions:- app_mentions:read
- assistant:write
- chat:write
- chat:write.public
- channels:read
- channels:history
- groups:read
- groups:history
- im:history
- im:write
- commands
- files:write
- links:read
- links:write
- reactions:read
- reactions:write
- users:read
- users:read.email
The steps below need the Measure API domain and not the Measure Dashboard domain.
If this URL is incorrect, you'll get a dispatch_failure error when connecting your Measure Team to your Slack Workspace.
Assuming your API domain is something like measure-api.yourcompany.com, you should put in https://[measure-api.yourcompany.com]/slack/events in the below steps.
Replace [measure-api.yourcompany.com] with your actual Measure API domain.
-
Event Subscriptions. Go to the
Event Subscriptionssection, enable events and set the Request URL tohttps://[measure-api.yourcompany.com]/slack/events. Slack verifies the URL immediately, so your Measure API service must be reachable when you save it. Then, underSubscribe to bot events, add:- app_mention — questions asked by @mentioning the bot in channels
- app_home_opened — lets the bot greet the user with suggested prompts when they open its DM
- message.channels — follow-up messages in a public channel thread, so a conversation can continue without re-mentioning the bot
- message.groups — the same for private channels
- message.im — questions asked in the bot's DMs
-
Agent. Go to the
Agentsection of your app settings and enable it (new Slack apps use Slack's Agent messaging experience by default). This gives the Measure app a direct-message surface where users chat with the agent, in addition to @mentioning it in channels. -
Slash Commands. Go to
Slash Commandssection. Create the commands as follows:
| Command | Request URL | Short Description |
|---|---|---|
| /subscribe-alerts | https://[measure-api.yourcompany.com]/slack/events | Registers current channel to receive alert notifications |
| /stop-alerts | https://[measure-api.yourcompany.com]/slack/events | Stops current channel from receiving alert notifications |
| /list-alert-channels | https://[measure-api.yourcompany.com]/slack/events | Lists channels currently registered to receive alert notifications |
Replace [measure-api.yourcompany.com] with your actual Measure API domain in each Request URL.
Configure Slack settings for existing installation
If you already set up Slack integration on an earlier version of Measure, your Slack app predates the query agent and is missing the scopes, event subscriptions and settings the agent needs. Update your existing Slack app, and if you are upgrading from v0.8.2 or below, your environment variables, as described below.
Slack cannot send event and OAuth callbacks to your local dev environments. In order to run and test Slack integration while developing or testing locally, you will need to use a tunneling service such as ngrok or Cloudflare tunnels and use that URL to proxy to your localhost.
See this guide for more information.
Update your Slack app
-
New scopes. Open your existing Slack app at api.slack.com/apps, go to the
OAuth & Permissionssection and, underScopes, add the following permissions while keeping the ones you already have:- app_mentions:read
- assistant:write
- chat:write.public
- channels:history
- groups:history
- im:history
- im:write
- files:write
- links:read
- links:write
- reactions:read
- reactions:write
- users:read
- users:read.email
Your app should now have the full set of scopes listed in step 4 of the new installation guide above.
-
Event Subscriptions. This section did not exist for alerts-only installs, so you are adding it for the first time. Follow step 5 of the new installation guide to enable events, set the Request URL and subscribe to the bot events.
-
Agent. Follow step 6 of the new installation guide to enable the agent.
-
Reinstall the app. New scopes only take effect after the app is reinstalled. Once you add them, Slack shows a banner prompting you to reinstall. Open the
Install Appsection and reinstall the app to your workspace. Your existing bot token keeps working and gains the new scopes, so you do not need to reconnect Slack from the Measure dashboard.
Update environment variables
If you are upgrading from v0.8.2 or below, you also need to add the Slack credentials to your environment variables manually instead of entering them at a terminal prompt. If you are upgrading from v0.10.0, you need to rename SLACK_OAUTH_STATE_SALT environment variable to SLACK_OAUTH_STATE_SECRET.
-
Slack Client Credentials. Open the
self-host/.envfile & add the following environment variables as obtained from your Slack app page.SLACK_CLIENT_ID=your-slack-client-id # change this SLACK_CLIENT_SECRET=your-slack-client-secret # change this SLACK_SIGNING_SECRET=your-slack-signing-secret # change this -
State Secret. Generate a random 44 character secret. Use the command
openssl rand -hex 22to generate a random secret.SLACK_OAUTH_STATE_SECRET=your-slack-oauth-state-secret # change this -
Shutdown. Run the following command to shutdown all services.
sudo docker compose -f compose.yml -f compose.prod.yml --profile migrate down -
Startup. Finally, run the
install.shscript for the configuration to take effect.sudo ./install.sh
Think this page can be better?
Open an issueSet up an SMTP email provider
Configure an SMTP email provider for your self-hosted Measure instance to send invites, alerts and daily summary emails.
Set up Measure Agent
Configure Measure Agent on your self-hosted instance. Get an OpenRouter API key, choose the models and expose the agent service so you can debug your app from your coding agent or Slack.