@restackio/integrations-slack
TypeScript icon, indicating that this package has built-in type declarations

0.0.4 • Public • Published

Slack for Restack

This package provides an integration for Slack with Restack, allowing:

Installation

To install the package, use npm or yarn:

npm install @restackio/integrations-slack

Configuration

Before using the Slack integration you need to set up your Slack Bot User OAuth token. You can do this by setting an environment variable or passing it directly to the functions.

  1. Set up environment variables:
SLACK_TOKEN=your_slack_bot_user_oauth_token
  1. Or pass them directly when calling the functions (see Usage section).

Usage

Starting the Slack Service

To start the Slack service, use the slackService function:

import Restack from "@restackio/ai";
import { slackService } from "@restackio/integrations-slack";

const client = new Restack();

slackService({ client }).catch((err) => {
  console.error("Error starting Slack service:", err);
});

Using the Slack Post Message Function

This function allows the posting of messages to conversations.

In order to use this function your Slack Bot User OAuth token must have one of these scopes:

  • bot
  • chat:bot:write
  • chat:user:write
import { postMessage } from "@restackio/integrations-slack/functions";

const result = await postMessage({
  blocks, // optional
  conversationId: "your_conversation_id", // Can be a channel ID, a DM ID, a MPDM ID, or a group ID
  mrkdwn, // defaults to true
  text: "Hello World!",
  token: "your_slack_bot_user_oauth_token", // Optional if set in environment variables
});

console.log(result);

Readme

Keywords

none

Package Sidebar

Install

npm i @restackio/integrations-slack

Weekly Downloads

7

Version

0.0.4

License

none

Unpacked Size

8.8 kB

Total Files

12

Last publish

Collaborators

  • atapiawastaken
  • osmanrestack
  • aboutphilippe