Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/button-agent-prompt-fields.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@slack/types": patch
---

fix(types): add the `agent_prompt`, `agent_prompt_display`, and `visible_to_user_ids` fields to the [`Button`](https://docs.slack.dev/reference/block-kit/block-elements/button-element) block element
14 changes: 14 additions & 0 deletions packages/types/src/block-kit/block-elements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,20 @@ export interface Button extends Actionable, Confirmable {
* readers instead of the button `text` object. Maximum length for this field is 75 characters.
*/
accessibility_label?: string;
/**
* @description A prompt sent to Slackbot when the button is clicked, if Slackbot AI is available to the user.
* Maximum length for this field is 4000 characters.
*/
agent_prompt?: string;
/**
* @description Short text shown instead of the full `agent_prompt` in the user's Slackbot message. Requires
* `agent_prompt` and defaults to the button's `text`.
*/
agent_prompt_display?: string;
/**
* @description An array of user IDs for which the button appears. If not provided, the button is visible to all users.
*/
visible_to_user_ids?: string[];
}

/**
Expand Down
15 changes: 14 additions & 1 deletion packages/types/test/block-elements.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expectAssignable, expectError } from 'tsd';
import type { RichTextInput, WorkflowButton } from '../src/index';
import type { Button, RichTextInput, WorkflowButton } from '../src/index';

// RichTextInput — happy paths
expectAssignable<RichTextInput>({
Expand Down Expand Up @@ -43,3 +43,16 @@ expectAssignable<WorkflowButton>({
},
},
});

// Button with agent prompt and visibility fields
expectAssignable<Button>({
type: 'button',
text: {
type: 'plain_text',
text: 'Summarize with Slackbot',
},
action_id: 'summarize_incident',
agent_prompt: 'Summarize this incident and suggest next steps.',
agent_prompt_display: 'Summarize this incident',
visible_to_user_ids: ['U123456'],
});
Loading