Digital Developer Conference: a FREE half-day online conference focused on AI & Cloud – North America: Nov 2 – India: Nov 9 – Europe: Nov 14 – Asia Nov 23 Register now

Close outline
  • United States
IBM?
  • Site map
IBM?
  • Marketplace

  • Close
    Search
  • Sign in
    • Sign in
    • Register
  • IBM Navigation
IBM Developer Answers
  • Spaces
    • Blockchain
    • IBM Cloud platform
    • Internet of Things
    • Predictive Analytics
    • Watson
    • See all spaces
  • Tags
  • Users
  • Badges
  • FAQ
  • Help
Close

Name

Community

  • Learn
  • Develop
  • Connect

Discover IBM

  • ConnectMarketplace
  • Products
  • Services
  • Industries
  • Careers
  • Partners
  • Support
10.190.13.195

Refine your search by using the following advanced search options.

Criteria Usage
Questions with keyword1 or keyword2 keyword1 keyword2
Questions with a mandatory word, e.g. keyword2 keyword1 +keyword2
Questions excluding a word, e.g. keyword2 keyword1 -keyword2
Questions with keyword(s) and a specific tag keyword1 [tag1]
Questions with keyword(s) and either of two or more specific tags keyword1 [tag1] [tag2]
To search for all posts by a user or all posts with a specific tag, start typing and choose from the suggestion list. Do not use a plus or minus sign with a tag, e.g., +[tag1].
  • Ask a question

A unique problem with Watson conversation service and node red

31000212E5 gravatar image
Question by DennisNoto  (16) | Sep 19, 2016 at 01:31 AM watsonwatson-assistantnode.jsnode-redibmcloud

My Ipad app is using a Node-Red flow that has conversation embedded in the flow.

Conversation service does not re-issue a new conversation_id when the conversation is on a dialog node that has condition = true when the iPad app is restarted. Infact, anytime the app calls the flow going forward, Watson conversation will return the same conversation_id and dialog node answer regardless of the context object being present. Only after restarting the flow - fixes the problem. There is a caching problem going on somewhere outside the Watson conversation api. Watson developers claim that the service is stateless and they only act on the presence of the context object. This is not a code issue with the node red flow, I have verified that the function node constructs the proper json struct sent to the conversation api and it has been debugged dozens of time. So what is left : nodered and the nodejs container.

Json Debug Example

First send to Conversation service, without Context structure

 2016-09-13T14:14:27.724-0600[App/0]OUT13 Sep 20:14:27 - [info] [function:Make String for Conversation] {"context":"","email":"dennisnoto@gmail.com","fname":"Mary","input":"Hi","lname":"Smith","nname":"Molly","phone":"720-236-2541","workspace_id":"71fb6c7d-730c-45ea-94e5-e7704b0eb4ca"}

Conversation service sent back a context block with conversation id present. As expected.

 2016-09-13T14:14:27.911-0600[App/0]OUT13 Sep 20:14:27 - [info] [function:Watson Response Msg] {"text":"Howdy Mary, Can I help you with learning about investing?","username":"Watson","context":"{\"conversation_id\":\"5c1605c7-17ae-4680-8907-fc540e7bfb88\",\"system\":{\"dialog_stack\":[\"node_6_1467586704662\"],\"dialog_turn_counter\":11,\"dialog_request_counter\":11,\"system\":{\"_node_output_map\":{\"node_6_1467586704662\":[0]}}},\"fname\":\"Mary\",\"lname\":\"Smith\",\"nname\":\"Molly\",\"email\":\"dennisnoto@gmail.com\",\"phone\":\"720-236-2541\"}"}

Stopped my app and restarted at a dialog node with condition = true. Sent the start of a new conversation with no context block present.

 2016-09-13T14:19:34.717-0600[App/0]OUT13 Sep 20:19:34 - [info] [function:Make String for Conversation] {"context":"","email":"dennisnoto@gmail.com","fname":"Mary","input":"Hi","lname":"Smith","nname":"Molly","phone":"720-236-2541","workspace_id":"71fb6c7d-730c-45ea-94e5-e7704b0eb4ca"}

