IBM Watson Assistant Telegram Integration unsure what to input in functions

Hi, I am planning to integrate IBM Watson chat assistant (a chatbot framework tool) to Telegram using Node-red.

However, I met with some errors along the way. I'm new to Node-red and would really appreciate any help given.

Below I'll paste the flow.

[{"id":"87677a1e.c802d8","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"b0bc2179.ada52","type":"tab","label":"Flow 4","disabled":false,"info":""},{"id":"6e215ffd.da9d5","type":"telegram bot","botname":"rylzbot","usernames":"","chatids":"","baseapiurl":"","updatemode":"polling","pollinterval":"300","usesocks":false,"sockshost":"","socksport":"6667","socksusername":"anonymous","sockspassword":"","bothost":"","botpath":"","localbotport":"8443","publicbotport":"8443","privatekey":"","certificate":"","useselfsignedcertificate":false,"sslterminated":false,"verboselogging":false},{"id":"5485c65d.c921c8","type":"telegram bot","botname":"JoaoBatistaBot","usernames":"","chatids":""},{"id":"7adbdb07.78b1f4","type":"telegram receiver","z":"87677a1e.c802d8","name":"","bot":"6e215ffd.da9d5","saveDataDir":"","filterCommands":false,"x":140,"y":260,"wires":[["23ccdc5e.afc1c4"],[]]},{"id":"4d3a2161.c0c35","type":"telegram sender","z":"87677a1e.c802d8","name":"","bot":"6e215ffd.da9d5","haserroroutput":false,"outputs":1,"x":610,"y":260,"wires":[[]]},{"id":"401f3cf0.bd9b94","type":"watson-assistant-v2","z":"87677a1e.c802d8","name":"NUS_APPS_CHATBOT","service-endpoint":"https://api.us-south.assistant.watson.cloud.ibm.com/instances/01a49130-7246-4978-af9d-04d49bbdfbaa","assistant_id":"f99a1857-79b0-44c4-bd81-59ac6876bcf4","debug":false,"restart":false,"return_context":true,"alternate_intents":false,"multisession":true,"timeout":"","optout-learning":false,"persist-session-id":false,"x":430,"y":40,"wires":[["742b4430.7cffac"]]},{"id":"23ccdc5e.afc1c4","type":"function","z":"87677a1e.c802d8","name":"P1","func":"context.flow.chatId = msg.payload.chatId;\ncontext.flow.type = msg.payload.type;\nmsg.payload = msg.payload.content;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":210,"y":140,"wires":[["401f3cf0.bd9b94"]]},{"id":"742b4430.7cffac","type":"function","z":"87677a1e.c802d8","name":"P2","func":"msg.payload.chatId = context.flow.chatId;\nmsg.payload.type = context.flow.type;\nmsg.payload.content = {\"_msgid\":\"4e7a205d.3c294\"};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":550,"y":140,"wires":[["4d3a2161.c0c35"]]},{"id":"83dbc697.d416c8","type":"inject","z":"b0bc2179.ada52","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"str","x":70,"y":200,"wires":[["d334bd1c.00abb"]]},{"id":"d334bd1c.00abb","type":"watson-assistant-v2","z":"b0bc2179.ada52","name":"NUS_APPS_CHATBOT","service-endpoint":"https://api.us-south.assistant.watson.cloud.ibm.com/instances/01a49130-7246-4978-af9d-04d49bbdfbaa","assistant_id":"f99a1857-79b0-44c4-bd81-59ac6876bcf4","debug":false,"restart":false,"return_context":true,"alternate_intents":false,"multisession":true,"timeout":"","optout-learning":false,"persist-session-id":false,"x":350,"y":200,"wires":[["151a548c.d4f44b"]]},{"id":"151a548c.d4f44b","type":"debug","z":"b0bc2179.ada52","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":630,"y":180,"wires":[]}]

In function P2 I got the msgid from the Flow 4 after doing an inject through the assistant, but I'm not sure if I inputted it right in P2.

msgid

Thanks!

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