Initialize and load your game

Integrate your JS URL

Place the following code inside the <head></head> of the page where SDK integration is needed.

<script src="https://telegram.org/js/telegram-web-app.js"></script>
<script src="https://h5.miniton.games/sdk/js/miniton_2.0.js"></script>

Initialize your game in MiniTon

After integrating the SDK, the first step is to call the init function. This function returns data related to the match.

The SDK object can be accessed via MINITONSDK, window.MINITONSDK, or window['MINITONSDK']

<initData> MINITONSDK.init(game_id);

Parameters: game_id

PropertyTypeDescription

game_id

Integer

The game ID

Return Value: initData

PropertyTypeSignature VerificationDescription

game_id

Integer

Y

ID of the game.

game_name

String

Y

Game Name

match_id

Integer

Y

Match ID

match_token

String

Y

Token associated with the ongoing match

user_ticket

String

Y

Ticket identifying the user.

first_experience

Integer

Y

Indicates if it is the player’s first experience (0 = No, 1 = Yes). If the value is 1, a tutorial should be displayed.

taste

Integer

Y

Indicates if it is a trial play (0 = No, 1 = Yes)

auth_date

Integer

Y

Data Verification Timestamp

auth_sign

String

N

Data Verification Signature

language

String

N

These are abbreviations used to identify languages. Each abbreviation represents a specific language, such as:

  • en: English

  • zh: Chinese

  • ja: Japanese

  • ko: Korean

  • ar: Arabic

  • ru: Russian

  • id: Indonesian

  • th: Thai

  • es: Spanish

  • fr: French

user

UserInfo

N

User information including user ID, nickname, avatar URL, region, region code, and region icon URL.

status

Integer

N

Status

  • 0=failed

  • 1=match ready

  • 2=match ended

error_msg

String

N

Error message (if any).

return_url

String

N

URL to return to MiniTon page after the game ends.

UserInfo

PropertyTypeDescription

uid

Integer

User's Telegram ID

nickname

String

Nick name

avatar

String

User Avatar URL

region

String

Region Name

region_code

String

Region Code (ISO Alpha2 code), e.g., RU

region_icon

String

Region Icon URL

Response Example

initData

{
    "game_id": 1,
    "game_name": "",
    "match_id": 1,
    "match_token": "",
    "user_ticket": "",
    "first_experience": 0,
    "taste": 0,
    "auth_date": 1704816000,
    "auth_sign": "",
    "user": 
        "uid": 1,
        "nickname": "",
        "avatar": "",
        "region": "",
        "region_code": "",
        "region_icon": ""
    },
    "status": 1,
    "error_msg": "",
    "return_url": ""
}

Set Progress Bar Value

During the loading of game resources, this function should be called multiple times to control the progress bar display on the main game page. When the num value reaches 100, the progress bar will no longer accept changes.

MINITONSDK.setProgressValue(num);

Parameters: num

PropertyTyepDescription

num

Integer

Progress value (range: 0 <= num <= 100)

Last updated

Contact us

Telegram

Šī¸MiniTon 2023