Setting up the connection to Slack

How to connect your SonarQube Server instance to your Slack workspace.

With the SonarQube Server integration with Slack, users can receive real-time notifications on analysis results directly in Slack. For more information, see About SonarQube Server integration with Slack.

To set up this feature, a SonarQube Server administrator must first connect your SonarQube Server instance to your Slack workspace. Once this initial setup is complete, users can subscribe to SonarQube Server notifications directly within their Slack account: see Subscribing to Slack notifications.

You can connect your Slack workspace to multiple SonarQube Server instances and you can connect your instance to multiple workspaces.

Connecting your SonarQube instance to your Slack workspace

You must be an administrator of your SonarQube Server instance and of your Slack workspace.

Step 1: Create the SonarQube Server app for Slack for your SonarQube instance

1

Create the app

  1. In your SonarQube Server instance, go to Administration > Configuration > General Settings > Integrations.

Select the Start setup button to start tzhe Slack integration setup.
  1. In the Slack section, select Start setup. You are redirected to Slack.

Select in the dialog box the Slack workspace in which the app will be created.
  1. Select your Slack workspace and select Next. The app’s Basic Information page opens.

2

Set up the app

  1. In the left navigation bar of the app, select Features > Event Subscriptions.

Select the Retry button to verify the Request URL used for the token-revoked event.
  1. In Enable Events > Request URL, select Retry. The Request URL should now be verified.

If the operation was successful, the Request URL is marked as Verified.
  1. In the bottom right corner of the page, select Save Changes.

3

Copy-paste the app parameters to SonarQube Server

  1. In the left navigation bar of the app, select Settings > Basic Information. You can see the Client ID, Client Secret, and Signing Secret parameters in the App Credentials section.

Copy-paste each of the following parameters to SonarQube Server: Client ID, Client Secret, Signing Secret.
  1. Copy-paste each of these parameters from Slack to your Slack configuration in SonarQube Server.

Paste the following parameters from the Slack app to SonarQube Server: Client ID, Client Secret, Signing Secret.
  1. Select Save configuration. Your SonarQube Server app for Slack is ready to be installed.

Step 2: Install the app on your Slack workspace

Once you have successfully created your SonarQube Server app for Slack, you can install it in your Slack workspace:

  1. In your SonarQube Server instance, go to Administration > Configuration > General Settings > Integrations.

Select the Install SonarQube for Slack button to install the app in your workspace.
  1. Select the Install SonarQube for Slack button. You’re redirected to Slack.

Select the Slack workspace in which you want to install your app.
  1. Select your workspace.

  2. Select Allow. The app is installed in your workspace. Workspace users can now subscribe to Slack notifications on SonarQube events.

Connecting your SonarQube instance to multiple workspaces

You can connect your SonarQube Server instance to multiple Slack workspaces. Once you have created and installed the SonarQube Server App for Slack in your first workspace as explained above in Setting up the connection to Slack, you must change the settings of your SonarQube Server App for Slack to enable multiple workspaces. Once this is done, you can install the app in other workspaces as described in Step 2: Install the app on your Slack workspace above.

To enable multiple workspaces in your app:

  1. Open the SonarQube Server App in the Slack workspace in which you created it.

  2. In the left navigation bar, select Settings > Manage Distribution and navigate to the bottom of the page.

  3. In Share Your App with Other Workspaces > Remove hard Coded Information, select the I’ve reviewed and removed any hard-coded information option.

To connect your SonarQube Server to multiple instances, enable the I've reviewed... option.
  1. Select the Activate Public Distribution button.

Connecting a workspace to multiple SonarQube instances

You can connect the same Slack workspace to several SonarQube Server instances. To do so, you must configure different slash commands for each SonarQube Server app for Slack to differentiate them. The slash command must have the following format:

/sonarqube-server<identifier>

For example, if you want to connect your workspace to two instances, you may configure the slash command as follows:

  • For the first instance: /sonarqube-server (default value)

  • For the second instance: /sonarqube-server-2

To configure the slash command of your SonarQube Server app:

  1. In your Slack workspace, open the SonarQube Server app you want to configure.

  2. In the left navigation bar, select Features > Slash Commands.

To connect the same workspace to several SonarQube instances, you must configure different slash commands for the  apps installed in the workspace.
  1. Select the edit icon and change the slash command.

Modifying your Slack configuration

If you modify the client ID, client secret or signing secret of your SonarQube Server app for Slack, you must update the change in SonarQube Server.

To update your Slack configuration in SonarQube Server:

  1. In your SonarQube Server instance, go to Administration > Configuration > General Settings > Integrations.

Select the Edit button to change the Slack configuration parameters in SonarQube.
  1. In the Slack section, in App configuration details, select the Edit button. The Slack configuration dialog opens.

  2. Update the parameters and select the Update configuration button.

Deleting your Slack configuration

You must delete both the Slack configuration in your SonarQube Server instance and the SonarQube Server app. Deleting the Slack configuration will delete all connections and Slack-related data on SonarQube Server based on this configuration.

Proceed as follows:

  1. In your SonarQube Server instance, go to Administration > Configuration > General Settings > Integrations.

  2. In the Slack section, in App configuration details, select the dustbin icon.

Select the dustbin icon to delete the Slack configuration.
  1. Confirm the deletion.

  2. Open the SonarQube Server app in the Slack workspace in which you created it and delete it.

Relates pages

Subscribing to Slack notifications About SonarQube Server integration with Slack

Last updated

Was this helpful?