skip to Main Content

I have created a game bot to present my simple h5 game in telegram. I wonder how to get the telegram user info who is playing my h5 game?

What i have done:

  • created bot to reply game to telegram
  • created bot to handle callback message from telegram play game button(the callback message from will always be my bot)
  • the chatgpt said telegram will carry user info into the game url, then i try to print game url when game opened in telegram, but nothing got
  • viewed the game integration doc but no related infomation found

2

Answers


  1. Chosen as BEST ANSWER

    Solved, the callback query carries the user info in the top field from like below:

    {
        callback_query: {
            id: "697xxxxxx622",
            from: {
                id: 162xxxx327,
                is_bot: false,
                first_name: "Test",
                username: "xxxx",
                language_code: "xxxx"
            },
            message: {}
        }
    }
    

  2. {
    callback_query: {
    id: "5035214419",
    from: {
    id: 5035214419,
    is_bot: false,
    first_name: "Ruth",
    username: "@Rtmz0",
    language_code: "xxxx"
    },
    message: {}
    }
    }

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search