Closed vomov closed 5 years ago
Looks good to me. Any chance you can export the flow json and put it here? I'll import and have a closer look.
Can you also confirm which version of the package you have installed?
My flow, according to the export functionality:
[{"id":"dcc1a860.e26b68","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"eac3b060.79df5","type":"debug","z":"dcc1a860.e26b68","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":990,"y":60,"wires":[]},{"id":"d2d6487c.787ef8","type":"function","z":"dcc1a860.e26b68","name":"slack message constructor","func":"var topic = \"chat.postMessage\";\n\nvar payload = {\n // channel: \"#somechannel\",\n text: \"hi from bot\",\n}\n\nmsg = {\n topic: topic,\n payload: payload\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":400,"y":140,"wires":[["12cfcb62.1a49a5","26d71e8a.089d92"]]},{"id":"708f5e91.c4e6","type":"inject","z":"dcc1a860.e26b68","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":60,"wires":[["d2d6487c.787ef8"]]},{"id":"12cfcb62.1a49a5","type":"slack-web-out","z":"dcc1a860.e26b68","client":"db972c93.219a9","name":"","x":700,"y":140,"wires":[["eac3b060.79df5"]]},{"id":"26d71e8a.089d92","type":"slack-rtm-out","z":"dcc1a860.e26b68","client":"db972c93.219a9","name":"","x":690,"y":60,"wires":[["eac3b060.79df5"]]},{"id":"db972c93.219a9","type":"slack-config","z":"","name":"homebot"}]
There's a hidden node with the bot token thing, but the two nodes state 'connected', so I'm tempted to say that's somewhat fine.
The errors involved look like this:
According to the palette, I'm running 2.0.0.
I forgot to mention earlier, but I'm running Nodered 0.20.5 from a docker container on a Raspberry.
I'll try the flow when back at my computer but it appears you may be sending that message to the rtm out
node instead of the web out
node..
OK, had a chance to import this. Simply delete the slack-rtm-out
node from your flow, that's an incorrect usage of it.
The only other change you need to make is actually set the payload.channel
. Remove the comments and put in a legitimate channel name (#somechannel
or @someuser
). Remember the context of the integration is from the perspective of the bot user so they must be in the appropriate channel as well.
I incorrectly assumed the channel would default to the channel set in the integration. Everything works now, thanks!
@vomov ah, you mean the channel associated with the bot on the slack portal? It's been so long since I've done/looked at that I didn't realize it had one. Might be good for me to document that for others.
Glad to hear it's working for you! Enjoy!
you mean the channel associated with the bot on the slack portal? Exactly. Although after being all kinds of confused with Slack (tokens, channels, and so forth), I perhaps should have taken the step to make things explicit, instead of assuming defaults would take over.
Somehow, I'm not able to post a simple message; I keep getting 'invalid message type'.
Initially, I tried to simply add a msg.topic with 'chat.postMessage', but this gave the initial error. I then made a function node containing:
var topic = "chat.postMessage"; var payload = { // channel: "#somechannel", text: "hi from bot", } msg = { topic: topic, payload: payload } return msg;
But this gives the same error. Is this a known error, bug, or is this me lacking in understanding?