Skip to main content

Creating steps from apps

danger

Steps from apps are a deprecated feature.

Steps from apps are different than, and not interchangeable with, Slack automation workflows. We encourage those who are currently publishing steps from apps to consider the new Slack automation features, such as custom steps for Bolt.

Please read the Slack API changelog entry for more information.

To create a step from app, Bolt provides the WorkflowStep class.

When instantiating a new WorkflowStep, pass in the step's callback_id and a configuration object.

The configuration object contains three keys: edit, save, and execute. Each of these keys must be a single callback or a list of callbacks. All callbacks have access to a step object that contains information about the step from app event.

After instantiating a WorkflowStep, you can pass it into app.step(). Behind the scenes, your app will listen and respond to the step’s events using the callbacks provided in the configuration object.

Alternatively, steps from apps can also be created using the WorkflowStepBuilder class alongside a decorator pattern. For more information, including an example of this approach, refer to the documentation.

Refer to the module documents (common / step-specific) to learn the available arguments.

import os
from slack_bolt import App
from slack_bolt.workflows.step import WorkflowStep

# Initiate the Bolt app as you normally would
app = App(
token=os.environ.get("SLACK_BOT_TOKEN"),
signing_secret=os.environ.get("SLACK_SIGNING_SECRET")
)

def edit(ack, step, configure):
pass

def save(ack, view, update):
pass

def execute(step, complete, fail):
pass

# Create a new WorkflowStep instance
ws = WorkflowStep(
callback_id="add_task",
edit=edit,
save=save,
execute=execute,
)

# Pass Step to set up listeners
app.step(ws)