JSON API to connect Watson Assistant to Facebook Messenger thru ChatFuel

This a REST API (JSON) to be used to connect to Facebook Messenger thru ChatFuel. It works with multiples responses from Watson Assistant. Details how to connect Watson Assistant to Facebook Messenger thru ChatFuel on video below: https://www.youtube.com/watch?v=Oni7g2uK9PM

[{"id":"5564e882.739708","type":"http in","z":"28db7b91.70b264","name":"","url":"/facebook","method":"get","upload":false,"swaggerDoc":"","x":120,"y":200,"wires":[["8861d5d5.9111c8"]]},{"id":"8861d5d5.9111c8","type":"change","z":"28db7b91.70b264","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"req.query.message","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":260,"y":260,"wires":[["9f8e41dd.4562f"]]},{"id":"9f8e41dd.4562f","type":"watson-conversation-v1","z":"28db7b91.70b264","name":"","workspaceid":"917de967-1975-4535-a4ea-101f5023d211","multiuser":false,"context":true,"empty-payload":false,"default-endpoint":true,"service-endpoint":"https://gateway.watsonplatform.net/conversation/api","timeout":"","optout-learning":false,"x":420,"y":260,"wires":[["23148461.af666c"]]},{"id":"23148461.af666c","type":"function","z":"28db7b91.70b264","name":"","func":"var wc_output = [];\nif(msg.payload.output.text)\n{\n    for(x=0;x<msg.payload.output.text.length;x++)\n    {\n        wc_output[x] = {\"text\":msg.payload.output.text[x]};\n    }\n    msg.payload = wc_output;\n    return msg;\n}\nreturn null;\n","outputs":1,"noerr":0,"x":550,"y":260,"wires":[["29cee149.f0e4be"]]},{"id":"29cee149.f0e4be","type":"http response","z":"28db7b91.70b264","name":"","statusCode":"","headers":{},"x":630,"y":200,"wires":[]},{"id":"8b63bab9.256028","type":"comment","z":"28db7b91.70b264","name":"How to connect Watson Assistant to Facebook Messenger thru ChatFuel","info":"Watch the follwoing video to see how to connect  Watson Assistant to Facebook Messenger thru ChatFuel\n\nhttps://www.youtube.com/watch?v=Oni7g2uK9PM","x":300,"y":140,"wires":[]}]
sergiogama

Flow Info

created 1 year ago
updated 3 months ago

Node Types

Core
  • change (x1)
  • comment (x1)
  • function (x1)
  • http in (x1)
  • http response (x1)
Other

Tags

  • Watson
  • Conversation
  • ChatFuel
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option