3 Things We Learned Building a Chatbot for Slack

Kip is a chatbot that helps you save time by doing all the shopping for you and your team. Integrating with Slack was a logical choice, we’re Slack users and wanted a simple, efficient way of team shopping via chatbot.

Try Kip, click the button below:

Click me

We ran into some interesting issues when building Kip for Slack. We hope you find our solutions useful!

1. Universal Emoji Translation

Sending emojis across devices can be messy. An emoji sent by you on iOS is displayed differently to someone receiving it on Android. Here are some examples of emoji variation across devices:

Emoji miscommunication, the new normal

Chat platforms have their own way of displaying emojis. If you send the same emoji code to every platform, it will display differently to all users.

We added a translator into Kip bot so it can speak multiple emoji dialects. Kip sends different emoji codes based on which chat platform (Slack, Facebook, SMS Texting) a user messaged from:

Emoji translator

Sample translation for numeric emoji (should actually use Redis or similar datastore, thanks r3versed):

By doing so we hope to avoid miscommunication while still retaining the universal simplicity of an emoji 😊.

2. Bot behavior on public Slack channels

When we added team shopping to Slack, we ran into a problem where Kip would respond with search results for everything people typed into public channels like #general (quite annoying!).

We solved this by sorting incoming Slack messages into direct messages: one user talking to Kip and public channels: many users talking to Kip.

Slack sends new chat messages to Kip with an ID (i.e. C5H6YHBN) that represents the channel the message came from. Chats that start with the letter C are from public channels, while D are direct messages.

If the message is from a public channel, we check the incoming message for the user ID of Kip bot on the team (i.e. U7A8YHVN) so we only respond when someone @ mentions Kip.

Example of @Kip being mentioned in a public channel for a group purchase:

Example Node.js code we use for sorting messages:

3. Kip is too slow!

With Google or Amazon, users now expect instant results. In searches with complicated modifications i.e “similar to option 3 but cheaper and in blue”, Kip suffers a bit of lag. This makes our users impatient.

A simple design hack, we send a “typing event” to Slack so it looks like Kip is typing while our bot rushes to respond quickly. Our users say they don’t mind the lag now since they know Kip understands them and is working on it. 😊

Sending “typing events” to Slack is not currently available in the Node.js package slackbots, so we extended it by adding this to the package index.js:

Using design solutions to solve complex programming issues saved us a lot of time and order of magnitude so that we could launch Kip earlier. In the next post, we’ll be talking about our design process of coming up with AI shopping chatbot persona. Stay tuned!

Try Kip on Slack by tapping the button below or try the demo at kipthis.com/chat

Push this button

If you enjoyed reading, please hit recommend. 💚

References

💁 Emojipedia
Amazing resource for cross-device Emoji translation.Aemojipedia.org