File tree Expand file tree Collapse file tree
claude-agent-sdk/listeners/events
openai-agents-sdk/listeners/events
pydantic-ai/listeners/events Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33from .app_home_opened import handle_app_home_opened
44from .app_mentioned import handle_app_mentioned
5+ from .assistant_thread_started import handle_assistant_thread_started
56from .message_im import handle_message_im
67
78
89def register (app : AsyncApp ):
910 app .event ("app_home_opened" )(handle_app_home_opened )
1011 app .event ("app_mention" )(handle_app_mentioned )
12+ app .event ("assistant_thread_started" )(handle_assistant_thread_started )
1113 app .event ("message" )(handle_message_im )
Original file line number Diff line number Diff line change 1+ from logging import Logger
2+
3+ from slack_sdk .web .async_client import AsyncWebClient
4+
5+ SUGGESTED_PROMPTS = [
6+ {"title" : "Reset Password" , "message" : "I need to reset my password" },
7+ {"title" : "Request Access" , "message" : "I need access to a system or tool" },
8+ {"title" : "Network Issues" , "message" : "I'm having network connectivity issues" },
9+ ]
10+
11+
12+ async def handle_assistant_thread_started (
13+ client : AsyncWebClient , event : dict , logger : Logger
14+ ):
15+ """Handle assistant thread started events by setting suggested prompts."""
16+ assistant_thread = event .get ("assistant_thread" , {})
17+ channel_id = assistant_thread .get ("channel_id" )
18+ thread_ts = assistant_thread .get ("thread_ts" )
19+
20+ try :
21+ await client .assistant_threads_setSuggestedPrompts (
22+ channel_id = channel_id ,
23+ thread_ts = thread_ts ,
24+ title = "How can I help you today?" ,
25+ prompts = SUGGESTED_PROMPTS ,
26+ )
27+ except Exception as e :
28+ logger .exception (f"Failed to handle assistant thread started: { e } " )
Original file line number Diff line number Diff line change 22
33from .app_home_opened import handle_app_home_opened
44from .app_mentioned import handle_app_mentioned
5+ from .assistant_thread_started import handle_assistant_thread_started
56from .message_im import handle_message_im
67
78
89def register (app : App ):
910 app .event ("app_home_opened" )(handle_app_home_opened )
1011 app .event ("app_mention" )(handle_app_mentioned )
12+ app .event ("assistant_thread_started" )(handle_assistant_thread_started )
1113 app .event ("message" )(handle_message_im )
Original file line number Diff line number Diff line change 1+ from logging import Logger
2+
3+ from slack_sdk import WebClient
4+
5+ SUGGESTED_PROMPTS = [
6+ {"title" : "Reset Password" , "message" : "I need to reset my password" },
7+ {"title" : "Request Access" , "message" : "I need access to a system or tool" },
8+ {"title" : "Network Issues" , "message" : "I'm having network connectivity issues" },
9+ ]
10+
11+
12+ def handle_assistant_thread_started (client : WebClient , event : dict , logger : Logger ):
13+ """Handle assistant thread started events by setting suggested prompts."""
14+ assistant_thread = event .get ("assistant_thread" , {})
15+ channel_id = assistant_thread .get ("channel_id" )
16+ thread_ts = assistant_thread .get ("thread_ts" )
17+
18+ try :
19+ client .assistant_threads_setSuggestedPrompts (
20+ channel_id = channel_id ,
21+ thread_ts = thread_ts ,
22+ title = "How can I help you today?" ,
23+ prompts = SUGGESTED_PROMPTS ,
24+ )
25+ except Exception as e :
26+ logger .exception (f"Failed to handle assistant thread started: { e } " )
Original file line number Diff line number Diff line change 22
33from .app_home_opened import handle_app_home_opened
44from .app_mentioned import handle_app_mentioned
5+ from .assistant_thread_started import handle_assistant_thread_started
56from .message_im import handle_message_im
67
78
89def register (app : App ):
910 app .event ("app_home_opened" )(handle_app_home_opened )
1011 app .event ("app_mention" )(handle_app_mentioned )
12+ app .event ("assistant_thread_started" )(handle_assistant_thread_started )
1113 app .event ("message" )(handle_message_im )
Original file line number Diff line number Diff line change 1+ from logging import Logger
2+
3+ from slack_sdk import WebClient
4+
5+ SUGGESTED_PROMPTS = [
6+ {"title" : "Reset Password" , "message" : "I need to reset my password" },
7+ {"title" : "Request Access" , "message" : "I need access to a system or tool" },
8+ {"title" : "Network Issues" , "message" : "I'm having network connectivity issues" },
9+ ]
10+
11+
12+ def handle_assistant_thread_started (client : WebClient , event : dict , logger : Logger ):
13+ """Handle assistant thread started events by setting suggested prompts."""
14+ assistant_thread = event .get ("assistant_thread" , {})
15+ channel_id = assistant_thread .get ("channel_id" )
16+ thread_ts = assistant_thread .get ("thread_ts" )
17+
18+ try :
19+ client .assistant_threads_setSuggestedPrompts (
20+ channel_id = channel_id ,
21+ thread_ts = thread_ts ,
22+ title = "How can I help you today?" ,
23+ prompts = SUGGESTED_PROMPTS ,
24+ )
25+ except Exception as e :
26+ logger .exception (f"Failed to handle assistant thread started: { e } " )
You can’t perform that action at this time.
0 commit comments