A sample/demo app that uses IBM Bluemix to analyze the objects in photos on Facebook via IBM Watson and analyzes the sentiment of the comments on photos via the Alchemy API
JavaScript HTML CSS
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
githubContent
public
views
.bowerrc
.cfignore
.gitignore
LICENSE
README.bmd
README.md
app.js
bower.json
config.js
manifest.yml
package.json
vcap-local-example.json

README.md

Facebook Photo Analyzer

Architecture Diagram

Deploy

There are two menthods to deploy this app. With both ways you will need to create a Facebook developer app and signup for a AlchemyAPI account.

Facebook setup

  1. Goto https://developer.facebook.com
  2. Sign in and click hover over My Apps at the top, then click new app.
  3. Click Website for the app type
  4. Click Skip and Create App ID
  5. Give your application a name and category. Click "Create App ID".
  6. Leave the page open on Facebook that it brings you to. It should have an App ID and App Secret displayed at the top. We will need this info later.

Quick and easy

Click the following button

Deploy to Bluemix

You might get a screen asking you to create an alias on DevOps services. If you do just use the part before the @ sign in your email address. Example if your email is johnsmith@gmail.com your username would be johnsmith*

Once the deployment is done, skip to step 10 below.

Developer way

  1. Create a Bluemix Account

    Sign up for Bluemix, or use an existing account.

  2. Download and install the Cloud-foundry CLI tool

  3. Download and install Git

  4. Clone the app to your local environment from your terminal using the following command

git clone https://github.com/IBM-Bluemix/facebook-photo-analyzer.git
  1. cd into this newly created directory
cd facebook-photo-analyzer
  1. Edit the manifest.yml file and change the <application-name> and <application-host> to something unique.

    applications:
    - name: facebook-photo-analyzer
      framework: node
      runtime: node12
      memory: 256M
      instances: 1
      host: facebook-photo-analyzer
      path: .
      command: node app.js
    

The host you use will determinate your application url initially, e.g. <application-host>.mybluemix.net.

  1. Connect to Bluemix in the command line tool and follow the prompts to log in.

    $ cf api https://api.ng.bluemix.net
    $ cf login
    

    If you want to deploy this app to the EU region in London use the following

    $ cf api https://api.eu-gb.bluemix.net
    $ cf login
    

    If you want to deploy this app to the Asia/Pacific region in Australia use the following

    $ cf api https://api.au-syd.bluemix.net
    $ cf login
    
  2. Create the Visual Recognition service in Bluemix.

$ cf create-service visual_recognition free visual-recognition-photo-analyzer
  1. Create the Cloudant service in Bluemix.
$ cf create-service cloudantNoSQLDB Shared cloudant-photo-analyzer
  1. Push it to Bluemix. We need to perform additional steps once it is deployed, so we will add the option --no-start argument
$ cf push --no-start
  1. In the Bluemix UI click on your application. At the top of the screen there will be a url for your application, ex. http://facebook-photo-analyzer.mybluemix.net. Copy this and go back to your Facebook app tab in your browser. We need to use this url as our application URL.
  2. Click "Settings" on the left hand side and then click "Add Platform"
  3. Click WWW
  4. Type in the URL for your application, ex. http://myapp.mybluemix.net, click "Save Changes".
  5. On the left click Dashboard, copy the Facebook app ID.
  6. Go back to Bluemix and click on Environment variables on the left hand side.
  7. Click on user defined
  8. For the name of the enviroment variable enter FACEBOOK_APP_ID. For the value paste your Facebook app ID.
  9. Go back to Facebook, copy the app secret. Go back to Bluemix. Repeat step 4 expect this time the variable name is FACEBOOK_APP_SECRET. Paste in the value for the Facebook app secret.
  10. When we signed up for the Alchemy API we should of recieved an API key in our email. We need to create an environment variable to store this. Create another environment variable called ALCHEMY_API_KEY, paste in api key for Alchemy for the value.
  11. Click save.
  12. Click overview in the top left.
  13. On the right hand side, click restart or start.

Privacy Notice

The Personality Box sample web application includes code to track deployments to Bluemix and other Cloud Foundry platforms. The following information is sent to a [Deployment Tracker] [deploy_track_url] service on each deployment:

  • Application Name (application_name)
  • Space ID (space_id)
  • Application Version (application_version)
  • Application URIs (application_uris)

This data is collected from the VCAP_APPLICATION environment variable in IBM Bluemix and other Cloud Foundry platforms. This data is used by IBM to track metrics around deployments of sample applications to IBM Bluemix. Only deployments of sample applications that include code to ping the Deployment Tracker service will be tracked.

Disabling Deployment Tracking

Deployment tracking can be disabled by removing require("cf-deployment-tracker-client").track(); from the beginning of the app.js main server file.