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
# Refer to https://tools.slack.dev/bolt-python/concepts/assistant/ for more details
11
+
assistant=Assistant()
12
+
13
+
14
+
defcreate_feedback_block() ->List[Block]:
15
+
"""
16
+
Create feedback block with thumbs up/down buttons
17
+
18
+
Returns:
19
+
Block Kit context_actions block
20
+
"""
21
+
blocks: List[Block] = [
22
+
ContextActionsBlock(
23
+
elements=[
24
+
FeedbackButtonsElement(
25
+
action_id="feedback",
26
+
positive_button=FeedbackButtonObject(
27
+
text="Good Response",
28
+
accessibility_label="Submit positive feedback on this response",
29
+
value="good-feedback",
30
+
),
31
+
negative_button=FeedbackButtonObject(
32
+
text="Bad Response",
33
+
accessibility_label="Submit negative feedback on this response",
34
+
value="bad-feedback",
35
+
),
36
+
)
37
+
]
38
+
)
39
+
]
40
+
returnblocks
41
+
42
+
43
+
# This listener is invoked when a human user opened an assistant thread
44
+
@assistant.thread_started
45
+
defstart_assistant_thread(
46
+
say: Say,
47
+
get_thread_context: GetThreadContext,
48
+
set_suggested_prompts: SetSuggestedPrompts,
49
+
logger: logging.Logger,
50
+
):
51
+
try:
52
+
say("How can I help you?")
53
+
54
+
prompts: List[Dict[str, str]] = [
55
+
{
56
+
"title": "What does Slack stand for?",
57
+
"message": "Slack, a business communication service, was named after an acronym. Can you guess what it stands for?",
58
+
},
59
+
{
60
+
"title": "Write a draft announcement",
61
+
"message": "Can you write a draft announcement about a new feature my team just released? It must include how impactful it is.",
62
+
},
63
+
{
64
+
"title": "Suggest names for my Slack app",
65
+
"message": "Can you suggest a few names for my Slack app? The app helps my teammates better organize information and plan priorities and action items.",
0 commit comments