Slack Mass User Provisioning API
The Slack Mass User Provisioning API allows bulk import and the ability to revoke user mappings between a Salesforce and Slack user. This feature is helpful for organizations with larger user lists.
- Accept all Slack terms of service. (Learn more)
- A user who has the Connect Salesforce with Slack and the Manage Slack user mappings permissions enabled and assigned.
- Access to a list of user mappings of Salesforce user id to Slack user id.
To import user mappings you must know the Salesforce and the Slack User IDs. Using the known IDs, create a list of user mappings with the Slack.UserMapping object.
After you have a list of mappings, use the Slack.UserProvisioningProvider to import the users for the workspace.
When the call to importUsers is complete, the API returns a result object that contains a list of successful mappings and a list of unsuccessful mappings.
Each unsuccessful mapping has a failure code and message associated with it. Mappings can fail because of an invalid Salesforce ID, an invalid Slack ID, or a previous mapping.
Important: Use of Slack.UserProvisioningProvider is limited to Salesforce users with the Enable Slack User Pre-mapping API user permission. A user without this permission gets an exception during execution.
This code sample uses the API to create a single user mapping. The Slack user ID and Salesforce user ID of the mapping is already known.
Individual mappings can be revoked by providing the Salesforce user ID and the team or workspace that they’re associated with or the Slack user id. Using the known user id, you create a list of strings of either the Salesforce user id or the Slack user id.
After you have a list of user ids, use the Slack.UserProvisioningProvider to revoke the users based on id type for the workspace.
After the call to revoke users is complete, the API returns a result object containing a list of successful mappings and a list of unsuccessful mappings.
Each unsuccessful revoked mapping has a failure code and message associated with it. Revoked mappings fail because of an invalid Salesforce ID, an invalid Slack ID, or a non-existent user mapping.
Important: Use of Slack.UserProvisioningProvider is limited to Salesforce users with the Enable Slack User Pre-mapping API user permission. A user without this permission gets an exception during execution.