Skip to content

Instantly share code, notes, and snippets.

@remkohdev
Created May 2, 2017 22:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save remkohdev/225e01e2b96c8585caf7bb05ae85b51c to your computer and use it in GitHub Desktop.
Save remkohdev/225e01e2b96c8585caf7bb05ae85b51c to your computer and use it in GitHub Desktop.
Watson Conversation chatbot integration with Slack Slash Commands
[{"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":[]}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment