Community

Twitter Personality Comparisons Using Watson

Hey Yall!

We are back at it again with some demos!!!

Did you ever wonder if you and your favorite celebrity would be compatible if you met?? I sure do! Or did you ever wonder how you could become a better leader, I sure do. Today you would have to go Google the person and analyze posts and articles about them and be a personality expert to see if you have personality traits in common.

Gone are those days now!

Enter FriendMe!  Your trusted personality comparison using IBM Watson. The answer to the above questions are easy now.  For example,  if I compared myself to the IBM Design Twitter account, I can see my personality is very much alike with the IBM Design team.  Thats good news for me because I never considered myself a designer…
jeff-and-ibm-design

 

For the leadership, personal, and professional case, Jerry Cuomo is a very successful leader at IBM. I can see that myself and Jerry share 5 out of the top 5 personality traits in common.  In my career development I can see I need to develop myself more as a transformational leader.

jeff-and-jerry

Lastly, I am going to do one more comparison, between myself and Blake McGregor (a product manager for Bluemix).

jeff-and-blake

So let’s jump right into it.

This app was written in about 6 hours, its built using obviously IBM Bluemix, Node.JS, Angular.JS, Bootstrap, JQuery, IBM Watson, Cloudant, and Twilio.

If you went to the link above, here it is again.  You can actually text the app.  If you text the app two Twitter handles it will tell you the compatibility between two people.

So the source code is available https://hub.jazz.net/project/jsloyer/friendme.

First, we are going to walk through on how to deploy this app and get it working in Bluemix.  Secondly, we are going to walk through how to use the command line to deploy this app as well.

If you haven’t already sign up for a Bluemix account.  Once you have done that head over to jazzhub.com.  Login there with the username and password you created from your Bluemix account.  If you haven’t logged in yet to jazzhub it will ask you to create an id.  For example if my email is jsmith@co.com, I would create a username of jsmith.

First, let’s open a web browser and goto https://hub.jazz.net/project/jsloyer/friendme.  Since we already created an account or logged in jazzhub above we should be logged in.  On the right hand side near the top there should be a big button that says “Fork Project”.  Let’s click that.


fork
Let’s go ahead and enter a project name, for example friendme, you can name it anything you want though.  Next place a check mark next to “Make it Private”, more on this later…  Next make sure an organization and space is shown, it should should your email address as the organization and the space should be dev.  Lastly, click “Save”.


fork2
Next we need to create the app in Bluemix and setup some services.  So in a new browser window navigate to http://bluemix.net.  In the top right click login.

Once you login click on catalog and find SDK for Node.JS.  Go ahead and click on it.

node

Type in a name for your app, this will also be the URL for your app, remember this as we will need it later…  Then click “Create”.

Behind the scenes Bluemix is spinning up a container for our app, setting up SSL, and setting up load balancing. In a traditional IaaS, you would have to do all this manually and it can take hours or days…

createapp

Next, we need to add some services to our app.  We need Watson and Cloudant.  Let’s do Watson first.  The Watson service that we want is User Modeling.  It will analyze text and determine someone’s personality.  So to do this let’s click “Add A Service”.

addservice

Let’s go to the Watson section and click on “User Modeling”.

usermodeling

It will bring up a dialog asking us to bind the service to our app, on the right hand side, click “Create”.

usermodeling2

It will ask us if we want to restage the app, go ahead and click ok.  What this means is it needs to bind the service to the app and to do this it needs to restart it.

Next, we need to create a database, to do this let’s click on the Cloudant tile.

cloudantclick

Then let’s click on the launch button.

cloudantlaunch

Next we need to create a database, click on “Add New Database” in the top right.

addnewdb

Then enter a name for the database, let’s use friendme, if you use something else we will have to edit the code…  Go ahead and click “Create”.

db

We can close out of Cloudant now.

So, since we are making API calls to Twilio and Twitter we need to register for API key’s.

Let’s do Twitter first, head on over to http://apps.twitter.com and login with your Twitter username and password.

In the top right let’s click on “Create New App”.  Type in a name and description for the app, the URL actually doesn’t matter but let’s type in something real.  Remember above the name you created for your app in Bluemix, let’s type that in.  For example http://friendme.mybluemix.net.  Replace friendme with the name of your app.

