core icon indicating copy to clipboard operation
core copied to clipboard

Problem with web_app in InlineKeyboardButton

Open the-lookin opened this issue 3 years ago • 3 comments

I try to send button with message, which will open Web App:

This is code:

      $keyboard = [
          "inline_keyboard" => [
              [
                   new InlineKeyboardButton(['text' => 'message', 'web_app' => new WebAppInfo(['url' => 'https://test.com/bot.php'])])
              ]
          ]
      ];
      $result = Request::sendMessage([
        'chat_id' => $chat_id,
        'parse_mode' => 'markdown',
        'text'    => 'Send message',
        'reply_markup' => $keyboard
      ]);```

But I have an error:

[ok] => [error_code] => 400 [description] => Bad Request: BUTTON_TYPE_INVALID

Without "web_app" param - all is OK

the-lookin avatar Aug 27 '22 11:08 the-lookin

Just to be sure…

you’re trying to do this in a private chat? „Available only in private chats between a user and the bot.“

TiiFuchs avatar Aug 27 '22 14:08 TiiFuchs

Ohhh... ok. I trying it at the channel.

the-lookin avatar Aug 28 '22 04:08 the-lookin

does it work in a private chat?

TiiFuchs avatar Aug 28 '22 08:08 TiiFuchs

Is it solved?

miuiv5ztl avatar Dec 04 '22 18:12 miuiv5ztl

@miuiv5ztl there is nothing to solve. You can't send web_app buttons in groups or channels. Only private chats according to the api documentation.

Closing this issue, since there was no further comment by the author.

TiiFuchs avatar Dec 04 '22 18:12 TiiFuchs