Skip to main content

Buttons that prompt Slackbot

A button can carry an optional agent_prompt of up to 4000 Unicode code points. Any app may set it. When Slackbot AI is available to the clicking user, Slack sends the prompt to Slackbot; otherwise the button still sends an interaction to your app. See Slack's button reference.

agent_prompt_display supplies the collapsed Slackbot message text and requires agent_prompt. The complete prompt remains expandable. Omit the display to let Slack use the button label. Slack documents no separate display length limit. Neither field changes existing button placement or URL support.

These examples use native fields and set an action_id for routing the click. An action ID remains optional in the payload schema. Add the resulting button to an actions block or another supported button parent.

from slackblocks import Button

button = Button(
"Summarize", action_id="summarize_incident",
agent_prompt="Summarize this incident.", agent_prompt_display="Incident summary",
)
print(button)

Always acknowledge the interaction​

Your app receives a block_actions payload in both cases, including when Slackbot receives the prompt. Verify the request using your Slack framework's signature verification, route summarize_incident to its handler, and acknowledge within three seconds before doing slow work. Do not skip acknowledgement because the button contains a prompt, or assume that an AI entitlement determines whether your handler runs. Follow Slack's acknowledgement requirements.

Slackblocks constructs and validates the outgoing payload; your application owns the interaction handler. No new OAuth scope or live Slack request is needed to construct this button. AI availability and Slack's rendered behavior remain platform concerns. The library's deterministic tests cover payloads and validation, not live Slackbot acceptance.