Kilian Valkhof

Building tools that make developers awesome.

A Messenger Adventure chatbot

Chatbots, Web, 19 December 2016, 2 minute read

For quite a while now I’ve had the idea to create a chatbot that works like one of those old-style text adventures like Zork. Recently I bumped into a free course on beginning a Facebook chatbot, and decided to really give it a go. The end result is A Messenger Adventure.

Welcome to Adventure, a game of danger, and low cunning. No Messenger should be without one!

The game now is really quite small and you should be able to finish it in ten minutes or so. You can click any of the quick replies (which also serve as a legend of possible room actions) or type out the command. I don’t do any fancy synonym matching or command interpretation yet, so if you typo you’re out of luck (but you can try again).

Whilst you can’t yet be really eaten by a Grue, I did sneak in at least one easter egg.

Technical notes

I wrote the bot using FacebookMessengerBot.js, a lovely ES7 library with most of the stuff I need and I decided to write A Messenger Adventure with it. The api is not entire complete, and some of the code doesn’t handle too well, but I might contribute some fixes in the future.

On top of this library, I wrote a system that can handle rooms, actions and states, the three of which allow you to do some rudimentary text adventure style puzzles. I based most of my scenario on and added some classic Zork elements.

For the logo, I really wanted to have a combination of the Zork logo style, and old-school pixel art. With the help of this page on Pixel Art Rocks and Stones I created the above logo. Not great, but not too shabby for a first try either. And plenty recognizable.

The A Messenger Adventure scenario is pretty small, but with my rooms-system I can easily expand it, or create an entirely new story. If there’s interest, I might release the rooms-system library so let me know if you’d like to create your own messenger text adventure!

For now, feel free to checkout the bot!

Polypane browser for responsive web development and design Hi, I'm Kilian. I make Polypane, the browser for responsive web development and design. If you're reading this site, that's probably interesting to you. Try it out!