Work with a Slack User Client

Use these Apex classes to work with a Slack user client.

Provides access to the Slack Web API with a user token to perform tasks as the associated user, such as sending messages to a channel.

Before putting the Slack User Client to use, it’s important to note that the Slack Bot Client is the preferred alternative to confirm your app will work as expected. Don't assume that a user token exists for each user that interacts with your app, even if your app configuration defines user scopes. If you decide to use a bot client, you can expect a bot token to be available in the workspace where your app is installed.

Why Does This Happen?

There are multiple reasons why your workspace doesn't contain a user token for certain users. One of the reasons is that users are associated between Slack and Salesforce through a process that doesn’t involve authorizing a Slack app.

Regardless of whether the app configuration includes the correct scopes, app developers can’t trust that a user mapping includes a token. For that reason, if you choose to use the User Client, verify that the user token exists. If it doesn't, write exceptions to trigger the OAuth flow between the Slack Application and the Salesforce Org.

Usage

Before you can work with a bot client, register the action and get access to a Slack context. To get access to a Slack client, use the Slack.App class.

Many Slack API methods require a token. UserClient automatically includes an appropriate token in your requests. For example, ChatPostMessageRequest calls Slack's chat.postMessage method, which requires a token along with a few other arguments. This token is automatically included when you use UserClient to make a request.

The following are methods for UserClient.

Signature

Parameters

req

Type: Slack.ApiTestRequest

Return Value

Type: Slack.ApiTestResponse

Signature

Parameters

req

Type: Slack.AppsEventAuthorizationsListRequest

Return Value

Type: Slack.AppsEventAuthorizationsListResponse

Signature

Parameters

req

Type: Slack.AppsUninstallRequest

Return Value

Type: Slack.AppsUninstallResponse

Signature

Parameters

req

Type: Slack.AuthRevokeRequest

Return Value

Type: Slack.AuthRevokeResponse

Signature

Parameters

req

Type: Slack.AuthTeamsListRequest

Return Value

Type: Slack.AuthTeamsListResponse

Signature

Parameters

req

Type: Slack.AuthTestRequest

Return Value

Type: Slack.AuthTestResponse

Signature

Parameters

req

Type: Slack.BotsInfoRequest

Return Value

Type: Slack.BotsInfoResponse

Signature

Parameters

req

Type: Slack.CallsAddRequest

Return Value

Type: Slack.CallsAddResponse

Signature

Parameters

req

Type: Slack.CallsEndRequest

Return Value

Type: Slack.CallsEndResponse

Signature

Parameters

req

Type: Slack.CallsInfoRequest

Return Value

Type: Slack.CallsInfoResponse

Signature

Parameters

req

Type: Slack.CallsParticipantsAddRequest

Return Value

Type: Slack.CallsParticipantsAddResponse

Signature

Parameters

req

Type: Slack.CallsParticipantsRemoveRequest

Return Value

Type: Slack.CallsParticipantsRemoveResponse

Signature

Parameters

req

Type: Slack.CallsUpdateRequest

Return Value

Type: Slack.CallsUpdateResponse

Signature

Parameters

req

Type: Slack.ChatDeleteRequest

Return Value

Type: Slack.ChatDeleteResponse

Signature

Parameters

req

Type: Slack.ChatDeleteScheduledMessageRequest

Return Value

Type: Slack.ChatDeleteScheduledMessageResponse

Signature

Parameters

req

Type: Slack.ChatGetPermalinkRequest

Return Value

Type: Slack.ChatGetPermalinkResponse

Signature

Parameters

req

Type: Slack.ChatMeMessageRequest

Return Value

Type: Slack.ChatMeMessageResponse

Signature

Parameters

req

Type: Slack.ChatPostEphemeralRequest

Return Value

Type: Slack.ChatPostEphemeralResponse

Signature

Parameters

req

Type: Slack.ChatPostMessageRequest

Return Value

Type: Slack.ChatPostMessageResponse

Signature

Parameters

req

Type: Slack.ChatScheduleMessageRequest

Return Value

Type: Slack.ChatScheduleMessageResponse

Signature

Parameters

req

Type: Slack.ChatScheduledMessagesListRequest

Return Value

Type: Slack.ChatScheduledMessagesListResponse

Signature

Parameters

req

Type: Slack.ChatUpdateRequest

Return Value

Type: Slack.ChatUpdateResponse

Signature

Parameters

req

Type: Slack.ConversationsArchiveRequest

Return Value

Type: Slack.ConversationsArchiveResponse

Signature

Parameters

req

Type: Slack.ConversationsCloseRequest

Return Value

Type: Slack.ConversationsCloseResponse

Signature

Parameters

req

Type: Slack.ConversationsCreateRequest

Return Value

Type: Slack.ConversationsCreateResponse

Signature

Parameters

req

Type: Slack.ConversationsHistoryRequest

Return Value

Type: Slack.ConversationsHistoryResponse

Signature

Parameters

req

Type: Slack.ConversationsInfoRequest

