Skip to content

Latest commit

 

History

History
174 lines (124 loc) · 6.78 KB

INSTRUCTIONS.md

File metadata and controls

174 lines (124 loc) · 6.78 KB

Watson Hands On Labs - Social Customer Care

During this lab, you will use the Natural Language Classifier service to direct customer requests and queries to the appropriate agent or workflow. Additionally, Tone Analyzer, Alchemy Language, and Personality Insights demonstrate how to efficiently provide an agent with customer insights.

You can see a version of this app that is already running here.

So let’s get started. The first thing to do is to build out the shell of our application in Bluemix.

Creating a IBM Bluemix Account

  1. Go to https://bluemix.net/
  2. Create a Bluemix account if required.
  3. Log in with your IBM ID (the ID used to create your Bluemix account)


Note: The confirmation email from Bluemix mail take up to 1 hour.

Deploy this sample application in Bluemix

  1. Clone the repository into your computer.

    git clone https://github.com/watson-developer-cloud/social-customer-care.git
    
  2. Sign up in Bluemix or use an existing account.

  3. If it is not already installed on your system, download and install the Cloud-foundry CLI tool.

  4. Edit the manifest.yml file in the folder that contains your code and replace social-customer-care with a unique name for your application. The name that you specify determines the application's URL, such as application-name.mybluemix.net. The relevant portion of the manifest.yml file looks like the following:

    declared-services:
      natural-language-classifier-service:
        label: natural_language_classifier
        plan: standard
      personality-insights-service:
        label: personality_insights
        plan: tiered
      tone-analyzer-standard:
        label: tone_analyzer
        plan: standard
    applications:
      - services:
        - natural-language-classifier-service
        - personality-insights-service
        - tone-analyzer-standard
      name: social-customer-care
      command: npm start
      path: .
      memory: 512M
  5. Connect to Bluemix by running the following commands in a terminal window:

cf api https://api.ng.bluemix.net
cf login -u <your-Bluemix-ID> -p <your-Bluemix-password>
  1. Create and retrieve service keys to access the Natural Language Classifier by running the following command:
cf create-service natural_language_classifier standard natural-language-classifier-service
cf create-service-key natural-language-classifier-service myKey
cf service-key natural-language-classifier-service myKey
  1. Create and retrieve service keys to access the AlchemyLanguage by running the following command:
cf create-service alchemy_api free alchemy-language-service
cf create-service-key alchemy-language-service myKey
cf service-key alchemy-language-service myKey
  1. Create and retrieve service keys to access the Tone Analyzer by running the following command:
cf create-service tone_analyzer standard tone-analyzer-service
cf create-service-key tone-analyzer-service myKey
cf service-key tone-analyzer-service myKey
  1. Create and retrieve service keys to access the Personality Insights by running the following command:
cf create-service personality_insights tiered personality-insights-service
cf create-service-key personality-insights-service myKey
cf service-key personality-insights-service myKey
  1. The Natural Language Classifier requires training prior to using the application. The training data is provided in data/classifier-training-data.csv. Adapt the following curl command to train your classifier (replace the username and password with the service credentials of the Natural Language Classifier created in the last step). Save the classifier_id from the returned json:

    curl -u "{username}":"{password}" -F training_data=@data/classifier-training-data.csv -F training_metadata="{\"language\":\"en\",\"name\":\"My Classifier\"}" "https://gateway.watsonplatform.net/natural-language-classifier/api/v1/classifiers"
  2. Sign up at dev-twitter for application credentials. Create a new application with the Create new app button and fill out the required form.

  3. Provide the credentials from step 6 - 9 to the application by creating a .env.js file using this format:

    module.exports = {
      TWITTER: JSON.stringify([{
        consumer_key: 'twitter_consumer_key',
        consumer_secret: 'twitter_consumer_secret',
        access_token_key: 'twitter_access_token_key',
        access_token_secret: 'twitter_access_token_secret'
      }]),
      
      TWITTER_TOPIC: '@support',
      
      NATURAL_LANGUAGE_CLASSIFIER_USERNAME: '<Natural Language Classfier username>',
      NATURAL_LANGUAGE_CLASSIFIER_PASSWORD: '<Natural Language Classfier password>',
      CLASSIFIER_ID: ' CLASSIFIER ID',
      
      PERSONALITY_INSIGHTS_USERNAME: '<Personality Insights username>',
      PERSONALITY_INSIGHTS_PASSWORD: '<Personality Insights password>',
    
      TONE_ANALYZER_USERNAME: '<Tone Analyzer username>',
      TONE_ANALYZER_PASSWORD: '<Tone Analyzer password>',
      
      ALCHEMY_API_KEY: '<Alchemy API apikey>'
    };
  4. Install the dependencies you application need:

npm install
  1. Build the application UI:
npm run build
  1. Start the application by running:
gulp
  1. Test your application locally by going to: http://localhost:5000/

Deploying your application to Bluemix

  1. Push the updated application live by running the following command:
cf push

After completing the steps above, you are ready to test your application. Start a browser and enter the URL of your application.

              <application-name>.mybluemix.net

You can also find your application name when you click on your application in Bluemix.

Congratulations

You have completed the Social Customer Care Lab! :bowtie:

Congratulations