-
Notifications
You must be signed in to change notification settings - Fork 7
Update the Slack toolkit docs for new refactored version #340
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
Large diffs are not rendered by default.
Oops, something went wrong.
23 changes: 23 additions & 0 deletions
23
pages/toolkits/social-communication/slack/environment_variables.mdx
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 @@ | ||
| # Slack Environment Variables | ||
|
|
||
| ### `SLACK_MAX_CONCURRENT_REQUESTS` | ||
|
|
||
| Arcade uses asynchronous calls to request Slack API endpoints. In some tools, multiple concurrent HTTP requests may be issued to speed up execution. This environment variable controls the maximum number of concurrent requests to Slack API in any tool execution. | ||
|
|
||
| The value must be a numeric string with an integer greater than or equal to 1. | ||
|
|
||
| **Default:** `3` | ||
|
|
||
|
|
||
| ### `MAX_PAGINATION_SIZE_LIMIT` | ||
|
|
||
| This environment variable controls the maximum number of items requested in a single call to a Slack API endpoint. Some of the Slack tools allow the tool caller to request a larger number of items per tool call, but the tool will paginate the results internally while respecting the `MAX_PAGINATION_SIZE_LIMIT`. | ||
|
|
||
| **Default:** `200` (Slack supports, but discourages a limit larger than 200) | ||
|
|
||
|
|
||
| ### `MAX_PAGINATION_TIMEOUT_SECONDS` | ||
|
|
||
| Controls the maximum number of seconds any given Slack tool should wait while paginating responses from the Slack API. | ||
|
|
||
| **Default:** `30` (expressed in seconds) | ||
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,10 @@ | ||
| # Slack Reference | ||
|
|
||
| Below is a reference of enumerations used by some tools in the Slack toolkit: | ||
|
|
||
| ## ConversationType | ||
|
|
||
| - **PUBLIC_CHANNEL**: `public_channel` | ||
| - **PRIVATE_CHANNEL**: `private_channel` | ||
| - **MULTI_PERSON_DIRECT_MESSAGE**: `multi_person_direct_message` | ||
| - **DIRECT_MESSAGE**: `direct_message` |
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
12 changes: 6 additions & 6 deletions
12
...ic/examples/integrations/toolkits/slack/get_channel_metadata_by_name_example_call_tool.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 |
|---|---|---|
| @@ -1,26 +1,26 @@ | ||
| import json | ||
| from arcadepy import Arcade | ||
|
|
||
| client = Arcade() # Automatically finds the `ARCADE_API_KEY` env variable | ||
|
|
||
| USER_ID = "{arcade_user_id}" | ||
| TOOL_NAME = "Slack.GetChannelMetadataByName" | ||
|
|
||
| auth_response = client.tools.authorize( | ||
| tool_name=TOOL_NAME, | ||
| user_id=USER_ID, | ||
| ) | ||
| auth_response = client.tools.authorize(tool_name=TOOL_NAME) | ||
|
|
||
| if auth_response.status != "completed": | ||
| print(f"Click this link to authorize: {auth_response.url}") | ||
|
|
||
| # Wait for the authorization to complete | ||
| client.auth.wait_for_completion(auth_response) | ||
|
|
||
| tool_input = {"channel_name": "general"} | ||
| tool_input = { | ||
| 'channel_name': 'general', 'next_cursor': 'abc123' | ||
| } | ||
|
|
||
| response = client.tools.execute( | ||
| tool_name=TOOL_NAME, | ||
| input=tool_input, | ||
| user_id=USER_ID, | ||
| ) | ||
| print(response) | ||
| print(json.dumps(response.output.value, indent=2)) |
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
12 changes: 6 additions & 6 deletions
12
...examples/integrations/toolkits/slack/get_conversation_metadata_by_id_example_call_tool.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 |
|---|---|---|
| @@ -1,26 +1,26 @@ | ||
| import json | ||
| from arcadepy import Arcade | ||
|
|
||
| client = Arcade() # Automatically finds the `ARCADE_API_KEY` env variable | ||
|
|
||
| USER_ID = "{arcade_user_id}" | ||
| TOOL_NAME = "Slack.GetConversationMetadataById" | ||
|
|
||
| auth_response = client.tools.authorize( | ||
| tool_name=TOOL_NAME, | ||
| user_id=USER_ID, | ||
| ) | ||
| auth_response = client.tools.authorize(tool_name=TOOL_NAME) | ||
|
|
||
| if auth_response.status != "completed": | ||
| print(f"Click this link to authorize: {auth_response.url}") | ||
|
|
||
| # Wait for the authorization to complete | ||
| client.auth.wait_for_completion(auth_response) | ||
|
|
||
| tool_input = {"conversation_id": "C1234567890"} | ||
| tool_input = { | ||
| 'conversation_id': 'C1234567890' | ||
| } | ||
|
|
||
| response = client.tools.execute( | ||
| tool_name=TOOL_NAME, | ||
| input=tool_input, | ||
| user_id=USER_ID, | ||
| ) | ||
| print(response) | ||
| print(json.dumps(response.output.value, indent=2)) |
28 changes: 28 additions & 0 deletions
28
public/examples/integrations/toolkits/slack/get_conversation_metadata_example_call_tool.js
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,28 @@ | ||
| import { Arcade } from "@arcadeai/arcadejs"; | ||
|
|
||
| const client = new Arcade(); // Automatically finds the `ARCADE_API_KEY` env variable | ||
|
|
||
| const USER_ID = "[email protected]"; // Unique identifier for your user (email, UUID, etc.) | ||
| const TOOL_NAME = "Slack.GetConversationMetadata"; | ||
|
|
||
| // Start the authorization process | ||
| const authResponse = await client.tools.authorize({tool_name: TOOL_NAME}); | ||
|
|
||
| if (authResponse.status !== "completed") { | ||
| console.log(`Click this link to authorize: ${authResponse.url}`); | ||
| } | ||
|
|
||
| // Wait for the authorization to complete | ||
| await client.auth.waitForCompletion(authResponse); | ||
|
|
||
| const toolInput = { | ||
| "conversation_id": "C1234567890" | ||
| }; | ||
|
|
||
| const response = await client.tools.execute({ | ||
| tool_name: TOOL_NAME, | ||
| input: toolInput, | ||
| user_id: USER_ID, | ||
| }); | ||
|
|
||
| console.log(JSON.stringify(response.output.value, null, 2)); |
26 changes: 26 additions & 0 deletions
26
public/examples/integrations/toolkits/slack/get_conversation_metadata_example_call_tool.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,26 @@ | ||
| import json | ||
| from arcadepy import Arcade | ||
|
|
||
| client = Arcade() # Automatically finds the `ARCADE_API_KEY` env variable | ||
|
|
||
| USER_ID = "[email protected]" # Unique identifier for your user (email, UUID, etc.) | ||
| TOOL_NAME = "Slack.GetConversationMetadata" | ||
|
|
||
| auth_response = client.tools.authorize(tool_name=TOOL_NAME) | ||
|
|
||
| if auth_response.status != "completed": | ||
| print(f"Click this link to authorize: {auth_response.url}") | ||
|
|
||
| # Wait for the authorization to complete | ||
| client.auth.wait_for_completion(auth_response) | ||
|
|
||
| tool_input = { | ||
| 'conversation_id': 'C1234567890' | ||
| } | ||
|
|
||
| response = client.tools.execute( | ||
| tool_name=TOOL_NAME, | ||
| input=tool_input, | ||
| user_id=USER_ID, | ||
| ) | ||
| print(json.dumps(response.output.value, indent=2)) |
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
12 changes: 6 additions & 6 deletions
12
.../toolkits/slack/get_direct_message_conversation_metadata_by_username_example_call_tool.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 |
|---|---|---|
| @@ -1,26 +1,26 @@ | ||
| import json | ||
| from arcadepy import Arcade | ||
|
|
||
| client = Arcade() # Automatically finds the `ARCADE_API_KEY` env variable | ||
|
|
||
| USER_ID = "{arcade_user_id}" | ||
| TOOL_NAME = "Slack.GetDirectMessageConversationMetadataByUsername" | ||
|
|
||
| auth_response = client.tools.authorize( | ||
| tool_name=TOOL_NAME, | ||
| user_id=USER_ID, | ||
| ) | ||
| auth_response = client.tools.authorize(tool_name=TOOL_NAME) | ||
|
|
||
| if auth_response.status != "completed": | ||
| print(f"Click this link to authorize: {auth_response.url}") | ||
|
|
||
| # Wait for the authorization to complete | ||
| client.auth.wait_for_completion(auth_response) | ||
|
|
||
| tool_input = {"username": "john_doe"} | ||
| tool_input = { | ||
| 'username': 'john_doe', 'next_cursor': 'abc123' | ||
| } | ||
|
|
||
| response = client.tools.execute( | ||
| tool_name=TOOL_NAME, | ||
| input=tool_input, | ||
| user_id=USER_ID, | ||
| ) | ||
| print(response) | ||
| print(json.dumps(response.output.value, indent=2)) |
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
12 changes: 6 additions & 6 deletions
12
.../examples/integrations/toolkits/slack/get_members_in_channel_by_name_example_call_tool.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 |
|---|---|---|
| @@ -1,26 +1,26 @@ | ||
| import json | ||
| from arcadepy import Arcade | ||
|
|
||
| client = Arcade() # Automatically finds the `ARCADE_API_KEY` env variable | ||
|
|
||
| USER_ID = "{arcade_user_id}" | ||
| TOOL_NAME = "Slack.GetMembersInChannelByName" | ||
|
|
||
| auth_response = client.tools.authorize( | ||
| tool_name=TOOL_NAME, | ||
| user_id=USER_ID, | ||
| ) | ||
| auth_response = client.tools.authorize(tool_name=TOOL_NAME) | ||
|
|
||
| if auth_response.status != "completed": | ||
| print(f"Click this link to authorize: {auth_response.url}") | ||
|
|
||
| # Wait for the authorization to complete | ||
| client.auth.wait_for_completion(auth_response) | ||
|
|
||
| tool_input = {"channel_name": "general", "limit": 100} | ||
| tool_input = { | ||
| 'channel_name': 'general', 'limit': 10 | ||
| } | ||
|
|
||
| response = client.tools.execute( | ||
| tool_name=TOOL_NAME, | ||
| input=tool_input, | ||
| user_id=USER_ID, | ||
| ) | ||
| print(response) | ||
| print(json.dumps(response.output.value, indent=2)) |
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.
Not in scope for this PR, but I feel that env vars wasn't the best way to do this, because you can't control them on the common Arcade workers. We need something like a secret that isn't secret...