简体   繁体   中英

How to open telegram web application by button from channel (not private chat)?

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
      ]);

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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM