I'm using my bot to tell important news, but when I using sendMessage
to the channel I'm receiving the following error:
{"ok":false,"error_code":403,"description":"Error: Forbidden: bot is not a participant of the channel"}
In the Change Log they mention it's not possible via the client to send a message to a channel, but then what is the other way to do that?
So, the question is, how to add my bot to the channel?
Are you using the right chat_id and including your bot's token after "bot" in the address? (api.telegram.org/bottoken/sendMessage)
This page explains a few things about sending (down in "sendMessage" section) - basic stuff, but I often forget the basics.
To quote:
I hope that helps.
This is how I've added a bot to my channel and set up notifications:
telegram.me/whateverIWantAndAvailable
the channel id will be @whateverIWantAndAvailable
Now set up your bot to send notifications by pusshing the messages here:
https://api.telegram.org/botTOKENOFTHEBOT/sendMessage?chat_id=@whateverIWantAndAvailable&text=Test
the message which bot will notify is: Test
I strongly suggest an urlencode of the message like
https://api.telegram.org/botTOKENOFTHEBOT/sendMessage?chat_id=@whateverIWantAndAvailable&text=Testing%20if%20this%20works
in php you can use urlencode("Test if this works"); in js you can encodeURIComponent("Test if this works");
I hope it helps
Now all clients allow to do it, but it's not pretty simple.
In any Telegram client:
Administrators
As of now:
To add the bot to your channel:
click on the channel name:
click on admins:
click on Add Admin:
search for your bot like @your_bot_name, and click add:**
* In some platforms like mac native telegram client it may look like that you can add bot as a member, but at the end it won't work.
** the bot doesn't need to be in your contact list.