Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't get Slack RTM Receiving Messages Sample to work properly #664

Closed
4 of 9 tasks
kutysam opened this issue Nov 4, 2018 · 2 comments
Closed
4 of 9 tasks

Can't get Slack RTM Receiving Messages Sample to work properly #664

kutysam opened this issue Nov 4, 2018 · 2 comments

Comments

@kutysam
Copy link

kutysam commented Nov 4, 2018

Description

Describe your issue here.

What type of issue is this? (place an x in one of the [ ])

  • bug
  • enhancement (feature request)
  • question
  • documentation related
  • testing related
  • discussion

Requirements (place an x in each of the [ ])

  • I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've searched for any related issues and avoided creating a duplicate issue.

Bug Report

Filling out the following details about bugs will help us solve your issue sooner.

Reproducible in:

@slack/client version: 4.8.0

node version: v11.1.0

OS version(s):

Steps to reproduce:

  1. I used http://slackapi.github.io/node-slack-sdk/rtm_api#receiving-messages sample.
  2. Invited the bot to my channel.
  3. Tried the inital example of rtm.sendMessage and it worked perfectly. Gave me the timestamp of the message.
  4. Tried receiving messages sample.
  5. Used my username to type dfaslkjfasdlk in the channel.
  6. Program crashed with ReferenceError: message is not defined happened
  7. I tried please message = event right below rtm.on('message', (event) => { and it worked.
  8. I am also able to console.log(event) too. but message hasn't been declared. Is this a 'bug' in the example?

Expected result:

Program shouldn't crash.

Actual result:

Program crashed with ReferenceError: message is not defined
at if ((message.subtype && message.subtype === 'bot_message') ||

@clavin clavin mentioned this issue Nov 6, 2018
2 tasks
@clavin
Copy link
Contributor

clavin commented Nov 6, 2018

Good catch! 👍

It looks like this sample was updated a couple months back when the v4 rewrite of the docs were made, but only the event signature was changed (the body of the event stayed the same). Therein, the name of the event's parameter changed, but the name the rest of the event's code referenced was still the old name.

I've submitted a PR (#665) to fix this so others don't run into this issue. Thanks!

@aoberoi
Copy link
Contributor

aoberoi commented Nov 12, 2018

Thanks everyone! Merged the fix just now.

@aoberoi aoberoi closed this as completed Nov 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants