Table Of Contents

astro

astro is a nodejs bot for flowdock. Its particularity is its ability to learn new commands.

Introduction

astro is a nodejs bot for flowdock. Its particularity is its ability to learn new commands.

Installation

Install dependencies

Dependencies are managed through npm

npm install

Configure

You have to configure the bot to use your own flowdock API tokens

mv config.sample.js config.js
vim config.js

Basic configuration reference

In order to get your flowdock tokens, go to https://www.flowdock.com/account/tokens,

  • userToken = Personal API token
  • apiToken = Flow API token.

apiToken must match the corresponding flow. You can see that all configuration options reside under the ‘default’ key, it allow you to define multiple configs.

var config = {
  'default': {
    'botName':        'astro',                // name of your bot
    'org':            'ORGANIZATION_NAME',    // flowdock organization name
    'flow':           'FLOW_NAME',            // flowdock flow name
    'userToken':      'YOUR_FLOW_USER_TOKEN', // flowdock personal API token
    'apiToken':       'YOUR_FLOW_API_TOKEN',  // flowdock flow API token
    'welcomeMessage': 'Hi, I\'m astro'        // message to display on bot connection
  }
};

Run

You’re now ready to launch astro, simply type teh following command in the root folder

node astro.js default

If you want to run the bot with a different configuration, define it and call

node astro.js CONFIG_KEY

Usage

Once astro is running, you just have to type a command in flowdock, then, if astro find a matching command, it will process it and send the response in the same flow. For example, if you want to invoke the ‘pt’ command:

pt documentation astro

Output

+---------------------------------+
| 1 documentation point for astro |
+---------------------------------+

Commands have an available help, to show it:

pt help

Output

pt help                                                            author: astr⦿
————————————————————————————————————————————————————————————————————————————————
give a type point to the given user
usage:
➜ pt humor john

Available commands

List command

The list command display the list of all available commands, to invoke it:

list-cmd

Sample output

astr⦿ available commands
————————————————————————————————————————————————————————————————————————————————
• teach .................................................................. astr⦿
• list-cmd ............................................................... astr⦿
• so ..................................................................... astr⦿
• pt ..................................................................... astr⦿
• relic .................................................................. astr⦿
...

So command

The so command display an image (most of them are animated gifs) according to the given term, example:

so crazy

Output

http://i188.photobucket.com/albums/z284/oblongman7/Scrubs/b6488ee3.gif

note: flowdock automatically convert the link to an image.

Point command

Tests

You can run tests with the following command:

./node_modules/.bin/vows tests/*