Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
773 changes: 464 additions & 309 deletions pages/toolkits/social-communication/slack.mdx

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Slack Environment Variables
Copy link
Contributor

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...


### `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)
10 changes: 10 additions & 0 deletions pages/toolkits/social-communication/slack/reference.mdx
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`
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,24 @@ const USER_ID = "{arcade_user_id}";
const TOOL_NAME = "Slack.GetChannelMetadataByName";

// Start the authorization process
const authResponse = await client.tools.authorize({
tool_name: TOOL_NAME,
user_id: USER_ID,
});
const authResponse = await client.tools.authorize({tool_name: TOOL_NAME});

if (authResponse.status !== "completed") {
console.log(`Click this link to authorize: ${authResponse.url}`);
console.log(`Click this link to authorize: ${authResponse.url}`);
}

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

const toolInput = {
channel_name: "general"
"channel_name": "general",
"next_cursor": "abc123"
};

const response = await client.tools.execute({
tool_name: TOOL_NAME,
input: toolInput,
user_id: USER_ID,
tool_name: TOOL_NAME,
input: toolInput,
user_id: USER_ID,
});

console.log(response);
console.log(JSON.stringify(response.output.value, null, 2));
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))
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,23 @@ const USER_ID = "{arcade_user_id}";
const TOOL_NAME = "Slack.GetConversationMetadataById";

// Start the authorization process
const authResponse = await client.tools.authorize({
tool_name: TOOL_NAME,
user_id: USER_ID,
});
const authResponse = await client.tools.authorize({tool_name: TOOL_NAME});

if (authResponse.status !== "completed") {
console.log(`Click this link to authorize: ${authResponse.url}`);
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"
"conversation_id": "C1234567890"
};

const response = await client.tools.execute({
tool_name: TOOL_NAME,
input: toolInput,
user_id: USER_ID,
tool_name: TOOL_NAME,
input: toolInput,
user_id: USER_ID,
});

console.log(response);
console.log(JSON.stringify(response.output.value, null, 2));
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))
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));
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))
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,24 @@ const USER_ID = "{arcade_user_id}";
const TOOL_NAME = "Slack.GetDirectMessageConversationMetadataByUsername";

// Start the authorization process
const authResponse = await client.tools.authorize({
tool_name: TOOL_NAME,
user_id: USER_ID,
});
const authResponse = await client.tools.authorize({tool_name: TOOL_NAME});

if (authResponse.status !== "completed") {
console.log(`Click this link to authorize: ${authResponse.url}`);
console.log(`Click this link to authorize: ${authResponse.url}`);
}

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

const toolInput = {
username: "john_doe"
"username": "john_doe",
"next_cursor": "abc123"
};

const response = await client.tools.execute({
tool_name: TOOL_NAME,
input: toolInput,
user_id: USER_ID,
tool_name: TOOL_NAME,
input: toolInput,
user_id: USER_ID,
});

console.log(response);
console.log(JSON.stringify(response.output.value, null, 2));
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))
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,24 @@ const USER_ID = "{arcade_user_id}";
const TOOL_NAME = "Slack.GetMembersInChannelByName";

// Start the authorization process
const authResponse = await client.tools.authorize({
tool_name: TOOL_NAME,
user_id: USER_ID,
});
const authResponse = await client.tools.authorize({tool_name: TOOL_NAME});

if (authResponse.status !== "completed") {
console.log(`Click this link to authorize: ${authResponse.url}`);
console.log(`Click this link to authorize: ${authResponse.url}`);
}

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

const toolInput = {
channel_name: "general",
limit: 100
"channel_name": "general",
"limit": 10
};

const response = await client.tools.execute({
tool_name: TOOL_NAME,
input: toolInput,
user_id: USER_ID,
tool_name: TOOL_NAME,
input: toolInput,
user_id: USER_ID,
});

console.log(response);
console.log(JSON.stringify(response.output.value, null, 2));
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))
Loading