super-slack

0.0.4 • Public • Published

Super Slack

A tool for creating Slack bots with Node.js.

var Slack = require('super-slack');
 
var slackBot = new Slack.Bot('http://slack/webhook', {
    username: 'Elon Musk Bot',
    emoji: ':rocket:',
    channel: '#general' // Default channel
});
 
var quotes = [
    "When something is important enough, you do it even if the odds are not in your favor.",
    "Failure is an option here. If things are not failing, you are not innovating enough.",
    "Any product that needs a manual to work is broken."
];
 
slackBot.send(quotes[Math.floor(Math.random() * quotes.length)])
.then(console.log)
.fail(console.error);

Bot(webhook, options)

  • webhook (string) Incoming Webhook provided by Slack.
  • options (object)
    • username: Name of the bot
    • [emoji]: Emoji icon to use as the bot's avatar

Bot.send(message)

  • message (Object|string): The message to send to the Slack channel.
    • text: Text of message to send.
    • channel: Channel to send the message to.

Bot.respond(request)

Readme

Keywords

Package Sidebar

Install

npm i super-slack

Weekly Downloads

2

Version

0.0.4

License

MIT

Last publish

Collaborators

  • maxprogram