Skip to content

Init Data

The 💠component responsible for the Telegram Mini Apps init data.

Restoring

To restore the init data state, use the restore method.

ts
import { initData } from '@telegram-apps/sdk';

initData.restore();
ts
import { restoreInitData } from '@telegram-apps/sdk';

restoreInitData();

Properties

ts
initData.authDate(); // Date | undefined
initData.canSendAfter(); // number | undefined
initData.canSendAfterDate(); // Date | undefined
initData.chat(); // Chat | undefined
initData.chatType(); // string | undefined
initData.chatInstance(); // string | undefined
initData.hash(); // string | undefined
initData.queryId(); // string | undefined
initData.raw(); // string | undefined. Raw representation of init data.
initData.receiver(); // User | undefined
initData.startParam(); // string | undefined
initData.state(); // InitData | undefined. Complete init data state
initData.user(); // User | undefined
ts
import {
  initDataAuthDate,
  initDataCanSendAfter,
  initDataCanSendAfterDate,
  initDataChat,
  initDataChatType,
  initDataChatInstance,
  initDataHash,
  initDataQueryId,
  initDataRaw,
  initDataReceiver,
  initDataStartParam,
  initDataState,
  initDataUser,
} from '@telegram-apps/sdk';

initDataAuthDate(); // Date | undefined
initDataCanSendAfter(); // number | undefined
initDataCanSendAfterDate(); // Date | undefined
initDataChat(); // Chat | undefined
initDataChatType(); // string | undefined
initDataChatInstance(); // string | undefined
initDataHash(); // string | undefined
initDataQueryId(); // string | undefined
initDataRaw(); // string | undefined. Raw representation of init data.
initDataReceiver(); // User | undefined
initDataStartParam(); // string | undefined
initDataState(); // InitData | undefined. Complete init data state
initDataUser(); // User | undefined

Released under the MIT License.