Set up the sample project and add the WDC SDK

  1. Open a new terminal window and create a directory for your application:
    mkdir example
    cd example
  2. Initialize a new npm project:
    npm init
  3. Accept all default values.
  4. Install the SDK for the Node.js package and save the dependency in package.json:
    npm install watson-developer-cloud –S
  5. Install the dotenv package and save this dependency in the package.json.
    Use dotenv to store the Watson Conversation service username and password in the environment:
    npm install dotenv –S
  6. Verify that both packages are listed as dependencies by running the cat command:
    cat package.json
  7. Open this project in your favorite code editor, such as VS Code:
    code .
    You should see the node_modules and package.json.
  8. In your editor, create a .env file and add the following lines:

    • Get the USERNAME and PASSWORD from your Watson Conversation instance Service Credentials page in Bluemix.
    • Get your WORKSPACE_ID from your Watson Conversation instance in the Manage tab in Bluemix (Launch Tool > menu > View Details).