DEV Community

Nik O'Donnell
Nik O'Donnell

Posted on

Creating our first worker/chat-bot HAL

Remember when bots were becoming popular? Described as the new 'Apps', well the steam kind of ran out of that engine. But when they were the new hotness - of course we decided we had to have one, like right now!

Whilst they are quite fun to play around with, our bot has actually been a great inclusion in team workflows, communications and task automation.

So when we set to work...by that I mean we did a little 'bot shopping' and found the perfect candidate to suit our needs, meet Hedwig IM.

Hedwig IM

After a quick:

git clone git@github.com:hedwig-im/hedwig_xmpp.git

We were on our way, with the tedious foundational templating already done for us!

Open Source FTW \0/ Thank you Sonny!!!

Then we set to actual work on integrating Hedwig within our communication channels on #Slack so it can start doing...

ALL THE THINGS!

We soon discovered it came with a fun little function out of the box to demonstrate how to code interactions, when you type "great success" in an active channel, the bot replies with a random image of Borat:

Great Success

We named our bot HAL9000 (Hal for short) - some many ALL of you will recognize the name straight away from the Sci-Fi classic Space Odyssey 2001 and 2010. I know what you're thinking, why the fudge sticks would we name our bot after this terrifying AI character from the past - well it just kinda happened, and yes as an aside our main developer on the project is named Dave (can't make that stuff up).

Though we figure we're safe enough here on Earth with our Halbot - there aren't any airlocks to lock or escape pods to trap us in.

As we got to know Hal a bit better, we taught it quite a few extra features. As soon as someone on the team thinks, 'this is annoying, can't we automate it!' we can respond, 'well yes team member, we can'.

Right now Hal can do the following:

  • Automate the creation of team meetings via Zoom's API !meeting or one on one chats !zoom @<person>
  • Do WHOIS domain lookups via the root servers !whois dev.to
  • Send a unique SMS code or message to a user !sms message: +17788997766 Hi, I am from iwantmyname, emails to your account are bouncing back...
  • Check which developer is on call !who is on call?, and notify them of something !page <your_message_for_oncall>
  • Hal sanity check...

Some things we would like to teach Hal how to do:

  • Check the site speed !site speed
  • Run a search query on the site !search is-hal9000-evil.io & check the 'happy path' (from search through to checkout) to make sure things are A-OK !happypath.
  • Query dig commands - !dig dev.to
  • Order beer and pizza for the next hackathon !pizza+beer <how many: i.e beer:10 pizza:10> <when: i.e NOW!> <delivery address>

Soon, Oh yes...Very soon!

Top comments (0)