@types/telegram-web-app 9.1.0 → 9.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,7 +8,7 @@ This package contains type definitions for telegram-web-app (https://telegram.or
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/telegram-web-app.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Tue, 25 Nov 2025 10:39:08 GMT
11
+ * Last updated: Mon, 01 Dec 2025 21:01:57 GMT
12
12
  * Dependencies: none
13
13
 
14
14
  # Credits
@@ -12,208 +12,338 @@ export interface Telegram {
12
12
 
13
13
  export interface WebApp {
14
14
  /**
15
- * A string with raw data transferred to the Web App, convenient for
16
- * validating data. WARNING: Validate data from this field before using it
17
- * on the bot's server.
15
+ * A string with raw data transferred to the Web App,
16
+ * convenient for {@link https://core.telegram.org/bots/webapps#validating-data-received-via-the-mini-app| validating data}.
17
+ *
18
+ * **WARNING:** {@link https://core.telegram.org/bots/webapps#validating-data-received-via-the-mini-app| Validate data} from this field before using it on the bot's server.
18
19
  */
19
20
  initData: string;
21
+
20
22
  /**
21
- * An object with input data transferred to the Web App. WARNING: Data from
22
- * this field should not be trusted. You should only use data from initData
23
- * on the bot's server and only after it has been validated.
23
+ * An object with input data transferred to the Mini App.
24
+ *
25
+ * **WARNING:** Data from this field should not be trusted.
26
+ * You should only use data from {@link initData} on the bot's server and only after it has been {@link https://core.telegram.org/bots/webapps#validating-data-received-via-the-mini-app| validated}.
24
27
  */
25
28
  initDataUnsafe: WebAppInitData;
29
+
26
30
  /**
27
31
  * The version of the Bot API available in the user's Telegram app.
28
32
  */
29
33
  version: string;
34
+
30
35
  /**
31
36
  * The name of the platform of the user's Telegram app.
32
37
  */
33
38
  platform: string;
39
+
34
40
  /**
35
- * The color scheme currently used in the Telegram app. Either “light” or
36
- * “dark”. Also available as the CSS variable var(--tg-color-scheme).
41
+ * The color scheme currently used in the Telegram app.
42
+ * Either light” or “dark”.
43
+ *
44
+ * @see available as the CSS variable `var(--tg-color-scheme)`.
37
45
  */
38
46
  colorScheme: "light" | "dark";
47
+
39
48
  /**
40
49
  * An object containing the current theme settings used in the Telegram app.
41
50
  */
42
51
  themeParams: ThemeParams;
52
+
43
53
  /**
44
- * **Bot API 8.0+**
54
+ * *True*, if the Mini App is currently active.
55
+ * *False*, if the Mini App is minimized.
45
56
  *
46
- * True, if the Mini App is currently active.
47
- * False, if the Mini App is minimized.
57
+ * @since Bot API 8.0+
48
58
  */
49
59
  isActive: boolean;
60
+
50
61
  /**
51
- * True if the Web App is expanded to the maximum available height.
52
- * False, if the Web App occupies part of the screen and can be expanded to the
53
- * full height using the expand() method.
62
+ * *True*, if the Mini App is expanded to the maximum available height.
63
+ * (False*, if the Mini App occupies part of the screen and can be expanded to the full height using the {@link expand| expand()} method.
54
64
  */
55
65
  isExpanded: boolean;
66
+
56
67
  /**
57
- * The current height of the visible area of the Web App.
58
- * Also available in CSS as the variable var(--tg-viewport-height).
68
+ * The current height of the visible area of the Mini App.
69
+ *
70
+ * The application can display just the top part of the Mini App,
71
+ * with its lower part remaining outside the screen area.
72
+ * From this position, the user can “pull” the Mini App to its maximum height,
73
+ * while the bot can do the same by calling the {@link expand| expand()} method.
74
+ * As the position of the Mini App changes,
75
+ * the current height value of the visible area will be updated in real time.
59
76
  *
60
- * The application can display just the top part of the Web App, with its
61
- * lower part remaining outside the screen area. From this position, the
62
- * user can “pull” the Web App to its maximum height, while the bot can do
63
- * the same by calling the expand() method. As the position of the Web App
64
- * changes, the current height value of the visible area will be updated in
65
- * real time.
77
+ * Please note that the refresh rate of this value is not sufficient to smoothly follow the lower border of the window.
78
+ * It should not be used to pin interface elements to the bottom of the visible area.
79
+ * It's more appropriate to use the value of the {@link viewportStableHeight} field for this purpose.
66
80
  *
67
- * Please note that the refresh rate of this value is not sufficient to
68
- * smoothly follow the lower border of the window. It should not be used to
69
- * pin interface elements to the bottom of the visible area. It's more
70
- * appropriate to use the value of the viewportStableHeight field for this
71
- * purpose.
81
+ * @see Available in CSS as the variable `var(--tg-viewport-height)`.
72
82
  */
73
83
  viewportHeight: number;
84
+
74
85
  /**
75
- * The height of the visible area of the Web App in its last stable state.
76
- * Also available in CSS as a variable var(--tg-viewport-stable-height).
86
+ * The height of the visible area of the Mini App in its last stable state.
87
+ *
88
+ * The application can display just the top part of the Mini App,
89
+ * with its lower part remaining outside the screen area.
90
+ * From this position, the user can “pull” the Mini App to its maximum height,
91
+ * while the bot can do the same by calling the {@link expand| expand()} method.
92
+ * Unlike the value of {@link viewportHeight}, the value of {@link viewportStableHeight} does not change as the position of the Mini App changes with user gestures or during animations.
93
+ * The value of {@link viewportStableHeight} will be updated after all gestures and animations are completed and the Mini App reaches its final size.
77
94
  *
78
- * The application can display just the top part of the Web App, with its
79
- * lower part remaining outside the screen area. From this position, the
80
- * user can “pull” the Web App to its maximum height, while the bot can do
81
- * the same by calling the expand() method. Unlike the value of
82
- * viewportHeight, the value of viewportStableHeight does not change as the
83
- * position of the Web App changes with user gestures or during animations.
84
- * The value of viewportStableHeight will be updated after all gestures and
85
- * animations are completed and the Web App reaches its final size.
95
+ * @remarks The event viewportChanged with the passed parameter `isStateStable=true`,
96
+ * which will allow you to track when the stable state of the height of the visible area changes.
86
97
  *
87
- * Note the event viewportChanged with the passed parameter
88
- * isStateStable=true, which will allow you to track when the stable state
89
- * of the height of the visible area changes.
98
+ * @see Available in CSS as a variable `var(--tg-viewport-stable-height)`.
90
99
  */
91
100
  viewportStableHeight: number;
101
+
92
102
  /**
93
- * Current header color in the #RRGGBB format.
103
+ * Current header color in the `#RRGGBB` format.
94
104
  */
95
105
  headerColor: string;
106
+
96
107
  /**
97
- * Current background color in the #RRGGBB format.
108
+ * Current background color in the `#RRGGBB` format.
98
109
  */
99
110
  backgroundColor: string;
111
+
100
112
  /**
101
- * Current bottom bar color in the #RRGGBB format.
113
+ * Current bottom bar color in the `#RRGGBB` format.
102
114
  */
103
115
  bottomBarColor: string;
116
+
104
117
  /**
105
- * True, if the confirmation dialog is enabled while the user is trying to
106
- * close the Web App. False, if the confirmation dialog is disabled.
118
+ * *True*, if the confirmation dialog is enabled while the user is trying to close the Mini App.
119
+ * *False*, if the confirmation dialog is disabled.
107
120
  */
108
121
  isClosingConfirmationEnabled: boolean;
122
+
123
+ /**
124
+ * *True*, if vertical swipes to close or minimize the Mini App are enabled.
125
+ * *False*, if vertical swipes to close or minimize the Mini App are disabled.
126
+ * In any case, the user will still be able to minimize and close the Mini App by swiping the Mini App's header.
127
+ */
128
+ isVerticalSwipesEnabled: boolean;
129
+
109
130
  /**
110
- * True, if the Mini App is currently being displayed in fullscreen mode.
131
+ * *True*, if the Mini App is currently being displayed in fullscreen mode.
111
132
  */
112
133
  isFullscreen: boolean;
134
+
113
135
  /**
114
- * True, if the Mini App’s orientation is currently locked.
115
- * False, if orientation changes freely based on the device’s rotation.
136
+ * *True*, if the Mini App’s orientation is currently locked.
137
+ * *False*, if orientation changes freely based on the device’s rotation.
116
138
  */
117
139
  isOrientationLocked: boolean;
140
+
118
141
  /**
119
142
  * An object representing the device's safe area insets,
120
143
  * accounting for system UI elements like notches or navigation bars.
121
144
  */
122
145
  safeAreaInset: SafeAreaInset;
146
+
123
147
  /**
124
148
  * An object representing the safe area for displaying content within the app,
125
149
  * free from overlapping Telegram UI elements.
126
150
  */
127
151
  contentSafeAreaInset: ContentSafeAreaInset;
152
+
128
153
  /**
129
- * An object for controlling the back button which can be displayed in the
130
- * header of the Web App in the Telegram interface.
154
+ * An object for controlling the back button,
155
+ * which can be displayed in the header of the Mini App in the Telegram interface.
131
156
  */
132
157
  BackButton: BackButton;
158
+
133
159
  /**
134
- * An object for controlling the main button, which is displayed at the
135
- * bottom of the Web App in the Telegram interface.
160
+ * An object for controlling the main button,
161
+ * which is displayed at the bottom of the Mini App in the Telegram interface.
136
162
  */
137
163
  MainButton: BottomButton;
164
+
138
165
  /**
139
166
  * An object for controlling the secondary button,
140
167
  * which is displayed at the bottom of the Mini App in the Telegram interface.
141
168
  */
142
169
  SecondaryButton: BottomButton;
170
+
143
171
  /**
144
- * An object for controlling the Settings item in the context menu of the
145
- * Mini App in the Telegram interface.
172
+ * An object for controlling the Settings item in the context menu of the Mini App in the Telegram interface.
146
173
  */
147
174
  SettingsButton: SettingsButton;
175
+
148
176
  /**
149
177
  * An object for controlling haptic feedback.
150
178
  */
151
179
  HapticFeedback: HapticFeedback;
180
+
152
181
  /**
153
182
  * An object for controlling cloud storage.
154
183
  */
155
184
  CloudStorage: CloudStorage;
185
+
156
186
  /**
157
187
  * An object for controlling biometrics on the device.
158
188
  */
159
189
  BiometricManager: BiometricManager;
190
+
160
191
  /**
161
- * An object for accessing device orientation data on the device.
192
+ * An object for accessing accelerometer data on the device.
162
193
  */
163
194
  Accelerometer: Accelerometer;
195
+
164
196
  /**
165
197
  * An object for accessing device orientation data on the device.
166
198
  */
167
199
  DeviceOrientation: DeviceOrientation;
200
+
168
201
  /**
169
202
  * An object for accessing gyroscope data on the device.
170
203
  */
171
204
  Gyroscope: Gyroscope;
205
+
172
206
  /**
173
207
  * An object for controlling location on the device.
174
208
  */
175
209
  LocationManager: LocationManager;
210
+
176
211
  /**
177
212
  * An object for storing and retrieving data from the device's local storage.
178
213
  */
179
214
  DeviceStorage: DeviceStorage;
215
+
180
216
  /**
181
217
  * An object for storing and retrieving data from the device's secure storage.
182
218
  */
183
219
  SecureStorage: SecureStorage;
220
+
184
221
  /**
185
- * Returns true if the user's app supports a version of the Bot API that is
186
- * equal to or higher than the version passed as the parameter.
222
+ * Returns true if the user's app supports a version of the Bot API
223
+ * that is equal to or higher than the version passed as the parameter.
187
224
  */
188
225
  isVersionAtLeast(version: string): boolean;
226
+
189
227
  /**
190
228
  * A method that sets the app header color in the `#RRGGBB` format.
191
- * You can also use keywords bg_color and secondary_bg_color.
229
+ * You can also use keywords `bg_color` and `secondary_bg_color`.
230
+ *
231
+ * Up to Bot API 6.9 You can only pass Telegram.WebApp.themeParams.bg_color
232
+ * or Telegram.WebApp.themeParams.secondary_bg_color as a color
233
+ * or bg_color, secondary_bg_color keywords.
234
+ *
235
+ * @since Bot API 6.1+
192
236
  */
193
237
  setHeaderColor(color: "bg_color" | "secondary_bg_color" | (string & {})): void;
238
+
194
239
  /**
195
- * A method that sets the app background color in the `#RRGGBB` format
196
- * or you can use keywords bg_color, secondary_bg_color instead.
240
+ * A method that sets the app background color in the `#RRGGBB` format.
241
+ * You can also use keywords `bg_color` and `secondary_bg_color`.
242
+ *
243
+ * @since Bot API 6.1+
197
244
  */
198
245
  setBackgroundColor(color: "bg_color" | "secondary_bg_color" | "bottom_bar_bg_color" | (string & {})): void;
246
+
199
247
  /**
200
- * A method that sets the app's bottom bar color in the #RRGGBB format.
201
- * You can also use the keywords bg_color, secondary_bg_color and bottom_bar_bg_color.
248
+ * A method that sets the app's bottom bar color in the `#RRGGBB` format.
249
+ * You can also use the keywords `bg_color`, `secondary_bg_color`, and `bottom_bar_bg_color`.
250
+ * This color is also applied to the navigation bar on Android.
251
+ *
252
+ * @since Bot API 7.10+
202
253
  */
203
254
  setBottomBarColor(color: "bg_color" | "secondary_bg_color" | (string & {})): void;
255
+
204
256
  /**
205
- * A method that enables a confirmation dialog while the user is trying to
206
- * close the Web App.
257
+ * A method that enables a confirmation dialog while the user is trying to close the Mini App.
258
+ *
259
+ * @since Bot API 6.2+
207
260
  */
208
261
  enableClosingConfirmation(): void;
262
+
209
263
  /**
210
- * A method that disables the confirmation dialog while the user is trying
211
- * to close the Web App.
264
+ * A method that disables the confirmation dialog while the user is trying to close the Mini App.
265
+ *
266
+ * @since Bot API 6.2+
212
267
  */
213
268
  disableClosingConfirmation(): void;
269
+
270
+ /**
271
+ * A method that enables vertical swipes to close or minimize the Mini App.
272
+ * For user convenience, it is recommended to always enable swipes unless they conflict with the Mini App's own gestures.
273
+ *
274
+ * @since Bot API 7.7+
275
+ */
276
+ enableVerticalSwipes(): void;
277
+
278
+ /**
279
+ * A method that disables vertical swipes to close or minimize the Mini App.
280
+ * This method is useful if your Mini App uses swipe gestures that may conflict with the gestures for minimizing and closing the app.
281
+ *
282
+ * @since Bot API 7.7+
283
+ */
284
+ disableVerticalSwipes(): void;
285
+
286
+ /**
287
+ * A method that requests opening the Mini App in fullscreen mode.
288
+ * Although the header is transparent in fullscreen mode,
289
+ * it is recommended that the Mini App sets the header color using the setHeaderColor method.
290
+ * This color helps determine a contrasting color for the status bar and other UI controls.
291
+ *
292
+ * @since Bot API 8.0+
293
+ */
294
+ requestFullscreen(): void;
295
+
296
+ /**
297
+ * A method that requests exiting fullscreen mode.
298
+ *
299
+ * @since Bot API 8.0+
300
+ */
301
+ exitFullscreen(): void;
302
+
214
303
  /**
215
- * A method that sets the app event handler. Check the list of available
216
- * events.
304
+ * A method that locks the Mini App’s orientation to its current mode (either portrait or landscape).
305
+ * Once locked, the orientation remains fixed, regardless of device rotation.
306
+ * This is useful if a stable orientation is needed during specific interactions.
307
+ *
308
+ * @since Bot API 8.0+
309
+ */
310
+ lockOrientation(): void;
311
+
312
+ /**
313
+ * A method that unlocks the Mini App’s orientation, allowing it to follow the device's rotation freely.
314
+ * Use this to restore automatic orientation adjustments based on the device orientation.
315
+ *
316
+ * @since Bot API 8.0+
317
+ */
318
+ unlockOrientation(): void;
319
+
320
+ /**
321
+ * A method that prompts the user to add the Mini App to the home screen.
322
+ * After successfully adding the icon, the homeScreenAdded event will be triggered if supported by the device.
323
+ *
324
+ * @remarks That if the device cannot determine the installation status, the event may not be received even if the icon has been added.
325
+ *
326
+ * @since Bot API 8.0+
327
+ */
328
+ addToHomeScreen(): void;
329
+
330
+ /**
331
+ * A method that checks if adding to the home screen is supported and if the Mini App has already been added.
332
+ * If an optional callback parameter is provided, the callback function will be called with a single argument status,
333
+ * which is a string indicating the home screen status.
334
+ *
335
+ * Possible values for status are:
336
+ * - **unsupported** – the feature is not supported, and it is not possible to add the icon to the home screen,
337
+ * - **unknown** – the feature is supported, and the icon can be added, but it is not possible to determine if the icon has already been added,
338
+ * - **added** – the icon has already been added to the home screen,
339
+ * - **missed** – the icon has not been added to the home screen.
340
+ *
341
+ * @since Bot API 8.0+
342
+ */
343
+ checkHomeScreenStatus(callback?: (status: "unsupported" | "unknown" | "added" | "missed") => void): void;
344
+
345
+ /**
346
+ * A method that sets the app event handler. Check the list of available events.
217
347
  */
218
348
  onEvent(eventType: "activated", eventHandler: ActivatedCallback): void;
219
349
  onEvent(eventType: "deactivated", eventHandler: DeactivatedCallback): void;
@@ -260,7 +390,9 @@ export interface WebApp {
260
390
  onEvent(eventType: "emojiStatusAccessRequested", eventHandler: EmojiStatusAccessRequestedCallback): void;
261
391
  onEvent(eventType: "fileDownloadRequested", eventHandler: FileDownloadRequestedCallback): void;
262
392
 
263
- /** A method that deletes a previously set event handler. */
393
+ /**
394
+ * A method that deletes a previously set event handler.
395
+ */
264
396
  offEvent(eventType: "activated", eventHandler: ActivatedCallback): void;
265
397
  offEvent(eventType: "deactivated", eventHandler: DeactivatedCallback): void;
266
398
  offEvent(eventType: "themeChanged", eventHandler: ThemeChangedCallback): void;
@@ -307,260 +439,202 @@ export interface WebApp {
307
439
  offEvent(eventType: "fileDownloadRequested", eventHandler: FileDownloadRequestedCallback): void;
308
440
 
309
441
  /**
310
- * A method used to send data to the bot. When this method is called, a
311
- * service message is sent to the bot containing the data data of the length
312
- * up to 4096 bytes, and the Web App is closed. See the field web_app_data
313
- * in the class Message.
442
+ * A method used to send data to the bot.
443
+ * When this method is called, a service message is sent to the bot containing the data *data* of the length up to 4096 bytes, and the Mini App is closed. See the field web_app_data in the class Message.
314
444
  *
315
- * This method is only available for Web Apps launched via a Keyboard
316
- * button.
445
+ * *This method is only available for Mini Apps launched via a {@link https://core.telegram.org/bots/webapps#keyboard-button-mini-apps| Keyboard button}.*
317
446
  */
318
447
  sendData(data: string): void;
448
+
319
449
  /**
320
- * A method that inserts the bot's username and the specified inline query
321
- * in the current chat's input field. Query may be empty, in which case only
322
- * the bot's username will be inserted. If an optional choose_chat_types
323
- * parameter was passed, the client prompts the user to choose a specific
324
- * chat, then opens that chat and inserts the bot's username and the
325
- * specified inline query in the input field. You can specify which types of
326
- * chats the user will be able to choose from. It can be one or more of the
327
- * following types: users, bots, groups, channels.
450
+ * A method that inserts the bot's username and the specified inline query in the current chat's input field.
451
+ * Query may be empty, in which case only the bot's username will be inserted.
452
+ * If an optional choose_chat_types parameter was passed, the client prompts the user to choose a specific chat,
453
+ * then opens that chat and inserts the bot's username and the specified inline query in the input field.
454
+ * You can specify which types of chats the user will be able to choose from.
455
+ * It can be one or more of the following types: users, bots, groups, channels.
456
+ *
457
+ * @since Bot API 6.7+
328
458
  */
329
- switchInlineQuery(query: string, choose_chat_types?: Array<"users" | "bots" | "groups" | "channels">): void;
459
+ switchInlineQuery(query: string, choose_chat_types?: ("users" | "bots" | "groups" | "channels")[]): void;
460
+
330
461
  /**
331
- * A method that opens a link in an external browser. The Web App will not
332
- * be closed. If the optional options parameter is passed with the field
333
- * @param try_instant_view the link will be opened in Instant View mode if
334
- * possible.
462
+ * A method that opens a link in an external browser. The Mini App will not be closed.
463
+ * Bot API 6.4+ If the optional options parameter is passed with the field try_instant_view=true, the link will be opened in Instant View mode if possible.
335
464
  *
336
- * Note that this method can be called only in response to user interaction
337
- * with the Web App interface (e.g. a click inside the Web App or on the
338
- * main button)
465
+ * @remarks That this method can be called only in response to user interaction with the Mini App interface (e.g. a click inside the Mini App or on the main button)
339
466
  */
340
467
  openLink(url: string, options?: { try_instant_view?: boolean }): void;
468
+
341
469
  /**
342
- * A method that opens a telegram link inside Telegram app. The Web App will
343
- * be closed.
470
+ * A method that opens a telegram link inside the Telegram app. The Mini App will not be closed after this method is called.
471
+ *
472
+ * Up to Bot API 7.0 The Mini App will be closed after this method is called.
344
473
  */
345
474
  openTelegramLink(url: string): void;
475
+
346
476
  /**
347
- * A method that opens an invoice using the link url. The Web App will
348
- * receive the event invoiceClosed when the invoice is closed. If an
349
- * optional callback parameter was passed, the callback function will be
350
- * called and the invoice status will be passed as the first argument.
477
+ * A method that opens an invoice using the link url.
478
+ * The Mini App will receive the event invoiceClosed when the invoice is closed.
479
+ * If an optional callback parameter was passed,
480
+ * the callback function will be called and the invoice status will be passed as the first argument.
481
+ *
482
+ * @since Bot API 6.1+
351
483
  */
352
484
  openInvoice(url: string, callback: (status: "paid" | "cancelled" | "failed" | "pending") => void): void;
485
+
353
486
  /**
354
- * **Bot API 9.1+**
487
+ * A method that opens the native story editor with the media specified in the media_url parameter as an HTTPS URL.
488
+ * An optional params argument of the type StoryShareParams describes additional sharing settings.
355
489
  *
356
- * A method that hides the on-screen keyboard, if it is currently visible.
357
- * Does nothing if the keyboard is not active.
358
- */
359
- hideKeyboard(): void;
360
- /**
361
- * A method that shows a native popup described by the params argument of
362
- * the type PopupParams. The Web App will receive the event popupClosed when
363
- * the popup is closed. If an optional callback parameter was passed, the
364
- * callback function will be called and the field id of the pressed button
365
- * will be passed as the first argument.
366
- */
367
- showPopup(params: PopupParams, callback?: (button_id: string) => void): void;
368
- /**
369
- * A method that shows message in a simple alert with a 'Close' button. If
370
- * an optional callback parameter was passed, the callback function will be
371
- * called when the popup is closed.
372
- */
373
- showAlert(message: string, callback?: () => void): void;
374
- /**
375
- * A method that shows message in a simple confirmation window with 'OK' and
376
- * 'Cancel' buttons. If an optional callback parameter was passed, the
377
- * callback function will be called when the popup is closed and the first
378
- * argument will be a boolean indicating whether the user pressed the 'OK'
379
- * button.
380
- */
381
- showConfirm(message: string, callback?: (ok: boolean) => void): void;
382
- /**
383
- * A method that shows a native popup for scanning a QR code described by
384
- * the params argument of the type ScanQrPopupParams. The Web App will
385
- * receive the event qrTextReceived every time the scanner catches a code
386
- * with text data. If an optional callback parameter was passed, the
387
- * callback function will be called and the text from the QR code will be
388
- * passed as the first argument. Returning true inside this callback
389
- * function causes the popup to be closed. Starting from **Bot API 7.7**,
390
- * the Mini App will receive the scanQrPopupClosed event if the user closes
391
- * the native popup for scanning a QR code.
392
- */
393
- showScanQrPopup(params: ScanQrPopupParams, callback?: (data: string) => void): void;
394
- /**
395
- * A method that closes the native popup for scanning a QR code opened with
396
- * the showScanQrPopup method. Run it if you received valid data in the
397
- * event qrTextReceived.
490
+ * @since Bot API 7.8+
398
491
  */
399
- closeScanQrPopup(): void;
400
- /** A method that opens the native story editor with the media specified in
401
- * the media_url parameter as an HTTPS URL. An optional params argument of
402
- * the type StoryShareParams describes additional sharing settings. */
403
492
  shareToStory(media_url: string, params?: StoryShareParams): void;
493
+
404
494
  /**
405
- * **Bot API 8.0+**
495
+ * A method that opens a dialog allowing the user to share a message provided by the bot.
496
+ * If an optional callback parameter is provided,
497
+ * the callback function will be called with a boolean as the first argument,
498
+ * indicating whether the message was successfully sent.
499
+ * The message id passed to this method must belong to a PreparedInlineMessage previously obtained via the Bot API method savePreparedInlineMessage.
406
500
  *
407
- * A method that opens a dialog allowing the user to share a message provided by the bot.
408
- * If an optional callback parameter is provided,
409
- * the callback function will be called with a boolean as the first argument,
410
- * indicating whether the message was successfully sent.
501
+ * @since Bot API 8.0+
411
502
  */
412
503
  shareMessage(msg_id: number, callback?: (success: boolean) => void): void;
504
+
413
505
  /**
414
- * **Bot API 8.0+**
506
+ * A method that opens a dialog allowing the user to set the specified custom emoji as their status.
507
+ * An optional params argument of type EmojiStatusParams specifies additional settings, such as duration.
508
+ * If an optional callback parameter is provided,
509
+ * the callback function will be called with a boolean as the first argument,
510
+ * indicating whether the status was set.
415
511
  *
416
- * A method that opens a dialog allowing the user to set the specified custom emoji as their status.
417
- * An optional params argument of type EmojiStatusParams specifies additional settings,such as duration.
418
- * If an optional callback parameter is provided,
419
- * the callback function will be called with a boolean as the first argument,
420
- * indicating whether the status was set.
512
+ * Note: this method opens a native dialog and cannot be used to set the emoji status without manual user interaction.
513
+ * For fully programmatic changes, you should instead use the Bot API method setUserEmojiStatus after obtaining authorization to do so via the Mini App method requestEmojiStatusAccess.
421
514
  *
422
- * Note: this method opens a native dialog and cannot be used to set the emoji status without manual user interaction.
423
- * For fully programmatic changes, you should instead use the Bot API method setUserEmojiStatus
424
- * after obtaining authorization to do so via the Mini App method requestEmojiStatusAccess.
515
+ * @since Bot API 8.0+
425
516
  */
426
517
  setEmojiStatus(custom_emoji_id: string, params?: EmojiStatusParams, callback?: (success: boolean) => void): void;
518
+
427
519
  /**
428
- * **Bot API 8.0+**
520
+ * A method that shows a native popup requesting permission for the bot to manage user's emoji status.
521
+ * If an optional callback parameter was passed, the callback function will be called when the popup is closed and the first argument will be a boolean indicating whether the user granted this access.
429
522
  *
430
- * A method that shows a native popup requesting permission for the bot to manage user's emoji status.
431
- * If an optional callback parameter was passed,
432
- * the callback function will be called when the popup is closed
433
- * and the first argument will be a boolean indicating whether the user granted this access.
523
+ * @since Bot API 8.0+
434
524
  */
435
525
  requestEmojiStatusAccess(callback?: (success: boolean) => void): void;
526
+
436
527
  /**
437
- * **Bot API 8.0+**
528
+ * A method that displays a native popup prompting the user to download a file specified by the params argument of type DownloadFileParams. If an optional callback parameter is provided, the callback function will be called when the popup is closed, with the first argument as a boolean indicating whether the user accepted the download request.
438
529
  *
439
- * A method that displays a native popup prompting the user to download a file
440
- * specified by the params argument of type DownloadFileParams.
441
- * If an optional callback parameter is provided,
442
- * the callback function will be called when the popup is closed,
443
- * with the first argument as a boolean indicating whether the user accepted the download request.
530
+ * @since Bot API 8.0+
444
531
  */
445
532
  downloadFile(params: DownloadFileParams, callback?: (success: boolean) => void): void;
533
+
446
534
  /**
447
- * A method that requests text from the clipboard.
448
- * The Web App will receive the event clipboardTextReceived.
449
- * If an optional callback parameter was passed,
450
- * the callback function will be called and the text from the clipboard will be passed as the first argument.
535
+ * A method that hides the on-screen keyboard, if it is currently visible. Does nothing if the keyboard is not active.
451
536
  *
452
- * Note: this method can be called only for Web Apps launched from the
453
- * attachment menu and only in response to a user interaction with the Web
454
- * App interface (e.g. a click inside the Web App or on the main button).
537
+ * @since Bot API 9.1+
455
538
  */
456
- readTextFromClipboard(callback?: (data: string | null) => void): void;
539
+ hideKeyboard(): void;
540
+
457
541
  /**
458
- * A method that shows a native popup requesting permission for the bot to
459
- * send messages to the user.
542
+ * A method that shows a native popup described by the params argument of the type PopupParams.
543
+ * The Mini App will receive the event popupClosed when the popup is closed.
544
+ * If an optional callback parameter was passed, the callback function will be called
545
+ * and the field id of the pressed button will be passed as the first argument.
460
546
  *
461
- * @param callback If an optional callback parameter was passed, the
462
- * callback function will be called when the popup is closed and the first
463
- * argument will be a boolean indicating whether the user granted this
464
- * access.
547
+ * @since Bot API 6.2+
465
548
  */
466
- requestWriteAccess(callback?: (success: boolean) => void): void;
549
+ showPopup(params: PopupParams, callback?: (button_id: string) => void): void;
550
+
467
551
  /**
468
- * A method that shows a native popup prompting the user for their phone
469
- * number.
552
+ * A method that shows message in a simple confirmation window with 'OK' and 'Cancel' buttons.
553
+ * If an optional callback parameter was passed, the callback function will be called when the popup is closed and the first argument will be a boolean indicating whether the user pressed the 'OK' button.
470
554
  *
471
- * @param callback If an optional callback parameter was passed, the
472
- * callback function will be called when the popup is closed and the first
473
- * argument will be a boolean indicating whether the user shared its phone
474
- * number. The second argument, contingent upon success, will be an object
475
- * detailing the shared contact information or a cancellation response.
476
- */
477
- requestContact(callback?: (success: boolean, response: RequestContactResponse) => void): void;
478
- /**
479
- * A method that informs the Telegram app that the Web App is ready to be
480
- * displayed. It is recommended to call this method as early as possible, as
481
- * soon as all essential interface elements are loaded. Once this method is
482
- * called, the loading placeholder is hidden and the Web App is shown. If
483
- * the method is not called, the placeholder will be hidden only when the
484
- * page is fully loaded.
485
- */
486
- ready(): void;
487
- /**
488
- * A method that expands the Web App to the maximum available height. To
489
- * find out if the Web App is expanded to the maximum height, refer to the
490
- * value of the Telegram.WebApp.isExpanded parameter
555
+ * @since Bot API 6.2+
491
556
  */
492
- expand(): void;
493
- /** A method that closes the Web App. */
494
- close(): void;
557
+ showAlert(message: string, callback?: () => void): void;
558
+
495
559
  /**
496
- * `True`, if vertical swipes to close or minimize the Mini App are enabled.
497
- * `False`, if vertical swipes to close or minimize the Mini App are
498
- * disabled. In any case, the user will still be able to minimize and close
499
- * the Mini App by swiping the Mini App's header.
560
+ * A method that shows message in a simple confirmation window with 'OK' and 'Cancel' buttons.
561
+ * If an optional callback parameter was passed, the callback function will be called when the popup is closed and the first argument will be a boolean indicating whether the user pressed the 'OK' button.
562
+ *
563
+ * @since Bot API 6.2+
500
564
  */
501
- isVerticalSwipesEnabled: boolean;
565
+ showConfirm(message: string, callback?: (success: boolean) => void): void;
566
+
502
567
  /**
503
- * **Bot API 7.7+**
504
- * A method that enables vertical swipes to close or minimize the Mini App.
505
- * For user convenience, it is recommended to always enable swipes unless they conflict
506
- * with the Mini App's own gestures.
568
+ * A method that shows a native popup for scanning a QR code described by the params argument of the type ScanQrPopupParams.
569
+ * The Mini App will receive the event qrTextReceived every time the scanner catches a code with text data.
570
+ * If an optional callback parameter was passed,
571
+ * the callback function will be called and the text from the QR code will be passed as the first argument.
572
+ * Returning true inside this callback function causes the popup to be closed.
573
+ * Starting from Bot API 7.7, the Mini App will receive the scanQrPopupClosed event if the user closes the native popup for scanning a QR code.
574
+ *
575
+ * @since Bot API 6.4+
507
576
  */
508
- enableVerticalSwipes(): void;
577
+ showScanQrPopup(params: ScanQrPopupParams, callback?: (data: string) => void): void;
578
+
509
579
  /**
510
- * **Bot API 7.7+**
511
- * A method that disables vertical swipes to close or minimize the Mini App.
512
- * This method is useful if your Mini App uses swipe gestures that may conflict
513
- * with the gestures for minimizing and closing the app.
580
+ * A method that closes the native popup for scanning a QR code opened with the showScanQrPopup method.
581
+ * Run it if you received valid data in the event qrTextReceived.
582
+ *
583
+ * @since Bot API 6.4+
514
584
  */
515
- disableVerticalSwipes(): void;
585
+ closeScanQrPopup(): void;
586
+
516
587
  /**
517
- * **Bot API 8.0+**
588
+ * A method that requests text from the clipboard.
589
+ * The Mini App will receive the event clipboardTextReceived.
590
+ * If an optional callback parameter was passed,
591
+ * the callback function will be called and the text from the clipboard will be passed as the first argument.
518
592
  *
519
- * A method that requests opening the Mini App in fullscreen mode.
520
- * Although the header is transparent in fullscreen mode,
521
- * it is recommended that the Mini App sets the header color using the setHeaderColor method.
522
- * This color helps determine a contrasting color for the status bar and other UI controls.
593
+ * @remarks This method can be called only for Mini Apps launched from the attachment menu
594
+ * and only in response to a user interaction with the Mini App interface
595
+ * (e.g. a click inside the Mini App or on the main button).
596
+ *
597
+ * @since Bot API 6.4+
523
598
  */
524
- requestFullscreen(): void;
599
+ readTextFromClipboard(callback?: (data: string | null) => void): void;
600
+
525
601
  /**
526
- * **Bot API 8.0+**
602
+ * A method that shows a native popup requesting permission for the bot to send messages to the user.
603
+ * If an optional callback parameter was passed,
604
+ * the callback function will be called when the popup is closed and the first argument will be a boolean indicating whether the user granted this access.
527
605
  *
528
- * A method that requests exiting fullscreen mode.
606
+ * @since Bot API 6.9+
529
607
  */
530
- exitFullscreen(): void;
608
+ requestWriteAccess(callback?: (success: boolean) => void): void;
609
+
531
610
  /**
532
- * **Bot API 8.0+**
611
+ * A method that shows a native popup prompting the user for their phone number.
612
+ * If an optional callback parameter was passed,
613
+ * the callback function will be called when the popup is closed and the first argument will be a boolean indicating whether the user shared its phone number.
533
614
  *
534
- * A method that locks the Mini App’s orientation to its current mode (either portrait or landscape).
535
- * Once locked, the orientation remains fixed, regardless of device rotation.
536
- * This is useful if a stable orientation is needed during specific interactions.
615
+ * @since Bot API 6.9+
537
616
  */
538
- lockOrientation(): void;
617
+ requestContact(callback?: (success: boolean, response: RequestContactResponse) => void): void;
618
+
539
619
  /**
540
- * **Bot API 8.0+**
541
- *
542
- * A method that unlocks the Mini App’s orientation, allowing it to follow the device's rotation freely.
543
- * Use this to restore automatic orientation adjustments based on the device orientation.
620
+ * A method that informs the Telegram app that the Mini App is ready to be displayed.
621
+ * It is recommended to call this method as early as possible, as soon as all essential interface elements are loaded.
622
+ * Once this method is called, the loading placeholder is hidden and the Mini App is shown.
623
+ * If the method is not called, the placeholder will be hidden only when the page is fully loaded.
544
624
  */
545
- unlockOrientation(): void;
625
+ ready(): void;
626
+
546
627
  /**
547
- * **Bot API 8.0+**
548
- *
549
- * A method that prompts the user to add the Mini App to the home screen.
550
- * After successfully adding the icon, the homeScreenAdded event will be triggered if supported by the device.
551
- * Note that if the device cannot determine the installation status,
552
- * the event may not be received even if the icon has been added.
628
+ * A method that expands the Mini App to the maximum available height.
629
+ * To find out if the Mini App is expanded to the maximum height,
630
+ * refer to the value of the {@link isExpanded| Telegram.WebApp.isExpanded} parameter
553
631
  */
554
- addToHomeScreen(): void;
632
+ expand(): void;
633
+
555
634
  /**
556
- * **Bot API 8.0+**
557
- *
558
- * A method that checks if adding to the home screen is supported and if the Mini App has already been added.
559
- * If an optional callback parameter is provided,
560
- * the callback function will be called with a single argument status,
561
- * which is a string indicating the home screen status.
635
+ * A method that closes the Mini App.
562
636
  */
563
- checkHomeScreenStatus(callback?: (status: "unsupported" | "unknown" | "added" | "missed") => void): void;
637
+ close(): void;
564
638
  }
565
639
 
566
640
  export type ActivatedCallback = () => void;
@@ -635,103 +709,130 @@ export type FileDownloadRequestedCallback = (eventData: {
635
709
  }) => void;
636
710
 
637
711
  /**
638
- * Web Apps can adjust the appearance of the interface to match the Telegram
639
- * user's app in real time. This object contains the user's current theme
640
- * settings:
712
+ * Mini Apps can adjust the appearance of the interface to match the Telegram user's app in real time.
713
+ * This object contains the user's current theme setting
641
714
  */
642
715
  export interface ThemeParams {
643
716
  /**
644
717
  * Background color in the `#RRGGBB` format.
645
- * Also available as the CSS variable `var(--tg-theme-bg-color)`.
718
+ *
719
+ * @see Available as the CSS variable `var(--tg-theme-bg-color)`.
646
720
  */
647
721
  bg_color?: string;
722
+
648
723
  /**
649
724
  * Main text color in the `#RRGGBB` format.
650
- * Also available as the CSS variable `var(--tg-theme-text-color)`.
725
+ *
726
+ * @see Available as the CSS variable `var(--tg-theme-text-color)`.
651
727
  */
652
728
  text_color?: string;
729
+
653
730
  /**
654
731
  * Hint text color in the `#RRGGBB` format.
655
- * Also available as the CSS variable `var(--tg-theme-hint-color)`.
732
+ *
733
+ * @see Available as the CSS variable `var(--tg-theme-hint-color)`.
656
734
  */
657
735
  hint_color?: string;
736
+
658
737
  /**
659
738
  * Link color in the `#RRGGBB` format.
660
- * Also available as the CSS variable `var(--tg-theme-link-color)`.
739
+ *
740
+ * @see Available as the CSS variable `var(--tg-theme-link-color)`.
661
741
  */
662
742
  link_color?: string;
743
+
663
744
  /**
664
745
  * Button color in the `#RRGGBB` format.
665
- * Also available as the CSS variable `var(--tg-theme-button-color)`.
746
+ *
747
+ * @see Available as the CSS variable `var(--tg-theme-button-color)`.
666
748
  */
667
749
  button_color?: string;
750
+
668
751
  /**
669
752
  * Button text color in the `#RRGGBB` format.
670
- * Also available as the CSS variable `var(--tg-theme-button-text-color)`.
753
+ *
754
+ * @see Available as the CSS variable `var(--tg-theme-button-text-color)`.
671
755
  */
672
756
  button_text_color?: string;
757
+
673
758
  /**
674
- * **Bot API 6.1+**
675
- *
676
759
  * Secondary background color in the `#RRGGBB` format.
677
- * Also available as the CSS variable `var(--tg-theme-secondary-bg-color)`.
760
+ *
761
+ * @since Bot API 6.1+
762
+ *
763
+ * @see Available as the CSS variable `var(--tg-theme-secondary-bg-color)`.
678
764
  */
679
765
  secondary_bg_color?: string;
766
+
680
767
  /**
681
- * **Bot API 7.0+**
682
- *
683
768
  * Header background color in the `#RRGGBB` format.
684
- * Also available as the CSS variable `var(--tg-theme-header-bg-color)`.
769
+ *
770
+ * @since Bot API 7.0+
771
+ *
772
+ * @see Available as the CSS variable `var(--tg-theme-header-bg-color)`.
685
773
  */
686
774
  header_bg_color?: string;
775
+
687
776
  /**
688
- * **Bot API 7.10+**
777
+ * Bottom background color in the `#RRGGBB` format.
778
+ *
779
+ * @since Bot API 7.10+
689
780
  *
690
- * Bottom background color in the #RRGGBB format.
691
- * Also available as the CSS variable var(--tg-theme-bottom-bar-bg-color).
781
+ * @see Available as the CSS variable `var(--tg-theme-bottom-bar-bg-color)`.
692
782
  */
693
783
  bottom_bar_bg_color?: string;
784
+
694
785
  /**
695
- * **Bot API 7.0+**
696
- *
697
786
  * Accent text color in the `#RRGGBB` format.
698
- * Also available as the CSS variable `var(--tg-theme-accent-text-color)`.
787
+ *
788
+ * @since Bot API 7.0+
789
+ *
790
+ * @see Available as the CSS variable `var(--tg-theme-accent-text-color)`.
699
791
  */
700
792
  accent_text_color?: string;
793
+
701
794
  /**
702
- * **Bot API 7.0+**
795
+ * Section background color in the `#RRGGBB` format.
796
+ *
797
+ * @since Bot API 7.0+
703
798
  *
704
- * Background color for the section in the `#RRGGBB` format.
705
- * It is recommended to use this in conjunction with *secondary_bg_color*.
706
- * Also available as the CSS variable `var(--tg-theme-section-bg-color)`.
799
+ * @see Available as the CSS variable `var(--tg-theme-section-bg-color)`.
707
800
  */
708
801
  section_bg_color?: string;
802
+
709
803
  /**
710
- * **Bot API 7.0+**
804
+ * Section header text color in the `#RRGGBB` format.
805
+ *
806
+ * @since Bot API 7.0+
711
807
  *
712
- * Header text color for the section in the `#RRGGBB` format.
713
- * Also available as the CSS variable `var(--tg-theme-section-header-text-color)`.
808
+ * @see Available as the CSS variable `var(--tg-theme-section-header-text-color)`.
714
809
  */
715
- section_header_text_color?: `#${string}`;
810
+ section_header_text_color?: string;
811
+
716
812
  /**
717
- * **Bot API 7.6+**
718
- *
719
813
  * Section separator color in the `#RRGGBB` format.
720
- * Also available as the CSS variable `var(--tg-theme-section-separator-color)`.
814
+ *
815
+ * @since Bot API 7.6+
816
+ *
817
+ * @see Available as the CSS variable `var(--tg-theme-section-separator-color)`.
721
818
  */
722
819
  section_separator_color?: string;
820
+
723
821
  /**
724
- * **Bot API 7.0+**
725
- *
726
822
  * Subtitle text color in the `#RRGGBB` format.
727
- * Also available as the CSS variable `var(--tg-theme-subtitle-text-color)`.
823
+ *
824
+ * @since Bot API 7.0+
825
+ *
826
+ * @see Available as the CSS variable `var(--tg-theme-subtitle-text-color)`.
728
827
  */
729
828
  subtitle_text_color?: string;
829
+
730
830
  /**
731
- * **Bot API 7.0+**
831
+ * Destructive text color in the `#RRGGBB` format.
832
+ *
833
+ * @since Bot API 7.0+
732
834
  *
733
- * Text color for destructive actions in the `#RRGGBB` format.
734
- * Also available as the CSS variable `var(--tg-theme-destructive-text-color)`.
835
+ * @see Available as the CSS variable `var(--tg-theme-destructive-text-color)`.
735
836
  */
736
837
  destructive_text_color?: string;
737
838
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/telegram-web-app",
3
- "version": "9.1.0",
3
+ "version": "9.1.1",
4
4
  "description": "TypeScript definitions for telegram-web-app",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/telegram-web-app",
6
6
  "license": "MIT",
@@ -36,6 +36,6 @@
36
36
  "scripts": {},
37
37
  "dependencies": {},
38
38
  "peerDependencies": {},
39
- "typesPublisherContentHash": "f446f17f32fcc8ca83f3118a6a869a8e164f6b95797cbd6b80fbddab18adedfe",
39
+ "typesPublisherContentHash": "c942da54059cdd792567429adafb556da1f1b2be1b66b00c2f2bcfada4b04578",
40
40
  "typeScriptVersion": "5.2"
41
41
  }