Matt Makai - Python web dev & Twilio Developer Evangelist.

@mattmakai on Twitter & GitHub

R2-D2 or Skynet? Combining Slack Bots with the Twilio API

This is a rough transcript along with the slides from our SIGNAL 2016 talk from May 24, 2016.

You can also find the slides without notes on my tech talks page. The code for the bot is open sourced under the MIT license in a GitHub repository named callbot.

At the end of the talk I give out bot-building resources to all the attendees - all those linked resources are listed at the bottom of this post.

R2-D2 or Skynet? Combining Slack Bots with the Twilio API by Matt Makai (Twilio) and Don Goodman-Wilson (Slack)

SIGNAL page for this talk

Hey folks, my name is Matt Makai and I'm a Developer Evangelist with Twilio. Joining me on stage is Don Goodman-Wilson, a Senior Developer Advocate from Slack. Welcome to "R2-D2 or Skynet?" Today we're going to show how to combine the Slack and Twilio APIs and learn about good bot-building practices.

Title slide for talk

Back in March, Twilio launched Tutorials, a new feature on the Twilio documentation. If you're a developer working on common features that incorporate Twilio, such as two-factor authentication or building an interactive voice response (IVR) system, you could find a tutorial with the code in your programming language along with an entire step-by-step walkthrough for how to add that feature to your application.

Tutorials by Twilio launch blog post slide

The launch involved about a dozen people at Twilio within the Developer Network team. Even with a reasonable size team we ran into issues manually scaling our communication across everyone on the team, such as when blog posts were going live.

The DevNetwork as 8-bit characters

Twilio's mission is to empower developers to build the future of communications. Internally, we use many tools to help us accomplish that mission.

Twilio logo

One of those tools is Slack, which Twilio uses company-wide. A new Slack channel was born with everyone who was on point for the launch.

We used Slack to coordinate team activities (Slack logo)

Slack's mission is to make people's working lives simpler, more pleasant and more productive.

Slack's mission statement

During our tutorials launch, we faced scaling challenges that we might've been able to overcome if we had better automated communication.

Blog posts picture

There is definitely a better way to handle all these logistics. The answer is spreadsheets. Lots and lots of spreadsheets.

Spreadsheets. Tons of them.

No, not really spreadsheets. We're software developers. We're on the side of good - the ones that want to rid the world of spreadsheets, not make them proliferate.

Developers looking down at code.

Our Slackbot should start out friendly, with helpful nudges like R2-D2's bleeps and boops.

R2-D2 from Star Wars. Image credit:

...but the bot goes full Skynet mode if you just never respond.

Terminator artwork. Image credit:

What we could use are smart bots in Slack with some intelligence based on our launch schedule and the list of people involved.

We need bots.

How would this Slack Bot scheduling utopia work? Well, rather than just talk about it, let's launch something together right now.

Launching Twilio blog post together. Image courtesy of Wikipedia (

Here are the three items part of our launch today: open source a GitHub project named "callbot", publish a Twilio blog post and social promote with @twilio.

We're launching 3 items today: open source project, blog post and giving it a boost with a tweet from @twilio.

We need a Slack channel to coordinate our launch, so we created one at Now we need your help. Get out your phones. Join the channel by texting (415) 689-xxxx.

iPhone held in hand. Image credit:

Our demo assistant is "Draw the Owl Bot", after one of Twilio's core values named after the Draw the Owl Bot meme.

Our Slack assistant today is the Draw the Owl Bot

Here's how our bot architecture works. When you sent a text message to our Slack bot's phone number, that was actually a number on Twilio. Twilio then sent an HTTP POST request to the Draw the Owl Bot and it responded with TwiML. Draw the Owl Bot then made a call to the Slack API to post a message.

Draw the Owl Bot architecture.

The Slack API is a very important part of the architecture, so here's more context about it.

More information about the Slack web API.

The Slack web API has a couple of methods that we're using in our talk today.

Web API methods our Slack bot uses

Here are some important points about the Slack Real Time Messaging API.

Slack Real Time Messaging API notes

Let's finally get to the launch! (Demo done in Slack console.)

Let's launch our open source project!

The demo architecture was a bit different than when people texted in the first time. In this case, we're going from the Slack user interface via their web app, with outbound communication to phones.

Architecture for the Draw the Owl Bot demo.

Here are several rules for building great bots based on what Slack's seen so far with their API.

Notes for building a great bot.

For every interaction, ask yourself if it's necessary and makes people's lives better and their jobs easier.

Rules for every interaction.

Thanks for launching with us! Let's quickly see how we're doing on our GitHub stars and retweets.

Thanks for launching with us!

To paraphrase Jeff Lawson, our CEO and co-founder, we can't wait to see what bots you build.

We can't wait to see what bots you build.

Thanks again! My name is Matt Makai and I'm a Developer Evangelist with Twilio, this is Don Goodman-Wilson from Slack. We'll be happy to answer questions in the hallway or contact us with the information on this slide.

Our contact information.

Resources given out via SMS during this talk provided below.

« Back to blog