Watson Conversation chatbot integration with WebSockets

This flow integrates IBM Watson Conversation service on IBM Bluemix with WebSockets. A detailed step-by-step tutorial about how to create the chatbot is found here at the FreeBootcamp.io site: https://www.freebootcamp.io/courses/developing-chat-apps-and-bots/

[{"id":"9466da43.8dc83","type":"debug","z":"e284a0e4.176b68","name":"","active":true,"console":"false","complete":"true","x":226.5,"y":92.5,"wires":[]},{"id":"f5a9a0c4.8a32a","type":"websocket in","z":"e284a0e4.176b68","name":"","server":"83931f8f.563388","client":"","x":93.5,"y":130,"wires":[["9466da43.8dc83","a9d3f7b4.4fb29"]]},{"id":"26bc17a4.0207d","type":"websocket out","z":"e284a0e4.176b68","name":"","server":"83931f8f.563388","client":"","x":843.5,"y":144,"wires":[]},{"id":"ffbb59e0.b4f7e","type":"function","z":"e284a0e4.176b68","name":"chat message","func":"msg.payload = \n{\n    'type': 'chat message', \n    'text': 'You said: '+msg.payload\n};\nreturn msg;","outputs":1,"noerr":0,"x":853.5,"y":308.75,"wires":[["26bc17a4.0207d"]]},{"id":"2ae462c1.29efd6","type":"switch","z":"e284a0e4.176b68","name":"","property":"payload.type","propertyType":"msg","rules":[{"t":"eq","v":"chat message","vt":"str"},{"t":"else"}],"checkall":"true","outputs":2,"x":354.5,"y":129.75,"wires":[["97c1fc52.f892a"],["9593061d.cd11c8"]]},{"id":"9593061d.cd11c8","type":"function","z":"e284a0e4.176b68","name":"other","func":"msg.payload = \n{\n    'type': msg.payload.type, \n    'text': 'Unknown Type',\n    'id':msg.payload.id\n};\nreturn msg;\nreturn msg;","outputs":1,"noerr":0,"x":493.5,"y":100.75,"wires":[["26bc17a4.0207d"]]},{"id":"a9d3f7b4.4fb29","type":"json","z":"e284a0e4.176b68","name":"","x":226.5,"y":129.75,"wires":[["2ae462c1.29efd6"]]},{"id":"fcbd924a.1f812","type":"function","z":"e284a0e4.176b68","name":"Format Send Request","func":"var messageText = msg.payload.output.text[0];\nmsg.payload = messageText;\nreturn msg;","outputs":1,"noerr":0,"x":643,"y":311,"wires":[["ffbb59e0.b4f7e"]]},{"id":"7215ea13.295824","type":"watson-conversation-v1","z":"e284a0e4.176b68","name":"ibm watson conversation","workspaceid":"9ad46f8d-575c-4bfb-9df6-12bb425a6dc0","multiuser":false,"context":true,"x":486,"y":269.75,"wires":[["fcbd924a.1f812","5f90325b.e53364"]]},{"id":"97c1fc52.f892a","type":"function","z":"e284a0e4.176b68","name":"Set Conversation Input","func":"msg.payload = msg.payload.text;\nreturn msg;","outputs":1,"noerr":0,"x":413,"y":216,"wires":[["7215ea13.295824"]]},{"id":"5f90325b.e53364","type":"debug","z":"e284a0e4.176b68","name":"","active":true,"console":"false","complete":"false","x":845.5,"y":354.5,"wires":[]},{"id":"83931f8f.563388","type":"websocket-listener","z":"","path":"/","wholemsg":"false"}]

Flow Info

Created 7 years, 5 months ago
Updated 6 years, 9 months ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • debug (x2)
  • function (x4)
  • json (x1)
  • switch (x1)
  • websocket in (x1)
  • websocket out (x1)
  • websocket-listener (x1)
Other

Tags

  • ibm
  • ibm-bluemix
  • websockets
  • ibm-watson-conversation
  • conversation
  • chatbot
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option