node-telegram-bot-api-tutorial
node-telegram-bot-api-tutorial copied to clipboard
response with Web app button on inline query
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);
}