Org Connections

A Slack app in a workspace is allowed to connect to one org for all Slack users in that workspace. When working with a Slack app, you might encounter a scenario where you have to disconnect and reconnect to a different org.

  • Your org or scratch org expires or is no longer valid.
  • You removed the app, which uninstalls and disconnects the app from the org.

If the org you’re connecting to already expired or is no longer valid, you’re prompted to log into a new org when interacting with the Slack app.

You get prompted to connect to your org when you run your Slack app the first time. For example, the first time you enter a slash command in a channel, Slack prompts you to connect.

Prompt to connect to an org

Follow the on-screen instructions to connect your Slack workspace to your Salesforce org.

After connecting to your Salesforce org, you get another prompt to grant your Slack app permission to access the workspace. If your app includes the chat:write scope, you must also select a channel to post to.

Finally, you get a prompt to allow Slack to access your Salesforce account. Following this step, you can run your app in the channel you selected.

If you have to connect an org you previously connected to, you must use the same Salesforce user that was used when you initially connected.

Disconnecting an org includes disassociating the app and workspace from the org, enabling you to target new orgs with a new user. You must uninstall and reinstall the app to connect a Slack app to another Salesforce org.

To disconnect your Slack app from an org, make sure you configure your Slack app to subscribe to the corresponding bot events and then invoke the app uninstall.

Shared user mappings enable a Slack user to authenticate to a Salesforce org one time for all Apex SDK for Slack apps. These apps must be installed in the same Salesforce org within the same Slack workspace. When a user authenticates successfully to one of these apps, a shared user mapping record is created.

View or Delete User Mappings

The Slack User Mappings page in your Personal Settings displays which Slack users are mapped to your Salesforce account. This page is available only in Lightning Experience.

On the Slack User Mappings page, you can delete a user mapping if you no longer wish to use a Apex SDK for Slack app. To remove the shared user mapping record in your org:

  1. From your personal settings, in the Quick Find box, enter Slack, and then select Slack User Mappings.
  2. Click the dropdown next to the user mapping you want to delete. Select Delete.

Revoke a User Mapping

Removing the shared user mapping record does not remove your org association from the app. You will be prompted to reconnect your app to the same org next time, which then establishes a new user mapping record.

To fully revoke user mapping to an org or app, an admin must deactivate the user in the Salesforce org or Slack app. By doing so, you can then associate the Slack user with another user of that org.

Alternatively, if you need to associate a Slack workspace to a different org, we recommend that you uninstall the app from the Slack workspace before attempting to connect the workspace to the org.

You get an error if there's an issue connecting to an org. Here are several scenarios that result in an error.

  • Connecting a Slack app that's installed by multiple users in a workspace to different or multiple orgs. Slack apps in workspaces are currently limited to connect to one Salesforce org.
  • Connecting a Slack app and user to a Salesforce org with a different Salesforce username. Once a Slack user mapping record is created, Apex SDK for Slack uses it for org authentication. However, if you install the Slack app in a different workspace, then you can use a different Salesforce username.
  • A user doesn't have permission to access a Slack app
  • An org doesn't have permission to access a Slack app

Slack displays Dispatch failed if it doesn't get a response from the SDK within a certain time limit, receives a 404, or encounters an unexpected error.