V
V
Vlad Gapanovich2021-03-12 16:56:20
Java
Vlad Gapanovich, 2021-03-12 16:56:20

Java messaging Telegram bot how to do? How is it better?

Good afternoon! There was a question about sending a message to the Telegram bot. Chat id is stored in the database. How to send messages there is an option with:
1. https://api.telegram.org/botTOKEN/sendMessage?chat...
Somehow differently?

If there are no more options, then how to make the bot send out itself after I press the POISON button

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Mark Struchkov, 2021-03-12
@upagge

If you need a completely primitive mailing, then the API call will also go directly (yes, the api is correct, you will only need to fasten the bot token), for example, via OkHttp

E
etozhesano, 2021-03-12
@etozhesano

What is the library? org.telegram? It has a SendMessage class through which messages can be sent. Don't forget to hook up the execute() method, because the class itself does not send a message.
Well, everything is simple on the button, the logic is as follows:
1) When you click on the button, an update arrives
2) Process the logic (check that it was from the button that the request arrived and if so, then form the newsletter)
3) Send the newsletter.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question