1

Is there a way to open the Web Application in Telegram from a channel by clicking on button? That is, what is the algorithm?

Adding a bot to the channel The bot sends a message with the button The user clicks the button and the application opens in Telegram

Problem: The message with the right button is not sent. Error:

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

My code:

   $telegram = new Telegram($bot_api_key, $bot_username);

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

1 Answers1

1

No way!

What you want works for BoT sent messages in private chats only, not on Channel or Groups.

Since, web or webview may have vulnerabilities/scripts, and is not hosted on telegram servers, but users, it is made such to avoid such instances.

You can however simple send a link button which opens with a prompt to open link in telegran official client(s).

Kapil G
  • 11
  • 2
  • This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/33357283) – Antoine Dec 11 '22 at 09:57
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Dec 13 '22 at 08:21