sendMessage API returns 'invalid channel id' with Docs examples
See original GitHub issue- 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.
Description
When calling rtm.sendMessage('test', ...)
with a username like @test
, or userid provided from message.user (like U3B4XADP9
) 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
(like G3BBUJ7HE
).
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?
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (3 by maintainers)
Top Results From Across the Web
chat.postMessage method - Slack API
This method posts a message to a public channel, private channel, or direct message/IM channel. Consider reviewing our message guidelines, especially if ...
Read more >Build app server send requests | Firebase Cloud Messaging
For Firebase Admin SDKs, this operation uses the sendAll() API under the hood, as shown in the examples. The return value is a...
Read more >Error and Warning Dictionary | Twilio
Explore the full list of all possible Twilio REST API error codes. ... Alpha Sender ID is Invalid or Not Authorized for this...
Read more >SendMessage - Amazon Simple Queue Service
Amazon SQS continues to keep track of the message deduplication ID even ... The following example SendMessage request sends a message containing This...
Read more >API Reference - Discord.py
The following section outlines the API of discord.py. Note. This module uses the Python logging ... Returns a partial messageable with the given...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The docs are broken.
Put this in the README.md example:
Then the example will work with a copy and paste.
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
chat.postMessage
is a different API from the RTM API—and it is much more permissive about what it will accept.