I tried to use the telegram node to use a telegram bot to send a message to a telegram channel where the bot is an admin.
I have both the chat ID and the name of the channel starting with @
Nothing I have tried so far seems to work.
(neither using the chat ID I got by adding the @username_to_id_bot bot as a member to the channel nor using the channel name itself)
I’ve tried a couple other stupid things not worth mentioning.
it gives this error:
"message": "400 - {"ok":false,"error_code":400,"description":"Bad Request: chat not found"}",
"name": "Error",
"stack": "Error: Request failed with status code 400 at createError
I can get the same n8n node to send a message to a chat I have going between me and the bot. But I can’t get it to send an update to the channel by changing over to its ID. I’m wondering if maybe that’s just not supported? Or maybe I just THINK I have the chat ID for the channel, but I don’t really.
Thanks to anybody very kindly for their time and help.
Thank you for the help. It gave me another thing to try at least. It turns out I had the right chat ID. But for SOME reason it won’t work without a minus sign in front of it. I wasn’t aware that needed to be included. Thank you for the help!
For what it’s worth, when the channel is public, the @username_to_channel works well in place of the chat ID. Also, n8n receives a response with the chat ID after sending a message using the channel’s username. So that’s another handy way to get the chat ID. Just make sure to include the @ symbol if you’re using the username. It is required
I found the relevant section on this really long page, thanks to your help:
(and that’s where I found mention of the channel name as an alternative)
For anyone else who may run in to difficulty with this, a particular stackoverflow discussion (linked below) was also helpful to me for finding the chat ID of the channel (before I made it public, etc.)
The easiest way I found was from this suggestion:
Found another one easiest way : Just send to @username_to_id_bot (Telegram: Contact @username_to_id_bot) bot your invite link to your private channel, it will return it’s ID . Simplest level : maximum!
The suggestions about getting it from the address bar are also easy (and not dependent on a bot), only problem is that the new version of Telegram on the Web doesn’t have it in the address bar. But you can still get it from the legacy version: Telegram Web
You have to add the -100 (rincluding the minus sign) to the beginning of the partial ID in the address bar. See discussion for more details: