travisghansen / node-red-slack

A node-red module to post to Slack.com
MIT License
22 stars 29 forks source link

Silence on slack-rtm-in, error on slack-web-out #39

Open si-hb opened 4 years ago

si-hb commented 4 years ago

Thank you for making these nodes available.

I followed this article and I'm able to post messages to a slack bot from a NodeRED, however when I type something into the Slack bot I see nothing from a debug node attached to slack-rtm-in.

The article does not mention the scopes required to make it work, but adding the chat:write scope under Bot Token Scopes appears to be what was required for slack-web-out to work. What am I missing in order to receive data from Slack via slack-rtm-in?

Also whenever I post to slack-web-out, I always get a msg:error of "TypeError: Cannot read property 'id' of undefined" from slack-web-out, though the post works fine and I see the post in the Bot's Slack channel.

travisghansen commented 4 years ago

This hasn’t been documented well frankly. Just use a bot token though and you’ll be all set.

si-hb commented 4 years ago

Thnx. It seems my post missed this article I was referring to

Escher's article was tremendously helpful, however does not cover scopes. Do I need any?

travisghansen commented 4 years ago

If you use a bot token it pretty much covers everything as I understand it. What are the first 4 or 5 chars of your token?

si-hb commented 4 years ago

If you use a bot token it pretty much covers everything as I understand it. What are the first 4 or 5 chars of your token?

First 5 characters: xoxb-

travisghansen commented 4 years ago

Ok that’s a bot token. Does something not work for you currently?

si-hb commented 4 years ago

Yes, I receive nothing from slack-rtm-in when posting something to the bot from within Slack.

travisghansen commented 4 years ago

Can you get the nodered logs and post them here? It should show the bot connecting etc

si-hb commented 4 years ago
27 Oct 16:03:26 - [error] [slack-config:Conductor chatbot post] TypeError: Cannot read property 'id' of undefined
    at recurse (/data/node_modules/node-red-contrib-slack/slackpost.js:568:50)
    at recurse (/data/node_modules/node-red-contrib-slack/slackpost.js:540:17)
    at SlackConfig.dressResponseMessage (/data/node_modules/node-red-contrib-slack/slackpost.js:589:11)
    at node.clientNode.webClient.apiCall.then.res (/data/node_modules/node-red-contrib-slack/slackpost.js:1306:43)
    at process._tickCallback (internal/process/next_tick.js:68:7)
27 Oct 16:06:34 - [error] [slack-config:Conductor chatbot post] TypeError: Cannot read property 'id' of undefined
    at recurse (/data/node_modules/node-red-contrib-slack/slackpost.js:568:50)
    at recurse (/data/node_modules/node-red-contrib-slack/slackpost.js:540:17)
    at SlackConfig.dressResponseMessage (/data/node_modules/node-red-contrib-slack/slackpost.js:589:11)
    at node.clientNode.webClient.apiCall.then.res (/data/node_modules/node-red-contrib-slack/slackpost.js:1306:43)
    at process._tickCallback (internal/process/next_tick.js:68:7)
travisghansen commented 4 years ago

Earlier in the logs do you see the bot connecting properly etc?

si-hb commented 4 years ago

We have a lot of things connected, and our logs are enormous, so I didn't see this immediately:

[INFO] @slack/client:RTMClient:7 unable to RTM start: An API error occurred: missing_scope [INFO] @slack/client:RTMClient:3 unable to RTM start: An API error occurred: not_allowed_token_type

Myzhar commented 4 years ago

@si-hb have you solved this issue? It seems that something has changed in Slack RTM and bots are not allowed anymore using it: https://github.com/slackapi/node-slack-sdk/issues/953#issuecomment-582261621 https://github.com/slackapi/node-slack-sdk/issues/921#issuecomment-633417805

si-hb commented 4 years ago

Myzhar, I have not yet solved the problem unfortunately.

Thanks for the links above.

n8n might be a better option for interfacing with external APIs, we're going to try this route.

travisghansen commented 4 years ago

Interesting. I'll try to document required scopes/legacy app better and see where I get. I haven't looked closely but I believe the n8n integration is strictly the http based stuff (which may fit your needs). It may even be limited to just sending messages in essence but would love to hear more if you go that route.