Skip to content

response with Web app button on inline query #18

Description

@chillbert

how can I reply with the web app button of the bot?


    const results = JSON.stringify([
      {
        type: "article",
        id: "1",
        title: "Echo: " + queryText,
        input_message_content: {
          message_text: "You said: " + queryText,
        },
      },
    ]);

    /* something like this????
    const results = JSON.stringify([
      {
        type: "article",
        id: "1",
        title: "Echo: " + queryText,
        input_message_content: {
          message_text: "You said: " + queryText,
        },
        reply_markup: {
          inline_keyboard: [
            [
              {
                text: "Open Web App",
                web_app: { url: "https://testbot.github.io/TONBot?id=32" }, // Web App URL
              },
            ],
          ],
        },
      },
    ]);
*/
    try {
      /* await sendMessageWithWebAppButton(
        chatId, // you don't have chatID on inline only on message
        "Open Web App using the button below:",
        "https://testbot.github.io/TONBot?id=32",
      ); */

      await fetch(
        `${telegramApi}/answerInlineQuery?inline_query_id=${queryId}&results=${results}`,
      );

      res.sendStatus(200);
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions