slack-attack
v1.2.1
Published
Use this to post pretty formatted messages to Slack
Downloads
5
Readme
:boom: Slack-Attack :metal:
Use this to as an interface to the Slack web API.
Usage
npm install slack-attack
var SlackAttack = require('slack-attack');
var slack = new SlackAttack('<YOUR-API-KEY>');
var options = { 'username': 'Test Bot',
'icon_emoji': ':robot_face:',
'link_names': 1 };
slack.chat('#<channel>', '<message>', options, function(err, posted, resp){
console.log(err, posted, resp);
});
channel
: the channel you want to post tomessage
: a string to post to the channel (can be an empty string)options
: an object with optional attachments for Slack. This follows the same convention as Slack's documentationcallback
: the function signature should be of the form of(err, posted, response)
whereerr
is the standard error of the request,posted
is a boolean response from Slack if your message was successfully posted, andresponse
is the body of the response from the Slack API.