From 495e0852f3d44170ddd400f061433a59cd09b150 Mon Sep 17 00:00:00 2001 From: Ermolay Date: Thu, 18 Dec 2025 00:07:29 +0300 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BA=D0=BD=D0=BE=D0=BF=D0=BA?= =?UTF-8?q?=D0=B8=20=D0=B4=D0=BB=D1=8F=20=D0=B7=D0=B0=D0=BF=D1=83=D1=81?= =?UTF-8?q?=D0=BA=D0=B0=20=D0=BC=D0=B8=D0=BD=D0=B8-=D0=BF=D1=80=D0=B8?= =?UTF-8?q?=D0=BB=D0=BE=D0=B6=D0=B5=D0=BD=D0=B8=D1=8F=20=D1=87=D0=B5=D1=80?= =?UTF-8?q?=D0=B5=D0=B7=20inlineKeyboard?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/helpers/buttons.ts | 12 ++++++++++++ src/core/network/api/types/keyboard.ts | 11 ++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/core/helpers/buttons.ts b/src/core/helpers/buttons.ts index 183ca84..1be733a 100644 --- a/src/core/helpers/buttons.ts +++ b/src/core/helpers/buttons.ts @@ -2,6 +2,7 @@ import { Button, CallbackButton, ChatButton, LinkButton, + OpenAppButton, RequestContactButton, RequestGeoLocationButton, } from '../network/api'; @@ -51,3 +52,14 @@ export const chat = ( type: 'chat', text, chat_title: chatTitle, ...extra, }; }; + +export const openApp = ( + text: string, + webApp: string, + contactId?: number, + payload?: string, +): OpenAppButton => { + return { + type: 'open_app', text, web_app: webApp, contact_id: contactId, payload + }; +}; \ No newline at end of file diff --git a/src/core/network/api/types/keyboard.ts b/src/core/network/api/types/keyboard.ts index ff11d60..176eb58 100644 --- a/src/core/network/api/types/keyboard.ts +++ b/src/core/network/api/types/keyboard.ts @@ -33,9 +33,18 @@ export type ChatButton = { uuid?: string | null; }; +export type OpenAppButton = { + type: 'open_app'; + text: string; + web_app?: string | null; + contact_id?: number | null; + payload?: string | null; +}; + export type Button = | CallbackButton | LinkButton | RequestContactButton | RequestGeoLocationButton - | ChatButton; + | ChatButton + | OpenAppButton; From 4554706bebb770a210daca2e575caa6294108d49 Mon Sep 17 00:00:00 2001 From: Ermolay Date: Thu, 18 Dec 2025 00:25:14 +0300 Subject: [PATCH 2/2] =?UTF-8?q?chore:=20=D0=BE=D0=BF=D0=B8=D1=81=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BC=D0=B5=D1=82=D0=BE=D0=B4=D0=B0=20ope?= =?UTF-8?q?nApp=20=D0=B2=20=D0=B4=D0=BE=D0=BA=D1=83=D0=BC=D0=B5=D0=BD?= =?UTF-8?q?=D1=82=D0=B0=D1=86=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/04-keyboard.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/04-keyboard.md b/docs/04-keyboard.md index 80799ad..1cc45d5 100644 --- a/docs/04-keyboard.md +++ b/docs/04-keyboard.md @@ -33,7 +33,7 @@ button.link(text: string, url: string); ```typescript button.requestContact(text: string); ``` -Добавляет кнопку запроса контакта. При нажатии на неё боту будет отправлено сообщение с номером телефона, полным имененм и почтой пользователя во вложении в формате `VCF`. +Добавляет кнопку запроса контакта. При нажатии на неё боту будет отправлено сообщение с номером телефона, полным именем и почтой пользователя во вложении в формате `VCF`. #### RequestGeoLocation ```typescript @@ -50,3 +50,9 @@ button.chat(text: string, chatTitle: string, extra?: { }); ``` Добавляет кнопку создания чата. При нажатии на неё будет создан новый чат с ботом и пользователем. + +#### OpenApp +```typescript +button.openApp(text: string, webApp?: string, contactId?: number, payload?: string); +``` +Добавляет кнопку для запуска мини-приложения. При нажатии на неё откроется окно с мини-приложением бота, ссылка на которого указана в параметре webApp.