Shortcuts

Shortcuts let users quickly trigger workflows from various prominent locations within Slack.

Shortcuts can trigger modals and other app interactions. When someone uses one of your shortcuts, your app will receive some context about what happened in an interaction payload. They are gateways to powerful, productive workflows.

Apps can create global shortcuts that are available from anywhere in Slack, and message shortcuts that are shown only in message context menus.

Read on to find out about the two types of shortcuts, and how to create one.


Shortcut types

Global shortcuts

Global shortcuts are available to users via the shortcuts button in the message composer, and when using search in Slack.

These type of shortcuts are intended to trigger workflows that can operate without the context of a channel or message.

For example, users might trigger a global shortcut to create a calendar event or view their upcoming on-call shifts.

Message shortcuts

Message shortcuts are shown to users in the context menus of non-ephemeral messages within Slack.

Message shortcuts will retain the context of the source message from which they were initiated. This makes them ideal when you have a workflow that relies on that context to work.

For example, users might quickly generate tasks from a posted message, or send messages to external services.


Getting started with shortcuts

If you don't have a Slack app yet, follow our quick guide to create one.

In order to start using shortcuts with your app, there are a few preparation steps you'll need to go through.

Preparing for payloads

Ensure your app is ready to receive interaction payloads by providing a Request URL, as described in our guide to handling user interactions.

Adding the right permissions

To make shortcuts available in Slack, your app must have the commands permission scope. You can either request this scope during the OAuth flow or add it to your app OAuth settings:

  1. From your app's dashboard, click the menu item OAuth & Permissions.

  2. 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 will need to be reinstalled before shortcuts can be used. If your app is published in the App Directory, the changes will be reflected only after the app is reviewed and approved.


Creating a shortcut

Now that your app is ready, it's time to create some potential interaction energy:

  1. Open your app's dashboard

  2. Click on Interactivity & Shortcuts in the sidebar

  3. Click the Create New Shortcut button under Shortcuts

  4. Select from the Global and On messages options, depending on which type of shortcut you want and click Next

  5. Fill in the following:

  • Name: a short, catchy call to action. Start the name with a verb, and use sentence case (eg. “Create a ticket”).
  • Short Description: describe what the shortcut does for the benefit of a potential user.
  • Callback ID: a string that will be sent to your Request URL in an interaction payload — we'll talk about this more later on.
  1. Click the green Create button, and you'll be sent back to the Interactivity & Shortcuts page.

  2. On that page you'll need to click the Save Changes button.

That's it—you've created your first shortcut! You can create some more—each app can have up to 5 global shortcuts, and separately, 5 message shortcuts. Shortcuts will appear in shortcuts menus in the order in which they were created.

Now let's make sure you are ready to receive interaction payloads and do something in response.


Handling the use of shortcuts in your app

You've created a shortcut, and at some point it will be used by someone in Slack. Your app has to handle that eventuality.

We explain the process in-depth in our guide to handling user interactions in apps, including how to prepare your app with a request URL. In short, your app will receive an interaction payload after someone uses one of your shortcuts. Your app must process that payload and then send a response.

First, let's learn more about that interaction payload.

Take a shortcut to a solution with Bolt
Our Bolt framework, available in JavaScript, Python, and Java allows you to rapidly build logic to handle shortcuts. Learn more about Bolt.

Processing the interaction payload

When a shortcut 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.

Inside you'll discover an interaction payload containing lots of useful context — consult our reference guide to see the full structure of the fields included.

Payloads for global shortcuts will contain different info from payloads for message shortcuts. For example, a payload for a message shortcut will include channel and message context, and a response_url for publishing message responses. If you want to publish a message in response to a global shortcut, use our alternative approach.

Responding to shortcuts

There are a few things to consider about responding to interaction payloads:

A note about global shortcuts and sending messages
If you're using global shortcuts, and want to publish messages as a response, you can do so by triggering a modal containing a special conversation selector.

Apps should use this approach to ensure that users know that they can use any shortcut without an unexpected message being published on their behalf.


Limitations

  • Global shortcuts are not visible (and therefore usable) for all types of guest user. Please see our Help Center for an up-to-date breakdown of the availability of shortcuts for these users.

  • When an app is submitted (or re-submitted) to the App Directory, the confirmation modal does not indicate any changes regarding global shortcuts. Despite the discrepancy, global shortcut changes will be submitted upon confirmation.

  • An app responding to a shortcut initiated from a threaded message cannot currently publish a message back to that thread. They can publish back to the parent conversation. We are working on a comprehensive solution that will make this possible.


Next steps

You've now learned how to create a shortcut, and what your app has to do to handle their use. That's a great start!

Read our guide to responding to interactions to understand the vast range of possibilities open to your app at this point.


Related references

Interaction payloads

Was this page helpful?