From a8c9beb312fe2abc346d3b9ae8e811d759a7010f Mon Sep 17 00:00:00 2001 From: Ale Mercado Date: Mon, 6 Oct 2025 21:06:56 -0400 Subject: [PATCH 1/5] build: bump slack sdk and bolt to latest release --- requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 76b1703..9e8c646 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ -slack-sdk==3.36.0.dev6 -slack-bolt==1.26.0.dev3 +slack-sdk==3.37.0 +slack-bolt==1.26.0 # If you use a different LLM vendor, replace this dependency openai From 4ef5f1beb83d98f907f35150ae6373b067eaba82 Mon Sep 17 00:00:00 2001 From: Ale Mercado Date: Mon, 6 Oct 2025 21:13:15 -0400 Subject: [PATCH 2/5] fix: remove channel summary functionality --- listeners/assistant/assistant.py | 55 ++++++-------------------------- 1 file changed, 10 insertions(+), 45 deletions(-) diff --git a/listeners/assistant/assistant.py b/listeners/assistant/assistant.py index b818019..e0df965 100644 --- a/listeners/assistant/assistant.py +++ b/listeners/assistant/assistant.py @@ -2,9 +2,7 @@ from typing import Dict, List from slack_bolt import Assistant, BoltContext, Say, SetStatus, SetSuggestedPrompts -from slack_bolt.context.get_thread_context import GetThreadContext from slack_sdk import WebClient -from slack_sdk.errors import SlackApiError from ai.llm_caller import call_llm @@ -17,7 +15,6 @@ @assistant.thread_started def start_assistant_thread( say: Say, - get_thread_context: GetThreadContext, set_suggested_prompts: SetSuggestedPrompts, logger: Logger, ): @@ -26,7 +23,6 @@ def start_assistant_thread( Args: say: Function to send messages to the thread from the app - get_thread_context: Function to retrieve thread context information set_suggested_prompts: Function to configure suggested prompt options logger: Logger instance for error tracking """ @@ -48,14 +44,6 @@ def start_assistant_thread( }, ] - thread_context = get_thread_context() - if thread_context is not None and thread_context.channel_id is not None: - summarize_channel = { - "title": "Summarize the referred channel", - "message": "Can you generate a brief summary of the referred channel?", - } - prompts.append(summarize_channel) - set_suggested_prompts(prompts=prompts) except Exception as e: logger.exception(f"Failed to handle an assistant_thread_started event: {e}", e) @@ -67,7 +55,6 @@ def start_assistant_thread( def respond_in_assistant_thread( client: WebClient, context: BoltContext, - get_thread_context: GetThreadContext, logger: Logger, payload: dict, say: Say, @@ -79,7 +66,6 @@ def respond_in_assistant_thread( Args: client: Slack WebClient for making API calls context: Bolt context containing channel and thread information - get_thread_context: Function to retrieve thread context (e.g., referred channel) logger: Logger instance for error tracking payload: Event payload with message details (channel, user, text, etc.) say: Function to send messages to the thread @@ -90,7 +76,6 @@ def respond_in_assistant_thread( team_id = context.team_id thread_ts = payload["thread_ts"] user_id = context.user_id - user_message = payload["text"] set_status( status="thinking...", @@ -103,36 +88,16 @@ def respond_in_assistant_thread( ], ) - if user_message == "Can you generate a brief summary of the referred channel?": - thread_context = get_thread_context() - referred_channel_id = thread_context.get("channel_id") - try: - channel_history = client.conversations_history(channel=referred_channel_id, limit=50) - except SlackApiError as e: - if e.response["error"] == "not_in_channel": - # If this app's bot user is not in the public channel, - # we'll try joining the channel and then calling the same API again - client.conversations_join(channel=referred_channel_id) - channel_history = client.conversations_history(channel=referred_channel_id, limit=50) - else: - raise e - prompt = f"Can you generate a brief summary of these messages in a Slack channel <#{referred_channel_id}>?\n\n" - for message in reversed(channel_history.get("messages")): - if message.get("user") is not None: - prompt += f"\n<@{message['user']}> says: {message['text']}\n" - messages_in_thread = [{"role": "user", "content": prompt}] - - else: - replies = client.conversations_replies( - channel=context.channel_id, - ts=context.thread_ts, - oldest=context.thread_ts, - limit=10, - ) - messages_in_thread: List[Dict[str, str]] = [] - for message in replies["messages"]: - role = "user" if message.get("bot_id") is None else "assistant" - messages_in_thread.append({"role": role, "content": message["text"]}) + replies = client.conversations_replies( + channel=context.channel_id, + ts=context.thread_ts, + oldest=context.thread_ts, + limit=10, + ) + messages_in_thread: List[Dict[str, str]] = [] + for message in replies["messages"]: + role = "user" if message.get("bot_id") is None else "assistant" + messages_in_thread.append({"role": role, "content": message["text"]}) returned_message = call_llm(messages_in_thread) From ba7932a0f0880c9f5bdff4a09084b34f7bd8840f Mon Sep 17 00:00:00 2001 From: Ale Mercado Date: Mon, 6 Oct 2025 21:20:37 -0400 Subject: [PATCH 3/5] chore: update scopes in manifest.json --- manifest.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/manifest.json b/manifest.json index 8576d09..e94c60a 100644 --- a/manifest.json +++ b/manifest.json @@ -22,11 +22,8 @@ "bot": [ "app_mentions:read", "assistant:write", - "channels:join", "im:history", - "channels:history", "channels:read", - "groups:history", "chat:write", "users:read" ] From ce7459e2f30c930a275009b2bbfdc323942b3450 Mon Sep 17 00:00:00 2001 From: Eden Zimbelman Date: Mon, 6 Oct 2025 18:50:50 -0700 Subject: [PATCH 4/5] fix: remove users:read scope --- manifest.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index e94c60a..f0a5ef6 100644 --- a/manifest.json +++ b/manifest.json @@ -24,8 +24,7 @@ "assistant:write", "im:history", "channels:read", - "chat:write", - "users:read" + "chat:write" ] } }, From 9929359b6b148f8f9f4c71ceb119f16af0be1ae6 Mon Sep 17 00:00:00 2001 From: Eden Zimbelman Date: Mon, 6 Oct 2025 18:51:18 -0700 Subject: [PATCH 5/5] fix: remove message.channels event Co-authored-by: Michael Brooks --- manifest.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index f0a5ef6..15aa21f 100644 --- a/manifest.json +++ b/manifest.json @@ -34,8 +34,7 @@ "assistant_thread_context_changed", "assistant_thread_started", "message.im", - "app_mention", - "message.channels" + "app_mention" ] }, "interactivity": {