Set up the sample project and add the WDC SDK
- Open a new terminal window and create a directory for your application:
mkdir example
cd example - Initialize a new npm project:
npm init
- Accept all default values.
- Install the SDK for the Node.js package and save the dependency in package.json:
npm install watson-developer-cloud –S
- 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
- Verify that both packages are listed as dependencies by running the
cat
command:
cat package.json
- Open this project in your favorite code editor, such as VS Code:
code .
You should see the node_modules and package.json. - In your editor, create a .env file and add the following lines:
USERNAME=<:your_value>
PASSWORD=<your_value>
WORKSPACE_ID=<your_value>- Get the
USERNAME
andPASSWORD
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).
- Get the