diff --git a/types/telegram-web-app/index.d.ts b/types/telegram-web-app/index.d.ts index 1b142fb36cbf63..1905ee2f0e67b6 100644 --- a/types/telegram-web-app/index.d.ts +++ b/types/telegram-web-app/index.d.ts @@ -616,6 +616,18 @@ export interface WebApp { */ requestContact(callback?: (success: boolean, response: RequestContactResponse) => void): void; + /** + * A method that opens a dialog allowing the user to select an existing chat + * or create a new one. If an optional _callback_ parameter is provided, + * the _callback_ function will be called with a boolean as the first argument, + * indicating whether the message was successfully sent. + * The request id passed to this method must belong to a {@link https://core.telegram.org/bots/api#preparedkeyboardbutton | PreparedKeyboardButton} + * previously obtained via the Bot API method {@link https://core.telegram.org/bots/api#savepreparedkeyboardbutton | savePreparedKeyboardButton}. + * + * @since Bot API 9.6+ + */ + requestChat(req_id: string, callback?: (success: boolean) => void): void; + /** * A method that informs the Telegram app that the Mini App is ready to be displayed. * It is recommended to call this method as early as possible, as soon as all essential interface elements are loaded. diff --git a/types/telegram-web-app/package.json b/types/telegram-web-app/package.json index ec080c1d7488e8..1f7c5245d3ab4d 100644 --- a/types/telegram-web-app/package.json +++ b/types/telegram-web-app/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@types/telegram-web-app", - "version": "9.5.9999", + "version": "9.6.9999", "nonNpm": "conflict", "nonNpmDescription": "telegram-web-app", "projects": ["https://telegram.org/js/telegram-web-app.js"], diff --git a/types/telegram-web-app/telegram-web-app-tests.ts b/types/telegram-web-app/telegram-web-app-tests.ts index 529ad9326a227f..1c4342f598d454 100644 --- a/types/telegram-web-app/telegram-web-app-tests.ts +++ b/types/telegram-web-app/telegram-web-app-tests.ts @@ -138,3 +138,7 @@ app.SecondaryButton.iconCustomEmojiId; // $ExpectType string app.SecondaryButton.setParams({ icon_custom_emoji_id: "", // $ExpectType string }); + +app.requestChat("req_id", (success) => { + success; // $ExpectType boolean +});