Giter Site home page Giter Site logo

watson_nodejs's Introduction

watson_nodejs

Interacting with the Watson Assistant service using the javascript sdk

Install the NodeJs module that is used to interact with watson developer cloud.

npm install -g watson-developer-cloud

Note: -g stores the node module globally in the local computer.

You will need a workspace in the Watson Assistant Service through which you will get the service information.

Getting Service Information

To access the Watson Assistant service REST APIs, your application needs to be able to authenticate with IBM® Cloud and connect to the right Watson Assistant workspace. You'll need to copy the service credentials and workspace ID and paste them into your application code.

To access the service credentials and the workspace ID from your workspace, select the Menu menu, choose Deploy, and then go to the Credentials tab.

You can also access the service credentials from your IBM® Cloud dashboard.

Communicating with the Watson Assistant service

Interacting with the Watson Assistant service is simple. Let's take a look at an example that connects to the service, sends a single message, and prints the output to the console:

Inside sendMessage.js file we sets up service wrapper, sends initial message, and receives response.

We use dotenv to access the .env variables since we need to keep the watson credentials secret.

npm install -g dotenv

Read the documentation for dotenv for more details on how to use it or take a look at sendMessage.js file.

Processing User Input

To be able to process user input, we need to add a user interface to our application. For this example, we'll keep things simple and use standard input and output. We can use the Node.js prompt-sync module to do this. (You can install prompt-sync using npm install prompt-sync.)

watson_nodejs's People

Contributors

alexmhack avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.