-
Notifications
You must be signed in to change notification settings - Fork 662
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
sendMessage API returns 'invalid channel id' with Docs examples #300
Comments
A fair question, thank you for raising it! At the lowest level, the RTM API only allows you to specify a channel/group/DM id. You cannot use a channel name, a user name, or a user id. This is clearly a problem with the documentation for this project. Please note that |
ahh cool, docs problem then. how do you go about messaging a private user then? is there a way to DM them without having to check if you already have a conversation with them? |
You need to know the DM id. Each DM conversation has a DM id that is separate from the participants' user ids. To participate in a DM using the RTM API, you'll need to start a DM using the |
The docs are broken. Put this in the README.md example:
Then the example will work with a copy and paste. |
So if I understand this correctly, in order to send a DM to a user, I need to use the |
So, I got around this issue by using the Web API |
closed in #347 |
I want to reopen this case. |
@BerndErnst thanks for the feedback. Your experience is valuable, since as maintainers it’s harder for us to unlearn ideas to document them in the best way. Which information did this issue have that you thought should have been more clear in the documentation? Any suggestions on changes? |
It's been a little while here. I hope that you've gotten past any issues you were having. Closing now, but feel free to open a new issue if there's still a problem we can solve. |
Description
When calling
rtm.sendMessage('test', ...)
with a username like@test
, or userid provided from message.user (likeU3B4XADP9
) it does not work. Instead a SlackRTMError is returned with 'invalid channel id'.The only way I've found to DM a user or send a message to a chat is to hardcode the channel found from
message.channel
(likeG3BBUJ7HE
).The docs make it sound like this should work: https://slackapi.github.io/node-slack-sdk/bots#posting-a-message
However the docs here: https://api.slack.com/methods/chat.postMessage discuss Channels and explain some of these issues.
So what's broken? Is it the API, or are the docs inconsistent?
The text was updated successfully, but these errors were encountered: