1.0.0 • Published 7 years ago
slack-alert v1.0.0
slack-alert :rotating_light:
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()
- instance.bot()
- instance.send()
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
Events
- error
- sent
instance.on('error', (err) => {})
instance.on('sent', (slack_confirm) => {})
1.0.0
7 years ago