Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Telegram Bot gets "Bad Request: message text is empty"

Tags:

When my Telegram bot sends sendMessage to Telegram server it gets the error message:

{"ok":false,"error_code":400,"description":"Bad Request: message text is empty"} 

The problem appeared this morning, before that my bot worked a whole year without errors. GetUpdates command works well as before. I use GET HTTP method to send commads:

https://api.telegram.org/bot<MyToken>/sendMessage 

with UTF-8-encoded data attached:

{"chat_id":123456789,"text":"any text"} 

Has anyone encountered this?

like image 474
Kryvich Avatar asked Feb 14 '18 22:02

Kryvich


People also ask

How many messages can a telegram BOT send?

Also note that your bot will not be able to send more than 20 messages per minute to the same group.

Can a telegram BOT send message to user?

It is only possible to send messages to users whom have already used /start on your bot. When they start your bot, you can find update. message.

Can Telegram bots edit messages?

Only the inline bot can edit message.


2 Answers

If the issue still persists, try to modify your curl request. For me adding header 'Content-Type: application/json' and -d '{"chat_id":12309832,"text":"any text"}' fixed issue

like image 148
Drey Avatar answered Sep 19 '22 00:09

Drey


Another way to send a message by emulating a form :

curl -s -X POST https://api.telegram.org/bot{apitoken}/sendMessage \ -F chat_id='-1234567890' -F text='test message'

like image 30
ededed Avatar answered Sep 19 '22 00:09

ededed