Mounika
Mounika

Reputation: 35

How to integrate IBM Watson Assistant services in Node.js local development

I created a simple instance which contains greetings intent in IBM Watson Assistant service. I need to integrate it with Node.js local development. And for that, I downloaded a simple Watson SDK for the Watson Assistant service. But I don't know how to proceed with it. In that SDK which fields do I need to edit for my instance.

Upvotes: 1

Views: 3234

Answers (2)

DSeager
DSeager

Reputation: 227

The sample apps list in the official documentation has several sample NodeJS apps: https://console.bluemix.net/docs/services/assistant/sample-applications.html#sample-apps

The simple assistant app from above details how to run the app locally and how to copy a .env file and set up the correct details of your Assistant service and workspace. Also how to push to Cloud Foundry and run as an app in the cloud.

The SDK will pick up the credentials from the environment or, if in IBM Cloud, the Assistant service if you bind it to your app.

It is recommended to not hardcode credentials or the Workspace ID into the app but pick these up from the environment, so that you can easily change them.

The date you provide the SDK is the latest Assistant API date that you want to use. As described in Versioning, when new features are added to the Assistant API which are not backward compatible, the version will be updated and only caller who pass in the new version will see the changed behaviour. Thus you can keep the API behaving in the way that you coded the application and not have any code breaks.

Upvotes: 1

data_henrik
data_henrik

Reputation: 17118

You probably downloaded or installed the official Watson Developer Cloud SDK for Node.js. It has API support for all the IBM Watson services.

In that SDK are examples, including some for the former Conversation, now Assistant service. Even though there is still a Conversation API, I highly suggest using the Assistant V1 and V2 APIs. The Conversation API is deprecated.

You need to pass in or set - the API version (a date)
- either username and password
- or the IAM access token
- the gateway URI

The GitHub org watson-developer-cloud contains several sample apps. The first one I found, customer-engagement-bot, has instructions for running the bot either in the cloud or locally.

Upvotes: 1

Related Questions