Work with Views
The following are Apex classes for the Slack views
API methods.
Contains information about a view.
ViewContext Methods
ViewContext
has the following methods.
getId()
The ID of the view.
Signature
Return Value
Type: String
getHash()
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
ViewReference Methods
The following are methods for ViewReference
.
setParameter(name, value)
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.
ViewsOpenRequest Methods
The following are methods for ViewsOpenRequest
.
builder()
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.
ViewsOpenRequest.Builder Methods
The following are methods for ViewsOpenRequest.Builder
.
build()
Required. Returns an instance of Slack.ViewsOpenRequest
.
Signature
Return Value
Type: Slack.ViewsOpenRequest
triggerId(triggerId)
Required. Exchanges a trigger to post to the user.
Signature
Parameters
triggerId
Type: String
Return Value
Type: Slack.ViewsOpenRequest.Builder
view(view)
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.
ViewsOpenResponse Methods
This class contains standard response methods.
The following are methods for ViewsOpenResponse
.
getRenderedView()
Signature
Return Value
Type: Slack.View
getResponseMetadata()
Signature
Return Value
Type: Slack.ErrorResponseMetadata
setResponseMetadata(responseMetadata)
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.
ViewsPublishRequest Methods
The following are methods for ViewsPublishRequest
.
builder()
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.
ViewsPublishRequest.Builder Methods
The following are methods for ViewsPublishRequest.Builder
. These methods are optional unless specified otherwise.
build()
Required. Returns an instance of the Slack.ViewsPublishRequest
object.
Signature
Return Value
Type: Slack.ViewsPublishRequest
hash(hash)
A string that represents view state to protect against possible race conditions.
Signature
Parameters
hash
Type: String
Return Value
Type: Slack.ViewsPublishRequest.Builder
userId(userId)
Required. The ID of the user you want to publish a view to.
Signature
Parameters
userId
Type: String
Return Value
Type: Slack.ViewsPublishRequest.Builder
view(view)
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.
HomeView Methods
The following are methods for HomeView
.
builder()
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.
HomeView.Builder Methods
The following are methods for HomeView.Builder
.
build()
Signature
Return Value
Type: Slack.HomeView
externalId(externalId)
Signature
Parameters
externalId
Type: String
Return Value
Type: Slack.HomeView.Builder
viewReference(viewReference)
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.
ViewsPublishResponse Methods
This class contains standard response methods.
The following are methods for ViewsPublishResponse
.
getResponseMetadata()
Signature
Return Value
Type: Slack.ErrorResponseMetadata
setResponseMetadata(responseMetadata)
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.
ViewsPushRequest Methods
The following are methods for ViewsPushRequest
.
builder()
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.
ViewsPushRequest.Builder Methods
The following are methods for ViewsPushRequest.Builder
.
build()
Required. Returns an instance of Slack.ViewsPushRequest
.
Signature
public Slack.ViewsPushRequest build()
Return Value
Type: Slack.ViewsPushRequest
triggerId(triggerId)
Required. Exchanges a trigger to post to the user.
Signature
Parameters
triggerId
Type: String
Return Value
Type: Slack.ViewsPushRequest.Builder
view(view)
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.
ViewsPushResponse Methods
This class contains standard response methods.
The following are methods for ViewsPushResponse
.
getResponseMetadata()
Signature
Return Value
Type: Slack.ErrorResponseMetadata
setResponseMetadata(responseMetadata)
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.
ViewsUpdateRequest Methods
The following are methods for ViewsUpdateRequest
.
builder()
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.
ViewsUpdateRequest.Builder Methods
The following are methods for ViewsUpdateRequest.Builder
. These methods are optional unless specified otherwise.
build()
Required. Returns an instance of Slack.ViewsUpdateRequest
.
Signature
Return Value
Type: Slack.ViewsUpdateRequest
externalId(externalId)
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
hash(hash)
A string that represents view state to protect against possible race conditions.
Signature
Parameters
hash
Type: String
Return Value
Type: Slack.ViewsUpdateRequest.Builder
view(view)
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
viewId(viewId)
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.
ViewsUpdateResponse Methods
This class contains standard response methods.
The following are methods for ViewsUpdateResponse
.
getRenderedView()
Signature
Return Value
Type: Slack.View
getResponseMetadata()
Signature
Return Value
Type: Slack.ErrorResponseMetadata
setResponseMetadata(responseMetadata)
Signature
Parameters
responseMetadata
Type: Slack.ErrorResponseMetadata
Return Value
Type: void