How Branching Narrative is Useful Outside of Game Design – Building a Chatbot

While I was at work the other day, I came across a post by the Social Media Examiner titled “How to Create a Facebook messenger Chatbot.”  After explaining some basics on what a chatbot is and how it can benefit your business, Social Media Examiner gives some basic definitions and jumps right into how to build one with Chatfuel.  This was the picture that very specifically caught my attention:

Picture of chatbot block made of the card and button.

This image is linked from Social Media Examiner’s original post. Their caption: “This is a visual representation of the placement of blocks, cards, and buttons in a chatbot.”

My immediate reaction upon seeing this picture was: “This is branching narrative!”

Don’t believe me?  Check out this example from the Storynexus Reference Guide:

An example of a Storynexus Storylet.

Storylet example that appears in the Storynexus Reference Guide

Out of the bit of branching narrative programs I have worked with, I have arguably the most experience with Storynexus; that’s why I immediately saw the parallel between it and Chatfuel.  Under the root Storylet, the branch happens, and then you program in whatever result(s) you want.  Storynexus is a little more complex, but you can still see how it has the card and button block structure.

Here’s one more example.  This is a Chat Mapper piece I put together for Apocalypse Madness back in January 2015 called “Village Woes“:

Chat Mapper output showing Village Woes

Chat Mapper output for Village Woes

Once again, you can see how it’s got the basic card/button structure (particularly at the beginning of this story, where it has the initial split in choices).

So after I had the realization that a Chatfuel chatbot is created very much like branching narrative, my next thought was “I can make one!”

And so I did!  I got permission from CILU’s Station Manager to build one for CILU’s Facebook page.

It took me about five hours to build the menu system of the chatbot, which is its basic backbone.

Block structure of the CILU chatbot.

As you can see on the left side of that picture, the bot starts out with two built-in blocks (the welcome message and the default answer).  Then you can make however many blocks you want (my current bot has 34 plus the two built-in ones).  On the right side, I’ve got the block titled “Main Menu” open as an example.  I made the card a text card (all of my bot’s cards are currently text cards) and gave it three buttons that link it to other blocks.  I wanted to have five buttons at the bottom of this menu, but Chatfuel limits you at three buttons per card.

Once that was done, I asked friends and family members to test the bot so I can refine its AI.  The AI is the one thing that branching narrative from Storynexus and Chat Mapper did not prepare me for.  But that’s okay – Chatfuel has a really easy to use interface.

AI Set up for CILU bot on Chatfuel

You click on the big red button (on the left side of the picture) to add an AI Rule.  Then you get to tell the bot what to reply with (either text or one of the blocks you’ve already programmed) when the user says something to it.  So in this example, if the user asks what’s on the air right now, I’ve got the bot set to reply with text linking the user to the CILU schedule (and also reminding them how they can listen to the station).

The AI has been quite fascinating to build.  I programmed in phrases that I thought people would say, and have been adding more and more as people have tested it.  For example, someone asked to “speak” with our station manager, but I hadn’t programmed it to recognize that command (if they had asked to “contact” the station manager, the chatbot would have been fine).  So after that interaction, I went back into Chatfuel and added more phrases to better connect people with the information they’re looking for.

Another example was the simple act of greeting people.  When I originally asked people to test the chatbot, I hadn’t thought about getting it to say things like hello or goodbye.  But now it can!

What’s really neat about the whole thing is how the chatbot has evolved over the last week.  When I first asked people to test it, the chatbot was a very rigid menu system that you click through to get to the information you wanted.  After a few days of refining, the menu system is there if you need it (which the default answer is quick to remind you of), but the chatbot is able to get you the information you want by just chatting – no menu required!

Of course it’s still in need of refinement, since it failed with its first real customer.  But the more people who test it by asking it things, the better I’ll be able to program it.  If you’re interested in testing it, or just want to see the chatbot in action, you can access it through this link (but you’ll need Facebook Messenger), or by contacting the station on the CILU Facebook page.  And feel free to leave me any comments or feedback – it’ll help me with refining the bot!  🙂

Advertisements

Leave a comment

Filed under Game Development, StoryNexus, Tools, Updates, Writing

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s