In this journey, our server application will get 200 tweets for a specified Twitter handle. These tweets will be analyzed by Waston Personality Insights to understand users’ habits and preferences on an individual level. Based on the resulting analysis, suggested gifts will be presented in a Web UI.
When the reader has completed this journey, they will understand how to:
- Run an application that monitors a Twitter feed.
- Send the tweets to Watson Personality Insights for processing and analysis.
- Present the information in a Node.js web UI.
- User enters a Twitter handle name and click
Find!
button. - Tweets are pushed out by Twitter.
- The app (app.js) processes the tweets.
- The Watson personality Insights Service performs analysis of consumption needs.
- The Web UI displays products that matches user consumption needs and preferences.
- Waston Personality Insights: Predict personality characteristics, needs and values through written text. Understand your customers’ habits and preferences on an individual level, and at scale.
- Cloud Foundry: Build, deploy, and run applications on an open source cloud platform.
- Artificial Intelligence: Artificial intelligence can be applied to disparate solution spaces to deliver disruptive technologies.
- Node.js: An open-source JavaScript run-time environment for executing server-side JavaScript code.
The setup is done in 3 primary steps. You will download the code, setup the application and then deploy the code to IBM Cloud.
- Sign up on IBM Cloud
- Clone the repo
- Twitter Requirements
- Create Watson Personality Insights service with IBM Cloud
- Run the application
If you do not already have a IBM Cloud account, sign up for IBM Cloud.
Click Clone or download
button. Then, Download ZIP
To get Tweets from a specific handle in this application, it is required to create a Twitter account and a Twitter application. The Twitter account will be used as the account that gets the tweets from other Twitter users.
- You can create an account on Twitter or use an existing account.
- Once you have the Twitter account created and verified, log in to Twitter Dev and create an application.
- Select the Keys and Access Tokens tab and copy your
API Key
andAPI Secret
. - In
app.js
file, paste your keys toconsumer_key
andconsumer_secret
:
var Twithelper = new Twit({
consumer_key: 'Your key',
consumer_secret: 'Your secret',
app_only_auth: true
})
- Download and install the Cloud Foundry CLI tool.
- Log into IBM Cloud with your account.
- Create
Personality Insights
service.
- From the top bar menu, click
Catalog
. - On the left menu, select
Watson
. - Select
Personality Insights
. - Click
Create
.
- Once the application is created, go into the application and select
Service credentials
. - Click
View credentials
to copy your username and password into the code inapp.js
:
var personality_insights = watson.personality_insights({
username: 'Your username',
password: 'Your password',
version_date:'2016-10-19',
version: 'v3'
});
-
Open the
manifest.yml
file and change thename
ANDhost
value to a unique application name. -
Connect to IBM Cloud in the command line tool and follow the prompts to log in
cf login -a https://api.ng.bluemix.net
- Push the app to IBM Cloud.
cf push
- The application should now be running on IBM Cloud. You can access the application URL using the application name you defined in the manifest.yml file with a
.mybluemix.net
appended to it.