@@ -188,10 +188,23 @@ class ButtonElement(InteractiveElement):
188188 text_max_length = 75
189189 url_max_length = 3000
190190 value_max_length = 2000
191+ agent_prompt_max_length = 4000
191192
192193 @property
193194 def attributes (self ) -> Set [str ]: # type: ignore[override]
194- return super ().attributes .union ({"text" , "url" , "value" , "style" , "confirm" , "accessibility_label" })
195+ return super ().attributes .union (
196+ {
197+ "text" ,
198+ "url" ,
199+ "value" ,
200+ "style" ,
201+ "confirm" ,
202+ "accessibility_label" ,
203+ "agent_prompt" ,
204+ "agent_prompt_display" ,
205+ "visible_to_user_ids" ,
206+ }
207+ )
195208
196209 def __init__ (
197210 self ,
@@ -203,6 +216,9 @@ def __init__(
203216 style : Optional [str ] = None , # primary, danger
204217 confirm : Optional [Union [dict , ConfirmObject ]] = None ,
205218 accessibility_label : Optional [str ] = None ,
219+ agent_prompt : Optional [str ] = None ,
220+ agent_prompt_display : Optional [str ] = None ,
221+ visible_to_user_ids : Optional [List [str ]] = None ,
206222 ** others : dict ,
207223 ):
208224 """An interactive element that inserts a button.
@@ -234,6 +250,12 @@ def __init__(
234250 accessibility_label: A label for longer descriptive text about a button element.
235251 This label will be read out by screen readers instead of the button text object.
236252 Maximum length for this field is 75 characters.
253+ agent_prompt: A prompt sent to Slackbot when the button is clicked, if Slackbot AI is available to the user.
254+ Maximum length for this field is 4000 characters.
255+ agent_prompt_display: Short text shown instead of the full agent_prompt in the user's Slackbot message.
256+ Only takes effect alongside agent_prompt and defaults to the button's text.
257+ visible_to_user_ids: User IDs for which the button appears.
258+ If not provided, the button is visible to all users.
237259 """
238260 super ().__init__ (action_id = action_id , type = self .type )
239261 show_unknown_key_warning (self , others )
@@ -245,6 +267,9 @@ def __init__(
245267 self .style = style
246268 self .confirm = ConfirmObject .parse (confirm ) # type: ignore[arg-type]
247269 self .accessibility_label = accessibility_label
270+ self .agent_prompt = agent_prompt
271+ self .agent_prompt_display = agent_prompt_display
272+ self .visible_to_user_ids = visible_to_user_ids
248273
249274 @JsonValidator (f"text attribute cannot exceed { text_max_length } characters" )
250275 def _validate_text_length (self ) -> bool :
@@ -266,6 +291,10 @@ def _validate_style_valid(self):
266291 def _validate_accessibility_label_length (self ) -> bool :
267292 return self .accessibility_label is None or len (self .accessibility_label ) <= self .text_max_length
268293
294+ @JsonValidator (f"agent_prompt attribute cannot exceed { agent_prompt_max_length } characters" )
295+ def _validate_agent_prompt_length (self ) -> bool :
296+ return self .agent_prompt is None or len (self .agent_prompt ) <= self .agent_prompt_max_length
297+
269298
270299class LinkButtonElement (ButtonElement ):
271300 def __init__ (
0 commit comments