> ## Documentation Index
> Fetch the complete documentation index at: https://major-5cc5eebc-docs-bot-mr2qm9w6-typctx.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Slack

> Send messages and interact with the Slack Web API.

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

## Usage

```typescript theme={null}
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.

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

## 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:

<ParamField path="method" type="string" required>
  The HTTP method to use: `"GET"` or `"POST"`.
</ParamField>

<ParamField path="path" type="string" required>
  The Slack Web API path (e.g., `/api/chat.postMessage`, `/api/channels.list`).
</ParamField>

<ParamField path="invocationKey" type="string" required>
  A unique identifier for this operation.
</ParamField>

<ParamField path="options" type="object">
  Optional configuration object.

  <Expandable title="properties">
    <ParamField path="query" type="Record<string, string | string[]>">
      Query parameters.
    </ParamField>

    <ParamField path="body" type="object">
      The request body.

      <Expandable title="properties">
        <ParamField path="type" type="&#x22;json&#x22;" required />

        <ParamField path="value" type="unknown" required>
          The JSON payload.
        </ParamField>
      </Expandable>
    </ParamField>

    <ParamField path="timeoutMs" type="number">
      Timeout in milliseconds (default: 30000).
    </ParamField>
  </Expandable>
</ParamField>

## Outputs

The output format is the same as the [Custom API](/connectors/custom-api#outputs) client.

<ResponseField name="kind" type="&#x22;api&#x22;">
  Discriminator for the response type.
</ResponseField>

<ResponseField name="status" type="number">
  The HTTP status code.
</ResponseField>

<ResponseField name="body" type="ResponseBody">
  The response body (typically JSON).
</ResponseField>
