Skip to content

Commit e43577e

Browse files
authored
feat(methods): add agents.conversations method examples (#194)
1 parent 425cd38 commit e43577e

15 files changed

Lines changed: 257 additions & 0 deletions

‎methods/README.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@ $ slack run chat_post_message.py # Make the request
1818

1919
### agents
2020

21+
- **[agents.conversations.archive](https://docs.slack.dev/reference/methods/agents.conversations.archive)**: Archive a code channel. [Implementation](./src/agents/conversations/agents_conversations_archive.py).
22+
- **[agents.conversations.create](https://docs.slack.dev/reference/methods/agents.conversations.create)**: Create a dedicated code channel for an agent session. [Implementation](./src/agents/conversations/agents_conversations_create.py).
23+
- **[agents.conversations.getCanvas](https://docs.slack.dev/reference/methods/agents.conversations.getCanvas)**: Fetch a canvas attached to a code channel. [Implementation](./src/agents/conversations/agents_conversations_get_canvas.py).
24+
- **[agents.conversations.listViews](https://docs.slack.dev/reference/methods/agents.conversations.listViews)**: List the views currently attached to a code channel. [Implementation](./src/agents/conversations/agents_conversations_list_views.py).
25+
- **[agents.conversations.removeView](https://docs.slack.dev/reference/methods/agents.conversations.removeView)**: Remove a view from a code channel. [Implementation](./src/agents/conversations/agents_conversations_remove_view.py).
26+
- **[agents.conversations.setCanvasContent](https://docs.slack.dev/reference/methods/agents.conversations.setCanvasContent)**: Replace the full markdown content of a plan canvas attached to a code channel. [Implementation](./src/agents/conversations/agents_conversations_set_canvas_content.py).
27+
- **[agents.conversations.setCommands](https://docs.slack.dev/reference/methods/agents.conversations.setCommands)**: Register the set of agent-defined slash commands for the calling agent in a code channel. [Implementation](./src/agents/conversations/agents_conversations_set_commands.py).
28+
- **[agents.conversations.setProperties](https://docs.slack.dev/reference/methods/agents.conversations.setProperties)**: Set properties on a code channel. [Implementation](./src/agents/conversations/agents_conversations_set_properties.py).
29+
- **[agents.conversations.setView](https://docs.slack.dev/reference/methods/agents.conversations.setView)**: Create or update a view in a code channel. [Implementation](./src/agents/conversations/agents_conversations_set_view.py).
2130
- **[agents.sessions.rename](https://docs.slack.dev/reference/methods/agents.sessions.rename)**: Rename an agent session. [Implementation](./src/agents/sessions/agents_sessions_rename.py).
2231
- **[agents.sessions.setStatus](https://docs.slack.dev/reference/methods/agents.sessions.setStatus)**: Set an agent session's lifecycle status, creating the session if needed. [Implementation](./src/agents/sessions/agents_sessions_set_status.py).
2332

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
apps.dev.json
2+
cache/
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"manifest": {
3+
"source": "local"
4+
},
5+
"project_id": "00000000-0000-0000-0000-000000000000"
6+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"hooks": {
3+
"get-hooks": "python3 -m slack_cli_hooks.hooks.get_hooks"
4+
}
5+
}

‎methods/src/agents/conversations/__init__.py‎

Whitespace-only changes.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import os
2+
3+
from slack_sdk import WebClient
4+
5+
# Read a token from an environment variable
6+
token = os.environ.get("SLACK_TOKEN")
7+
8+
# Initialize
9+
client = WebClient(token=token)
10+
11+
# Call the agents.conversations.archive method
12+
response = client.agents_conversations_archive(
13+
channel_id="C9876543210",
14+
summary_message_ts="1717182000.456789",
15+
)
16+
17+
# Inspect the response
18+
print(response)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import os
2+
3+
from slack_sdk import WebClient
4+
5+
# Read a token from an environment variable
6+
token = os.environ.get("SLACK_TOKEN")
7+
8+
# Initialize
9+
client = WebClient(token=token)
10+
11+
# Call the agents.conversations.create method
12+
response = client.agents_conversations_create(
13+
name="Migrate billing cron to Temporal",
14+
session_id="ses_8675309",
15+
origin_channel_id="C0123456789",
16+
origin_message_ts="1717171717.123456",
17+
)
18+
19+
# Inspect the response
20+
print(response)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import os
2+
3+
from slack_sdk import WebClient
4+
5+
# Read a token from an environment variable
6+
token = os.environ.get("SLACK_TOKEN")
7+
8+
# Initialize
9+
client = WebClient(token=token)
10+
11+
# Call the agents.conversations.getCanvas method
12+
response = client.agents_conversations_getCanvas(
13+
channel="C9876543210",
14+
canvas_id="F1234567890",
15+
include_resolved=False,
16+
)
17+
18+
# Inspect the response
19+
print(response)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import os
2+
3+
from slack_sdk import WebClient
4+
5+
# Read a token from an environment variable
6+
token = os.environ.get("SLACK_TOKEN")
7+
8+
# Initialize
9+
client = WebClient(token=token)
10+
11+
# Call the agents.conversations.listViews method
12+
response = client.agents_conversations_listViews(
13+
channel_id="C9876543210",
14+
)
15+
16+
# Inspect the response
17+
print(response)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import os
2+
3+
from slack_sdk import WebClient
4+
5+
# Read a token from an environment variable
6+
token = os.environ.get("SLACK_TOKEN")
7+
8+
# Initialize
9+
client = WebClient(token=token)
10+
11+
# Call the agents.conversations.removeView method
12+
response = client.agents_conversations_removeView(
13+
channel_id="C9876543210",
14+
view_key="reports/coverage.html",
15+
)
16+
17+
# Inspect the response
18+
print(response)

0 commit comments

Comments
 (0)