Watson Conversation chatbot integration with Slack Slash Commands

This flow integrates IBM Watson Conversation service on IBM Bluemix with Slash Commands in Slack. 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-chatbots/

[{"id":"384a665d.f04052","type":"http in","z":"9080ea2e.ed36d8","name":"POST /slack/commands","url":"/slack/commands","method":"post","swaggerDoc":"","x":153,"y":68,"wires":[["f266880c.763d6","faf9d2d8.6b504"]]},{"id":"a688342a.18bdb8","type":"function","z":"9080ea2e.ed36d8","name":"Set Conversation Input","func":"msg.payload = msg.payload.text;\nreturn msg;","outputs":1,"noerr":0,"x":424,"y":172,"wires":[["31e8b621.0b7a12"]]},{"id":"faf9d2d8.6b504","type":"switch","z":"9080ea2e.ed36d8","name":"Validate Slack Token","property":"payload.token","propertyType":"msg","rules":[{"t":"eq","v":"<your slack token>","vt":"str"},{"t":"else"}],"checkall":"true","outputs":2,"x":159,"y":191.75,"wires":[["ac2c005b.31a76","a688342a.18bdb8"],["4c7bc523.74d1d4","441d59db.a83e38"]]},{"id":"31e8b621.0b7a12","type":"watson-conversation-v1","z":"9080ea2e.ed36d8","name":"Watson Conversation","workspaceid":"","multiuser":false,"context":true,"x":666,"y":172,"wires":[["4b19718a.4cf3d8","dac51d8.24178e"]]},{"id":"ac2c005b.31a76","type":"debug","z":"9080ea2e.ed36d8","name":"logValidToken","active":true,"console":"false","complete":"payload.token","x":394,"y":117.5,"wires":[]},{"id":"4c7bc523.74d1d4","type":"debug","z":"9080ea2e.ed36d8","name":"logInvalidToken","active":true,"console":"false","complete":"payload.token","x":396,"y":262.5,"wires":[]},{"id":"4b19718a.4cf3d8","type":"function","z":"9080ea2e.ed36d8","name":"Format Response","func":"msg.payload = msg.payload.output.text[0];\nreturn msg;","outputs":1,"noerr":0,"x":870,"y":170,"wires":[["7e44df7c.2af54"]]},{"id":"dac51d8.24178e","type":"debug","z":"9080ea2e.ed36d8","name":"logConversation","active":true,"console":"false","complete":"payload","x":855,"y":115,"wires":[]},{"id":"7e44df7c.2af54","type":"http response","z":"9080ea2e.ed36d8","name":"","x":1023,"y":169,"wires":[]},{"id":"82f335a5.adc6d","type":"http response","z":"9080ea2e.ed36d8","name":"","x":617,"y":209.5,"wires":[]},{"id":"441d59db.a83e38","type":"template","z":"9080ea2e.ed36d8","name":"Invalid Token Response","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Your token is not a valid Slack token: {{payload.token}} !","x":427,"y":210.75,"wires":[["82f335a5.adc6d"]]},{"id":"f266880c.763d6","type":"debug","z":"9080ea2e.ed36d8","name":"logSlackRequest1","active":true,"console":"false","complete":"payload","x":419,"y":49,"wires":[]}]

Flow Info

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

Owner

Actions

Rate:

Node Types

Core
  • debug (x4)
  • function (x2)
  • http in (x1)
  • http response (x2)
  • switch (x1)
  • template (x1)
Other

Tags

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