Skip to main content

Workflow button

Build a workflow trigger with named input parameters. Replace the example URL with your real link trigger; this example does not activate a workflow.

Output

Local preview of the selected language’s tested example. Slack client appearance may differ; controls here do not send requests.

Run the release workflow with the parameters below.
Serialized output
{
"channel": "#release",
"mrkdwn": true,
"blocks": [
{
"type": "section",
"block_id": "<generated-block-id>",
"text": {
"type": "mrkdwn",
"text": "Run the release workflow with the parameters below."
}
},
{
"type": "actions",
"block_id": "<generated-block-id>",
"elements": [
{
"type": "workflow_button",
"text": {
"type": "plain_text",
"text": "Release"
},
"action_id": "release",
"workflow": {
"trigger": {
"url": "https://slack.com/shortcuts/Ft012KXZK1MZ/...",
"customizable_input_parameters": [
{
"name": "env",
"value": "prod"
},
{
"name": "retries",
"value": "3"
}
]
}
}
}
]
}
],
"text": ""
}

Code​

Workflow.from_url collapses the most common workflow construction:

from slackblocks import (
ActionsBlock,
Message,
SectionBlock,
Workflow,
WorkflowButton,
)

msg = Message(
channel="#release",
blocks=[
SectionBlock("Run the release workflow with the parameters below."),
ActionsBlock(
elements=[
WorkflowButton(
text="Release",
action_id="release",
workflow=Workflow.from_url(
"https://slack.com/shortcuts/Ft012KXZK1MZ/...",
env="prod",
retries="3",
),
),
],
),
],
)
print(msg.json())

Each keyword pair becomes one InputParameter on the underlying Trigger. Calling Workflow.from_url(url) with no parameters omits the customizable_input_parameters field.