Create an Apex Handler
You can create an Apex class either via the Developer Console in your org or by creating the following files in the
force-app/main/default/classes directory in your SFDX project.
YourClassName.cls: The Apex class
YourClassName.cls-meta.xml: Apex class metadata
For more information, see Create an Apex Class.
Extend the dispatcher based on the type of operation you're handling.
Pass in your Slack parameters and context and return a
Slack.ActionHandlerhas a number of methods to help you structure your handler and enable you to work with modals.
Create a handler that is passed as an argument to
Implement the required methods for the interface using
Use these examples to implement your Apex handlers.
Basic Slash Command
This example creates a handler for a slash command, returns the
ack() method to avoid the 3-second timeout, and runs a callback method.
Slash Command Returning a Modal View
This example handles a slash command and returns a view definition that contains a modal.
Global Shortcut Acknowledging Request
This example handles a global shortcut by acknowledging the request.