codebuddies / greetbot

Slackbot for greeting new codebuddies users
MIT License
9 stars 14 forks source link

Message Send Fails Slack Authentication if Message is not in Same File as the Send Logic #18

Closed BethanyG closed 6 years ago

BethanyG commented 6 years ago

I am sure this is due to my lack of experience with node and express. If I separate the message bodies that our bot user is supposed to send into different files from the logic that is supposed to do the sending, the SLACK_TOKEN variable won't resolve, and the message fails Slack's authentication.

Here is an example:

In /app/routes/slash/welcome.js, if you take the section from lines 80-->98 (the const welcome), and save it out in a different file, then do an export.module from that file and use it in welcome.js, the send fails with an 'auth failed' message - even when the SLACK_TOKEN parameter is hard-coded inside the message.

This ought to work. I have no idea (really) what I am doing wrong here - and it is probably something obvious. Any help/suggestions are greatly appreciated.

BethanyG commented 6 years ago

Fixed by Pulls #24 and #25. Needs some additional fixes for default user / channel parsing. Will log those under a different issue. Closing this and fixed.