If you want to build your own Slack bot, BotKit is a fantastic choice, but what if you want to build a bot that connect to anything, not just Slack? BotKit has a core bot implementation which you can build off of but it suffers from a significant technical limitation: BotKit stores your conversation progress in memory. That means if your host restarts (as Heroku dynos do once a day) then your conversation state is lost and you have to start from the beginning. It also rules out the option of running your bot on a cluster of node instances.

To solve this problem, we built SmoochBot, a simple bot framework that supports persistance of conversation state and user properties. SmoochBot is what powers Smooch's conversational onboarding experience.

Building your own bot on top of SmoochBot is straightforward. To begin, create a conversation script like this:

let script = new Script({
    start: {
        receive: (bot) => {
            return bot.say('Hi! I\'m Smooch Bot!')
                .then(() => 'askName');

    askName: {
        prompt: (bot) => bot.say('What\'s your name?'),
        receive: (bot, message) => {
            const name = message.text;
            return bot.setProp('name', name)
                .then(() => bot.say(`Great! I'll call you ${name}`))
                .then(() => 'finish');

    finish: {
        receive: (bot, message) => {
            return bot.getProp('name')
                .then((name) => bot.say(`Hello again, ${name}!`))
                .then(() => 'finish');

This simple script has three steps, start, askName and finish. Each step can specify an optional prompt() method which can be used to have your bot ask a question when the conversation moves into that state. Each step then implements a receive() method which is run whenever the user says something to the bot. This will perform whatever asynchronous tasks you wish, and it will then return a state string which determines how the conversation should proceed. With this simple structure you can build a conversation decision tree that is as simple or complex as you wish.

All you have to do is write your script and SmoochBot will take care of the rest. When you hook your bot up with Smooch, things become magical. You can connect your bot to countless apps and services such as iOS, Android, SMS, Web, Slack, HelpScout, Zendesk, Front, and much more.

Smooch integrates any messaging channels to any your business software

For example, you could add your bot to your website using the Smooch web widget and then connect it to your Slack team. Now humans can jump into the conversation at any time!


To get started, check out the example SmoochBot project on github: smooch/smooch-bot-example where you'll find instructions on how deploy your own bot to Heroku and have it up and running in minutes.

Happy botting!