Integrate with Ease — AWS + Twilio, Slack and IoT

By Fritzi Borja

Amazon Web Services (AWS) is changing the way engineers develop solutions. It is so easy to prototype and have a scalable architecture with very little hand holding from the Office of the CTO or Systems Engineers. This, in turn, fosters the DevOps culture within the organization.

One of the prototypes we’ve tried is to integrate AWS with Twilio, Slack and Intel Edison + Grove IoT device. We cannot take all the credit here because this was inspired by a recent trip to AWS’s San Francisco pop-up loft. They had a zombie apocalypse themed workshop but we took it a step further and used our company use cases and dissected each step since when we were there, we were just going through the motions. We also thought that learning about how some of these technology companies work will provide us a fresh new perspective on what is moving and shaking the software industry.

The discussion below assumes some AWS knowledge of some of the services used. It does not elaborate on each service and explain it in detail but here’s a quick refresher taken from AWS themselves:

  1. Lambda — “Lets you run code without provisioning or managing servers. You pay only for the compute time you consume — there is no charge when your code is not running”
  2. API Gateway — “Makes it easy for developers to create, publish, maintain, monitor, and secure APIs at any scale”
  3. SNS — “Pub-sub Service for Mobile and Enterprise Messaging”
  4. Dynamo DB — “Fast and flexible NoSQL database service”

Let’s get right to it, shall we? First up…


Twilio is a technology company that allows programmable communications. They are the interface for sending and receiving global SMS and MMS messaging from any app.

  1. Box
  2. Nordstrom
  3. OpenTable
  4. Intuit
  5. Uber
  6. EMC2
  7. Zendesk
  8. Cocacola
  1. Nexmo
  2. Plivo

Our use case is to send a client their next scheduled appointment to speak with one of our investment advisors if they send a text message of “schedule”. For this prototype, the date would have been previously set.


User-appt-schedule is the API gateway that fronts the lambda function named user-schedule-get. The lambda function then fetches the data from the dynamo DB for the schedule date.

  1. Create your Dynamo DB with the primary key of phone number and column for appointment date.
  1. Create your node JS lambda function with that gets the date from the DB given the phone number.
console.log('Loading function');
var aws = require('aws-sdk');
var ddb = new aws.DynamoDB({
region: "us-west-2",
params: {
TableName: "participant-schedule-reminder"
var theContext;function dynamoCallback(err, response) {
if (err) {
console.log('error' + err, err.stack); // an error occurred;
} else {
console.log('result: ' + JSON.stringify(response)) // success
console.log('parsed response ' + JSON.stringify(response.Item.scheduledDate.S).replace("\"", ""));
theContext.succeed("Your next retirement checkup is scheduled on " +
JSON.stringify(response.Item.scheduledDate.S).replace("\"", ""));
exports.handler = function(event, context, callback) {
theContext = context;
console.log("Request received:\n", JSON.stringify(event));
console.log("Context received:\n", JSON.stringify(context));
// Determine text
var textBody = event.body;
// Get the phone number, only the last 10 characters
var phoneNumber = event.fromNumber.substring(2, 12);
console.log('phone ' + phoneNumber);
if (event.body.trim() == "schedule") { var params = {
Key: {
"phone-number": { N: phoneNumber }
AttributesToGet: [
var response = ddb.getItem(params,dynamoCallback);
} else {
theContext.succeed("Text 'schedule' to get your retirement check up date");

3. Create your API gateway that invokes the lambda function for each get request. The nuance with this is that every request that comes from Twilio is in TwiML format (XML format) but our lambda function requires a JSON object so a conversion has to be done in the integration piece of the API gateway and every JSON response from the lambda function needs to be converted to TwiML format.


  1. You can sign up for a trial account with Twilio and they you will get a phone number from them.
  2. You can then program this phone number with web hooks. The URL below is the ARN URL from AWS for the API gateway.


Slack is an instant messaging and collaboration system. They have teams and channels and have robust features for search. There are commands that can be programmed called “slash commands” which allows for forwarding the message typed in the chat box to an external source with the use of a web hook.

  1. Airbnb
  2. CNN
  3. Buzzfeed
  4. EA Sports
  5. Ebay
  6. Harvard University
  7. Samsung
  8. Expedia
  9. Intuit
  1. HipChat
  2. Yammer
  3. Google Hangouts
  4. Facebook at work

Our use case is to send a client their next scheduled appointment to speak with one of our investment advisors if they send a slash command in the appropriate FE channel. The date would have been previously set.

  1. Create a slash command (“fngn” in this example). You still wouldn’t have the URL at this point since that will come from AWS. The token below will be copied over to AWS’ lambda function to verify that the request came from the right channel.


  1. Create a Dynamo DB with the slack handle as the primary key:

2. Create a lambda function that takes the handle and looks it up in the DB.

3. Create an API gateway to convert the XML format from slack to JSON and vice versa.

Intel Edison + Grove IoT device

Intel Edison is a chip where code can be pushed built for wearables and Internet of Things (IoT) devices. The grove toolkit contains a variety of widgets that can be attached to the Edison board.

Use case:

When motion is detected from the IoT device, send me an email notification.

Grove has a motion detector widget so that was attached to the Edison board.

  1. Intel XDK IoT Edition is the IDE that provides templates to create Nodejs projects and deploy the code for sensors to Edison.

2. From there, it’s just a matter of setting up the SNS service so that every motion detected triggers a publish to the email.

This was a very fun hack. Not only did I find out more information about Twilio, Slack and IoT but it made me realize how easy it is to prototype and possibly productize solutions using the power of AWS. We are now only limited by the power of our imagination.

Financial Engines TechBlog

Technological insights in the FinTech space

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store