|Read this if:||You want to share and distribute your app.|
|Read first:||An overview of app interactivity|
|Read next:||Enabling interactivity with Slash Commands|
Apps can create custom Actions that allow users to invoke your app in simple, visual ways.
App Actions appear within standard spaces in Slack, such as the message menu, in any workspace where the app is installed.
Want to learn more? The only action (pun definitely intended) to take is to read on (and on):
Allow your users to quickly invoke specific workflows provided by your Slack app by implementing App Actions.
App Actions can be added to the More actions menu of every non-ephemeral message in Slack workspaces your app is installed in.
When someone uses an App Action in a message's More actions menu, your app will receive context about what happened and where it happened. Use the content of messages to create tasks, send comments to external services, trigger modals, and trigger many more potential workflows.
The potential use cases for App Actions are unbounded.
Here's an example for a hypothetical app called Yogi, with an action that would share a message from a channel to Yogi and create a task on that service:
You can see how this App Action appears in the More actions menu of a message, how the app triggered a modal for more input, and followed up with a confirmation message.
If you're intrigued, and want to learn more, keep reading...
If you don't have a Slack app yet, what are you waiting for? Follow our quick guide to create one.
In order to start using App Actions with your app, there are a few steps you'll need to quickly go through first.
Ensure your app is ready for user interactions by following the preparation steps in our guide to handling user interactions.
To make the actions available in the UI, you need to enable the
commands permission scope.
From the app dashboard, click the menu item OAuth & Permissions.
Under Scopes, type
commands into the text field, select the correct permission to add it, then click Save Changes.
If your app isn't already requesting
commands at installation, it may need to be reinstalled before actions may be used, and if your app is published in the App Directory, the changes will be reflected only after the app is reviewed and approved.
Now that your app is ready, it's time to create some potential interaction energy:
Click that tempting green Create button, and you'll be sent back to the Interactive Components page.
On that page you'll either need to click the Save Changes button, or if you're just setting up interactive components for the first time, you'll need to click the Enable Interactive Components button (yes, you've already clicked one of those before, but you'll need to do it again at this point).
That's it! You've created your first App Action (and you can create 4 more - each app can have up to 5 App Actions for messages) and are ready to receive interaction payloads and do something in response.
You've created an app action, and at some point it will be used by someone in Slack. Your app has to handle that eventuality, so here's what will happen:
The first step is handled by Slack, so let's run through the other two.
When an action is invoked, a request will be sent to the app's configured Request URL. The request body will contain a
payload parameter that your app should parse for JSON.
After you've parsed it, you'll see an interaction payload — consult our reference guide to see the exact structure of the fields included.
You'll notice that the payload contains plenty of information that can be used to ascertain the context of the interaction.
Now you've parsed the payload basketball that Slack passed to you, it's time to start figuring out your next move so you finish with a slam dunk.
As soon as your app receives the request sent by an action a countdown begins, because this message will self-destruct in 3 seconds.
In other words, if your app doesn't respond with an HTTP status
200 OK within 3000ms of receiving the request, the user who clicked to initiate the action will receive the following error message:
This is what we call an acknowledgment response — read more about these in our guide to handling user interactions.
But that's not the only way your app can respond.
Read our guide to responding to interactions to understand the vast range of possibilities open to your app at this point.