Work with Requests

The following are Apex classes for working with Slack actions.

Describes the context in which a particular Slack action is invoked.

Usage

RequestContext exposes information about the source of the action in Slack, performs custom logic, and obtains the correct Slack client to respond to Slack based on the request. Each action type receives different information in its RequestContext.

See Shortcuts and Slash Commands.

The following are methods for RequestContext.

Gets the action payload, such as the action name or type.

Signature

Return Value

Type: Slack.ActionPayload

Gets the ID of the Slack app.

Signature

Return Value

Type: String

Gets the channel ID.

Signature

Return Value

Type: String

Gets the enterprise ID. See Look for enterprise IDs.

Signature

Return Value

Type: String

Gets the form field values from the modal view.

Signature

Return Value

Type: Map<String,Object>

Gets the message context.

Signature

Return Value

Type: Slack.MessageContext

Signature

Return Value

Type: String

Signature

Return Value

Type: String

Signature

Return Value

Type: String

Signature

Return Value

Type: Slack.ViewContext


Contains methods to build an instance of the Slack.RequestContext class.

A Builder object is obtained by invoking one of the RequestContext.Builder methods defined by the RequestContext class.

The following are methods for RequestContext.Builder.

Signature

Parameters

actionPayload

Type: Slack.ActionPayload

Return Value

Type: Slack.RequestContext.Builder

Signature

Parameters

appId

Type: String

Return Value

Type: Slack.RequestContext.Builder

Returns an instance of the Slack.RequestContext object.

Signature

Return Value

Type: Slack.RequestContext

Signature

Parameters

channelId

Type: String

Return Value

Type: Slack.RequestContext.Builder

Signature

Parameters

enterpriseId

Type: String

Return Value

Type: Slack.RequestContext.Builder

Signature

Parameters

formData

Type: Map<String,Object>

Return Value

Type: Slack.RequestContext.Builder

Signature

Parameters

messageContext

Type: Slack.MessageContext

Return Value

Type: Slack.RequestContext.Builder

Signature

Parameters

teamId

Type: String

Return Value

Type: Slack.RequestContext.Builder

Signature

Parameters

triggerId

Type: String

Return Value

Type: Slack.RequestContext.Builder

Signature

Parameters

userId

Type: String

Return Value

Type: Slack.RequestContext.Builder

Signature

Parameters

viewContext

Type: Slack.ViewContext

Return Value

Type: Slack.RequestContext.Builder