Skip to main content
The SlackResourceClient allows you to connect to Slack workspaces and interact with the Slack Web API for messaging, channel operations, and more.

Usage

import { mySlackClient } from "./clients";

const result = await mySlackClient.invoke(
  "POST",
  "/api/chat.postMessage",
  "send-notification",
  {
    body: {
      type: "json",
      value: {
        channel: "C01234567",
        text: "Hello from Major!",
      },
    },
  }
);

if (result.ok && result.result.body.kind === "json") {
  console.log("Message sent:", result.result.body.value);
}

Direct Messages

The Slack integration accepts direct messages from users in addition to app mentions and threaded replies. Top-level DMs start new conversations, and threaded DM replies continue existing ones. This expands how users can interact with your bot via Slack—they can message it directly without mentioning it in a channel.

Channel Access Verification

Before performing any channel operations, the AI agent must verify that the bot has access to the target channel. The agent calls slack_list_channels first to confirm bot access. If the bot isn’t in the channel, the agent will instruct you to invite @Major Slack Integration and re-verify access before proceeding with messages, file posts, or history reads.

File Uploads

The Slack connector supports file uploads via Slack’s external upload API. The flow involves requesting an upload URL, uploading the file, and completing the upload.
File upload requires the files:write and files:read OAuth scopes. If your Slack connector was created before file upload support was added, you’ll need to reauthorize it to get the new scopes.

Account Linking

Users can link their Slack identity to their Major account for a seamless experience. After linking, users can manage their connected Slack accounts from the Connected Accounts settings page.

Inputs

The invoke method accepts the following arguments:
method
string
required
The HTTP method to use: "GET" or "POST".
path
string
required
The Slack Web API path (e.g., /api/chat.postMessage, /api/channels.list).
invocationKey
string
required
A unique identifier for this operation.
options
object
Optional configuration object.

Outputs

The output format is the same as the Custom API client.
kind
"api"
Discriminator for the response type.
status
number
The HTTP status code.
body
ResponseBody
The response body (typically JSON).