From 1edf454723d6dcd0a4cb3e3ee71b63d51bbce32e Mon Sep 17 00:00:00 2001 From: Eden Zimbelman Date: Wed, 18 Feb 2026 19:39:36 -0800 Subject: [PATCH] fix(agent): match channel_id api argument for set_status and set_suggested_prompts --- slack_bolt/agent/agent.py | 12 ++++++------ slack_bolt/agent/async_agent.py | 12 ++++++------ tests/slack_bolt/agent/test_agent.py | 8 ++++---- tests/slack_bolt_async/agent/test_async_agent.py | 8 ++++---- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/slack_bolt/agent/agent.py b/slack_bolt/agent/agent.py index aa84bae90..523b0e33c 100644 --- a/slack_bolt/agent/agent.py +++ b/slack_bolt/agent/agent.py @@ -77,7 +77,7 @@ def set_status( *, status: str, loading_messages: Optional[List[str]] = None, - channel: Optional[str] = None, + channel_id: Optional[str] = None, thread_ts: Optional[str] = None, **kwargs, ) -> SlackResponse: @@ -86,7 +86,7 @@ def set_status( Args: status: The status text to display. loading_messages: Optional list of loading messages to cycle through. - channel: Channel ID. Defaults to the channel from the event context. + channel_id: Channel ID. Defaults to the channel from the event context. thread_ts: Thread timestamp. Defaults to the thread_ts from the event context. **kwargs: Additional arguments passed to ``WebClient.assistant_threads_setStatus()``. @@ -94,7 +94,7 @@ def set_status( ``SlackResponse`` from the API call. """ return self._client.assistant_threads_setStatus( - channel_id=channel or self._channel_id, # type: ignore[arg-type] + channel_id=channel_id or self._channel_id, # type: ignore[arg-type] thread_ts=thread_ts or self._thread_ts or self._ts, # type: ignore[arg-type] status=status, loading_messages=loading_messages, @@ -106,7 +106,7 @@ def set_suggested_prompts( *, prompts: Sequence[Union[str, Dict[str, str]]], title: Optional[str] = None, - channel: Optional[str] = None, + channel_id: Optional[str] = None, thread_ts: Optional[str] = None, **kwargs, ) -> SlackResponse: @@ -116,7 +116,7 @@ def set_suggested_prompts( prompts: A sequence of prompts. Each prompt can be either a string (used as both title and message) or a dict with 'title' and 'message' keys. title: Optional title for the suggested prompts section. - channel: Channel ID. Defaults to the channel from the event context. + channel_id: Channel ID. Defaults to the channel from the event context. thread_ts: Thread timestamp. Defaults to the thread_ts from the event context. **kwargs: Additional arguments passed to ``WebClient.assistant_threads_setSuggestedPrompts()``. @@ -131,7 +131,7 @@ def set_suggested_prompts( prompts_arg.append(prompt) return self._client.assistant_threads_setSuggestedPrompts( - channel_id=channel or self._channel_id, # type: ignore[arg-type] + channel_id=channel_id or self._channel_id, # type: ignore[arg-type] thread_ts=thread_ts or self._thread_ts or self._ts, # type: ignore[arg-type] prompts=prompts_arg, title=title, diff --git a/slack_bolt/agent/async_agent.py b/slack_bolt/agent/async_agent.py index 7272338e1..da4ec6c0a 100644 --- a/slack_bolt/agent/async_agent.py +++ b/slack_bolt/agent/async_agent.py @@ -76,7 +76,7 @@ async def set_status( *, status: str, loading_messages: Optional[List[str]] = None, - channel: Optional[str] = None, + channel_id: Optional[str] = None, thread_ts: Optional[str] = None, **kwargs, ) -> AsyncSlackResponse: @@ -85,7 +85,7 @@ async def set_status( Args: status: The status text to display. loading_messages: Optional list of loading messages to cycle through. - channel: Channel ID. Defaults to the channel from the event context. + channel_id: Channel ID. Defaults to the channel from the event context. thread_ts: Thread timestamp. Defaults to the thread_ts from the event context. **kwargs: Additional arguments passed to ``AsyncWebClient.assistant_threads_setStatus()``. @@ -93,7 +93,7 @@ async def set_status( ``AsyncSlackResponse`` from the API call. """ return await self._client.assistant_threads_setStatus( - channel_id=channel or self._channel_id, # type: ignore[arg-type] + channel_id=channel_id or self._channel_id, # type: ignore[arg-type] thread_ts=thread_ts or self._thread_ts or self._ts, # type: ignore[arg-type] status=status, loading_messages=loading_messages, @@ -105,7 +105,7 @@ async def set_suggested_prompts( *, prompts: Sequence[Union[str, Dict[str, str]]], title: Optional[str] = None, - channel: Optional[str] = None, + channel_id: Optional[str] = None, thread_ts: Optional[str] = None, **kwargs, ) -> AsyncSlackResponse: @@ -115,7 +115,7 @@ async def set_suggested_prompts( prompts: A sequence of prompts. Each prompt can be either a string (used as both title and message) or a dict with 'title' and 'message' keys. title: Optional title for the suggested prompts section. - channel: Channel ID. Defaults to the channel from the event context. + channel_id: Channel ID. Defaults to the channel from the event context. thread_ts: Thread timestamp. Defaults to the thread_ts from the event context. **kwargs: Additional arguments passed to ``AsyncWebClient.assistant_threads_setSuggestedPrompts()``. @@ -130,7 +130,7 @@ async def set_suggested_prompts( prompts_arg.append(prompt) return await self._client.assistant_threads_setSuggestedPrompts( - channel_id=channel or self._channel_id, # type: ignore[arg-type] + channel_id=channel_id or self._channel_id, # type: ignore[arg-type] thread_ts=thread_ts or self._thread_ts or self._ts, # type: ignore[arg-type] prompts=prompts_arg, title=title, diff --git a/tests/slack_bolt/agent/test_agent.py b/tests/slack_bolt/agent/test_agent.py index 87d51d9eb..76ac7d17b 100644 --- a/tests/slack_bolt/agent/test_agent.py +++ b/tests/slack_bolt/agent/test_agent.py @@ -183,7 +183,7 @@ def test_set_status_with_loading_messages(self): ) def test_set_status_overrides_context_defaults(self): - """Explicit channel/thread_ts override context defaults.""" + """Explicit channel_id/thread_ts override context defaults.""" client = MagicMock(spec=WebClient) client.assistant_threads_setStatus.return_value = MagicMock() @@ -196,7 +196,7 @@ def test_set_status_overrides_context_defaults(self): ) agent.set_status( status="Thinking...", - channel="C999", + channel_id="C999", thread_ts="9999999999.999999", ) @@ -295,7 +295,7 @@ def test_set_suggested_prompts_with_dict_prompts(self): ) def test_set_suggested_prompts_overrides_context_defaults(self): - """Explicit channel/thread_ts override context defaults.""" + """Explicit channel_id/thread_ts override context defaults.""" client = MagicMock(spec=WebClient) client.assistant_threads_setSuggestedPrompts.return_value = MagicMock() @@ -308,7 +308,7 @@ def test_set_suggested_prompts_overrides_context_defaults(self): ) agent.set_suggested_prompts( prompts=["Hello"], - channel="C999", + channel_id="C999", thread_ts="9999999999.999999", ) diff --git a/tests/slack_bolt_async/agent/test_async_agent.py b/tests/slack_bolt_async/agent/test_async_agent.py index 7c01a4301..3ed8ef0b4 100644 --- a/tests/slack_bolt_async/agent/test_async_agent.py +++ b/tests/slack_bolt_async/agent/test_async_agent.py @@ -214,7 +214,7 @@ async def test_set_status_with_loading_messages(self): @pytest.mark.asyncio async def test_set_status_overrides_context_defaults(self): - """Explicit channel/thread_ts override context defaults.""" + """Explicit channel_id/thread_ts override context defaults.""" client = MagicMock(spec=AsyncWebClient) client.assistant_threads_setStatus, call_tracker, _ = _make_async_api_mock() @@ -227,7 +227,7 @@ async def test_set_status_overrides_context_defaults(self): ) await agent.set_status( status="Thinking...", - channel="C999", + channel_id="C999", thread_ts="9999999999.999999", ) @@ -331,7 +331,7 @@ async def test_set_suggested_prompts_with_dict_prompts(self): @pytest.mark.asyncio async def test_set_suggested_prompts_overrides_context_defaults(self): - """Explicit channel/thread_ts override context defaults.""" + """Explicit channel_id/thread_ts override context defaults.""" client = MagicMock(spec=AsyncWebClient) client.assistant_threads_setSuggestedPrompts, call_tracker, _ = _make_async_api_mock() @@ -344,7 +344,7 @@ async def test_set_suggested_prompts_overrides_context_defaults(self): ) await agent.set_suggested_prompts( prompts=["Hello"], - channel="C999", + channel_id="C999", thread_ts="9999999999.999999", )