This module allows you to connect to the IBM Cloud Watson Assistant, allow you to create sessions, and send messages
npm install watson-assistant-nodejs --save
const Watson = require('watson-assistant-nodejs');
// The first function
const assistantID = ""; // Requiered
const config = {
iam_apikey: "", // Required
assistantId: "", // Required
url: "", // Optional, default is https://api.us-south.assistant.watson.cloud.ibm.com
version: "", // Optional, default is 2018-07-10
};
const context = {}; // Optional
const assistant = new Assistant(assistantID = "", config = {}, context = {}); // return promise
// The second function
const context = {} // Optional
const assistantID = "" // Optional, defaults to the AssistantID of the class constructor
assistant.createSession(context = {}, assistantID = ""); // return promise
// The third function (Optional)
const session_id = ""; // Required
const context = {} // Optional
const assistantID = "" // Optional, defaults to the AssistantID of the class constructor
assistant.initConversation(session_id, context = {}, assistantID = this.assistantID); // return promise
// The third function
const sessionId = ""; // Required
const input = ""; // Required
const assistantID = "" // Optional, defaults to the AssistantID of the class constructor
assistant.sendMessage(sessionId = "", input = {}, context = {}, assistantID = ""); // return promise