简体   繁体   中英

IBM Watson Assistant: How can i handle context variable coming from the dialog?

I have a problem handling context variables of my Wataon Assistant. Example, let's say I want to update my bank balance in a MongoDB layer. So I ask the user please provide new deposit amount . And in the dialog flow I respond let's say Thank you, you're balance now is $balanceFromDB .

The proplem here that once i respond with the amont the chatbot respond without waiting me to update the db and the amount context variable he provided I can't find it in the json response to my Node.js app? So how can i make the assistant send me the new context variable and wait before responding to user till I update my DB.

Take a look at this tutorial about building a database-driven chatbot with Watson Assistant . The provided code includes the dialog for Watson Assistant.

  • You either handle the database update using Cloud Functions (as in the tutorial). In that case you need a dialog node to invoke the database action and a node to return the response.
  • If you have an app that sits between the user and Watson Assistant, you need to check whether your app needs to act, eg, update the database. Are you using the Node.js SDK to handle the session and the messages? You could check what context variables are returned and act based on the user input.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM