Reuse app configuration in other workspaces
In order to connect multiple Slack workspaces to Bitbucket, use the following steps.
1. All URLs require HTTPS
To reuse the Slack app in multiple workspaces, all of the configured URLs are required to use HTTPS. Ensure that your Bitbucket can be reached with HTTPS.
2. Enable Distribution
Go to Slack Apps configuration (https://api.slack.com/apps) and select your Pull Request Analytics app. Then go to Manage Distribution, scroll down and confirm “I’ve reviewed and removed any hard-coded information”.
Then click Activate Public Distribution. This will not list your app in Slack's App Directory place. It allows other workspaces to use your App. To install the App, the link to the App and Admin permissions on your Bitbucket are still required.
In case you forgot to update all URLs to HTTPS, Slack will tell you which ones still need to be updated.
3. Use Link to Install to Workspaces
Use the provided Add to Slack button or links to add the App to other workspaces.
On the permission screen, select the Workspace in the upper right corner and confirm by clicking Allow. You should be redirected to the Bitbucket Slack configuration page, with the Slack workspace connected.
Repeat using the Add to Slack or links to add the app to more workspaces.
Possible Problems
Error: Client must be authenticated to access this resource
After clicking Allow on the App installation screen, you get a ‘Client must be authenticated to access this resource’ error. You are not logged into Bitbucket as an Administrator. Log in as Administrator in Bitbucket first, with the same Bitbucket URL as configured in Slack:
Error: Something went wrong when authorizing
After clicking Authenticate yourself on the PR Analytics Slack Configuration screen, or clicking Update Access on the PR Analytics account management screen, you get a ‘redirect_uri did not match any configured URIs’ error.
Confirm that the passed URI is HTTPS. If it is instead showing HTTP, your Bitbucket server will need to be configured to use HTTPS for redirects.
If the redirect URI is using HTTPS, the problem is likely in the Slack App configuration. Check Slack App → Features → OAuth & Permissions → Redirect URLs, comparing the saved URLs with the redirect URI from the error message. An exact match is not required, but one of the URLs in the Slack App config must be fully included within the Redirect URI. Edit the incorrect URL or Add New Redirect URL to match your redirect URI. When finished, Save URLs.