Skip to content

InitData

The component which is responsible for implementing the Telegram Mini Apps init data.

Initialization

To initialize the component, use the initInitData function:

typescript
import { initInitData } from '@telegram-apps/sdk';

const [initData] = initInitData();

Properties

authDate

Type: Date

Init data generation date.

canSendAfter

Type: number, optional

The number of seconds after which a message can be sent via the method answerWebAppQuery.

canSendAfterDate

Type: Date, optional

Date after which it is allowed to call the answerWebAppQuery method.

chat

Type: Chat, optional

An object containing data about the chat where the bot was launched via the attachment menu. Returned for supergroups, channels and group chats – only for Mini Apps launched via the attachment menu.

chatType

Type: 'sender' | 'private' | 'group' | 'supergroup' | 'channel' | string, optional

The type of chat from which Mini App was opened.

chatInstance

Type: string, optional

A global identifier indicating the chat from which Mini App was opened. Returned only for applications opened by direct link.

hash

Type: string

A hash of all passed parameters, which the bot server can use to check their validity.

queryId

Type: string, optional

A unique identifier for the Mini App session, required for sending messages via the answerWebAppQuery method.

receiver

Type: User, optional

An object containing data about the chat partner of the current user in the chat where the bot was launched via the attachment menu. Returned only for private chats and only for Mini Apps launched via the attachment menu.

startParam

Type: string, optional

The value of the startattach parameter, passed via link. Only returned for Mini Apps when launched from the attachment menu via link.

user

Type: User, optional

An object containing data about the current user.

Released under the MIT License.