tinybot
A tiny wrapper around the slack RTM api.
Requirements
A slack bot token and node 4.2+.
What is included
- listen for any message in slack
- listen only for messages matching multiple fields
- deregister listeners matching a wildcard
- respond with text in a channel specified by name or ID
What is not included
- DM functionality
- At mentions
- Incoming/outgoing webhook integration
- Explicit API for adding reactions
- Message storage backend
- Reconnect logic
- Pretty much everything else
Usage
Hello World
var Tinybot = ;var bot = 'mySecretSlackToken'; bot; // posts to #general by defaultbot; // post to a channel by namebot; // post to a channel by ID
Basic listener: fires for every message over slack websocket
var Tinybot = ;var bot = 'mySecretSlackToken'; bot
Filtered listeners
var Tinybot = ;var bot = 'mySecretSlackToken' '#random'; // listen for only messages in a channelbot // rain on everyone's parade with regex matchesbot // trolls anyone who posts in #random from an iPhone with nested matchersbot // snooze one meeting with hearsOncebot bot; // deregister functions named foo and fooBarbot; // deregister all listeners