This package has been deprecated

Author message:

Moved to @sagi.io/workers-slack

@sagi.io/cfw-slack

0.0.27 • Public • Published

cfw-slack

@sagi.io/cfw-slack allows you to use Slack's Web API within Cloudflare Workers.

CircleCI MIT License version

Installation

$ npm i @sagi.io/cfw-slack

Cloudflare Workers Usage

Initialize SlackREST:

// Without token:
const SlackREST = require('@sagi.io/cfw-slack')
const SlackAPI = new SlackREST()

// With token:
const botAccessToken = process.env.SLACK_BOT_ACCESS_TOKEN;
const SlackREST = require('@sagi.io/cfw-slack')
const SlackAPI = new SlackREST({ botAccessToken })

You can then use supported Slack methods. For instance, here's how to use the chat.postMessage method:

// SlackREST was initialized with a token
const formData = { channel: 'general', text: 'hello world'}

// SlackREST wasn't initialized with a token
const botAccessToken = process.env.SLACK_BOT_ACCESS_TOKEN;
const formData = { token: botAcccessToken, channel: 'general', text: 'hello world' }

const result = await SlackREST.chat.postMessage(formData)

Package Sidebar

Install

npm i @sagi.io/cfw-slack

Homepage

sagi.io

Weekly Downloads

0

Version

0.0.27

License

MIT

Unpacked Size

17.6 kB

Total Files

4

Last publish

Collaborators

  • kedmi