systemic-slack
v1.0.1
Published
Slack component for systemic
Downloads
3
Readme
systemic-slack
systemic-slack
Simple systemic component to send messages or files in Slack to any room.
Environment variables
- SLACK_TOKEN - Slack API token Slack Token Page
Usage
const System = require('systemic')
const slack = require('systemic-slack')
new System()
.configure({
slack: {
token: process.env.SLACK_TOKEN
}
})
.add('logger', console)
.add('slack', slack()).dependsOn('config')
.start((err, components) => {
/// do anything with components.slack
})
How to send a message
Use the client method chat.postMessage
, documentation is available here
await components.slack.chat.postMessage({
channel: 'CXXXXXX', // channel ID
text, // Text to send
});
How to send a file
Use the client method files.upload
, documentation is available here
const {createReadStream} = require('fs');
slackClient.files.upload({
filepath,
title,
channels: [ 'CXXXXXXX' ],
file: createReadStream(filepath),
});
Message format
Message content can be formated using MarkDown syntax Markdown cheatseet