All Blog Posts

How To Build A Slack Chatbot: Making PIP Sentient

Innovation Time gives members of our team a week to work on personal projects of their choosing. I decided to spend my time developing a watermelon chatbot that would make our team's favourite emoji pillow sentient. Using Botkit and Wit.ai to build a chatbot that integrates with Slack, here's how you can do it too. Introducing PIP.

Innovation

Slack Chatbot Development

Giving a watermelon a mind might not be your first thought when it comes to innovation. I wanted to put my week to good use and pick up a previous Innovation Time chatbot project to solve a few of the larger problems our team were experiencing.

But this isn’t just a CUBE thing.

Chatbots can solve a huge number of problems that every organisation faces when it comes to internal processes. That’s why I wanted to share my ideas and experience developing a Slack chatbot with Botkit and Wit.ai.

WHY DID I DECIDE TO DEVELOP A CHATBOT?

The original idea for this innovation project was a ‘companion app’ which would solve the problem of helping new starters, as well as other CUBES understand the more technical terms and jargon without having to interrupt other people in the office.

An app wasn’t the best solution.

This is actually a very common mistake; getting carried away with ideas and thinking that the most ‘out-there’ solution is the right one, but I found that a chatbot would solve all of the issues our team were facing while taking up a fraction of the cost, time and resources.

The problems I wanted to solve:

Understanding technical terms and jargon was a priority for the chatbot even though the project would no longer result in an app. After incubating my ideas with the team and getting their feedback, a few bigger problems were identified:

  • Having to access so many different tools and programmes to do every-day tasks
  • Not having easy access to information on all of our apps, projects and clients
  • Submitting forms in different places for internal activities like Feedback Friday
  • Having to manually check meeting room availability in Google calendars

What did the solution look like?

A chatbot which could be integrated into Slack and offer a friendly conversational interface, within an environment people at work already know how to use. Reducing any stresses with learning yet another tool and making the chatbot fit into the current processes our team use.

PIP Chatbot Slack App

WHAT DOES THE CHATBOT DO?

Aside from features like checking meeting rooms, submitting Jira tickets and collecting feature requests, PIP maintains conversations with the team and has all the personality they do. Greeting you with various GIFs and recognising when you’re being rude, before responding in sassy ways depending on the severity of your in-politeness.

1. Checking on meeting rooms

Simply ask Pip which meeting rooms are free or ask about a specific room in-particular, the chatbot will access data from our Calendars and let you know who’s using the room, which meeting they’re in and how long the room is booked out for.

PIP Slack Chatbot Meeting Rooms

2. Collecting Internal Feedback

Pip can also submit internal activities like feedback forms, lunch or coffee orders and even emoji’s representing how you’re week has been. We use the chatbot for Feedback Friday and Rate My Week in particular, which has saved the team a bunch of time that can now be spent on more important things.

PIP Slack Chatbot Internal Feedback

3. Letting you know about updates

If you ask PIP what she’s been up to lately you’ll give a list of the latest features and functionality our developers have added to the project. Without constant announcements the team can quickly open a chat with PIP and ask ‘what’s new?’ to see if PIP can solve the problem they’re experiencing.

PIP Slack Chatbot Whats New

4. Collecting feature requests

Another form of feedback, but this time it’s based around the PIP chatbot. If we have any problems that PIP could solve or any ideas for ways that the chatbot can be improved, we just tell PIP and she collects the feedback in a separate database which our developers will pick up in their next Innovation Time.

PIP Slack Chatbot Request a Feature

4 STEPS TO DEVELOPING YOUR OWN CHATBOT

The time I spent during my week can mainly be put down to creating, updating, hosting and testing the chatbot. The steps you’ll need to take while developing your own chatbot will differ depending on what you’re trying to do. Whether you’re trying to solve the problems we were facing or develop the features that PIP uses, you’ll need to do the following.

1. Build a store of knowledge for the chatbot to access

Using Amazon’s elastic search (A distributed search and analytics engine) we scraped a spreadsheet with content and built a Node.js API that delivered that content. Here’s an example response when we query the API for “Blood” under a filter of “Projects”

{
  "title": "Blood Donor App",
  "description": "The Blood Donor app allows users to search and schedule blood donation.... ",
  "tags": arc,
  "createdAt": "2017-10-18T15:14:58.878Z",
  "updatedAt": "2017-10-18T15:14:58.878Z"
}

 

2. Develop the chatbot with BotKit and Wit.ai:

Botkit is a tool used by developers to allow chatbots to maintain conversations, understanding the intent of what users are asking and knowing where to go to get the answers. The software is what lets chatbots go back-and-forth and can easily add integrations like Slack with a simple line of Javascript.

Wit.ai is a fantastic NLP (Natural Language Processor) that can work as a plugin with Botkit, it’s used to translate the way people communicate into a format more easily understood by computers. Developers train chatbots by feeding in sentences that users might say, before matching these up to the intent it represents.

Chances are if you’re reading this you’ve probably heard of Botkit, but for those new to the system, check out this guide to getting started which covers everything you need to know about using Botkit Studio.

3. Host your chatbot on AWS:

Pip runs on AWS Elastic Container Service and uses the new Fargate serverless container hosting platform, which allows you to run containers without having to manage servers or clusters. Meaning you no longer have to provision, configure, and scale clusters of virtual machines to run containers.

It seemed like an excellent opportunity to kick the tyres of serverless container infrastructure with a view to eventually running more of our services this way. This is one of the more complicated processes you’ll undertake during your project, so here’s a great introduction to AWS to get you started.

4. Connect your chatbot to Slack:

The last stage is by far the easiest. Link up your chatbot to your company’s Slack profile using the Slack Events API, it’ll ask for various permissions but once accepted, can be accessed by anyone in your team, in the same way you communicate with other individuals.

The biggest challenge I faced?

Going from developing websites/frontends to working with Node.js.

The challenge was to take the knowledge I knew of JS and throw that into a different way of organising and presenting the code being written. A few new things I learnt included:

  • When to use Callbacks and Async / Await functionality
  • Events (Running a bit of code when something has happened)
  • Streams (How to work with the file system on the host where the node service is being run)
  • Modules (How can we write code and use code in a modular way)

For more information check out the art of node document that covers all these topics and more!

The future of the project:

I’ll be working through the feature requests that PIP’s been collecting to make the chatbot even more useful to our team. A few of our other developers also have Innovation Time coming up and can help out in areas I know less about.

Other than continuous improvement the chatbot could also be developed to integrate with systems other than Slack. For example, we’re discussing using PIP as a chatbot on the CUBE website, having her act as a first-contact on Facebook messenger or even making the project open-source so that other organisations can use the chatbot with their own brand.

 

If you’ve ever developed or used a chatbot I’d love to hear your feedback and opinions on Pip – @3SIDEDCUBE. For more on AI, AR and other tech, check out a few of our other Innovation Time projects or get in touch and give us a brand new challenge!

Published on August 16, 2018, last updated on April 10, 2019

Give us the seal of approval!

Like what you read? Let us know.

10

Tags

Questions for app developers?

The nine most important things to ask if you are searching for an app development agency. Including costs, timelines and process requirements that will make your launch an enjoyable experience.

Read more

Latest from the blog