You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ff18e20
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: slack-api-model-kotlin-extension/src/main/kotlin/com/slack/api/model/kotlin_extension/block/element/ButtonElementBuilder.kt
+44Lines changed: 44 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -17,6 +17,9 @@ class ButtonElementBuilder : Builder<ButtonElement> {
17
17
privatevar style:String?=null
18
18
privatevar confirm:ConfirmationDialogObject?=null
19
19
privatevar accessibilityLabel:String?=null
20
+
privatevar agentPrompt:String?=null
21
+
privatevar agentPromptDisplay:String?=null
22
+
privatevar visibleToUserIds:List<String>?=null
20
23
21
24
/**
22
25
* An identifier for this action. You can use this when you receive an interaction payload to identify the source
@@ -103,6 +106,44 @@ class ButtonElementBuilder : Builder<ButtonElement> {
103
106
this.accessibilityLabel = accessibilityLabel
104
107
}
105
108
109
+
/**
110
+
* A prompt sent to Slackbot when the button is clicked, if Slackbot AI is available to the user.
111
+
* Maximum length for this field is 4000 characters.
112
+
*
113
+
* @see <a href="https://docs.slack.dev/reference/block-kit/block-elements/button-element">Button element documentation</a>
114
+
*/
115
+
funagentPrompt(agentPrompt:String) {
116
+
this.agentPrompt = agentPrompt
117
+
}
118
+
119
+
/**
120
+
* Short text shown instead of the full agent_prompt in the user's Slackbot message.
121
+
* Requires agent_prompt and defaults to the button's text.
122
+
*
123
+
* @see <a href="https://docs.slack.dev/reference/block-kit/block-elements/button-element">Button element documentation</a>
Copy file name to clipboardExpand all lines: slack-api-model-kotlin-extension/src/test/kotlin/test_locally/block/ActionsBlockTest.kt
+19Lines changed: 19 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -31,6 +31,25 @@ class ActionsBlockTest {
31
31
assertEquals(expected, result)
32
32
}
33
33
34
+
@Test
35
+
funbuttonWithAgentPrompt() {
36
+
val gson =GsonFactory.createSnakeCase()
37
+
val blocks = withBlocks {
38
+
actions {
39
+
button {
40
+
actionId("summarize_incident")
41
+
text("Summarize with Slackbot")
42
+
agentPrompt("Summarize this incident and suggest next steps.")
43
+
agentPromptDisplay("Summarize this incident")
44
+
visibleToUserIds("U123456")
45
+
}
46
+
}
47
+
}
48
+
val result = gson.toJson(blocks)
49
+
val expected ="""[{"type":"actions","elements":[{"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"]}]}]"""
0 commit comments