Jarvis, a Slack-bot Which Does Far Too Much

2015-10-17

Technology

Subscribe with RSS

At some point, I plan to blog about my experiences setting up my home server, as well as managing the deployments of all of my other apps. That'll come later; for now, I'd like to introduce you to J.A.R.V.I.S., or Jarvis for short, a slack-bot which does far too much.

Jarvis is an app similar to Hubot. What's the difference? Well... Jarvis is written in Python. That's pretty much it, theoretically every Jarvis plugin could be written as a hubot extension, but then I'd have to write CoffeeScript and... ugh. That said, Hubot was the original inspiration for Jarvis; one of the companies at which I've worked had Hubot set up as an automated deploy-bot and that got me thinking about all the cool things I could do with a similar chat-bot. Shortly thereafter, me and my friends started using Slack for pretty much all our group chatting and the rest is history (in-the-making? Jarvis is still in-development!).

A bit of background about my house / roommates; we're all programmers and we've been living together for a couple years now. Understandably, our house looks like what you'd expect: we have a couple different sound systems set up, a projector in our basement / home theatre, ethernet wires running literally all across our house, and so on. Don't get me wrong, this is awesome, but the fact hat we originally had to manually turn the media centres off and on? Not OK. Clearly something had to be done.

Enter Jarvis. He's a work in progress, but soon he'll be the interface for our entire house. Feeling like listening to music? Jarvis works as well as Spotify. Want to download a movie? Jarvis will store it on the Stark Industries' Central Database (not really). Maybe you just want to know the weather? Jarvis knows the surf conditions.

Programmatically, keeping Jarvis simple was important. At startup, he simply scans through his plugins directory and "installs" them. The plugins read in any command we send to Jarvis over Slack, do whatever they need to, and (optionally) write any output back to the channel the command originated from. There's a couple requirements for plugins (they must have an "outputs" list, their entry must be a process_MESSAGETYPE function), but -- so long as those couple rules are followed -- everything should "just work".

Architecturally, Jarvis integrates perfectly with my PuppetFiles, which I used to manage any computer I touched (my laptop, my work computer, my servers, etc). In fact, all you need to do to install Jarvis is to run puppet manifest on a node configured to include slack::jarvis. More about these manifests and how they effectively manage everything will be posted eventually.

Interfaceially Of or pertaining to the interface, Jarvis is meant to be straightforward to use. If you tell Jarvis to "describe himself", he should do exactly that. If you tell him that "Jim sent $12 to Bob", he should remember that and make sure Bob knows he's in debt. Clearly, this is a far-reaching goal, but they did it in Iron Man so there should be no reason why I can't do it with Jarvis... right, guys? Guys? ...getting Jarvis to react to natural language is probably a pipe dream; I have nowhere near enough experience with NLP to build that. On that note, though...

If you want to check out Jarvis or -- hint, hint -- contribute to his skillset, you can find him on my Github. As with any and all of my projects, I'm always happy to see contributions. Hope to see you there!


As always, this article is available on GitHub. Comments (ie. issues) are welcome!