From b02a2685f5218efd370c5134dc745de0c7759136 Mon Sep 17 00:00:00 2001 From: Eden Zimbelman Date: Tue, 18 Aug 2026 14:12:12 -0700 Subject: [PATCH 1/3] feat(methods): add agents.sessions method examples Add examples for agents.sessions.setStatus and agents.sessions.rename with a minimal manifest (assistant:write). Stacked on the codeChannels examples. Co-Authored-By: Claude --- methods/README.md | 5 ++++ methods/src/agents_sessions/__init__.py | 0 .../agents_sessions/agents_sessions_rename.py | 18 +++++++++++++ .../agents_sessions_set_status.py | 19 ++++++++++++++ methods/src/agents_sessions/manifest.json | 25 +++++++++++++++++++ 5 files changed, 67 insertions(+) create mode 100644 methods/src/agents_sessions/__init__.py create mode 100644 methods/src/agents_sessions/agents_sessions_rename.py create mode 100644 methods/src/agents_sessions/agents_sessions_set_status.py create mode 100644 methods/src/agents_sessions/manifest.json diff --git a/methods/README.md b/methods/README.md index 37a8064..29f17cb 100644 --- a/methods/README.md +++ b/methods/README.md @@ -16,6 +16,11 @@ $ slack run chat_post_message # Make the request ## What's on call +### agents.sessions + +- **[agents.sessions.rename](https://docs.slack.dev/reference/methods/agents.sessions.rename)**: Renames an agent session. [Implementation](./src/agents_sessions/agents_sessions_rename.py). +- **[agents.sessions.setStatus](https://docs.slack.dev/reference/methods/agents.sessions.setStatus)**: Sets an agent session's lifecycle status, creating the session if needed. [Implementation](./src/agents_sessions/agents_sessions_set_status.py). + ### chat - **[chat.postMessage](https://docs.slack.dev/reference/methods/chat.postmessage)**: Sends a message to a channel. [Implementation](./src/chat/chat_post_message.py). diff --git a/methods/src/agents_sessions/__init__.py b/methods/src/agents_sessions/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/methods/src/agents_sessions/agents_sessions_rename.py b/methods/src/agents_sessions/agents_sessions_rename.py new file mode 100644 index 0000000..7d40e6a --- /dev/null +++ b/methods/src/agents_sessions/agents_sessions_rename.py @@ -0,0 +1,18 @@ +import os + +from slack_sdk import WebClient + +# Read a token from an environment variable +token = os.environ.get("SLACK_TOKEN") + +# Initialize +client = WebClient(token=token) + +# Call the agents.sessions.rename method to give an agent session a new title +response = client.agents_sessions_rename( + channel_id="C123ABC456", + title="Fix flaky login test", +) + +# Inspect the response +print(response) diff --git a/methods/src/agents_sessions/agents_sessions_set_status.py b/methods/src/agents_sessions/agents_sessions_set_status.py new file mode 100644 index 0000000..a73deb0 --- /dev/null +++ b/methods/src/agents_sessions/agents_sessions_set_status.py @@ -0,0 +1,19 @@ +import os + +from slack_sdk import WebClient + +# Read a token from an environment variable +token = os.environ.get("SLACK_TOKEN") + +# Initialize +client = WebClient(token=token) + +# Call the agents.sessions.setStatus method to set an agent session's lifecycle +# status, creating the session if one does not exist yet +response = client.agents_sessions_setStatus( + channel_id="C123ABC456", + status="processing", +) + +# Inspect the response +print(response) diff --git a/methods/src/agents_sessions/manifest.json b/methods/src/agents_sessions/manifest.json new file mode 100644 index 0000000..3efbd1b --- /dev/null +++ b/methods/src/agents_sessions/manifest.json @@ -0,0 +1,25 @@ +{ + "display_information": { + "name": "Slack API Methods", + "description": "Example implementations to call \"agents.sessions\" methods" + }, + "features": { + "bot_user": { + "display_name": "Slack API Methods", + "always_online": true + }, + "agent_view": { + "enabled": true + } + }, + "oauth_config": { + "scopes": { + "bot": ["assistant:write"] + } + }, + "settings": { + "org_deploy_enabled": true, + "socket_mode_enabled": false, + "token_rotation_enabled": false + } +} From bee5752652bf75d0270a7730321edfb4885c6232 Mon Sep 17 00:00:00 2001 From: Eden Zimbelman Date: Tue, 18 Aug 2026 14:23:51 -0700 Subject: [PATCH 2/3] docs(methods): trim agents.sessions example comments to match convention Co-Authored-By: Claude --- methods/src/agents_sessions/agents_sessions_rename.py | 2 +- methods/src/agents_sessions/agents_sessions_set_status.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/methods/src/agents_sessions/agents_sessions_rename.py b/methods/src/agents_sessions/agents_sessions_rename.py index 7d40e6a..c173a23 100644 --- a/methods/src/agents_sessions/agents_sessions_rename.py +++ b/methods/src/agents_sessions/agents_sessions_rename.py @@ -8,7 +8,7 @@ # Initialize client = WebClient(token=token) -# Call the agents.sessions.rename method to give an agent session a new title +# Call the agents.sessions.rename method response = client.agents_sessions_rename( channel_id="C123ABC456", title="Fix flaky login test", diff --git a/methods/src/agents_sessions/agents_sessions_set_status.py b/methods/src/agents_sessions/agents_sessions_set_status.py index a73deb0..5a6d1f3 100644 --- a/methods/src/agents_sessions/agents_sessions_set_status.py +++ b/methods/src/agents_sessions/agents_sessions_set_status.py @@ -8,8 +8,7 @@ # Initialize client = WebClient(token=token) -# Call the agents.sessions.setStatus method to set an agent session's lifecycle -# status, creating the session if one does not exist yet +# Call the agents.sessions.setStatus method response = client.agents_sessions_setStatus( channel_id="C123ABC456", status="processing", From d5b6a634f8eb65d187f7854b44bf9f6f38e24a90 Mon Sep 17 00:00:00 2001 From: Eden Zimbelman Date: Tue, 18 Aug 2026 14:46:19 -0700 Subject: [PATCH 3/3] fix(methods): add missing .slack CLI hooks to agents.sessions example The agents.sessions example dir was missing the .slack/ scaffold that every other method family has, so `slack run` would not work there. Copy the standard config.json, hooks.json, and .gitignore from a sibling. Co-Authored-By: Claude --- methods/src/agents_sessions/.slack/.gitignore | 2 ++ methods/src/agents_sessions/.slack/config.json | 6 ++++++ methods/src/agents_sessions/.slack/hooks.json | 5 +++++ 3 files changed, 13 insertions(+) create mode 100644 methods/src/agents_sessions/.slack/.gitignore create mode 100644 methods/src/agents_sessions/.slack/config.json create mode 100644 methods/src/agents_sessions/.slack/hooks.json diff --git a/methods/src/agents_sessions/.slack/.gitignore b/methods/src/agents_sessions/.slack/.gitignore new file mode 100644 index 0000000..973ba60 --- /dev/null +++ b/methods/src/agents_sessions/.slack/.gitignore @@ -0,0 +1,2 @@ +apps.dev.json +cache/ diff --git a/methods/src/agents_sessions/.slack/config.json b/methods/src/agents_sessions/.slack/config.json new file mode 100644 index 0000000..909afbe --- /dev/null +++ b/methods/src/agents_sessions/.slack/config.json @@ -0,0 +1,6 @@ +{ + "manifest": { + "source": "local" + }, + "project_id": "00000000-0000-0000-0000-000000000000" +} diff --git a/methods/src/agents_sessions/.slack/hooks.json b/methods/src/agents_sessions/.slack/hooks.json new file mode 100644 index 0000000..ce474c9 --- /dev/null +++ b/methods/src/agents_sessions/.slack/hooks.json @@ -0,0 +1,5 @@ +{ + "hooks": { + "get-hooks": "python3 -m slack_cli_hooks.hooks.get_hooks" + } +}