Click on the “Keys and Access Tokens” tab.  Under Access Tokens click “Create my access token”.  Leave this tab open, we will need these API’s keys in a bit…

Next we need a Twilio phone number if you would like to be able to text your app.  If you don’t want to be able to text the app skip this section, you can use the UI of the app to interact with it.  Head on over to https://www.twilio.com/try-twilio and create an account.  If you already have an account go ahead and goto https://www.twilio.com/user/account/phone-numbers/incoming or if you just created an account go there as well.

We need to buy a number, to do this click on “Buy Number” in the top right.  Make sure the number has texting capabilities.

twilio

Try to find one of the cheaper ones, the cheapest you can find is $1/month, not bad…

So once we buy the number we will need our API key’s.  They can be found at https://www.twilio.com/user/account/settings.  Leave this tab open like we did for Twitter, we will come back to this…

Ok so finally time to deploy our app.  To do this switch back to Jazzhub, click the “Build & Deploy” button in the top right.

buildanddeploy

Go ahead and click on “Advanced” to turn on deployments.

advanced

Click on “add a builder”.

addabuilder

For builder type choose “Shell Script”.

For the build script text area enter the following.

#!/bin/bash
echo "do nothing"

Since it is node we really don’t need a build here…  If this wasn’t a demo and real app we would probably run some unit tests and do some linting here…

Click on Save.

builderdone

Next we need to set up the deployment.  Click on “add a stage”.

addstage

Make sure the app name matches the app name we created in Bluemix.

Last thing we need to do is modify the build script.  This is the only really confusing bit, you need to make sure you set this up correct or the app won’t work…

When you first click on “add a stage” it will look like the following….

deploybefore

The script will look like the following.


We will need to update it to the following.

For each of these values we need to substitute in the the correct values from the tab’s we kept open earlier from Twitter and Twilio.

If you remember earlier we made the project private, this was to prevent other people from seeing our secret access key’s.  DevOps Service will be rolling out a new over the coming weeks where you can find information for a public project.

Once you replace the values go ahead and click “Save”.

Last thing to do is click “Request Build”.  That should successfully complete and that will trigger a deployment of your app.

You can see the deployment is being performed by the following screen shot.

buildrunning
Once the deployment finishes you can click the link (name of your app) to your app to use it!

done

Please reach out to me on Twitter (@jsloyer) if you have any issues or post a comment below.

Share this post:

Share on LinkedIn


Name *Tagwa

The link to the FriendMe app is not working!


Leo Kenji

It’s working for me, but I have those entries in my hosts file to find some bluemix domains. There’s a broken image link, although. Pretty nice app :-)


    Jeff Sloyer

    The app is working for me, give it a try again.


Leo Kenji

Now it stopped working. It says “Oh snap! Change a few things up and try submitting again.”


    Jeff Sloyer

    You might be typing in an invalid twitter handle. The error message could of been a little better, sorry about that.


ValerieLampkin

This is a pretty cool app. I compared my teenage daughter and myself thinking we would not have anything in common but
we had 2 of 5 matching personality traits


    Msingh

    Please somebody tell how to call Twitter service from Watson using Java code

Comments are closed.

More Community Stories

IBM Analytics for Apache Spark – Personal Plan price and name change

We’re excited to announce new pricing and a name change for the IBM Analytics for Apache Spark Personal Plan. The pricing change is effective November 1, 2016.

Container Orchestration = Harmony for Born in the Cloud Applications

Have you heard all the buzz around Docker? Have you ever tried to run a Docker container on your laptop or even in the Cloud like IBM Bluemix? Assuming you have, have you ever discovered that you need more than one Docker images in your application so that your Docker container can do more than “Hello World”? As you need to build more interesting cloud native applications, it is critical for you to have a “prescription” for building multi-container packaged applications and run these applications in the cloud. There is a growing container orchestration ecosystem that is dedicated to solving this!

With IBM Wearables SDK, you do the exercise, Bluemix will do the counting

To show how powerful Bluemix could be for making wearable devices really helpful, we’ve built a simple app that counts the number of repetitions you perform when you exercise. And yes, you can obtain this app and the tools needed to build your own flavor.