Can a Telegram bot send a message without text?

I’m working on a Telegram bot with custom keyboards. When users tap an arrow, it switches to a new keyboard layout. Here’s my problem: I want to update the keyboard without sending any text.

$updateKeyboard = function($chatID, $newKeyboard) {
    $apiEndpoint = API_BASE . '/updateInterface';
    $params = [
        'chat' => $chatID,
        'keyboard' => json_encode($newKeyboard),
        'message' => ''  // This is where I'm stuck
    ];
    
    curlRequest($apiEndpoint, $params);
};

I know the ‘message’ field is required, but I’ve tried using spaces and HTML entities without success. Is there a trick to send a ‘silent’ update? Or do I have to include some text every time? Thanks for any tips!

hey sophia, yep u can send empty messages! try using a zero-width space (U+200B) as the message. it’s invisible but technically counts as content. just paste this in ur code: \u200B

might solve ur problem without messing up the layout. good luck!

I’ve encountered this issue before when developing Telegram bots. While you can’t send a completely empty message, there’s a workaround that’s worked well for me. Instead of using a zero-width space, try using the Unicode character ’ ’ (Mongolian Vowel Separator, U+180E). It’s virtually invisible and doesn’t affect layout.

Here’s how you can modify your code:

$params = [
    'chat' => $chatID,
    'keyboard' => json_encode($newKeyboard),
    'message' => ' '
];

This approach has been reliable in my projects, allowing for keyboard updates without visible text. Just remember to handle any potential encoding issues in your server-side code. Hope this helps with your bot development!

In my experience working with Telegram bots, sending a truly empty message isn’t possible due to API constraints. However, there’s a clever workaround that’s served me well. Try using the Unicode ‘Braille Pattern Blank’ character (U+2800). It’s effectively invisible and doesn’t impact layout.

Modify your code like this:

$params = [
    'chat' => $chatID,
    'keyboard' => json_encode($newKeyboard),
    'message' => '⠀'  // Braille Pattern Blank
];

This method has consistently worked for me, allowing seamless keyboard updates without visible text. Just ensure your server properly handles Unicode characters. It’s a reliable solution that should resolve your issue without compromising user experience.