Work with UserMappingService

Use the UserMappingService class to query for existing user mappings stored in Salesforce. A Slack user mapping is created when a user links their Salesforce and Slack accounts in these ways.

A user may have more than one mapping if they connect several Slack accounts to a Salesforce account.

Usage

The following are methods for UserMappingService.

For a given Slack user ID, get the associated Salesforce user Id.

Signature

Parameters

slackUserId

Type: String

Return Value

Type: String

Given a list of Slack user IDs, get the associated Salesforce user ids. If at least one successful mapping is possible, then the returned map contains an entry for each supplied Slack user ID.

Signature

Parameters

slackUserIds

Type: List<String>

Return Value

Type: Map<String, String>

Gets the Slack user ID for a given Salesforce ID within a Slack workspace. If you’re calling from an Enterprise organization, ensure that you pass your Slack Enterprise ID for the teamId parameter. See Slack’s team.info method.

Signature

Parameters

salesforceUserId

Type: String

teamId

Type: String

Return Value

Type: String

Given a list of Salesforce user IDs in a Slack workspace for a specific Slack App, get the associated Slack user mappings. If at least one successful mapping is possible, then the returned map contains an entry for each supplied Salesforce user ID. If you’re calling from an Enterprise organization, ensure that you pass your Slack Enterprise ID for the teamId parameter. See Slack’s team.info method.

Signature

Parameters

salesforceUserIds

Type: List<String>

teamId

Type: String

Return Value

Type: Map<String, String>