Skip to content

Commit 133f03a

Browse files
authored
Update the Slack toolkit docs for new refactored version (#340)
update slack toolkit docs for new refactored version
1 parent b5a1ca2 commit 133f03a

File tree

53 files changed

+1147
-632
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+1147
-632
lines changed

pages/toolkits/social-communication/slack.mdx

Lines changed: 464 additions & 309 deletions
Large diffs are not rendered by default.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Slack Environment Variables
2+
3+
### `SLACK_MAX_CONCURRENT_REQUESTS`
4+
5+
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.
6+
7+
The value must be a numeric string with an integer greater than or equal to 1.
8+
9+
**Default:** `3`
10+
11+
12+
### `MAX_PAGINATION_SIZE_LIMIT`
13+
14+
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`.
15+
16+
**Default:** `200` (Slack supports, but discourages a limit larger than 200)
17+
18+
19+
### `MAX_PAGINATION_TIMEOUT_SECONDS`
20+
21+
Controls the maximum number of seconds any given Slack tool should wait while paginating responses from the Slack API.
22+
23+
**Default:** `30` (expressed in seconds)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Slack Reference
2+
3+
Below is a reference of enumerations used by some tools in the Slack toolkit:
4+
5+
## ConversationType
6+
7+
- **PUBLIC_CHANNEL**: `public_channel`
8+
- **PRIVATE_CHANNEL**: `private_channel`
9+
- **MULTI_PERSON_DIRECT_MESSAGE**: `multi_person_direct_message`
10+
- **DIRECT_MESSAGE**: `direct_message`

public/examples/integrations/toolkits/slack/get_channel_metadata_by_name_example_call_tool.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,24 @@ const USER_ID = "{arcade_user_id}";
66
const TOOL_NAME = "Slack.GetChannelMetadataByName";
77

88
// Start the authorization process
9-
const authResponse = await client.tools.authorize({
10-
tool_name: TOOL_NAME,
11-
user_id: USER_ID,
12-
});
9+
const authResponse = await client.tools.authorize({tool_name: TOOL_NAME});
1310

1411
if (authResponse.status !== "completed") {
15-
console.log(`Click this link to authorize: ${authResponse.url}`);
12+
console.log(`Click this link to authorize: ${authResponse.url}`);
1613
}
1714

1815
// Wait for the authorization to complete
1916
await client.auth.waitForCompletion(authResponse);
2017

2118
const toolInput = {
22-
channel_name: "general"
19+
"channel_name": "general",
20+
"next_cursor": "abc123"
2321
};
2422

2523
const response = await client.tools.execute({
26-
tool_name: TOOL_NAME,
27-
input: toolInput,
28-
user_id: USER_ID,
24+
tool_name: TOOL_NAME,
25+
input: toolInput,
26+
user_id: USER_ID,
2927
});
3028

31-
console.log(response);
29+
console.log(JSON.stringify(response.output.value, null, 2));
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1+
import json
12
from arcadepy import Arcade
23

34
client = Arcade() # Automatically finds the `ARCADE_API_KEY` env variable
45

56
USER_ID = "{arcade_user_id}"
67
TOOL_NAME = "Slack.GetChannelMetadataByName"
78

8-
auth_response = client.tools.authorize(
9-
tool_name=TOOL_NAME,
10-
user_id=USER_ID,
11-
)
9+
auth_response = client.tools.authorize(tool_name=TOOL_NAME)
1210

1311
if auth_response.status != "completed":
1412
print(f"Click this link to authorize: {auth_response.url}")
1513

1614
# Wait for the authorization to complete
1715
client.auth.wait_for_completion(auth_response)
1816

19-
tool_input = {"channel_name": "general"}
17+
tool_input = {
18+
'channel_name': 'general', 'next_cursor': 'abc123'
19+
}
2020

2121
response = client.tools.execute(
2222
tool_name=TOOL_NAME,
2323
input=tool_input,
2424
user_id=USER_ID,
2525
)
26-
print(response)
26+
print(json.dumps(response.output.value, indent=2))

public/examples/integrations/toolkits/slack/get_conversation_metadata_by_id_example_call_tool.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,23 @@ const USER_ID = "{arcade_user_id}";
66
const TOOL_NAME = "Slack.GetConversationMetadataById";
77

88
// Start the authorization process
9-
const authResponse = await client.tools.authorize({
10-
tool_name: TOOL_NAME,
11-
user_id: USER_ID,
12-
});
9+
const authResponse = await client.tools.authorize({tool_name: TOOL_NAME});
1310

1411
if (authResponse.status !== "completed") {
15-
console.log(`Click this link to authorize: ${authResponse.url}`);
12+
console.log(`Click this link to authorize: ${authResponse.url}`);
1613
}
1714

1815
// Wait for the authorization to complete
1916
await client.auth.waitForCompletion(authResponse);
2017

2118
const toolInput = {
22-
conversation_id: "C1234567890"
19+
"conversation_id": "C1234567890"
2320
};
2421

2522
const response = await client.tools.execute({
26-
tool_name: TOOL_NAME,
27-
input: toolInput,
28-
user_id: USER_ID,
23+
tool_name: TOOL_NAME,
24+
input: toolInput,
25+
user_id: USER_ID,
2926
});
3027

31-
console.log(response);
28+
console.log(JSON.stringify(response.output.value, null, 2));
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1+
import json
12
from arcadepy import Arcade
23

34
client = Arcade() # Automatically finds the `ARCADE_API_KEY` env variable
45

56
USER_ID = "{arcade_user_id}"
67
TOOL_NAME = "Slack.GetConversationMetadataById"
78

8-
auth_response = client.tools.authorize(
9-
tool_name=TOOL_NAME,
10-
user_id=USER_ID,
11-
)
9+
auth_response = client.tools.authorize(tool_name=TOOL_NAME)
1210

1311
if auth_response.status != "completed":
1412
print(f"Click this link to authorize: {auth_response.url}")
1513

1614
# Wait for the authorization to complete
1715
client.auth.wait_for_completion(auth_response)
1816

19-
tool_input = {"conversation_id": "C1234567890"}
17+
tool_input = {
18+
'conversation_id': 'C1234567890'
19+
}
2020

2121
response = client.tools.execute(
2222
tool_name=TOOL_NAME,
2323
input=tool_input,
2424
user_id=USER_ID,
2525
)
26-
print(response)
26+
print(json.dumps(response.output.value, indent=2))
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { Arcade } from "@arcadeai/arcadejs";
2+
3+
const client = new Arcade(); // Automatically finds the `ARCADE_API_KEY` env variable
4+
5+
const USER_ID = "[email protected]"; // Unique identifier for your user (email, UUID, etc.)
6+
const TOOL_NAME = "Slack.GetConversationMetadata";
7+
8+
// Start the authorization process
9+
const authResponse = await client.tools.authorize({tool_name: TOOL_NAME});
10+
11+
if (authResponse.status !== "completed") {
12+
console.log(`Click this link to authorize: ${authResponse.url}`);
13+
}
14+
15+
// Wait for the authorization to complete
16+
await client.auth.waitForCompletion(authResponse);
17+
18+
const toolInput = {
19+
"conversation_id": "C1234567890"
20+
};
21+
22+
const response = await client.tools.execute({
23+
tool_name: TOOL_NAME,
24+
input: toolInput,
25+
user_id: USER_ID,
26+
});
27+
28+
console.log(JSON.stringify(response.output.value, null, 2));
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import json
2+
from arcadepy import Arcade
3+
4+
client = Arcade() # Automatically finds the `ARCADE_API_KEY` env variable
5+
6+
USER_ID = "[email protected]" # Unique identifier for your user (email, UUID, etc.)
7+
TOOL_NAME = "Slack.GetConversationMetadata"
8+
9+
auth_response = client.tools.authorize(tool_name=TOOL_NAME)
10+
11+
if auth_response.status != "completed":
12+
print(f"Click this link to authorize: {auth_response.url}")
13+
14+
# Wait for the authorization to complete
15+
client.auth.wait_for_completion(auth_response)
16+
17+
tool_input = {
18+
'conversation_id': 'C1234567890'
19+
}
20+
21+
response = client.tools.execute(
22+
tool_name=TOOL_NAME,
23+
input=tool_input,
24+
user_id=USER_ID,
25+
)
26+
print(json.dumps(response.output.value, indent=2))

public/examples/integrations/toolkits/slack/get_direct_message_conversation_metadata_by_username_example_call_tool.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,24 @@ const USER_ID = "{arcade_user_id}";
66
const TOOL_NAME = "Slack.GetDirectMessageConversationMetadataByUsername";
77

88
// Start the authorization process
9-
const authResponse = await client.tools.authorize({
10-
tool_name: TOOL_NAME,
11-
user_id: USER_ID,
12-
});
9+
const authResponse = await client.tools.authorize({tool_name: TOOL_NAME});
1310

1411
if (authResponse.status !== "completed") {
15-
console.log(`Click this link to authorize: ${authResponse.url}`);
12+
console.log(`Click this link to authorize: ${authResponse.url}`);
1613
}
1714

1815
// Wait for the authorization to complete
1916
await client.auth.waitForCompletion(authResponse);
2017

2118
const toolInput = {
22-
username: "john_doe"
19+
"username": "john_doe",
20+
"next_cursor": "abc123"
2321
};
2422

2523
const response = await client.tools.execute({
26-
tool_name: TOOL_NAME,
27-
input: toolInput,
28-
user_id: USER_ID,
24+
tool_name: TOOL_NAME,
25+
input: toolInput,
26+
user_id: USER_ID,
2927
});
3028

31-
console.log(response);
29+
console.log(JSON.stringify(response.output.value, null, 2));

0 commit comments

Comments
 (0)