Conversation sends back the same context block with the same conversation_id.

 2016-09-13T14:19:34.877-0600[App/0]OUT13 Sep 20:19:34 - [info] [function:Watson Response Msg] {"text":"I am here at the point of no return","username":"Watson","context":"{\"conversation_id\":\"5c1605c7-17ae-4680-8907-fc540e7bfb88\",\"system\":{\"dialog_stack\":[\"node_1_1473797885279\"],\"dialog_turn_counter\":16,\"dialog_request_counter\":16,\"system\":{\"_node_output_map\":{\"node_6_1467586704662\":[0,1]}}},\"fname\":\"Mary\",\"lname\":\"Smith\",\"nname\":\"Molly\",\"email\":\"dennisnoto@gmail.com\",\"phone\":\"720-236-2541\"}"}

Re-Started flow

 2016-09-13T14:19:34.876-0600[App/0]OUT13 Sep 20:19:34 - [info] [function:Watson Response Msg] ["I am here at the point of no return"]
 2016-09-13T14:30:01.272-0600[App/0]OUT13 Sep 20:30:01 - [info] Stopping flows
 2016-09-13T14:30:01.273-0600[App/0]OUT13 Sep 20:30:01 - [info] Starting flows
 2016-09-13T14:30:01.273-0600[App/0]OUT13 Sep 20:30:01 - [info] Stopped flows
 2016-09-13T14:30:01.587-0600[App/0]OUT13 Sep 20:30:01 - [info] Started flows
 2016-09-13T14:30:30.950-0600[App/0]OUT13 Sep 20:30:30 - [info] [function:Make String for Conversation] 

Sent first convo {"context":"","email":"dennisnoto@gmail.com","fname":"Mary","input":"Hi","lname":"Smith","nname":"Molly","phone":"720-236-2541","workspace_id":"71fb6c7d-730c-45ea-94e5-e7704b0eb4ca"} Returned new conversation_id as expected. Restarting the flow is not an option.

 2016-09-13T14:30:31.168-0600[App/0]OUT13 Sep 20:30:31 - [info] [function:Watson Response Msg] {"text":"Howdy , Can I help you with learning about investing?","username":"Watson","context":"{\"conversation_id\":\"c66cb700-2917-48ff-9195-70ab4a037f04\",\"system\":{\"dialog_stack\":[\"node_6_1467586704662\"],\"dialog_turn_counter\":1,\"dialog_request_counter\":1,\"system\":{\"_node_output_map\":{\"node_6_1467586704662\":[1]}}}}"}

People who like this

  0   Show 3
Comment
10 |3000 characters needed characters left characters exceeded
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
310001R593 gravatar image huestones (459)   Sep 19, 2016 at 04:03 AM 0
Share

Have you made sure its not HTTP caching. i.e. your browser caching? Tip: Send no cache headers back with your responses.

31000212E5 gravatar image DennisNoto (16)   Sep 26, 2016 at 09:12 AM 0
Share

can't be http caching. Its a rest web service call from a native ios app. Don't know if node-red has a caching issue or the nodejs that node-red runs on has a caching issue??

110000PNBC gravatar image @chughts (12979) ♦   Sep 26, 2016 at 10:33 AM 0
Share

To null out the context object, try sending it as an null object, rather than a null string. eg.

  "context":"{}",

4 answers

  • Sort: 
31000212E5 gravatar image

Answer by DennisNoto (16) | Sep 26, 2016 at 11:22 AM

In my flow, I construct a new message every time I send to conversation. I don't put the context object in the json object when initiating a new conversation. Not the problem. In fact this problem only happens if you bail out of the conversation on a dialog node that has condition = true. I can restart the app a 100 times, not even have the context variable passed to the service and it will still remember the conversation until I restart the bordered flow!!! Weird huh? Not a flow coding problem. its something outside my control.

Comment

People who like this

  0   Show 1   Share
10 |3000 characters needed characters left characters exceeded
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
110000PNBC gravatar image @chughts (12979) ♦   Sep 26, 2016 at 11:36 AM 0
Share

As per my previous comment, have you tried to bail out of the conversation by sending in a null context object and not a null string as you have in your examples?

eg. "context":"{}",

31000212E5 gravatar image

