-
Notifications
You must be signed in to change notification settings - Fork 0
feat(methods): add agents.conversations method examples #194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
zimeg
wants to merge
19
commits into
main
Choose a base branch
from
clack/code-channels-method-examples
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+257
−0
Draft
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
1f11194
feat(methods): add agents.sessions method examples
zimeg 67d25e0
feat(methods): add codeChannels method examples
zimeg d16b8c2
docs(methods): use `agents` section header and concise descriptions
zimeg 67cfd1a
Merge branch 'clack/agents-sessions-method-examples-new' into clack/c…
zimeg 3356acc
fix(methods): use chat:write scope for agents.sessions example
zimeg 287c037
Merge branch 'clack/agents-sessions-method-examples-new' into clack/c…
zimeg 13a1d6c
refactor(methods): nest agents.sessions example under agents/sessions/
zimeg 2270dd3
Merge branch 'clack/agents-sessions-method-examples-new' into clack/c…
zimeg 2df47f6
feat(methods): make agents.sessions example manifest a well-formed agent
zimeg 4826a6b
Merge remote-tracking branch 'origin/clack/agents-sessions-method-exa…
zimeg c71e168
Merge remote-tracking branch 'origin/main' into clack/agents-sessions…
zimeg 4f8922c
Merge branch 'clack/agents-sessions-method-examples' into clack/code-…
zimeg 3d664a0
refactor(methods): rename codeChannels examples to agents.conversatio…
zimeg c80e434
Merge remote-tracking branch 'origin/main' into clack/code-channels-m…
zimeg 322e8de
Merge remote-tracking branch 'origin/main' into clack/code-channels-m…
zimeg b1208f8
docs(methods): align agents.conversations README descriptions with docs
zimeg c721b51
docs(methods): match agents.conversations examples to docs #816 verbatim
zimeg f900ed5
feat(methods): enable Socket Mode in agents.conversations manifest
zimeg b7ed427
docs(methods): add the summarize command to setCommands example
zimeg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| apps.dev.json | ||
| cache/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { | ||
| "manifest": { | ||
| "source": "local" | ||
| }, | ||
| "project_id": "00000000-0000-0000-0000-000000000000" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "hooks": { | ||
| "get-hooks": "python3 -m slack_cli_hooks.hooks.get_hooks" | ||
| } | ||
| } |
Empty file.
18 changes: 18 additions & 0 deletions
18
methods/src/agents/conversations/agents_conversations_archive.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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.conversations.archive method | ||
| response = client.agents_conversations_archive( | ||
| channel_id="C9876543210", | ||
| summary_message_ts="1717182000.456789", | ||
| ) | ||
|
|
||
| # Inspect the response | ||
| print(response) |
20 changes: 20 additions & 0 deletions
20
methods/src/agents/conversations/agents_conversations_create.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| 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.conversations.create method | ||
| response = client.agents_conversations_create( | ||
| name="Migrate billing cron to Temporal", | ||
| session_id="ses_8675309", | ||
| origin_channel_id="C0123456789", | ||
| origin_message_ts="1717171717.123456", | ||
| ) | ||
|
|
||
| # Inspect the response | ||
| print(response) |
19 changes: 19 additions & 0 deletions
19
methods/src/agents/conversations/agents_conversations_get_canvas.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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.conversations.getCanvas method | ||
| response = client.agents_conversations_getCanvas( | ||
| channel="C9876543210", | ||
| canvas_id="F1234567890", | ||
| include_resolved=False, | ||
| ) | ||
|
|
||
| # Inspect the response | ||
| print(response) |
17 changes: 17 additions & 0 deletions
17
methods/src/agents/conversations/agents_conversations_list_views.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| 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.conversations.listViews method | ||
| response = client.agents_conversations_listViews( | ||
| channel_id="C9876543210", | ||
| ) | ||
|
|
||
| # Inspect the response | ||
| print(response) |
18 changes: 18 additions & 0 deletions
18
methods/src/agents/conversations/agents_conversations_remove_view.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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.conversations.removeView method | ||
| response = client.agents_conversations_removeView( | ||
| channel_id="C9876543210", | ||
| view_key="reports/coverage.html", | ||
| ) | ||
|
|
||
| # Inspect the response | ||
| print(response) |
19 changes: 19 additions & 0 deletions
19
methods/src/agents/conversations/agents_conversations_set_canvas_content.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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.conversations.setCanvasContent method | ||
| response = client.agents_conversations_setCanvasContent( | ||
| channel="C9876543210", | ||
| canvas_id="F1234567890", | ||
| content="# Migration plan\n\n1. Inventory cron jobs\n2. Port billing jobs last\n", | ||
| ) | ||
|
|
||
| # Inspect the response | ||
| print(response) |
32 changes: 32 additions & 0 deletions
32
methods/src/agents/conversations/agents_conversations_set_commands.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| 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.conversations.setCommands method | ||
| response = client.agents_conversations_setCommands( | ||
| channel_id="C9876543210", | ||
| commands=[ | ||
| { | ||
| "name": "create-pr", | ||
| "description": "Open a pull request for the current branch", | ||
| "argument_hint": "[title]", | ||
| }, | ||
| { | ||
| "name": "run-tests", | ||
| "description": "Run the test suite and report back", | ||
| }, | ||
| { | ||
| "name": "summarize", | ||
| "description": "Post a summary of the work so far", | ||
| }, | ||
| ], | ||
| ) | ||
|
|
||
| # Inspect the response | ||
| print(response) |
44 changes: 44 additions & 0 deletions
44
methods/src/agents/conversations/agents_conversations_set_properties.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| 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.conversations.setProperties method | ||
| response = client.agents_conversations_setProperties( | ||
| channel_id="C9876543210", | ||
| code_channel={ | ||
| "context_bar_items": [ | ||
| { | ||
| "key": "repo", | ||
| "label": "borant/billing", | ||
| "icon": "folder", | ||
| "url": "https://github.com/borant/billing", | ||
| }, | ||
| { | ||
| "key": "branch", | ||
| "label": "agent/migrate-cron", | ||
| "icon": "branch", | ||
| "url": "https://github.com/borant/billing/tree/agent/migrate-cron", | ||
| }, | ||
| { | ||
| "key": "pr", | ||
| "label": "PR #42 is open", | ||
| "icon": "hierarchy", | ||
| "url": "https://github.com/borant/billing/pull/42", | ||
| }, | ||
| { | ||
| "key": "ci", | ||
| "label": "Tests pending", | ||
| "icon": "terminal", | ||
| }, | ||
| ] | ||
| }, | ||
| ) | ||
|
|
||
| # Inspect the response | ||
| print(response) |
23 changes: 23 additions & 0 deletions
23
methods/src/agents/conversations/agents_conversations_set_view.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| 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.conversations.setView method | ||
| response = client.agents_conversations_setView( | ||
| channel_id="C9876543210", | ||
| view_key="reports/coverage.html", | ||
| name="Coverage", | ||
| content="<!doctype html><html><head>…</head><body>…</body></html>", | ||
| csp={ | ||
| "resource_domains": ["https://cdn.jsdelivr.net"], | ||
| }, | ||
| ) | ||
|
|
||
| # Inspect the response | ||
| print(response) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| { | ||
| "display_information": { | ||
| "name": "Slack API Methods", | ||
| "description": "Example implementations to call \"agents.conversations\" methods" | ||
| }, | ||
| "features": { | ||
| "bot_user": { | ||
| "display_name": "Slack API Methods", | ||
| "always_online": true | ||
| }, | ||
| "code_channels": { | ||
| "enabled": true | ||
| } | ||
| }, | ||
| "oauth_config": { | ||
| "scopes": { | ||
| "bot": ["code_channels:manage"] | ||
| } | ||
| }, | ||
| "settings": { | ||
| "org_deploy_enabled": true, | ||
| "socket_mode_enabled": true, | ||
| "token_rotation_enabled": false | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👁️🗨️ note: This is required for commands to be created with a placeholder URL.