yagop / node-telegram-bot-api

Telegram Bot API for NodeJS
MIT License
8.34k stars 1.52k forks source link

setChatMenuButton not working (Web app) #1165

Closed un-hongly closed 7 months ago

un-hongly commented 8 months ago

Below code is not working

bot.setChatMenuButton({
      menu_button: {
          type: 'web_app',
          text: 'Order now',
          web_app: {
              url: '....'
          }
      }
  });
Dhamu143 commented 7 months ago

Hi , is there any update on this ?

danielperez9430 commented 7 months ago

Use example:


const chatId = "XXXX"; 

bot.setChatMenuButton({
        chat_id: chatId,
        menu_button: JSON.stringify({ type: 'web_app', text: 'Hello', web_app: { url: 'https://webappcontent.telegram.org/cafe' } }),
      })
un-hongly commented 7 months ago

Use example:

const chatId = "XXXX"; 

bot.setChatMenuButton({
        chat_id: chatId,
        menu_button: JSON.stringify({ type: 'web_app', text: 'Hello', web_app: { url: 'https://webappcontent.telegram.org/cafe' } }),
      })

This is work!. In typescript, cast json string to any.

JSON.stringify({ type: 'web_app', text: 'Hello', web_app: { url: 'https://webappcontent.telegram.org/cafe' } }) as any