AI In Your Windows Phone apps? Elementary, My Dear Watson pt. 1

IBM’s Watson supercomputer achieved celebrity status in 2011 when it beat Brad Rutter and Ken Jennings in the Jeopardy! Challenge.  According to IBM:

Watson is a cognitive technology that processes information more like a human than a computer—by understanding natural language, generating hypotheses based on evidence, and learning as it goes. And learn it does. Watson “gets smarter” in three ways: by being taught by its users, by learning from prior interactions, and by being presented with new information. This means organizations can more fully understand and use the data that surrounds them, and use that data to make better decisions.

Wouldn’t it be cool if you could harness the power of Watson in your Windows Store and Windows Phone apps?

Sign up for a FREE 30-day trial with IBM Bluemix

Of course it would, and that is exactly what we are going to start doing right now.

IBM Bluemix

Bluemix is IBM’s cloud application platform and the gateway to accessing Watson’s REST-ful APIs. There are 8 differenct Watson APIs currently available ranging from language identification to user modeling to a question and answer service. In this article we are going to work with the Question and Answer service, but in future articles we will explore other services as well.

To get started, you first need to create a Bluemix account and start your 30-day FREE trial. Once your account is created and you are logged in, you will be able to access the Bluemix dashboard.

Bluemix dashboard

Bluemix dashboard

At this point, the main difference you will see is that your dashboard is blank and you do not have any apps or services yet. While the Watson APIs are services, it is still necessary to create an app and then bind the Watson service to that app to be able to access the REST APIs.

Sign up for a FREE 30-day trial with IBM Bluemix

Create Your App

I wonder what this button does?

Creating an app is as simple as clicking on the ridiculously large “Create an App” button on your dashboard.

You should now see a list of Boilerplate apps. You can literally select any one of these and it doesn’t matter. I chose the “Node.js Cache Web Starter” because Node.js has some cache amongst the hipster/startup crowd.

You will be prompted to enter a name and host for your new app and then click the “Create” button. You will be taken to your app’s dashboard page where you can see its current status. It may take a few minutes for your app to spin up.

Sign up for a FREE 30-day trial with IBM Bluemix

Service With a Smile

Once your app is running you can return to the dashboard page. We are now going to click the “Add a Service” button to add the Watson Question and Answer service to our app. You should now see the following screen:

Add a service

Add a service

Once you click on the Question and Answer service, you will be prompted to bind the service to an existing app. Unless you’ve gone crazy with creating apps, you should only see the app we created earlier. Select it from the App drop down, change the service name if you like, and click the create button.

Sign up for a FREE 30-day trial with IBM Bluemix

Free as in Beer

One thing you may have noticed is that the Watson services are all listed as currently being in BETA. So while that does mean that the full power of Watson is not quite available in all of these services, it also means that your use of the Watson services is completely free, even after your 30 day trial runs out.

Sign up for a FREE 30-day trial with IBM Bluemix

As I might have mentioned a few times, the Watson services are all accessible via REST APIs and the full documentation for those APIs is right here. And since we are all good little devs and have accessed REST APIs hundreds, if not thousands of times before, I can stop right now and go to bed, because you can figure the rest out for yourselves, right?

Not so Fast

One important thing you won’t find on this page is the URL for the service API or the credentials to be able to access the Watson service. Let’s go back to the dashboard page and click on your application. On the application page, you will see each of the services that are bound to it listed. On the bottom of each service box is a “Show Credentials” link. Click that link and you will see the following.

Service URL and credentials

Service URL and credentials

You now have everything you need to start accessing the Watson Question and Answer service. In the next post we will create a Windows Phone 8.1 app with a “Ask Watson” page. If you are anxious to check it out, you can find the source code for the app on GitHub.

If you haven’t already done so: Sign up for a FREE 30-day trial with IBM Bluemix


About Andrew Long

Web developer, Windows Phone developer:, IBM Bluemix Evangelist:
This entry was posted in Windows Phone, Windows Store, Windows Universal, WP8 and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s