Q: “Combining these two APIs can let you quickly query a complex health data set via SMS.”

A: “What are IBM Watson and Twilio?”

You probably remember IBM Watson battling humans in Jeopardy. Now developers can access this same power via the Watson Question and Answer API. Currently IBM has exposed the health and travel data sets via the API. I wanted to build an app that lets me send a question about health in an SMS and get a response from the Watson. This app will allow me to trick my friends into being impressed by my expansive knowledge of healthy living. Today I’m going to show you how I did it using IBM Bluemix, the Watson Question and Answer API, Node.js and Twilio. You can try out the finished product by texting a health related question to: (929) 242-6747

What’s In Our Fannypack

We’ll be using the following technologies to build our app:

Cause I’m Hapi

One of my favorite things to do when I’m building an application like this is to treat it as an opportunity to try new technologies I’ve been hearing about. I thought this application would be a fun excuse to use Hapi.js. Hapi.js is a Node.js HTTP server framework, in a similar vein to Express. If you’re wondering a bit more about Hapi and Node.js I’d highly recommend Matt Harrison’s great post “Express to Hapi.js”.

In order to interact with the Watson Question and Answer API we need to deploy this application to IBM Bluemix. To start, let’s just build the Hapi.js “hello world” application and deploy it to Bluemix to make sure we have everything set up correctly. After that we’ll integrate Watson and Twilio.

We can create a new directory on our location machine called twilio-watson and then initialize a new Node.js project in that directory: