Answer the question
In order to leave comments, you need to log in
Is it possible to test the telegram bot locally?
I want to start developing a telegram bot and want to test it, but I haven't bought a server yet.
Earlier, I bought a hosting, pointed out the url of this hosting to telegrams with a webhook, all requests went to that server, and thus I tested the bot. Right now I haven't bought anything yet, and I just want to develop locally for now, can I do it this way? If so, what should I put in the webhook url? If not, then only the Long Pool option? Or is it easier to buy a server already and test on it?
Answer the question
In order to leave comments, you need to log in
It is also possible locally, for this you need a white IP, a domain and a certificate and forward port 443 on the PC with the bot. Or switch to bot.polling - there is nothing fatal about it.
I always test and write on a remote server. This is much easier than trying to set up webhooks on your PC, although it is possible, the answer has already been given exactly how.
In PHP/Web Stroms, when you save a file, they are immediately sent to the server - while I switch to telegram for a test message, the file is already uploaded and working.
+ especially bottlenecks can be tested with fake webhooks. Save the request body of the desired webhook, and then send it to your server. You can fake data - change the text of the message or the sender ID. The request is formed using Postman , for example.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question