"You’re welcome"

June 15, 2015

This may be the tiniest of all my gen-art projects. It’s almost ridiculous to post, but I like the effects I’ve observed from it in the wild so much, that I’m doing it anyway.

We ask our chatbots to do all kinds of things, from showing us a random photo of a pug to deploying our code to production. How often do we thank them for their efforts?

But no one’s going to thank a bot who’s not listening for a “thank you,” who won’t respond to the thanks.

So I wrote a small script so a chatbot can say “You’re welcome.”

"Thanks, bot!"

This simple addition regularly added tiny hits of joy to my day.

The first job I installed this at, the bot was named for Jane Jacobs, but every time I said “Thanks Jane” and she’d respond, it felt more like Ender Wiggin’s in-ear AI from Speaker for the Dead.

I loved thanking the bot and having it speak back; it seemed to humanize the bot. But even more, I loved seeing other people thank the bot. It didn’t always respond properly to others, probably because I should’ve added to the kinds of phrases it responded to (see below), but it was sometimes a strange mirage of awareness, when it would ignore someone and then respond to me.

Here’s the source, written for anyone to read and especially to edit, no matter how much javascript they know:

The best way to use it in your chat depends on your chat platform and chatbot framework. Here’s how I’ve installed it as a hubot script on Slack, written in coffeescript; a bot named Hobbes (as it was at a prior employer) will respond to messages like “thx, Hobbes”, or to an “@Hobbes thank you!”

module.exports = (robot) ->
  robot.hear ///(thx|thanks|thank\s+you),?\s+#{robot.name}///i, (msg) ->
    msg.send youre_welcome()

  robot.respond /(thx|thanks|thank you)/i, (msg) ->
    msg.send youre_welcome()