0.0.27 • Published 4 years ago

@sagi.io/cfw-slack v0.0.27

Weekly downloads
21
License
MIT
Repository
github
Last release
4 years ago

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)
0.0.27

4 years ago

0.0.25

4 years ago

0.0.24

4 years ago

0.0.23

4 years ago

0.0.21

4 years ago

0.0.20

4 years ago

0.0.19

4 years ago

0.0.18

4 years ago

0.0.17

5 years ago

0.0.15

5 years ago

0.0.14

5 years ago

0.0.13

5 years ago

0.0.10

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago