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/.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" + } +} 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..c173a23 --- /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 +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..5a6d1f3 --- /dev/null +++ b/methods/src/agents_sessions/agents_sessions_set_status.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.setStatus method +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 + } +}