Inside story of how Ghostbot handles texting creepers

Last month, in collaboration with the folks behind the fantastic Burner app , my company Voxable launched our latest chatbot project,Ghostbot for Burner. Ghostbot runs on top of Burner’s “open” phone numbers as an agent inside your text message inbox, allowing you to “ghost” away from fleeting relationships by responding to unwanted or creepy texters on your behalf.

Since the launch, Ghostbot has been covered in over one hundred media outlets . Chris Messina was also kind enough to post it to Product Hunt , calling it “the first bot-as-personal-firewall” he had seen. The opportunity to break new ground in the coming era of bot-mediated communication was what initially both excited and terrified us about the project.

Turing test anxiety

When Burner first approached us with the idea, I was skeptical that it was even possible. The bot would be activated for certain contacts on a disposable Burner phone number. From that point on, it would need to respond to incoming texters by brushing off their advances. A late-night “Netflix and chill?” text would result in an excuse about being slammed with work or suddenly not feeling so well.

Most of the time, when a user interacts with a bot, they know it’s a computer on the other end of the conversation. These “conversational interfaces” simplify interaction with technology by allowing natural language interaction. They’re exactly what we specialize in building at Voxable. Ghostbot didn’t just need to interact in a human manner, though — it had to convincingly pretend it was a human.

The Turing test was devised by the father of modern computing, Alan Turing. He proposed an “imitation game” in which an evaluator would be given the task of observing a conversation between a human and a computer, not knowing which was which. If the evaluator could not reliably determine which side of the conversation was the machine and which was the human, then the machine would be said to have “passed” the Turing test. Despite repeated assertions to the contrary, the Turing test has never been passed .

Initially, it seemed Ghostbot would be expected to pass the Turing test thousands of times a day. It would need to generate appropriate responses to entirely unknown messages. I was doubtful that we could pull off something that had never been done before.

Another reason chatbots can perform well in parsing meaning from natural language inputs is that mostly they are dealing with a limited domain of knowledge. If I’m building a bot to help you find a house, I don’t need to teach it how to answer questions about cooking. Choosing a focused purpose for a bot, combined with modeling a conversation as a state machine, means we can narrow the range of possible user intents that we need to parse at any point in a conversation. With Ghostbot, the range of potential intents we would need to parse could have been unlimited.

Envisioning Ghostbot as a delegate for online dating meant we could limit the scope of the bot’s capabilities to that domain. As we explored the use cases for Burner with their team, we discovered that many Burner users were already taking advantage of its ability to create temporary phone numbers to avoid sharing their real contact information on first dates. These users had already established anonymity. It was a good fit. This would mean we were dealing with a fixed number of potential intents that a user might be trying to express.

An important factor in the Turing test is that the evaluator knows one side of the conversation is a computer. With Ghostbot, that wouldn’t be the case. Most folks aren’t expecting to be talking to a piece of software when they’re supposedly interacting with a human. When using SMS especially, people reasonably start with the assumption that the “person” responding to them is a real person.

Projects like Inbox by Gmail’s Smart Reply point to a future where mediating conversation with software is considered normal. Having your colleague’s digital assistant reply to a message on their behalf will be a routine part of the work day. It hadn’t been done for text messaging before, though, so for the moment a bot wouldn’t be expected in this context. This would give us just the right amount of wiggle room for the texter’s mind to step in and explain away the occasional odd response from Ghostbot. The limited scope of the bot, combined with these assumptions, moved the project from the realm of “never been done before” to “we can definitely make this happen.”

Building Ghostbot’s intelligence

Until recently, building advanced natural language processing into a product was limited to only the largest companies. Most couldn’t afford the team of PhDs necessary to build a reliable model. However, the explosion of NLP platforms over the past year has democratized innovation in the conversational interface space. This has helped fuel recent interest in conversational interfaces.

I always recommend to our clients that we use an NLP platform, rather than building a model from the ground up. If you’re going to build a web application, you don’t start by designing your own database engine. The same logic now holds for chatbots and NLP.

Our approach was to determine a fixed set of intents that a texter might be attempting to express. Given our domain of online dating, we could assume that the person interacting with the bot might be trying to set up another date, asking about plans for the coming week, or saying something offensive (in which case they would get blocked), among other uses.

Once we had established a framework for what we called intent categories, we needed to build an NLP model capable of taking an inbound message and matching it to one of the categories. Ghostbot could then generate an appropriate response for that intent. If an inbound message read, for example, “I’ve got a really nice apartment downtown,” the intent might be recognized as “bragging,” at which point Ghostbot could respond to the recipient with something like “How nice for you.”

We created several examples of messages that might fit into each intent category to train the model. This is a common approach to building conversational interfaces. We used our own translation language, Expando , to encode many example messages in a more manageable way. The line “(want to|let’s) (go to a movie|grab some dinner|get some coffee) tonight” is expanded into the Cartesian product of each of the possible phrases enclosed in parentheses:

want to go to a movie tonight

want to grab some dinner tonight

want to get some coffee tonight

let’s go to a movie tonight

let’s grab some dinner tonight

let’s get some coffee tonight

Voxable partnered with talented screenwriter Peter Miriani to script the bot. He worked with our cofounder Lauren Golembiewski to ensure that the example inbound messages were representative of what users might expect to receive. Together, they crafted the responses to each possible intent and made sure they had the correct tone.

We chose API.ai as our NLP platform for this project. While many platforms might have worked for this use case, we find API.ai is still the most flexible and capable. IBM Watson Natural Language Classifier would also be a good fit for a similar project. If you wanted to build a system for this use case from scratch, a naive Bayes classifier could give you reasonable performance.

We also evaluated chatbot scripting languages like AIML and RiveScript . Based on the work used to create the original chatbot, ELIZA , they enable techniques like pronoun switching and keyword matching. While these techniques can enable surprisingly human interactions, we determined that a classifier would be a better approach for this project.

We created a GitHub repo to house the Expando message examples for each intent category so that Peter and Lauren could collaborate. Once a commit was pushed to GitHub, a CircleCI job would run to expand the example messages and upload them to API.ai automatically. This allowed the fastest possible iteration on Ghostbot’s intelligence.

Out in the wild

Along with our branding, design, and development of the web app and its integration into the Burner platform, Ghostbot’s intelligence created a practical and delightful experience for users. This was a challenging project, and I’m thrilled with the way it’s resonating with the public.

There will be more opportunities for bots to act as intermediaries between humans in the future. I’m excited to see the innovations taking place in this space.