Community

Twitter Personality Comparisons Using Watson

Share this post:

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.

Add Comment
7 Comments

Leave a Reply

Your email address will not be published.Required fields are marked *


Name *Tagwa

The link to the FriendMe app is not working!

Reply

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 🙂

Reply

    Jeff Sloyer

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

    Reply

Leo Kenji

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

Reply

    Jeff Sloyer

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

    Reply

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

Reply

    Msingh

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

    Reply
More How-tos Stories

Get the most out of Salesforce

CRM systems are critical for enterprises. They allow business users to more easily access and manage customer information and records customer interactions from multiple channels. CRM systems also automate workflows and provide tracking, performance and productivity information.

Continue reading

Top 5 Highlights from VMworld 2017

With VMworld US & Europe coming to a close, we’re taking a look back into activities and announcements that took place over the past couple of weeks. Below is a recap of some of the most exciting stories for those who didn’t get a chance to hear the news on the ground.

Continue reading

Monitoring & logging for IBM Bluemix Container Service with Sematext

In this blog post we discuss how Sematext integrates with IBM Bluemix Container Service to provide monitoring and logging visibility of your containerized applications, as they run in production. In the sections below, we demonstrate how to set up a Kubernetes cluster in Bluemix and how to set up Sematext in this cluster. IBM Cloud has monitoring and logging capabilities in the platform, but we know our customers operate in a multi-cloud or hybrid cloud environment and we are very excited to partner with Sematext, enabling operational consistency across those environments. We worked with Alen Komljen, an Automation Engineer from Sematext, to create the following content and perform the technology validation.

Continue reading