Messenger Bot for Writers: How to Build it and Use it

Have you heard of essay writer bots used by many essay typers? For the last few months, I was working on a secret project: teaching and launching our customer writing service chatbot, Edith. We write a lot about how writers can utilise AI and Natural Language Processing to save time with their marketing, so we thought: let’s try it ourselves! This is why we built Edith, our new customer service superstar: she knows the FAQ better than any of us, has a great sense of humor (well, she has my sense of humor) and gets smarter by the day. This article is on how to build a messenger bot using Dialogflow (API.AI) and how can authorpreneurs use it in their marketing. You can also try the bot (we used the sad and low-functionality WordPress plugin), only under this article.
Messenger Bot for Writers: Common Usages
Who doesn’t like talking to a robot? I start every morning asking my Google Assistant for the weather and traffic updates; but I often find myself just casually engaging in conversations with Siri on the iPad. (And millions of youtube videos prove that I’m not alone.)
Messenger bots are a great writing tools and ways to engage potential readers and keep your existing readers entertained.
1. Write an interactive short story
The most obvious way of using a messenger bot as a writer is to use it to tell an interactive story. The ‘choose your own adventure’ type of books have always been popular, and interactive storytelling on computer is as old as computers themselves. (This is how we have adventure games: blessed be the writers.) We can even see interactivity in how authors and TV-show runners react to fans’ requests and change storylines in order to please crowds. Popular examples include cancelling the death of Sherlock Holmes or Bobby Ewing. There are several other examples of interactive storytelling in this great article in the Chatbots Magazine.
Creating an interactive short story is not only useful to get readers ‘hooked up’ and show that their opinions matter, but also a powerful way to give potential readers a ‘taster’ of what your books are like. They work especially well if your writing style is first person singular at the first place.
While there are complete platforms, like Sequel for building and sharing storybots, we always encourage writers to keep control over their IP and use an independent platform with different embedding options. If you are considering building a storybot, find a platform that lets you send different kinds of messages or multiple messages without user input.
2. Impersonate a character
By the time your readers finish your book, they’ll love your characters (hopefully not the evil ones, though) and feel like they are best friends. You can enhance their feelings of attachment and affection by creating a chatbot that impersonates one of the characters. Moving your characters to Facebook or Instagram is certainly not a new idea.Hungarian teen series Szent Johanna Gimi has over 60k follower on Facebook only, as all main characters have their own, real-looking Facebook profiles where they live a very active social life, and last year’s Scandi YA drama, the Skins-like Skam runs real-time Instagram accounts for all leads. Messenger bots take this to a whole new level: they suspend the traditional role of voyeur by enabling you to have a real discussion with one of the characters.
3. Interact with your readers
This is how we built Edith: her job is to answer questions. While I assume that most writers like writing, and there is nobody who doesn’t get excited if nice strangers come and ask questions, after a certain number of followers answering the same questions over and over again can take a lot of time – leaving you less time for doing what you do best.
Building a simple chatbot that is able to answer the most common questions regarding your book (like when is your next book coming, or is it true that you eat babies for breakfast) is likely to save you time in the long go. No conversation will ever go unnoticed, and you always have the option of a human takeover if the bot cannot answer or if your (potential) reader needs special attention.
How to Start: Basic Rules
Before we move to the technical side, let’s clarifies what messenger bots are designed to do and some things they are not so good at.
1. The bots can’t initiate conversation
While it is possible to program a chatbot to start the conversation when the user for example hovers over the chat window on your website, it is something messenger bots will never do: it is against Facebook’s bot requirements. The user can prompt the conversation on your page by clicking the ‘Send message’ button: this will send a message (‘get started’) to your bot, so it can reply.
2. You can’t use your bot to send marketing messages or promotional content
Were you ever dreaming of a bot that automatically messages all your subscribers of your Facebook page when your new book is out? Well, think twice. While you can request subscription messages (the possibility of automatically messaging your subscribers without them initiating conversation), think again. It is strictly against the messenger platform’s policy to send messages of this kind.
3. Don’t pretend that your readers are talking to a human
This is a big no-no: they’ll find out soon enough, and being lied to is a bitter experience. There is nothing wrong with talking to a robot: we do that all the time, and everyone enjoys it. (If the bot is a bit smarter than Google Drive’s slackbot.)
In the following, I focus on creating a ‘customer service’ (replying to questions) type of bot, because that’s what I have experience with.
Setting up Dialogflow
The code behind Edith is running on Dialogflow (former API.AI), a free chatbot building API by Google. I chose Dialogflow because of the wide range of platforms with easy integration; good handling of contexts; an unexplainable affection for every Google product; and because of the Google Launchpad program PublishDrive is participating in, in case I need help from our amazing developers. I didn’t. (Too bad Google has a tendency of cancelling my favourite products.)
1. Sign in with your Google Account.
2. Create new agent: the ‘agent’ is Google’s name for the bot.
On this page, you can select a sample data: this will be pre-taught to your bot. Don’t forget to click ‘Save’ and wait until it finishes saving. (It is very slow.)
Understanding Dialogflow
Let’s go through the menu on the left and see what are our options.
Intents: You define the ‘prompts’ and answers of your bot under the intents menu.
Entities: You use entities if you would like your bot to ask for certain type of information. Dialogflow comes with many pre-defined entities: it recognises numbers, countries and email addresses for example. Here you can add your own intents – more on this later.
Training: This is where your dialogue history is stored, and this is where you can approve or reject your bots answers. This is what is amazing about building a chatbot using AI and NLP: you don’t have to be prepared for every single scenario in advance, you can teach your bot later once users start to use it. I would have never thought of teaching Edith three different ways of mistyping ‘hello’, but here we are, now she knows that you were just trying to be polite.
Integrations: Surprisingly, this is the menu under which you find every information for testing your bot, then integrating it to different platforms.
Analytics: Handy usage statistics.
Small talk: Hundreds of options noone would ever think of.
Creating your first intent
Independently from whether you choose a ‘package’ to start with or start from scratch, your bot will come with two pre-built intents: Default Fallback and Default Welcome.
Let’s see how to customise what the robot says at the beginning of a conversation.
To ‘user says’, add certain ways of saying ‘hello’. You don’t have to be all inclusive: you can teach your bot later, once people start to use it.
Then enter your responses at the bottom of the page. You can even set different responses for different platforms.
Answer types
As a default (if you were to embed it to your wordpress, for example), your bot can only handle text responses. You can add variants of one response, and your bot will randomly select which one to use. Or, you can add multiple, consecutive answers by clicking the ‘Add message content’ button.
Just save it, and you can immediately try it in the very same window, at the top right corner.
Facebook and other messaging apps support multiple types of contents. For example, if you would like your bot to send a picture, or the user for simply tap an option from multiple options, you can easily do that. For images, just insert a direct link for an image file.
Your robot will technically has to be ready for Facebook testing, but the Slack testing integration is extremely easy to use, so I used Slack to test how everything would look like in Messenger.
Well done! Your robot is ready to use!
No, just kidding. But basically, you’ll just need to repeat these steps over and over again, for all your user intents. Easy-peasy.
Context
If you would like to build something where the previous responses are important, you probably need to use contexts. For example, if you ask Edith about ebook conversion, she’ll ask you whether you would like to know how to convert your book yourself or you are interested in ordering ebook conversion service. For the best result, minimize the risk of the user giving an unexpected answer by using ‘quick replies’ on Facebook.
After creating your question, go back to the main Intents page, hover over the intent and click ‘Add follow-up intent’
You’ll be presented with a few meaningful, pre-defined options (eg. yes / no / more), but can also define your own follow-up. Follow-ups work just like normal intents. Follow-ups can even have their own follow-ups!
Small talk
In addition to creating your own intents, you can teach your bot some small talk as well. Here is your chance to shine and be funny. If you’d like to hide some Easter eggs in your bot, this is your place to do so. Simply enable small talk for this functionality. If you don’t customise it, your visitors will receive automatic answers.
Launch your bot on Messenger
Once your artificial intelligence chatbot is potty-trained, you can send it out to the world for others to try. You’ll need to have a Facebook developer account (developer.facebook.com), but the setup process is fairly straightforward. For the bot to be able to use your Facebook page and send messages, it needs to be approved and verified by Facebook personnel (Edith is just getting approved), but you’ll be able to set it up and try it before the launch.