Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Telegram bot api getUpdates or SendMessage doesn't work on browser

I created a Telegram bot using the Botfather and got token for that bot.

Visiting the following url in browser worked fine to send message on Telegram.

https://api.telegram.org/bot<123:Token>/sendMessage?chat_id=<123>&text=TestFromBot

But just now, if I visit the url in a browser, it doesn't return valid response.

enter image description here

I've researched via googling, and they say I should call telegram bot api via backend not directly from browser. But I know and confirmed that it worked well before.

Is there any recent update for bot api in Telegram?

What is the reason for that worked well before but not now?

like image 356
toygr Avatar asked Feb 18 '26 11:02

toygr


1 Answers

TL;DR Change your UserAgent to something non-browser like

This can be done in Chrome: User Agent Switcher for Chrome.
As well as Firefox: How do I change Firefox's user agent via about:config?
Or using anther tool like Curl or Postman.


Starting from September 12th, a lot of people started reporting issues with calling the Telegram Bot API via browsers.

Multiple people in the @BotTalk channel reported this.

I was able to reproduce this in FireFox, the same request with a random UserAgent did work when sending with CURL.


One of the posts from @BotTalk summarizing the issue:

Telegram temporarily (?) blocked popular browsers' user agents. Try using a proper API testing client or a simple Python program.

You can also install a extension in your browser to replace the actual user-agent with a random string.

like image 73
0stone0 Avatar answered Feb 21 '26 13:02

0stone0



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!