Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to send empty message in telegram bot?

I have this keyboard in my telegram bot:

enter image description here

When i click the right arrow i get this new keyboard:

enter image description here

the code is this:

    $url = $GLOBALS["website"]."/sendMessage?chat_id=".$chatID."&text=''&parse_mode=html&reply_markup=".json_encode($keyboard3);
    file_get_contents($url);

I know that text is required in sendmessage method, but i'm searching a way or workaround to send an empty message.

I've tried with space or similar html entity, but i did not suceed.

There is a way to do this?

Thank you.

like image 976
sclero Avatar asked Sep 16 '17 15:09

sclero


3 Answers

You can't send empty message now, it was a bug for zero-width space and RTL (Right-to-Left) control character, but it can't send along now.

like image 136
Sean Avatar answered Oct 12 '22 15:10

Sean


You can try Alt + 0173 in the Numpad. Press and hold the Alt key and click on 0 then 1 then 7 then 3.

like image 30
S Pranaov Avatar answered Oct 12 '22 15:10

S Pranaov


I don't think there is a way to do what you want.

Consider this:

https://api.telegram.org/botYOURTOKEN/sendMessage?chat_id=ID&text=

Since even space is not accepted, there are no other characters that can be encoded to represent "nothingness".

like image 3
andrea Avatar answered Oct 12 '22 13:10

andrea