Answer by DennisNoto (16) | Sep 27, 2016 at 06:45 PM

So dude, you know something. So by sending the context = {} it worked!!! But why does not sending context at all screw up the service??

Comment

People who like this

  0   Show 1   Share
10 |3000 characters needed characters left characters exceeded
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
110000PNBC gravatar image @chughts (12979) ♦   Sep 28, 2016 at 04:44 AM 0
Share

Don't know, as the node does the same thing set context = {}, if no context is passed in.

We are reworking the conversation node to be able to remember context. Default mode will be as is, where it doesn't remember context, so you will need to pass it in. Single User mode will remember the context, you will not need to pass it in. Multiple User mode will also remember the context. You will not need to pass in the context, but you will need to pass in an id, that you set and remember. You will be able to add variables to the context. Reset of context will be by setting context = {}

31000212E5 gravatar image

Answer by DennisNoto (16) | Oct 12, 2016 at 02:23 PM

When will this be available? Thanks!

Comment

People who like this

  0   Share
10 |3000 characters needed characters left characters exceeded
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
31000212E5 gravatar image

Answer by DennisNoto (16) | Oct 21, 2016 at 12:36 AM

I see "save context" and "multiple user" check boxes on the WCS service in node-red and their is a new msg.user property. I tried looking this up on the api documentation, no luck. Where are the docs on what these changes actually dol.

Comment

People who like this

  0   Share
10 |3000 characters needed characters left characters exceeded
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster

Follow this question

115 people are following this question.

Answers

Answers & comments

Related questions

Issue: Slack integration with Conversation 1 Answer

Conversation Issues: My app gets interrupted with error message (Workspace) 1 Answer

Trying to follow Node-RED, Watson Conversation example 1 Answer

Initiating a Node-RED flow with a Watson Conversation block without having to use the "Inject" node 1 Answer

How can I get my Node-RED application to display API resulting from a link in a function instead of a literal string? 1 Answer

  • Contact
  • Privacy
  • IBM Developer Terms of use
  • Accessibility
  • Report Abuse
  • Cookie Preferences

Powered by AnswerHub

Authentication check. Please ignore.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • API Connect
  • Analytic Hybrid Cloud Core
  • Application Performance Management
  • Appsecdev
  • BPM
  • Blockchain
  • Business Transaction Intelligence
  • CAPI
  • CAPI SNAP
  • CICS
  • Cloud Analytics
  • Cloud Automation
  • Cloud Object Storage
  • Cloud marketplace
  • Collaboration
  • Content Services (ECM)
  • Continuous Testing
  • Courses
  • Customer Experience Analytics
  • DB2 LUW
  • Data and AI
  • DataPower
  • Decision Optimization
  • DevOps Build
  • DevOps Services
  • Developers IBM MX
  • Digital Commerce
  • Digital Experience
  • Finance
  • Global Entrepreneur Program
  • Hadoop
  • Hybrid Cloud Core
  • Hyper Protect
  • IBM Cloud platform
  • IBM Design
  • IBM Forms Experience Builder
  • IBM Maximo Developer
  • IBM StoredIQ
  • IBM StoredIQ-Cartridges
  • IIDR
  • ITOA
  • InformationServer
  • Integration Bus
  • Internet of Things
  • Kenexa
  • Linux on Power
  • LinuxONE
  • MDM
  • Mainframe
  • Messaging
  • Node.js
  • ODM
  • Open
  • PartnerWorld Developer Support
  • PowerAI
  • PowerVC
  • Predictive Analytics
  • Product Insights
  • PureData for Analytics
  • Push
  • QRadar App Development
  • Run Book Automation
  • Search Insights
  • Security Core
  • Storage
  • Storage Core
  • Streamsdev
  • Supply Chain Business Network
  • Supply Chain Insights
  • Swift
  • UBX Capture
  • Universal Behavior Exchange
  • UrbanCode
  • WASdev
  • WSRR
  • Watson
  • Watson Campaign Automation
  • Watson Content Hub
  • Watson Marketing Insights
  • dW Answers Help
  • dW Premium
  • developerWorks Sandbox
  • developerWorks Team
  • Watson Health
  • More
  • Tags
  • Questions
  • Users
  • Badges