The following are Apex classes to work with response metadata for errors and warnings. Slack returns response metadata as part of the Web API calls, which are helpful for debugging or error handling. Detailed errors and warnings are returned in the messages field in the response metadata.
ResponseMetadata Class
Represents response metadata from a Slack Web API call.
Usage
When receiving a response from Slack’s API call, use getResponseMetadata().getMessages() to retrieve any error messages. This example shows how to retrieve the error messages from Slack.ChatPostMessageResponse.
1Slack.ChatPostMessageRequest req = new Slack.ChatPostMessageRequest.builder()2 .channel((String)this.parameters.get('channelId'))3 .text('Details for record id' + recordId)4 .viewReference(viewReference)5 .build();67Slack.ChatPostMessageResponse response = userClient.ChatPostMessage(req);8if(response.getError() != null){9 System.debug(response.getResponseMetadata().getMessages());10}
The following are methods for ErrorResponseMetadata.
getMessages()
Signature
1public List<String>getMessages()
Return Value
Type: List<String>
setMessages(messages)
Signature
1public void setMessages(List<String> messages)
Parameters
messages
Type: List<String>
Return Value
Type: void
WarningResponseMetadata Class
Represents response metadata for a warning.
WarningResponseMetadata Methods
The following are methods for WarningResponseMetadata.
getWarnings()
Signature
1public List<String>getWarnings()
Return Value
Type: List<String>
setWarnings(warnings)
1public void setWarnings(List<String> warnings)
Parameters
warnings
Type: List<String>
Return Value
Type: void
Beta Feature
This feature is not generally available. It is not part of your purchased Services. This feature is subject to change, may be discontinued with no notice at any time in SFDC’s sole discretion, and SFDC may never make this feature generally available. Make your purchase decisions only on the basis of generally available products and features. This feature is made available on an AS IS basis and use of this feature is at your sole risk.