slack-msg-helper

1.0.0 • Public • Published

slack-helper

A Nodejs module facilitating Slack messaging.

installation

npm install --save slack-msg-helper

usage

Add client

const SL = require("slack-helper")
 
// Will create a default config
SL.addConfig("token","botname");
 
// Will create a config with name "slack1"
SL.addConfig("slack1","token","botname");
 

Use client

The client is chainable which means that you can call functions one after the other until you execute the posting. It then returning a promise.

Initialise a post:

// Creating message to group or channel called "my-channel"
SL.message("my-channel");
 
// Creating message to group or channel called "my-channel" using the config "slack1"
SL.message("my-channel").use("Client1")

Posting

For those example we will use the query variable 'slack':

// initialise query
var slack = SL.message("my-channel");

Simple message

slack.post("my message");

Message with JSON attachement

slack.post("my message", {...});

Readme

Keywords

Package Sidebar

Install

npm i slack-msg-helper

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

7.81 kB

Total Files

4

Last publish

Collaborators

  • samsoul007