0.0.27 • Published 5 years ago
@sagi.io/cfw-slack v0.0.27
cfw-slack
@sagi.io/cfw-slack
allows
you to use Slack's Web API within Cloudflare Workers.
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
5 years ago
0.0.25
5 years ago
0.0.24
5 years ago
0.0.23
5 years ago
0.0.21
6 years ago
0.0.20
6 years ago
0.0.19
6 years ago
0.0.18
6 years ago
0.0.17
6 years ago
0.0.15
6 years ago
0.0.14
6 years ago
0.0.13
6 years ago
0.0.10
6 years ago
0.0.9
6 years ago
0.0.8
6 years ago
0.0.7
6 years ago
0.0.5
6 years ago
0.0.4
6 years ago
0.0.3
6 years ago
0.0.2
6 years ago
0.0.1
6 years ago