Deploy Watson AI (with option response function) in Node-RED

Hello,

I'm using watson assistant were i have created a skill and in that i have used "option response". so i am deploying it in node-RED.

The problem is that in UI when watson interact with user upto when its not came up with "option response" but when watson has to response with option functionality then it's not showing any option!

as you can see here watson asked for email address and then next watson reply has to be in "option response" but its not showing.....

in function 1 node code is :-

msg.payload = msg.payload.text;
return msg;

in function 2 node code is :-

msg.payload = msg.payload.output.text[0];
return msg;

in form node :-

I tried to explain my problem as clear as i can. please! please! help me out with that.
if i have used less nodes or whatever it is please let me know.
Thank you.

i want to show, output from watson in (try it section) has to show like this :-

Capture3

when i tried typing this code in function node 2 :

msg.payload =payload

then in debug node at that point where watson has to option response is like that

Hi,

in your Function 2 code, you are getting the value of msg.payload.output.text[0]

The Debug output you've shared shows msg.payload.output.text is empty - it doesn't have any text for you to display.

You need to construct the text from:

msg.output.generic[0].title gives you "Thank you. what type of job...."

msg.output.generic[0].options is an array with the individual options in it - each has a label property that you would display and value object (although your screenshot doesn't show what is in that object, and I don't know the Watson Assistant api to say what it would be expecting).

if i not used .text[0] then output is coming under brackets from watson reply..

you mean like this in function 2 node -

ohke -

here watson Assistant (i trained it ) works as a AI recruiter and he is asking for Email address from the user! after giving the email. watson have to reply with 3 option box along with ("thank you... what type......." ) as i shared a screenshot above in IBM watson try it section...

so that reply is not coming in node-red UI..
i think now u get it !

Sort of - that will only give you the value of payload.output.generic[0].options[0].label.

If you want to include all the other bits, you'll need to build up a string containing the text you want.

"i think the nodes which i had used are not capable of watson to show output in option response!"
my main problem is that :point_up_2:
what i want to tell you is, i want the output in Node-red UI like this :point_down:

now you got it or not!?

i want these 3 option format response in UI.....

There is no pre-built dashboard UI component for doing chat dialogs like that (although it is one I've considered making, just not got around to it).

You'd need to build it up yourself using a ui_template node with some custom HTML and JavaScript to draw the messages.

I understand that isn't as helpful a response as it could be, but I simply don't have a prebuilt example of a chat dialog I can point you at. Maybe someone else has...

@abhayssaini - please don't DM (direct message) people asking for help - as you did to me. If I could help you I would have replied on this thread.

ok,got it.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.