|Read first:||An introduction to Slack apps|
Slack apps can use interactive features to achieve much more than just one-way communication.
An injection of interactivity can invite and inspire action (and reaction). Best of all, users never have to depart from the comfort of Slack to get things done.
In this overview we'll explain the general flow of interactivity between Slack apps and users. You'll learn about the different ways that interactions can be invoked, and the multitude of options for responding.
Every interaction between a user and an app exists as part of a flow, a continuum of events that gets something done.
This interactive flow can be simplified to two basic steps:
Read on for a more detailed study of this action and reaction process.
Any interaction has to start somewhere, with a knock on the door to request entry.
There are several potential ways that app interactions are triggered.
The timed or scheduled interaction is one of the simplest triggers, one that doesn't necessarily need the input of a user to occur. Some examples include:
Connections you've built with external services can trigger app interactions at any time. This provides seamless integration from those services into Slack. Some examples include:
For example, the
app_mention event sends a push when an app is mentioned by someone in a conversation. The app could then respond with a message to continue the workflow in the same conversation.
Read more about enabling and reacting to Events API notifications.
Give the control to trigger interaction to your users by enabling one of these entry points:
Reaction follows action — if a door is knocked, someone on the other side decides what to do. Maybe they'll hide behind the sofa, run to collect the delivery they were waiting on, or tentatively open the door for an unexpected visitor.
An app's reaction to an interaction can take on many forms too, ranging from doing nothing at all, to performing one of the many API functions available to Slack apps. There are countless possibilities.
Some features have their own specific interactive behaviors to accommodate — most user invocations will send data payloads to an app containing contextual information about the interaction, for example.
Read the relevant docs linked above for more information on specific interactive flows for different features.
The interactive flow we've described above might seem simple on the surface, a binary back-and-forth. Consider, however, that the responses to interactions can themselves be invocations of further interaction.
An interactive message could be published in response to a schedule, and a button within that message could be clicked to continue a workflow.
When that modal is submitted and closed, that could be the trigger for an update of the app's Home tab.
Chaining interactions together creates workflows that can accomplish complex tasks. It's important to have a good sense of the flow of your app before you start building these interactions.