hubot-as-syncbot
v0.0.6
Published
A sync bot for two services.
Downloads
2
Readme
Mebot
About
Webot is a chat bot built on the Hubot framework. It was initially generated by generator-hubot.
This project is a tying together of a yo generated hubot and several published packages for the purpose of taking an individual's presence in one room and replicating this onto a different service.
It was written by Andrew Lucas for resin.io's internal communication streamlining.
License
- Parts published by GitHub.
- Parts authored by Andrew Lucas (sqweelygig), owned by resin.io, and published under Apache-2.0.
Installation
Resin.io
- Get an app & device
- Create a new application in https://resin.io targeted for your hardware
- Download ResinOS, flash and boot to make your IoT device cloud manageable
- Set up environment
- Read the Environment Variables section of this document
- Use the Environment Variables page of your application or device
- Deploy the repo
git clone https://github.com/resin-io/hubot-as-mebot
thencd
into it- Add the remote using the provided command in the top right of resin.io
git push resin
& see the unicorn
Heroku
- Get an app
- Visit heroku.com, get an account
- Create a new app using the top right button
- Set up environment
- Read the Environment Variables section of this document
- Visit the settings tab of Heroku
- Use the Config Variables section on Heroku to configure how you wish
- Fork the repo
- This is optional if you have access to and trust an organisation that has already forked this repo (eg resin.io)
- Fork hubot-as-mebot
- Link the repo
- Visit the deploy Tab on Heroku
- Enable Automatic deploys from the master branch
- Activate the worker
- Visit the resources tab on Heroku
- Edit the web Dyno so it is not running
- Edit the worker Dyno so it is running
- Restart, just in case
- My experience is that once this is all set up it's best to restart
- Using the More dropdown (top right) restart all Dynos
Deployment without Trust
So, you don't trust the repo maintainers and want to follow the principle of least privilege. Good for you. You've got two easy options, either way you're going to have to take over the review and deploy yourself:
- Create and maintain your own Fork in step (3). More work, more secure.
- Leave deployment as manual in step (4). Less work, less secure.
Windows
- Get node.js
- I use whatever the latest ^6.x is.
- Plenty of guides exist for this, I'm not going to replicate or recommend.
- Clone the repo
git clone https://github.com/resin-io/hubot-as-mebot
- Set up environment
- Read the Environment Variables section of this document
- I quite like using
SET
commands in a .bat file for this
- Run the code
cd
into the code directorynpm run windows
- I quite like using a
CALL
in the .bat file for this
Environment Variables
HUBOT_ADAPTOR
- Always set toflowdock-listen-to-self
. Sets up which service to listen to. Runtime processes should force this.HUBOT_FLOWDOCK_API_TOKEN
- Personal API token from www.flowdock.com/account/tokens. eg43542ab245098dade5098f12430bcdfa
.HUBOT_FLOWDOCK_LISTEN_TO_SELF
- Always set to1
. This tells the adaptor to listen to it's own account. This modifications made in flowdock-attend-own-account. Runtime processes should force this.HUBOT_GITTER_API_TOKEN
- Personal Access Token from developer.gitter.im/apps. eg342d5aacbe45098ade243578de435fc425ad23ee
.HUBOT_GITTER_ROOM
- Name of the Gitter conversation to replicate to. egresin-io/sandbox
. This defaults toresin-io/public
.HUBOT_IGNORE_PREFIX
- Ignores lines based on a prefix. eg:
. This defaults to£
.HUBOT_MONITOR_ROOM
- ID of the Flowdock flow to replicate from, currently awkward to access. The utility command 'monitor log' will put this to the robot logger. egbed6fa5a-6a31-4a31-9b3b-9184b158c2b8
(r/sandbox). This defaults to3febc696-3aaf-4a83-9ddd-3a267abf4212
(public/chat).HUBOT_NAME
- Set to your own nickname in Flowdock. Tells Hubot what account it is using. egsqweelygig
.
Program Flow
- Connect
- because of
HUBOT_ADAPTOR
theflowdock-listen-to-self
adaptor connects to flowdock using theHUBOT_FLOWDOCK_API_TOKEN
and lists the channels it is joined to. This pays attention to the account's output because ofHUBOT_LISTEN_TO_SELF
.
- because of
- Receive
flowdock-ignore-by-prefix
intercepts all comments and stops the processing of any beginning withHUBOT_IGNORE_PREFIX
.hubot-room-select
intercepts all comments and stops any that are not fromHUBOT_MONITOR_ROOM
andHUBOT_NAME
(this module seems to have two purposes because it was coded to have monitor off|me|all, but our use case configures it into one monitor me).
- Listen
hubot-gitter-echo
hears all comments and echos them toHUBOT_GITTER_ROOM
usingHUBOT_GITTER_API_TOKEN
.hubot-rules
listens for "what are the three rules" and echoes Asimov's three rules. In the project because it is a good debug script.