/hubot-symphony

Hubot adapter for Symphony

Primary LanguageCoffeeScriptApache License 2.0Apache-2.0

hubot-symphony

Hubot adapter for Symphony developed by the Symphony Foundation

Build Status Coverage Status Code Climate Dependency Status bitHound Dependencies bitHound Dev Dependencies NSP Status

semantic-release Commitizen friendly

NPM

Usage

You must pass the following environment variables to hubot

  • HUBOT_SYMPHONY_HOST set to the url of your pod without the https:// prefix
  • HUBOT_SYMPHONY_PUBLIC_KEY set to the location of your bot account .pem public key file
  • HUBOT_SYMPHONY_PRIVATE_KEY set to the location of your bot account .pem private key file
  • HUBOT_SYMPHONY_PASSPHRASE set to the passphrase associated with your bot account private key

These arguments are passed through to the NodeJs request module as described here.

If you want to send a rich message you can call send with an Object instead of a String

module.exports = (robot) ->
  robot.respond /pug me/i, (msg) ->
    msg.http("http://pugme.herokuapp.com/random")
      .get() (err, res, body) ->
        pug = JSON.parse(body).pug
        msg.send pug
        msg.send {
          format: 'MESSAGEML'
          text: "<messageML><a href=\"#{pug}\"/></messageML>"
        }

Diagnostics

A simple diagnostic script is included to help confirm that you have all the necessary pieces to get started. You can run this as follows:

npm install hubot-symphony
npm run diagnostic -- --publicKey [key1.pem] --privateKey [key2.pem] --passphrase [changeit] --host [host.symphony.com]

If the script runs as expected it will obtain and log both session and key manager tokens, look up and log some details of the bot account and then create a datafeed and poll. If you send a message using the Symphony client to the bot account you should see the details logged.

Note

The privateKey.pem and publicKey.pem files under test/resources have been generated at random and are not real keys.