All Blog Posts

How To Build A Slack Chatbot: Making PIP Sentient

Giving a watermelon a mind... In an attempt to make Pip sentient, we've been exploring chatbots in this weeks innovation project. Read on to find out about the process of building a chatbot using Botkit and Wit.ai.

Innovation

Pip Mascot

When we say AI, what do you imagine?

Siri, Alexa, Ultron…

Okay so maybe that last one was a little extreme, but you have to admit it would be a whole lot more interesting than talking about bots and coding.

We’ve been thinking about this a lot (not building a super-evil AI), wouldn’t it be handy to have a system in place that the team could go to for their questions and queries, such as booking a meeting room, understanding an acronym, or adding things to the office shopping list.

There are so many ways an AI could benefit the team (besides being great fun to build), but in typical CUBE fashion, we don’t just want to create an internal search engine. We want a conversational member of the team who can reciprocate what it means to be a CUBE, and everything this entails.

More than a mascot...

You probably haven’t met Pip, but you may have seen one of her appearances on Twitter or Instagram, we don’t like to think of her as a mascot (she gets offended). More like a member of the team, so it makes sense that when discussing the potential of a CUBE AI, her name would pop-up.

Essentially Pip represents CUBE culture and the personality of our brand, so why wouldn’t we want to give her a mind of her own that goes beyond understanding sentences and delivering information?

I spent a week of my time making a sentient watermelon slack chatbot for internal communication. Making a chatbot can be complex and the world of AI means that a lot is possible. To help me I worked out all the features of a chatbot that I would like. Why? Find out below.

The purpose of a chatbot?

We’ve had a bunch of new starters over the past few months, and something that keeps coming up are questions regarding the terminology and acronyms that people are unfamiliar with.

A new member joining the CUBE team might want to know something and feel uncomfortable asking; ‘Should I already know what this means?’ Instead of constantly having to ask someone, they could just ask Pip. But this isn’t the only problem we think Pip can solve:

  • Being a glossary of terms and acronyms we use regularly
  • A searchable database of projects, clients, products and apps
  • Checking meeting room availability
  • A search engine for general questions and queries
  • Collecting Feedback Friday and other internal activities.

Feedback Friday – a form submitted by each member of our team talking about everything good and bad that’s happened during our week, and things we would like to see happen in the future.

What would Pip think?

Or more importantly, how would Pip think? 

To meet our needs Pip will need the ability to search databases based on topics and tags as well as understand the intent of questions in order to take relevant actions; Pip needs to follow a process to deliver information:

Listen. Understand. Feedback.

But we don’t just want another chatbot, we want Pip to be bursting with personality by communicating in our tone of voice and recognising rudeness. Using sentiment analysis so that responses could differ depending on how rude you are, even leading to Pip refusing to answer questions if you’re consistently impolite.

Botkit - listening.

Building blocks for building bots.

Pip needs (metaphorical) ears to listen…

Botkit can be just that; listening and maintaining all the conversations that Pip is having.

Botkit sells itself as a framework for handling the conversation between the end user and the developer. It helps the developer maintain conversations and act on what the user is asking.

The thing Botkit really excels at however is its support for other services. So you can throw in a slack integration with just a simple line of some tasty Javascript:

Botkit chatbots

We could talk for hours about why this bit of kit so fantastic, go check out their Github for some awesome starter projects.

Wit.ai - understanding.

Robots that understand humans and discover their unforeseen needs.

Wit.ai is a Natural Language Processor (NLP) that creates understanding by taking what we say as humans and translating it into an intent that machines can digest more easily.

Here’s a handy diagram from Wit explaining how it works:

Wit.ai building chatbots

The best thing about Wit is its ease of training, you can feed in sentences that a user might say into Wit’s handy online tool and select the intent it’s supposed to match up to.

This eventually trains your app to detect things you haven’t even told it about.

Wit.ai chatbot understanding

Here we’ve asked, “Who are the American Red Cross?” – Wit has been trained to realise we want to know who someone is (the intent) and what the thing is (American Red Cross).

We look at Wit as being the brains of the operation. It takes what Botkit has listened to and makes sense of it so that the correct actions/responses can be taken.

Glossary API - feeding back.

The CUBE search engine.

Pip

The glossary API can be seen as Pip’s library; Pip goes and checks for the term before feeding back with the answer.

One of the original reasons for building Pip was so we can easily ask, “Hey what does x mean?” or “Who are the xyz?”.

It could even be a member of the team asking what a technical term means because a client has mentioned it and they need to quickly look it up.

To store and access the cumulative acronym, client and term knowledge of every member of the team, we needed to collect this information and then store it somewhere; this is where the API comes in. We quizzed all the CUBE team for their favourite terms, clients and acronyms before throwing them all into a big old spreadsheet.

The API uses a tasty cocktail of node.jsexpress and elastic search. This allows an application to request client, term and acronym information.

Separating this from Pip was a good choice, it means that in the future we can integrate this API with other services we may wish to write… *cough* Alexa *cough*.

Bringing the Pip chatbot to life.

So, we’ve mentioned all these different parts of Pip, but how does it all come together to form the best watermelon ever?

The following diagram should help!

Wit AI and Botkit chatbot

You can see how Pip uses Botkit to handle conversations, Wit.ai to figure out the intent of what a message is saying, and a glossary API to retrieve the relevant content.

Another sweet feature we’re including solves a long time problem at CUBE – quickly finding out if a meeting room is free. Now we can ask Pip, ‘Hey, is the Snazzy Chair Lair free?’ and she will use Google Calendar API to see if it’s in use or not.

The future of the Pip chatbot?

No longer just a mascot, Pip encompasses CUBE culture in a way which we have never experienced before, it’s not just a gimmick designed to make us smile, the AI is going to add real value to the team and the way we work internally.

We have tonnes of plans for Pip, here are a few of the other things we’re going to add in the not-to-distant future:

  • Timing our work with Harvest
  • Mindfulness – “Hey, don’t forget to drink some water!”
  • Make it super easy for Pip to learn by allowing people to update her glossary in chat
  • Analytics so Pip’s natural language detection gets better and we can see what people want to talk to Pip about
  • And so, so much more…
Pip AI chatbot conversation

Published on November 8, 2017, last updated on March 15, 2023

Give us the seal of approval!

Like what you read? Let us know.

3

Tags