Return Value

Type: Slack.ConversationsInfoResponse

Signature

Parameters

req

Type: Slack.ConversationsInviteRequest

Return Value

Type: Slack.ConversationsInviteResponse

Signature

Parameters

req

Type: Slack.ConversationsJoinRequest

Return Value

Type: Slack.ConversationsJoinResponse

Signature

Parameters

req

Type: Slack.ConversationsKickRequest

Return Value

Type: Slack.ConversationsKickResponse

Signature

public Slack.ConversationsLeaveResponse conversationsLeave(Slack.ConversationsLeaveRequest req)

Parameters

req

Type: Slack.ConversationsLeaveRequest

Return Value

Type: Slack.ConversationsLeaveResponse

Signature

Parameters

req

Type: Slack.ConversationsListRequest

Return Value

Type: Slack.ConversationsListResponse

Signature

Parameters

req

Type: Slack.ConversationsMarkRequest

Return Value

Type: Slack.ConversationsMarkResponse

Signature

Parameters

req

Type: Slack.ConversationsMembersRequest

Return Value

Type: Slack.ConversationsMembersResponse

Signature

Parameters

req

Type: Slack.ConversationsOpenRequest

Return Value

Type: Slack.ConversationsOpenResponse

Signature

Parameters

req

Type: Slack.ConversationsRenameRequest

Return Value

Type: Slack.ConversationsRenameResponse

Signature

Parameters

req

Type: Slack.ConversationsRepliesRequest

Return Value

Type: Slack.ConversationsRepliesResponse

Signature

Parameters

req

Type: Slack.ConversationsSetPurposeRequest

Return Value

Type: Slack.ConversationsSetPurposeResponse

Signature

Parameters

req

Type: Slack.ConversationsSetTopicRequest

Return Value

Type: Slack.ConversationsSetTopicResponse

Signature

Parameters

req

Type: Slack.ConversationsUnarchiveRequest

Return Value

Type: Slack.ConversationsUnarchiveResponse

Signature

Parameters

req

Type: Slack.DndEndDndRequest

Return Value

Type: Slack.DndEndDndResponse

Signature

Parameters

req

Type: Slack.DndEndSnoozeRequest

Return Value

Type: Slack.DndEndSnoozeResponse

Signature

Parameters

req

Type: Slack.DndInfoRequest

Return Value

Type: Slack.DndInfoResponse

Signature

Parameters

req

Type: Slack.DndSetSnoozeRequest

Return Value

Type: Slack.DndSetSnoozeResponse

Signature

Parameters

req

Type: Slack.DndTeamInfoRequest

Return Value

Type: Slack.DndTeamInfoResponse

Signature

Parameters

req

Type: Slack.EmojiListRequest

Return Value

Type: Slack.EmojiListResponse

Signature

Parameters

req

Type: Slack.FilesDeleteRequest

Return Value

Type: Slack.FilesDeleteResponse

Signature

Parameters

req

Type: Slack.FilesInfoRequest

Return Value

Type: Slack.FilesInfoResponse

Signature

Parameters

req

Type: Slack.FilesListRequest

Return Value

Type: Slack.FilesListResponse

Signature

Parameters

req

Type: Slack.FilesRemoteInfoRequest

Return Value

Type: Slack.FilesRemoteInfoResponse

Signature

Parameters

req

Type: Slack.FilesRemoteListRequest

Return Value

Type: Slack.FilesRemoteListResponse

Signature

Parameters

req

Type: Slack.FilesRemoteShareRequest

Return Value

Type: Slack.FilesRemoteShareResponse

Signature

Parameters

req

Type: Slack.FilesRevokePublicURLRequest

Return Value

Type: Slack.FilesRevokePublicURLResponse

Signature

Parameters

req

Type: Slack.FilesSharedPublicURLRequest

Return Value

Type: Slack.FilesSharedPublicURLResponse

Signature

Parameters

req

Type: Slack.FilesUploadRequest

Return Value

Type: Slack.FilesUploadResponse

Signature

Return Value

Type: List<String>

Signature

Parameters

req

Type: Slack.MigrationExchangeRequest

Return Value

Type: Slack.MigrationExchangeResponse

Signature

Parameters

req

Type: Slack.PinsAddRequest

Signature

Parameters

req

Type: Slack.PinsListRequest

Return Value

Type: Slack.PinsListResponse

Signature

Parameters

req

Type: Slack.PinsRemoveRequest

Return Value

Type: Slack.PinsRemoveResponse

Signature

Parameters

req

Type: Slack.ReactionsAddRequest

Return Value

Type: Slack.ReactionsAddResponse

Signature

Parameters

req

Type: Slack.ReactionsGetRequest

Return Value

Type: Slack.ReactionsGetResponse

Signature

Parameters

req

Type: Slack.ReactionsListRequest

Return Value

Type: Slack.ReactionsListResponse

Signature

Parameters

req

Type: Slack.ReactionsRemoveRequest

