How launch game when user press "start game" button on telegram bot?

1.9k views Asked by At

I create game with BotFather and send this game with "sendGame" function to user, but i not understand how launch game when user press start button?
From API:
When this button is pressed, your bot gets a CallbackQuery with the game_short_name of the requested game.
My bot gets this CallbackQuery, but what next step? I try send message with my game url (http://192.168.1.10/game.html - this game i can launch on pc or phone browser, work fine), but this not work inside telegram...
Can somebody help?
Thanks!

2

There are 2 answers

0
fredy kardian On

I've been experienced the same problem, game comes up with white black screen,

When I try to open it with telegram desktop, which launches the game in browsers, it returns an error about HTTPS.

So I try to send my game URL using HTTPS like https://mygame.com then it works

0
Lorenzo On

When the button is pressed the "callback_query" is invoked.

Using nodejs api I'm sending the link to the game in this way:

bot.on("callback_query", function(callbackQuery) {
   bot.answerCallbackQuery(callbackQuery.id, gameLink, true, {url: gameLink});  
});