slackbot
Installation
$ npm install seed-slackbot
Slackbot API
constructor({Object|String} options)
Options should contain a token
field that is string.
Options could contain a processSlackbot
field, that is an optional boolean and false by default
Options could contain a processReplies
field, that is an optional boolean and false by default
Options could contain a processSubtypes
field, that is an optional boolean and false by default
Options could contain a processSelf
field, that is an optional boolean and false by default
Options could contain a mock
field, that is an optional boolean and false by default
var Slack = ;var slack = token: 'ABC123' processReplies: true ;var slack = 'ABC123'; // shorthand
request({String} method, {Object} data, {Function} callback(error, result)):Slack
Used to call slack web api
slack;
channel({String} term):Object
Get channel by name or id
var channel = slack;
user({String} term):Object
Get user by name or id
var user = slack;
im({String} term):Object
Get IM by id or user name or user id
var im = slack;
self():Object
Get current user
var self = slackself;
send({String|Object} channelId, {String} message):Slack
Send message to channel
slack;slack; // alternative
stream():DuplexStream
Get slackbot's internal duplex stream
var stream = slack; stream;
Usage
var Slack = ;var slack = token: processenvSLACK_TOKEN ; slack;
Testing
It's possible to mock slack transports to test slackbot and it's dependents
var slack = mock: true ; // simulate a message coming from slackslack; // examine messages going to slackslack; // examine requests going to slack and simulate slack responseslack;
TODO
Buffer stream until slack is connected
License
MIT