I am facing an issue while sending context variable from Node app to Watson Conversation.
I am trying to implement the following,
- The user enters their phone number.
- Data corresponding to that phone number is fetched and displayed in next node.
For eg:
When the user enters his phone number, the next node should greet the user with their name; which is obtained from the database.
Node 1: Enter your phone number?
Node 2: <user enters the phone number>
fetches the data corresponding to the phone number from the database and passes it to Watson as context variable
Node 3: Hey,$user_name. How are you?
Node 4: <waits for user input>
The issue I am facing is,
Node app only sends the context variable back only when it wants user input, so, until that point, the Watson Conversation doesn't get the new set of the context variable. So here it sends the new set of context variable only with Node 3, but what I want is, I want the Watson Conversation to have the new set of context variable once I enter my phone number.
That is after the user enters his phone_number in Node 2, the Node app immediately fetches the user_name corresponding to it and set the value as context variable from Node app and sends it back to Watson Conversation. So before Node 3 prints Watson Conversation have the new set of context variables.
But what actually happens is, when user enters the phone number, I fetch a user_name corresponding to it on my Node App, but the context variable is NOT on Watson Conversation, so now when Watson responds, the value for $user_name is still undefined, so it returns as an empty string.
Can anyone help me out in solving this? Thanks in advance.