slack-alert
Slack Bot alert message
Install
To install slack-alert, simply use npm:
npm install slack-alert --save
Example
const SlackAlert = require('slack-alert')
let alert = SlackAlert({
name: 'bot',
token: 'token',
channel: '#channel'
})
alert.send(new Error('error'))
// multiple bots
let alert = SlackAlert([{
name: 'foo',
token: 'token',
channel: '#channel'
}, {
name: 'bar',
token: 'token',
channel: '#channel'
}])
alert.bot('foo').send(new Error('error'))
// different channel
alert.bot('foo').send(new Error('error'), '#another_channel')
API
SlackAlert(bots)
Creates a new instance of SlackAlert.
instance.bot(bot_name)
Change the current bot
instance.send(error[, channel])
Send a new error to slack
error, Error object or a stringchannel, Slack channel