parameters of msg.payload as an output of conversation of watson

223 views
Skip to first unread message

Rahma Gargouri

unread,
Oct 20, 2016, 9:52:54 AM10/20/16
to Node-RED
I want to connect node red "conversation" to slack! I did the diagram and after the node "conversation" I made a node "function" but I don't knwo the input of this node which is the output of the node "conversation". So I couldn't send the response of Watson Conversation to slack. Can someone help me?

Nicholas O'Leary

unread,
Oct 20, 2016, 9:59:12 AM10/20/16
to Node-RED Mailing List
Hi - have replied in slack, but for those on the list...

here's a simple Slack->Watson Conversation->Slack flow, that uses the node-red-contrib-slacker nodes.

[{"id":"ad1d51dc.312a","type":"slack-in","z":"3eec60d6.58cdd","name":"@iotchatbot","events":"direct_message","controller":"6fa228ce.033678","x":130,"y":620,"wires":[["34d1d5b9.9a6cca"]]},{"id":"34d1d5b9.9a6cca","type":"function","z":"3eec60d6.58cdd","name":"Get user context","func":"var user = msg.user;\n\nvar convContext = flow.get('convContexts')||{};\nconvContext[user] = convContext[user] || {};\nflow.set('convContexts',convContext);\n\nmsg.params = {\n context: convContext[user]\n}\n\n\nreturn msg;","outputs":1,"noerr":0,"x":338,"y":619,"wires":[["5b211cac.d463d4"]]},{"id":"5b211cac.d463d4","type":"watson-conversation-v1","z":"3eec60d6.58cdd","name":"","workspaceid":"","x":518,"y":619,"wires":[["4c58ac48.217704"]]},{"id":"4c58ac48.217704","type":"function","z":"3eec60d6.58cdd","name":"Handle response","func":"var user = msg.user;\nvar convContext = flow.get('convContexts')||{};\n\nconvContext[user] = msg.payload.context;\n\nmsg.payload = msg.payload.output.text.join(\"\\n\");\n\nflow.set('convContexts',convContext);\n\nreturn msg;","outputs":"1","noerr":0,"x":718,"y":619,"wires":[["1c3e064d.e2d4ca"]]},{"id":"1c3e064d.e2d4ca","type":"slack-out","z":"3eec60d6.58cdd","name":"@iotchatbot","channel":"","controller":"6fa228ce.033678","x":910,"y":620,"wires":[]},{"id":"6fa228ce.033678","type":"slack-bot-controller","z":"3eec60d6.58cdd","name":"@iotchatbot","token":""}]

On 20 October 2016 at 14:52, Rahma Gargouri <rahma.ga...@gmail.com> wrote:
I want to connect node red "conversation" to slack! I did the diagram and after the node "conversation" I made a node "function" but I don't knwo the input of this node which is the output of the node "conversation". So I couldn't send the response of Watson Conversation to slack. Can someone help me?

--
http://nodered.org
 
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/8d84bb8e-8ba5-47f8-a929-85731226db7b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages