Skip to content

Instantly share code, notes, and snippets.

@sergiogama
Last active June 18, 2018 18:30
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sergiogama/21882d6f11cb61b133e95c522794120d to your computer and use it in GitHub Desktop.
Save sergiogama/21882d6f11cb61b133e95c522794120d to your computer and use it in GitHub Desktop.
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":[]}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment