Work with Views
The following are Apex classes for the Slack views
API methods.
Contains information about a view.
ViewContext
has the following methods.
The ID of the view.
Signature
Return Value
Type: String
A unique value that's optionally accepted in views.update
and views.publish
API calls. When provided to those APIs, the hash is validated such that only the most recent view can be updated. This should be used to ensure the correct view is being updated when updates are happening asynchronously.
Signature
Return Value
Type: String
Represents a view definition. This class provides access to ViewDefinition
records where the targetType
is slack
.
Usage
The following are methods for ViewReference
.
Sets the name and value of the view definition.
Signature
Parameters
name Type: String
The name of the view definition.
value
Type: Object
Return Value
Type: void
Sends a request to open a view for a user.
Usage
See Slack’s view.open method.
The following are methods for ViewsOpenRequest
.
Builds a request object that's used when executing the API call.
Signature
Return Value
Type: Slack.ViewsOpenRequest.Builder
Contains methods to build an instance of the Slack.ViewsOpenRequest
class.
A Builder object is obtained by invoking one of the ViewsOpenRequest.builder
methods defined by the ViewsOpenRequest
class.
The following are methods for ViewsOpenRequest.Builder
.
Required. Returns an instance of Slack.ViewsOpenRequest
.
Signature
Return Value
Type: Slack.ViewsOpenRequest
Required. Exchanges a trigger to post to the user.
Signature
Parameters
triggerId
Type: String
Return Value
Type: Slack.ViewsOpenRequest.Builder
Required. A view payload in the form of a JSON-encoded string.
Signature
Parameters
view
Type: Slack.ModalView
Return Value
Type: Slack.ViewsOpenRequest.Builder
Opens a view for a user.
Usage
See Slack’s view.open method.
This class contains standard response methods.
The following are methods for ViewsOpenResponse
.
Signature
Return Value
Type: Slack.View
Signature
Return Value
Type: Slack.ErrorResponseMetadata
Signature
Parameters
responseMetadata
Type: Slack.ErrorResponseMetadata
Return Value
Type: void
Sends a request to publish a static view for a user.
Usage
See Slack’s view.publish method.
The following are methods for ViewsPublishRequest
.
Builds a request object that's used when executing the API call.
Signature
Contains methods to build an instance of the Slack.ViewsPublishedRequest
class.
A Builder object is obtained by invoking one of the ViewsPublishRequest.Builder
methods defined by the ViewsPublishRequest
class.
The following are methods for ViewsPublishRequest.Builder
. These methods are optional unless specified otherwise.
Required. Returns an instance of the Slack.ViewsPublishRequest
object.
Signature
Return Value
Type: Slack.ViewsPublishRequest
A string that represents view state to protect against possible race conditions.
Signature
Parameters
hash
Type: String
Return Value
Type: Slack.ViewsPublishRequest.Builder
Required. The ID of the user you want to publish a view to.
Signature
Parameters
userId
Type: String
Return Value
Type: Slack.ViewsPublishRequest.Builder
Required. A JSON-encoded string that contains the view payload.
Signature
Parameters
view
Type: Type: Slack.HomeView
Return Value
Type: Slack.ViewsPublishRequest.Builder
Build views for the App Home page.
Usage
HomeView
enables you to build a view for your App Home page, and publish the view when an action is dispatched.
You can also publish the view in response to a slash command. See ChatPostMessageRequest.
The following are methods for HomeView
.
Builds an object which is used when executing the API call.
Signature
Return Value
Type: Slack.HomeView.Builder
Contains methods to build an instance of the Slack.HomeView
class.
A Builder object is obtained by invoking one of the HomeView.builder
methods defined by the ViewsOpenRequest
class.
The following are methods for HomeView.Builder
.
Signature
Return Value
Type: Slack.HomeView
Signature
Parameters
externalId
Type: String
Return Value
Type: Slack.HomeView.Builder
Signature
Parameters
viewReference
Type: Slack.ViewReference
Return Value
Type: Slack.HomeView.Builder
Publish a static view for a user.
Usage
See Slack’s view.publish method.
This class contains standard response methods.
The following are methods for ViewsPublishResponse
.
Signature
Return Value
Type: Slack.ErrorResponseMetadata
Signature
Parameters
responseMetadata
Type: Slack.ErrorResponseMetadata
Return Value
Type: void
Sends a request to push a view onto the stack of a root view.
Usage
See Slack’s views.push method.
The following are methods for ViewsPushRequest
.
Builds a request object that's used when executing the API call.
Signature
Return Value
Type: Slack.ViewsPushRequest.Builder
Contains methods to build an instance of the Slack.ViewsPushRequest
class.
A Builder object is obtained by invoking one of the ViewsPushRequest.Builder
methods defined by the ViewsPushRequest
class.
The following are methods for ViewsPushRequest.Builder
.
Required. Returns an instance of Slack.ViewsPushRequest
.
Signature
public Slack.ViewsPushRequest build()
Return Value
Type: Slack.ViewsPushRequest
Required. Exchanges a trigger to post to the user.
Signature
Parameters
triggerId
Type: String
Return Value
Type: Slack.ViewsPushRequest.Builder
Required. A view payload in the form of a JSON-encoded string.
Signature
Parameters
view
Type: Slack.ModalView
Return Value
Type: Slack.ViewsPushRequest.Builder
Pushes a view onto the stack of a root view.
Usage
See Slack’s views.push method.
This class contains standard response methods.
The following are methods for ViewsPushResponse
.
Signature
Return Value
Type: Slack.ErrorResponseMetadata
Signature
Parameters
responseMetadata
Type: Slack.ErrorResponseMetadata
Return Value
Type: void
Sends a request to update an existing view.
Usage
See Slack’s views.update method.
The following are methods for ViewsUpdateRequest
.
Builds a request object that's used when executing the API call.
Signature
Return Value
Type: Slack.ViewsUpdateRequest.Builder
Contains methods to build an instance of the Slack.ViewsUpdateRequest
class.
A Builder object is obtained by invoking one of the ViewsUpdateRequest.Builder
methods defined by the ViewsUpdateRequest
class.
The following are methods for ViewsUpdateRequest.Builder
. These methods are optional unless specified otherwise.
Required. Returns an instance of Slack.ViewsUpdateRequest
.
Signature
Return Value
Type: Slack.ViewsUpdateRequest
Required if view(view)
is not provided. A unique identifier of the view set by the developer. Must be unique for all views on a team. Max length of 255 characters.
Signature
Parameters
externalId
Type: String
Return Value
Type: Slack.ViewsUpdateRequest.Builder
A string that represents view state to protect against possible race conditions.
Signature
Parameters
hash
Type: String
Return Value
Type: Slack.ViewsUpdateRequest.Builder
Required if externalId(externalId)
is not provided. A view object in the format of a JSON-encoded string.
Signature
Parameters
view
Type: Slack.ModalView
Return Value
Type: Slack.ViewsUpdateRequest.Builder
A unique identifier of the view to be updated. Required if the external ID is not provided.
Signature
Parameters
viewId
Type: String
Return Value
Type: Slack.ViewsUpdateRequest.Builder
Updates an existing view.
Usage
See Slack’s views.update method.
This class contains standard response methods.
The following are methods for ViewsUpdateResponse
.
Signature
Return Value
Type: Slack.View
Signature
Return Value
Type: Slack.ErrorResponseMetadata
Signature
Parameters
responseMetadata
Type: Slack.ErrorResponseMetadata
Return Value
Type: void