How to configure Slack in your on-prem Sentry

Note

These instructions are outdated and describe the flow for what Slack apps calls the “classic apps”. Please follow the updated documentation for how to set up the Slack integration with Slacks new apps.

If you already have the classic app set up, you can continue to use it. It is recommended that if you are using the slack.verification-token that you switch to using the slack.signing-secret, but both are valid.

For more information between these two kind of bot apps see the Slack documentation


To use Sentry’s new Slack integration you’ll need to create an app in Slack bot app. Navigate to Your Apps and click Create new App.

image

After naming your app and connecting your workspace, navigate to Basic Information. Here you’ll find your Client ID, Client Secret, and Verification token that lets your app access the Slack API.

Here’s where you’ll connect your on-premise Sentry instance to your newly created Slack app. Copy your Client ID, Client Secret, and Verification Token to your config.yml file in your Sentry server.

slack.client-id: <'client id'>
slack.client-secret: <client secret>
slack.verification-token: <verification token>

After you update the config.yml you need to restart your Sentry server to continue configuring the Slack app.

Now that you’ve created your app and updated your Sentry config, you can navigate to Interactive Components under Features.

Click Enable Interactive Components and you’ll be able to enter your Request URL (this is the location of your on-premise Sentry) and Options Load URL:

Request URL: https://your-sentry-server.com/extensions/slack/action/
Options Load URL: https://your-sentry-server.com/extensions/slack/options-load/

Click Enable Interactive Components and Slack will confirm if the HTTP request to the URL you entered succeeds or fails.

Navigate to OAuth & Permissions to configure the Redirect URLs.

Click Add a new Redirect URL, enter the URL, and click Add. The URL will look like:

https://your-sentry-server.com/extensions/slack/setup/

Click Save URLs.

On the same page under Scopes in the Select Permission Scopes dropdown menu, add:

  • links:read

Click Save Changes.

Note: You have the option to set Restrict API Token Usage on this page if you want to ensure your Slack is the only one talking to your Sentry instance.

Navigate to Event Subscription and toggle “On”. Here you will enter another Request URL in the following format: https://your-sentry-server.com/extensions/slack/event/

You’ll see “Verified” when you’ve entered the correct URL.

Note: When you enter the Request URL, Slack tries to verify it. The request will fail if you didn’t configure the client keys/secret and restarted Sentry to ensure those config changes were picked up. If it fails to validate, first make sure your Sentry instance is running and Slack can talk to it (Slack doesn’t have an ip range)

On the same page under Selected Events, click Add Workspace Event and search for link_shared:

On the same page under App Unfurl Domains, click Add Domain to enter your domain and click Done.

At the bottom of the page, click Save Changes.

Navigate to Bot Users

Click Add a Bot User and give your sentry app bot a name (this is the name that will be displayed when alerts are triggered)

Now you can use Slack with Sentry! See our documentation on configuring the Slack integration for your projects to take advantage of multi-channel Alert routing with the new integration.

3 Likes

Is there a way to specify a slack.client-id etc for different Organisations in Sentry?

@_matthanley no as this is a once-per-install configuration, and is done when creating the app within Slack

@jessla thanks a lot for that description, it was very helpful. However, I saw that the usage of the Verification Token is now deprecated by Slack. Instead they recommend to use the Signing Secret. Is this possible already with the slack plugin?

Greetings!

Hi there,

It looks like Slack is deprecating working with workspace tokens. I was trying to set those up for our on-prem instance, but the steps outlined here don’t seem to work anymore.

I cannot navigate to a place where I find the ‘app that uses workspace tokens’. Did I look at the wrong place ? Is there still a way to list that in slack ?

Thanks !
Benjamin

1 Like

@bsergean I’m also seeing this. This is the error message I get from Slack when I click the “Add Workspace” button in Sentry:

User tokens do not support scope: chat:write

I couldn’t find any options on the app configuration to use a workspace token. I also couldn’t add the “chat:write” permission as it does not exist. The closest matches are “chat:write:bot” and “chat:write:user”.

Hi @backwardspy, Slack deprecated workspace tokens so we don’t have a way for you to use the new integration right now. Here’s a thread you can subscribe to for updates: https://github.com/getsentry/sentry/issues/9004#issuecomment-429179713

In the meantime, you can use the legacy Slack integration and/or webhooks.

Apologies for the inconvenience here.

Thank you for the update, @jessla!
It’s a shame that Slack keeps changing so much in this regard.

I’ve updated the documentation here to reflect the current state of the Slack Sentry Integration. I’m happy to say you can now use the new-style Slack integration on premise once again!

@bsergean do you want to try setting up Slack now that it’s working again?

Thanks for the ping ; I need to update to the latest sentry first (we’re using pip install sentry=9.xxx to update), and I don’t know if new fixes will be rolled out that way. Did the fix made it to a . version of sentry on PyPI the python index ?

We’re thinking about using the hosted version of sentry which would make this a non-problem btw.

We haven’t released a new version quite yet actually. The 9.1.2 release will most likely include this. We don’t have a timeline on that quite yet though.

It definitely would make it a non-issue!

Can I infer from this post that there is likely to be a 9.1.2 release? I really hope that’s the case, because the 9.1.0 release notes say “FUTURE VERSIONS OF SENTRY WILL INTRODUCE BACKWARDS INCOMPATIBLE INFRASTRUCTURE” but I’d really love to have slack without the major infrastructure changes.

We plan on doing a 9.1.2 release. I can’t say when, but we definitely will. What you are referencing is our next major version, so possibly we could have worded that more explicitly, but we plan to maintain a 9.1.x branch for critical issues like this.

This is a really important fix as the legacy slack seems to be missing from the 9.1.1 release so we have zero slack integrations at this time.

2 Likes

We are encountering this bug too. The most important integration is Slack. But for now, we don’t have it at all. Now We have 6 projects concurrently, but without Slack, it’s too hard to know the incoming issues @@

For what it’s worth, the legacy Slack integration is still present in the sentry-plugins package, and I’m still using it just fine in the latest 9.1.1 release.

1 Like

thanks @tierra, I realize that I have to type Slack to search the legacy plugin. It does not show in the Legacy Integrations tab by default.

I hope my comment will save someone’s time :slight_smile:

1 Like