D
D
Dmitry2016-03-08 19:29:31
API
Dmitry, 2016-03-08 19:29:31

Telegram Bot Api How to send a message to a private channel through a bot?

Actually I'm trying to check with a regular http request through a browser, but it doesn't work out that way. Who can tell me how to correctly specify the type of chat?
https://api.telegram.org/bot/sendMessage? chat_type=private &chat_id=AlA_...5FA&text=Blablacar
Here's what's in the API "type String Type of chat, can be either “private”, “group”, “supergroup” or “channel”"
Ps there is no problem with a public channel.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
I
Islamfon, 2016-03-08
@DmitrY29

I know how to do it!
1. Make the channel public, set a username for it.
2. Add any bot to the channel.
3. Follow the link

https://api.telegram.org/bot[ТОКЕН_БОТА]/[email protected][USERNAME_КАНАЛА]&text=тест
. After clicking on the link, the channel id will be displayed, save it.
4. Make the channel private.
5. Send messages like this:
https://api.telegram.org/bot[ТОКЕН_БОТА]/[email protected][ID_КАНАЛА]&text=тест.

A
Alexander Shpak, 2016-03-08
@shpaker

In a telegram, bots can write not only by username, but also by id to channels. I would go in that direction.

A
AlexLeshchenko, 2022-01-24
@AlexLeshchenko

How to write a bot?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question