Return Value

Type: Slack.ReactionsRemoveResponse

Signature

Parameters

req

Type: Slack.RemindersAddRequest

Return Value

Type: Slack.RemindersAddResponse

Signature

Parameters

req

Type: Slack.RemindersCompleteRequest

Return Value

Type: Slack.RemindersCompleteResponse

Signature

Parameters

req

Type: Slack.RemindersDeleteRequest

Return Value

Type: Slack.RemindersDeleteResponse

Signature

Parameters

req

Type: Slack.RemindersInfoRequest

Return Value

Type: Slack.RemindersInfoResponse

Signature

Parameters

req

Type: Slack.RemindersListRequest

Return Value

Type: Slack.RemindersListResponse

Signature

Parameters

req

Type: Slack.SearchAllRequest

Return Value

Type: Slack.SearchAllResponse

Signature

Parameters

req

Type: Slack.SearchFilesRequest

Return Value

Type: Slack.SearchFilesResponse

Signature

Parameters

req

Type: Slack.SearchMessagesRequest

Return Value

Type: Slack.SearchMessagesResponse

Signature

Parameters

req

Type: Slack.StarsAddRequest

Return Value

Type: Slack.StarsAddResponse

Signature

Parameters

req

Type: Slack.StarsListRequest

Return Value

Type: Slack.StarsListResponse

Signature

Parameters

req

Type: Slack.StarsRemoveRequest

Return Value

Type: Slack.StarsRemoveResponse

Signature

Parameters

req

Type: Slack.TeamAccessLogsRequest

Return Value

Type: Slack.TeamAccessLogsResponse

Signature

Parameters

req

Type: Slack.TeamBillableInfoRequest

Return Value

Type: Slack.TeamBillableInfoResponse

Signature

Parameters

req

Type: Slack.TeamInfoRequest

Return Value

Type: Slack.TeamInfoResponse

Signature

Parameters

req

Type: Slack.TeamIntegrationLogsRequest

Return Value

Type: Slack.TeamIntegrationLogsResponse

Signature

Parameters

req

Type: Slack.TeamProfileGetRequest

Return Value

Type: Slack.TeamProfileGetResponse

Signature

Parameters

req

Type: Slack.UsergroupsCreateRequest

Return Value

Type: Slack.UsergroupsCreateResponse

Signature

Parameters

req

Type: Slack.UsergroupsDisableRequest

Return Value

Type: Slack.UsergroupsDisableResponse

Signature

Parameters

req

Type: Slack.UsergroupsEnableRequest

Return Value

Type: Slack.UsergroupsEnableResponse

Signature

Return Value

Type: Slack.UsergroupsListResponse

Signature

Parameters

req

Type: Slack.UsergroupsUpdateRequest

Return Value

Type: Slack.UsergroupsUpdateResponse

Signature

Parameters

req

Type: Slack.UsergroupsUsersListRequest

Return Value

Type: Slack.UsergroupsUsersListResponse

Signature

Parameters

req

Type: Slack.UsergroupsUsersUpdateRequest

Return Value

Type: Slack.UsergroupsUsersUpdateResponse

Signature

Parameters

req

Type: Slack.UsersConversationsRequest

Return Value

Type: Slack.UsersConversationsResponse

Signature

Parameters

req

Type: Slack.UsersDeletePhotoRequest

Return Value

Type: Slack.UsersDeletePhotoResponse

Signature

Parameters

req

Type: Slack.UsersGetPresenceRequest

Return Value

Type: Slack.UsersGetPresenceResponse

Signature

Parameters

req

Type: Slack.UsersIdentityRequest

Return Value

Type: Slack.UsersIdentityResponse

Signature

Parameters

req

Type: Slack.UsersInfoRequest

Return Value

Type: Slack.UsersInfoResponse

Signature

Parameters

req

Type: Slack.UsersListRequest

Return Value

Type: Slack.UsersListResponse

Signature

Parameters

req

Type: Slack.UsersLookupByEmailRequest

Return Value

Type: Slack.UsersLookupByEmailResponse

Signature

Parameters

req

Type: Slack.UsersProfileGetRequest

Return Value

Type: Slack.UsersProfileGetResponse

Signature

Parameters

req

Type: Slack.UsersProfileSetRequest

Return Value

Type: Slack.UsersProfileSetResponse

Signature

Parameters

req

Type: Slack.UsersSetActiveRequest

Return Value

Type: Slack.UsersSetActiveResponse

Signature

Parameters

req

Type: Slack.UsersSetPresenceRequest

Return Value

Type: Slack.UsersSetPresenceResponse

Signature

Parameters

req

Type: Slack.ViewsOpenRequest

Return Value

Type: Slack.ViewsOpenResponse

Signature

Parameters

req

Type: Slack.ViewsPushRequest

Return Value

Type: Slack.ViewsPushResponse

Signature

Parameters

req

Type: Slack.ViewsUpdateRequest

Return Value

Type: Slack.ViewsUpdateResponse