M
M
mukola332016-09-06 11:05:48
API
mukola33, 2016-09-06 11:05:48

How to send a message to telegram from my site, just by clicking on a button?

My site has a button and a message box. Is it possible through the telegram api to make the message from this field be sent to me on telegram and how? The user does not have to run anything on his computer or phone, he may not even have a telegram account. I just pressed the button and the message was sent.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dmitry Entelis, 2016-09-06
@mukola33

Can. Create a bot, subscribe to it.
When a user clicks a button on the site, send a request from the site to the telegram api so that the bot sends you a message.
https://core.telegram.org/bots
method https://core.telegram.org/bots/api#sendmessage
chat_id is your personal telegram id.
You can find it out very simply - we get messages from the bot that users write to it, how to do this is written https://core.telegram.org/bots/api#getting-updates
The chat_id of the author is visible in the message. Accordingly, write something to the bot, see your chat_id, hardcode it in the code.

I
Ivan, 2016-09-06
@trak_ivan

Yes, you can, but you need to start a conversation with him. sendmessage specifies the chatid and the message. When you click on the button, implement this and that's it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question