A bot of one’s own
I enjoyed Matt’s piece on conversations interfaces. I think he’s right — there are situations where they work so well because the context is embedded in the conversation. Chatting with a bot (or a person :-) who knows who you are, what you like and don’t like, what you mean by certain phrases—that sort of conversation is the best.
At betaworks, we’ve been working for about a year on a product called Dexter, a software-development environment designed for creating apps that integrate multiple services. Dexter works for tinkerers (people like me), who can drag-and-drop logic modules on a canvas and wire them up like the stereo components of my youth. But it also works great for developers, who can create new modules using JavaScript and push them to Dexter using Git. (I know what all those words mean.)
One thing Dexter is really good at: creating chat bots. You can wire up Slack or SMS or other input methods like email, run text from them through whatever logic you like, and then send a response back to the user. The version of Dexter that launched this week adds dozens of modules and several new featured apps.
One of the new apps is Spreadsheet Bot. The gist: input comes in from Slack, you process/analyze/transform it in a Google Sheets document, and send your response back to Slack. Easy.


The app page is shown below. First, authorize your Slack and Google accounts. You’ll need to make a copy of the Google Sheets template document in your own Google account (so you can edit the sheet to put in your own questions and answers).


Once you do that, get the spreadsheet ID from the full address of your own copy of the spreadsheet and enter it into the box shown when you click the “Configure This App” button.


The base spreadsheet has two columns. In Column A you enter a regular expression that matches the specific question(s) from Slack that you want that row to address. Column B contains the answer you want to send back to Slack. Don’t be intimidated by regular expressions. Actually, you should be incredibly intimidated by regular expressions because they’re an inscrutable language of their own with nuclear powers. But I built a Slackbot without knowing anything about them and so can you.
What’s fun for spreadsheet-lovers like me (um, did I just embarrass myself?) is that you can use any spreadsheet function in Column B. So, as an example, I put
^CAP\s*(.*)
in Column A (matching typing “CAP” plus something) and put
‘=”\1"&” market capitalization is “&text(GOOGLEFINANCE(“\1”,”marketcap”),”$#,###”)
in Column B (all on one line). That uses the built-in GoogleFinance formula to retrieve the market cap of the ticker I type and then sends it back to Slack nicely formatted.
The result? If I’m chatting my Slackbot, I can type “cap twtr” and it will respond “twtr market capitalization is $11,816,097,026”. OK, it may not be as chatty as Eliza but it knows much more!
What’s fun about the Spreadsheet Bot is that you can throw in more and more responses whenever you want, without delving into code. It’s just a spreadsheet. Want it to translate Chinese to English for you? No problem: put ^zh\s*(.*) in Column A and =GOOGLETRANSLATE(“\1”,”en”,”zh”) in Column B. Whenever you send the message en 洗手间在哪里 to your bot, you’ll get back Where are the restrooms? Super helpful if you only can write Chinese and need to get to a bathroom in the States, right? Right?
The default app calls your bot Spreadsheet Bot, which is a bit dreary, I know. You’ll want to name it something far better. To do that, just Remix the app and make it your own.


Feel free to email me (josh at betaworks) if you have questions or want to tell me how much better / smarter / more clever your bot is than mine.