Skip to content

Mini Apps Integration

Official Telegram Mini Apps Documentation

Field Mapping

FieldComposable
initDatauseMiniApp
initDataUnsafeuseMiniApp
versionuseMiniApp
platformuseMiniApp
colorSchemeuseTheme
themeParamsuseTheme
isActiveuseMiniApp
isExpandeduseViewport
viewportHeightuseViewport
viewportStableHeightuseViewport
headerColoruseTheme
backgroundColoruseTheme
isClosingConfirmationEnableduseMiniApp
isVerticalSwipesEnableduseViewport
isFullscreenuseViewport
isOrientationLockeduseViewport
safeAreaInsetuseViewport
contentSafeAreaInsetuseViewport
BackButtonuseBackButton
MainButtonuseMainButton
HapticFeedbackuseHapticFeedback
BiometricManageruseBiometricManager
AccelerometeruseAccelerometer
DeviceOrientationuseDeviceOrientation
GyroscopeuseGyroscope
LocationManageruseLocationManager
isVersionAtLeastuseMiniApp
setHeaderColoruseTheme
setBackgroundColoruseTheme
setBottomBarColoruseTheme
enableClosingConfirmationuseMiniApp
disableClosingConfirmationuseMiniApp
enableVerticalSwipesuseViewport
disableVerticalSwipesuseViewport
requestFullscreenuseViewport
exitFullscreenuseViewport
lockOrientationuseViewport
unlockOrientationuseViewport
addToHomeScreenuseHomeScreen
checkHomeScreenStatususeHomeScreen
onEventEvent Handling
offEventManaging Event Subscriptions
sendDatauseMiniApp
switchInlineQueryuseMiniApp
openLinkuseMiniApp
openTelegramLinkuseMiniApp
openInvoiceuseMiniApp
shareToStoryuseMiniApp
shareMessageuseMiniApp
setEmojiStatususeEmojiStatus
requestEmojiStatusAccessuseEmojiStatus
downloadFileuseMiniApp
showPopupusePopup
showAlertusePopup
showConfirmusePopup
showScanQrPopupuseQrScanner
closeScanQrPopupuseQrScanner
readTextFromClipboarduseClipboard
requestWriteAccessuseMiniApp
requestContactuseMiniApp
readyuseMiniApp
expanduseViewport
closeuseMiniApp

Version Check

Features are introduced in specific versions of the Bot API, but users may not always use clients that support the latest version. Always verify version compatibility to ensure feature support.

For example, shareToStory was introduced in version 7.8:

ts
import { 
useMiniApp
} from 'vue-tg'
const
miniApp
=
useMiniApp
()
// error because this method was introduced in version 7.8 miniApp.shareToStory("https://url-to-image")
Cannot invoke an object which is possibly 'undefined'.
// first, ensure the version is 7.8 or higher if (
miniApp
.
isVersionAtLeast
('7.8')) {
miniApp
.
shareToStory
("https://url-to-image") // no error
}

You can explicitly set the base version:

ts
import { 
useMiniApp
} from 'vue-tg/7.8'
const
miniApp
=
useMiniApp
()
miniApp
.
shareToStory
("https://url-to-image") // no error
// error because this method was introduced in version 8.0 miniApp.downloadFile({
url
: "https://url-to-image",
file_name
: "kitten.png" })
Cannot invoke an object which is possibly 'undefined'.

To skip all version checks, use latest, which is an alias for the latest version. This is useful for prototyping but unreliable for production. Use it only if you know what you are doing.

ts
import { 
useMiniApp
} from 'vue-tg/latest'
const
miniApp
=
useMiniApp
()
miniApp
.
shareToStory
("https://url-to-image") // no error

Specifying the version every time can be tedious. For convenience, create a file telegram.ts with following content:

ts
import { 
isVersionAtLeast
} from 'vue-tg'
import {
usePopup
,
useMiniApp
} from 'vue-tg/latest'
const
popup
=
usePopup
()
const
miniApp
=
useMiniApp
()
if (!
isVersionAtLeast
('8.0')) {
popup
.
showAlert
(
"Please update Telegram to the latest version!",
miniApp
.
close
) } export * from 'vue-tg/8.0'

Now, you can import composables from telegram.ts and be sure that the client supports the specified version (8.0 in this case).

Event Handling

Event-handling functions follow the naming convention on<EventName> in camelCase. For example, the themeChanged event becomes onThemeChanged, and so on. A generic onEvent is also available if you prefer to use it instead.

ts
import { onThemeChanged } from 'vue-tg'

onThemeChanged(() => {
  // handle theme update
})

You can also use composables for event handling:

ts
import { useTheme } from 'vue-tg'

const theme = useTheme()

theme.onChange(() => {
  // handle theme update
})
Event Mapping
Event nameHandlerComposable Alias
activatedonActivateduseMiniApp →
onActive
deactivatedonDeactivateduseMiniApp →
onDeactive
themeChangedonThemeChangeduseTheme →
onChange
viewportChangedonViewportChangeduseViewport →
onChange
safeAreaChangedonSafeAreaChangeduseViewport →
onSafeAreaChange
contentSafeAreaChangedonContentSafeAreaChangeduseViewport →
onContentSafeAreaChange
mainButtonClickedonMainButtonClickeduseMainButton →
onClick
secondaryButtonClickedonSecondaryButtonClickeduseSecondaryButton →
onClick
backButtonClickedonBackButtonClickeduseBackButton →
onClick
settingsButtonClickedonSettingsButtonClickeduseSettingsButton →
onClick
invoiceClosedonInvoiceCloseduseMiniApp →
onInvoiceClose
popupClosedonPopupClosedusePopup →
onClose
qrTextReceivedonQrTextReceiveduseQrScanner →
onScan
scanQrPopupClosedonScanQrPopupCloseduseQrScanner →
onClose
clipboardTextReceivedonClipboardTextReceiveduseClipboard →
onRead
writeAccessRequestedonWriteAccessRequesteduseMiniApp →
onWriteAccessRequest
contactRequestedonContactRequesteduseMiniApp →
onContactRequest
biometricManagerUpdatedonBiometricManagerUpdateduseBiometricManager →
onManagerUpdate
biometricAuthRequestedonBiometricAuthRequesteduseBiometricManager →
onAuthRequest
biometricTokenUpdatedonBiometricTokenUpdateduseBiometricManager →
onTokenUpdate
fullscreenChangedonFullscreenChangeduseViewport →
onFullscreenChange
fullscreenFailedonFullscreenFaileduseViewport →
onFullscreenFail
homeScreenAddedonHomeScreenAddeduseHomeScreen →
onShortcutAdd
homeScreenCheckedonHomeScreenCheckeduseHomeScreen →
onShortcutCheck
accelerometerStartedonAccelerometerStarteduseAccelerometer →
onStart
accelerometerStoppedonAccelerometerStoppeduseAccelerometer →
onStop
accelerometerChangedonAccelerometerChangeduseAccelerometer →
onChange
accelerometerFailedonAccelerometerFaileduseAccelerometer →
onFail
deviceOrientationStartedonDeviceOrientationStarteduseDeviceOrientation →
onStart
deviceOrientationStoppedonDeviceOrientationStoppeduseDeviceOrientation →
onStop
deviceOrientationChangedonDeviceOrientationChangeduseDeviceOrientation →
onChange
deviceOrientationFailedonDeviceOrientationFaileduseDeviceOrientation →
onFail
gyroscopeStartedonGyroscopeStarteduseGyroscope →
onStart
gyroscopeStoppedonGyroscopeStoppeduseGyroscope →
onStop
gyroscopeChangedonGyroscopeChangeduseGyroscope →
onChange
gyroscopeFailedonGyroscopeFaileduseGyroscope →
onFail
locationManagerUpdatedonLocationManagerUpdateduseLocationManager →
onManagerUpdate
locationRequestedonLocationRequesteduseLocationManager →
onRequest
shareMessageSentonShareMessageSentuseMiniApp →
onShareMessageSent
shareMessageFailedonShareMessageFaileduseMiniApp →
onShareMessageFail
emojiStatusSetonEmojiStatusSetuseEmojiStatus →
onSet
emojiStatusAccessRequestedonEmojiStatusAccessRequesteduseEmojiStatus →
onAccessRequest
emojiStatusFailedonEmojiStatusFaileduseEmojiStatus →
onFail
fileDownloadRequestedonFileDownloadRequesteduseMiniApp →
onFileDownloadRequest

Managing Event Subscriptions

Event handlers automatically unsubscribe when the component unmounts. However, you can unsubscribe earlier if needed:

ts
import { onThemeChanged } from 'vue-tg'

const handler = onThemeChanged(() => {
  // handle theme update
})

// unsubscribe
handler.off()

To disable automatic unsubscribing, set manual mode:

ts
import { onThemeChanged } from 'vue-tg'

const handler = onThemeChanged(
  () => {
    // handle theme update
  },
  { manual: true },  
)

// unsubscribe
handler.off()

WARNING

In manual mode, you are responsible for managing the subscription. Improper management may lead to memory leaks or other issues.

Components

Alert Bot API 6.2+

A component that shows message in a simple alert with a 'Close' button when is rendered.

vue
<script lang="ts" setup>
import { Alert } from 'vue-tg'

function handleAlertClose() {
  // ...
}
</script>

<template>
  <Alert message="Hello!" @close="handleAlertClose" />
</template>

Props

NameTypeRequiredDescription
messagestringtrueThe message to be displayed in the body of the alert popup.

Events

NameTypeDescription
close() => voidEmits when the opened popup is closed.

BackButton Bot API 6.1+

A component that enables the back button when is rendered.

vue
<script lang="ts" setup>
import { BackButton } from 'vue-tg'

function handleBackButton() {
  // ...
}
</script>

<template>
  <BackButton @click="handleBackButton" />
</template>

Props

NameTypeRequiredDescription
visiblebooleanfalseShows whether the button is visible. Set to true by default.

Events

NameTypeDescription
click() => voidEmits when the back button is pressed.

BiometricManager Bot API 7.2+

A component that init the biometric manager when is rendered.

vue
<script lang="ts" setup>
import { BiometricManager } from 'vue-tg'
  
const handleInit = () => {
  // ...
}
</script>

<template>
  <BiometricManager @init="handleInit" />
</template>

Events

NameTypeDescription
init() => voidEmits when the biometric manager is init.

ClosingConfirmation Bot API 6.2+

A component that enables the confirmation dialog while the user is trying to close the Mini App.

vue
<script lang="ts" setup>
import { ClosingConfirmation } from 'vue-tg'
</script>

<template>
  <ClosingConfirmation />
</template>

Confirm Bot API 6.2+

A component that shows message in a simple confirmation window with 'OK' and 'Cancel' buttons when is rendered.

vue
<script lang="ts" setup>
import { Confirm } from 'vue-tg'

function handleConfirmClose(ok: boolean) {
  // ...
}
</script>

<template>
  <Confirm message="Hello?" @close="handleConfirmClose" />
</template>

Props

NameTypeRequiredDescription
messagestringtrueThe message to be displayed in the body of the confirm popup.

Events

NameTypeDescription
close(ok: boolean) => voidEmits when the opened popup is closed.

ExpandedViewport

A component that expands the Mini App to the maximum available height when is rendered.

vue
<script lang="ts" setup>
import { ExpandedViewport } from 'vue-tg'
</script>

<template>
  <ExpandedViewport />
</template>

Props

NameTypeRequiredDescription
forcebooleanfalseExpands the viewport despite user interaction. Disables vertical swipes if supported. Set to false by default.

MainButton

A component that enables the main button when is rendered.

vue
<script lang="ts" setup>
import { MainButton } from 'vue-tg'

function handleMainButton() {
  // ...
}
</script>

<template>
  <MainButton @click="handleMainButton" />
</template>

Props

NameTypeRequiredDescription
visiblebooleanfalseShows whether the button is visible. Set to true by default.
disabledbooleanfalseShows whether the button is disable.
progressbooleanfalseShows whether the button is displaying a loading indicator.
textstringfalseCurrent button text. Set to Continue for the main button and Cancel for the secondary button by default.
colorstringfalseCurrent button color. Set to themeParams.button_color for the main button and themeParams.bottom_bar_bg_color for the secondary button by default.
textColorstringfalseCurrent button text color. Set to themeParams.button_text_color for the main button and themeParams.button_color for the secondary button by default.
hasShineEffectbooleanfalseBot API 7.10+ Shows whether the button has a shine effect. Set to false by default.

Events

NameTypeDescription
click() => voidEmits when the main button is pressed.

A component that shows a native popup when is rendered.

vue
<script lang="ts" setup>
import { Popup } from 'vue-tg'

function handlePopupClose(buttonId: string) {
  // ...
}
</script>

<template>
  <Popup message="Hello" @close="handlePopupClose" />
</template>

Props

NameTypeRequiredDescription
messagestringtrueThe message to be displayed in the body of the popup.
titlestringfalseThe text to be displayed in the popup title.
buttonsPopupButton[] ↗falseList of buttons to be displayed in the popup.

Events

NameTypeDescription
close(buttonId: string) => voidEmits when the opened popup is closed.

ScanQr Bot API 6.4+

A component that shows a native popup for scanning a QR code when is rendered.

vue
<script lang="ts" setup>
import { ScanQr } from 'vue-tg'

function handleScanResult(data: string) {
  // ...
}
</script>

<template>
  <ScanQr @result="handleScanResult" />
</template>

Props

NameTypeRequiredDescription
textstringfalseThe text to be displayed under the 'Scan QR' heading.

Events

NameTypeDescription
result(data: string) => voidEmits when the QR code scanner catches a code with text data.

SecondaryButton Bot API 7.10+

A component that enables the secondary button when is rendered.

vue
<script lang="ts" setup>
import { SecondaryButton } from 'vue-tg'

function handleSecondaryButton() {
  // ...
}
</script>

<template>
  <SecondaryButton @click="handleSecondaryButton" />
</template>

Props

NameTypeRequiredDescription
visiblebooleanfalseShows whether the button is visible. Set to true by default.
disabledbooleanfalseShows whether the button is disable.
progressbooleanfalseShows whether the button is displaying a loading indicator.
textstringfalseCurrent button text. Set to Continue for the main button and Cancel for the secondary button by default.
colorstringfalseCurrent button color. Set to themeParams.button_color for the main button and themeParams.bottom_bar_bg_color for the secondary button by default.
textColorstringfalseCurrent button text color. Set to themeParams.button_text_color for the main button and themeParams.button_color for the secondary button by default.
hasShineEffectbooleanfalseBot API 7.10+ Shows whether the button has a shine effect. Set to false by default.
positionstringfalseBot API 7.10+ Position of the secondary button. Not defined for the main button. It applies only if both the main and secondary buttons are visible. Set to left by default.
Supported values:
- left, displayed to the left of the main button,
- right, displayed to the right of the main button,
- top, displayed above the main button,
- bottom, displayed below the main button.

Events

NameTypeDescription
click() => voidEmits when the main button is pressed.

SettingsButton Bot API 7.0+

A component that enables the settings button when is rendered.

vue
<script lang="ts" setup>
import { SettingsButton } from 'vue-tg'

function handleSettingsButton() {
  // ...
}
</script>

<template>
  <SettingsButton @click="handleSettingsButton" />
</template>

Props

NameTypeRequiredDescription
visiblebooleanfalseShows whether the button is visible. Set to true by default.

Events

NameTypeDescription
click() => voidEmits when the settings button is pressed.

Composables

useMiniApp

ts
import { useMiniApp } from 'vue-tg'

const miniApp = useMiniApp()
NameDescription
initDataA string with raw data transferred to the Mini App, convenient for validating data.
WARNING: Validate data from this field before using it on the bot's server.
initDataUnsafeAn object with input data transferred to the Mini App.
WARNING: Data from this field should not be trusted. You should only use data from initData on the bot's server and only after it has been validated.
platformThe name of the platform of the user's Telegram app.
isActiveBot API 8.0+ True, if the Mini App is currently active. False, if the Mini App is minimized.
⚡️ readonly reactive
onActiveBot API 8.0+ A method that sets event handler. An alias for onActivated.
onDeactiveBot API 8.0+ A method that sets event handler. An alias for onDeactivated.
sendDataA method used to send data to the bot. 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.

This method is only available for Mini Apps launched via a Keyboard button.
switchInlineQueryBot API 6.7+ A method that inserts the bot's username and the specified inline query in the current chat's input field. Query may be empty, in which case only the bot's username will be inserted. If an optional choose_chat_types parameter was passed, the client prompts the user to choose a specific chat, then opens that chat and inserts the bot's username and the specified inline query in the input field. You can specify which types of chats the user will be able to choose from. It can be one or more of the following types: users, bots, groups, channels.
openLinkA method that opens a link in an external browser. The Mini App will not be closed.
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.

Note 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)
openTelegramLinkA method that opens a telegram link inside the Telegram app. The Mini App will not be closed after this method is called.

Up to Bot API 7.0 The Mini App will be closed after this method is called.
openInvoiceBot API 6.1+ A method that opens an invoice using the link url. The Mini App will receive the event invoiceClosed when the invoice is closed. If an optional callback parameter was passed, the callback function will be called and the invoice status will be passed as the first argument.
⭐️ async
onInvoiceCloseBot API 6.1+ A method that sets event handler. An alias for onInvoiceClosed.
shareToStoryBot API 7.8+ A method that opens the native story editor with the media specified in the media_url parameter as an HTTPS URL. An optional params argument of the type StoryShareParams describes additional sharing settings.
shareMessageBot API 8.0+ A method that opens a dialog allowing the user to share a message provided by the bot. 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 message id passed to this method must belong to a PreparedInlineMessage previously obtained via the Bot API method savePreparedInlineMessage.
⭐️ async
onShareMessageSentBot API 8.0+ A method that sets event handler. An alias for onShareMessageSent.
onShareMessageFailBot API 8.0+ A method that sets event handler. An alias for shareMessageFailed.
downloadFileBot API 8.0+ 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.
⭐️ async
onFileDownloadRequestBot API 8.0+ A method that sets event handler. An alias for onFileDownloadRequested.
requestWriteAccessBot API 6.9+ A method that shows a native popup requesting permission for the bot to send messages to the user. 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.
⭐️ async
onWriteAccessRequestBot API 6.9+ A method that sets event handler. An alias for onWriteAccessRequested.
requestContactBot API 6.9+ A method that shows a native popup prompting the user for their phone number. 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 shared its phone number.
⭐️ async
onContactRequestBot API 6.9+ A method that sets event handler. An alias for onContactRequested.
isClosingConfirmationEnabledTrue, if the confirmation dialog is enabled while the user is trying to close the Mini App. False, if the confirmation dialog is disabled.
⚡️ reactive
readyA 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. Once this method is called, the loading placeholder is hidden and the Mini App is shown.
If the method is not called, the placeholder will be hidden only when the page is fully loaded.
closeA method that closes the Mini App.
isReadyBoolean indicating if the app is ready.
🔋 custom⚡️ readonly reactive
isPlatformFunction to check if the app is running on a specified platform.
🔋 custom
versionThe version of the Bot API available in the user's Telegram app.
isVersionAtLeastReturns true if the user's app supports a version of the Bot API that is equal to or higher than the version passed as the parameter.

useAccelerometer

ts
import { useAccelerometer } from 'vue-tg'

const accelerometer = useAccelerometer()
NameDescription
isStartedIndicates whether accelerometer tracking is currently active.
⚡️ readonly reactive
xThe current acceleration in the X-axis, measured in m/s².
⚡️ readonly reactive
yThe current acceleration in the Y-axis, measured in m/s².
⚡️ readonly reactive
zThe current acceleration in the Z-axis, measured in m/s².
⚡️ readonly reactive
startBot API 8.0+ Starts tracking accelerometer data using params of type AccelerometerStartParams. If an optional callback parameter is provided, the callback function will be called with a boolean indicating whether tracking was successfully started.
⭐️ async
onStartBot API 8.0+ A method that sets event handler. An alias for onAccelerometerStarted.
onChangeBot API 8.0+ A method that sets event handler. An alias for onAccelerometerChanged.
onFailBot API 8.0+ A method that sets event handler. An alias for onAccelerometerFailed.
stopBot API 8.0+ Stops tracking accelerometer data. If an optional callback parameter is provided, the callback function will be called with a boolean indicating whether tracking was successfully stopped.
⭐️ async
onStopBot API 8.0+ A method that sets event handler. An alias for onAccelerometerStopped.
versionThe version of the Bot API available in the user's Telegram app.
isVersionAtLeastReturns true if the user's app supports a version of the Bot API that is equal to or higher than the version passed as the parameter.

useBackButton

ts
import { useBackButton } from 'vue-tg'

const backButton = useBackButton()
NameDescription
isVisibleShows whether the button is visible. Set to false by default.
⚡️ reactive
showBot API 6.1+ A method to make the button active and visible.
hideBot API 6.1+ A method to hide the button.
onClickBot API 6.1+ A method that sets the button press event handler. An alias for Telegram.WebApp.onEvent('backButtonClicked', callback)
versionThe version of the Bot API available in the user's Telegram app.
isVersionAtLeastReturns true if the user's app supports a version of the Bot API that is equal to or higher than the version passed as the parameter.

useBiometricManager

ts
import { useBiometricManager } from 'vue-tg'

const biometricManager = useBiometricManager()
NameType
isInitedShows whether biometrics object is initialized.
⚡️ readonly reactive
isBiometricAvailableShows whether biometrics is available on the current device.
⚡️ readonly reactive
biometricTypeThe type of biometrics currently available on the device. Can be one of these values:
- finger, fingerprint-based biometrics,
- face, face-based biometrics,
- unknown, biometrics of an unknown type.
⚡️ readonly reactive
isAccessRequestedShows whether permission to use biometrics has been requested.
⚡️ readonly reactive
isAccessGrantedShows whether permission to use biometrics has been granted.
⚡️ readonly reactive
isBiometricTokenSavedShows whether the token is saved in secure storage on the device.
⚡️ readonly reactive
deviceIdA unique device identifier that can be used to match the token to the device.
⚡️ readonly reactive
initBot API 7.2+ A method that initializes the BiometricManager object. It should be called before the object's first use. If an optional callback parameter was passed, the callback function will be called when the object is initialized.
⭐️ async
requestAccessBot API 7.2+ A method that requests permission to use biometrics according to the params argument of type BiometricRequestAccessParams. If an optional callback parameter was passed, the callback function will be called and the first argument will be a boolean indicating whether the user granted access.
⭐️ async
onManagerUpdateBot API 7.2+ A method that sets event handler. An alias for onBiometricManagerUpdated.
authenticateBot API 7.2+ A method that authenticates the user using biometrics according to the params argument of type BiometricAuthenticateParams. If an optional callback parameter was passed, the callback function will be called and the first argument will be a boolean indicating whether the user authenticated successfully. If so, the second argument will be a biometric token.
⭐️ async
onAuthRequestBot API 7.2+ A method that sets event handler. An alias for onBiometricAuthRequested.
updateTokenBot API 7.2+ A method that updates the biometric token in secure storage on the device. To remove the token, pass an empty string. If an optional callback parameter was passed, the callback function will be called and the first argument will be a boolean indicating whether the token was updated.
⭐️ async
onTokenUpdateBot API 7.2+ A method that sets event handler. An alias for onBiometricTokenUpdated.
openSettingsBot API 7.2+ A method that opens the biometric access settings for bots. Useful when you need to request biometrics access to users who haven't granted it yet.

Note 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)
versionThe version of the Bot API available in the user's Telegram app.
isVersionAtLeastReturns true if the user's app supports a version of the Bot API that is equal to or higher than the version passed as the parameter.

useClipboard

ts
import { useClipboard } from 'vue-tg'

const clipboard = useClipboard()
NameDescription
readTextBot API 6.4+ A method that requests text from the clipboard. The Mini App will receive the event clipboardTextReceived. If an optional callback parameter was passed, the callback function will be called and the text from the clipboard will be passed as the first argument.

Note: this method can be called only for Mini Apps launched from the attachment menu and only in response to a user interaction with the Mini App interface (e.g. a click inside the Mini App or on the main button).
⭐️ async
onReadTextBot API 6.4+ A method that sets event handler. An alias for onClipboardTextReceived.
versionThe version of the Bot API available in the user's Telegram app.
isVersionAtLeastReturns true if the user's app supports a version of the Bot API that is equal to or higher than the version passed as the parameter.

useCloudStorage

ts
import { useCloudStorage } from 'vue-tg'

const cloudStorage = useCloudStorage()
NameType
setItemBot API 6.9+ A method that stores a value in the cloud storage using the specified key. The key should contain 1-128 characters, only A-Z, a-z, 0-9, _ and - are allowed. The value should contain 0-4096 characters. You can store up to 1024 keys in the cloud storage. If an optional callback parameter was passed, the callback function will be called. In case of an error, the first argument will contain the error. In case of success, the first argument will be null and the second argument will be a boolean indicating whether the value was stored.
⭐️ async
getItemBot API 6.9+ A method that receives a value from the cloud storage using the specified key. The key should contain 1-128 characters, only A-Z, a-z, 0-9, _ and - are allowed. In case of an error, the callback function will be called and the first argument will contain the error. In case of success, the first argument will be null and the value will be passed as the second argument.
⭐️ async
getItemsBot API 6.9+ A method that receives values from the cloud storage using the specified keys. The keys should contain 1-128 characters, only A-Z, a-z, 0-9, _ and - are allowed. In case of an error, the callback function will be called and the first argument will contain the error. In case of success, the first argument will be null and the values will be passed as the second argument.
⭐️ async
removeItemBot API 6.9+ A method that removes a value from the cloud storage using the specified key. The key should contain 1-128 characters, only A-Z, a-z, 0-9, _ and - are allowed. If an optional callback parameter was passed, the callback function will be called. In case of an error, the first argument will contain the error. In case of success, the first argument will be null and the second argument will be a boolean indicating whether the value was removed.
⭐️ async
removeItemsBot API 6.9+ A method that removes values from the cloud storage using the specified keys. The keys should contain 1-128 characters, only A-Z, a-z, 0-9, _ and - are allowed. If an optional callback parameter was passed, the callback function will be called. In case of an error, the first argument will contain the error. In case of success, the first argument will be null and the second argument will be a boolean indicating whether the values were removed.
⭐️ async
getKeysBot API 6.9+ A method that receives the list of all keys stored in the cloud storage. In case of an error, the callback function will be called and the first argument will contain the error. In case of success, the first argument will be null and the list of keys will be passed as the second argument.
⭐️ async
versionThe version of the Bot API available in the user's Telegram app.
isVersionAtLeastReturns true if the user's app supports a version of the Bot API that is equal to or higher than the version passed as the parameter.

useDeviceOrientation

ts
import { useDeviceOrientation } from 'vue-tg'

const deviceOrientation = useDeviceOrientation()
NameDescription
isStartedIndicates whether device orientation tracking is currently active.
⚡️ readonly reactive
absoluteA boolean that indicates whether or not the device is providing orientation data in absolute values.
⚡️ readonly reactive
alphaThe rotation around the Z-axis, measured in radians.
⚡️ readonly reactive
betaThe rotation around the X-axis, measured in radians.
⚡️ readonly reactive
gammaThe rotation around the Y-axis, measured in radians.
⚡️ readonly reactive
startBot API 8.0+ Starts tracking device orientation data using params of type DeviceOrientationStartParams. If an optional callback parameter is provided, the callback function will be called with a boolean indicating whether tracking was successfully started.
⭐️ async
onStartBot API 8.0+ A method that sets event handler. An alias for onDeviceOrientationStarted.
onChangeBot API 8.0+ A method that sets event handler. An alias for onDeviceOrientationChanged.
onFailBot API 8.0+ A method that sets event handler. An alias for onDeviceOrientationFailed.
stopBot API 8.0+ Stops tracking device orientation data. If an optional callback parameter is provided, the callback function will be called with a boolean indicating whether tracking was successfully stopped.
⭐️ async
onStopBot API 8.0+ A method that sets event handler. An alias for onDeviceOrientationStopped.
versionThe version of the Bot API available in the user's Telegram app.
isVersionAtLeastReturns true if the user's app supports a version of the Bot API that is equal to or higher than the version passed as the parameter.

useEmojiStatus

ts
import { useEmojiStatus } from 'vue-tg'

const emojiStatus = useEmojiStatus()
NameDescription
setBot API 8.0+ A method that opens a dialog allowing the user to set the specified custom emoji as their status. An optional params argument of type EmojiStatusParams specifies additional settings, such as duration. If an optional callback parameter is provided, the callback function will be called with a boolean as the first argument, indicating whether the status was set.

Note: this method opens a native dialog and cannot be used to set the emoji status without manual user interaction. 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.
⭐️ async
onSetBot API 8.0+ A method that sets event handler. An alias for onEmojiStatusSet.
onFailBot API 8.0+ A method that sets event handler. An alias for onEmojiStatusFailed.
requestAccessBot API 8.0+ A method that shows a native popup requesting permission for the bot to manage user's emoji status. 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.
⭐️ async
onAccessRequestBot API 8.0+ A method that sets event handler. An alias for onEmojiStatusAccessRequested.
versionThe version of the Bot API available in the user's Telegram app.
isVersionAtLeastReturns true if the user's app supports a version of the Bot API that is equal to or higher than the version passed as the parameter.

useGyroscope

ts
import { useGyroscope } from 'vue-tg'

const gyroscope = useGyroscope()
NameDescription
isStartedIndicates whether gyroscope tracking is currently active.
⚡️ readonly reactive
xThe current rotation rate around the X-axis, measured in rad/s.
⚡️ readonly reactive
yThe current rotation rate around the Y-axis, measured in rad/s.
⚡️ readonly reactive
zThe current rotation rate around the Z-axis, measured in rad/s.
⚡️ readonly reactive
startBot API 8.0+ Starts tracking gyroscope data using params of type GyroscopeStartParams. If an optional callback parameter is provided, the callback function will be called with a boolean indicating whether tracking was successfully started.
⭐️ async
onStartBot API 8.0+ A method that sets event handler. An alias for onGyroscopeStarted.
onChangeBot API 8.0+ A method that sets event handler. An alias for onGyroscopeChanged.
onFailBot API 8.0+ A method that sets event handler. An alias for onGyroscopeFailed.
stopBot API 8.0+ Stops tracking gyroscope data. If an optional callback parameter is provided, the callback function will be called with a boolean indicating whether tracking was successfully stopped.
⭐️ async
onStopBot API 8.0+ A method that sets event handler. An alias for onGyroscopeStopped.
versionThe version of the Bot API available in the user's Telegram app.
isVersionAtLeastReturns true if the user's app supports a version of the Bot API that is equal to or higher than the version passed as the parameter.

useHapticFeedback

ts
import { useHapticFeedback } from 'vue-tg'

const hapticFeedback = useHapticFeedback()
NameDescription
impactOccurredBot API 6.1+ A method tells that an impact occurred. The Telegram app may play the appropriate haptics based on style value passed. Style can be one of these values:
- light, indicates a collision between small or lightweight UI objects,
- medium, indicates a collision between medium-sized or medium-weight UI objects,
- heavy, indicates a collision between large or heavyweight UI objects,
- rigid, indicates a collision between hard or inflexible UI objects,
- soft, indicates a collision between soft or flexible UI objects.
notificationOccurredBot API 6.1+ A method tells that a task or action has succeeded, failed, or produced a warning. The Telegram app may play the appropriate haptics based on type value passed. Type can be one of these values:
- error, indicates that a task or action has failed,
- success, indicates that a task or action has completed successfully,
- warning, indicates that a task or action produced a warning.
selectionChangedBot API 6.1+ A method tells that the user has changed a selection. The Telegram app may play the appropriate haptics.

Do not use this feedback when the user makes or confirms a selection; use it only when the selection changes.
versionThe version of the Bot API available in the user's Telegram app.
isVersionAtLeastReturns true if the user's app supports a version of the Bot API that is equal to or higher than the version passed as the parameter.

useHomeScreen

ts
import { useHomeScreen } from 'vue-tg'

const homeScreen = useHomeScreen()
NameType
addShortcutBot API 8.0+ A method that prompts the user to add the Mini App to the home screen. After successfully adding the icon, the homeScreenAdded event will be triggered if supported by the device. Note that if the device cannot determine the installation status, the event may not be received even if the icon has been added.
onShortcutAddBot API 8.0+ A method that sets event handler. An alias for onHomeScreenAdded.
checkShortcutStatusBot API 8.0+ A method that checks if adding to the home screen is supported and if the Mini App has already been added. If an optional callback parameter is provided, the callback function will be called with a single argument status, which is a string indicating the home screen status. Possible values for status are:
- unsupported – the feature is not supported, and it is not possible to add the icon to the home screen,
- 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,
- added – the icon has already been added to the home screen,
- missed – the icon has not been added to the home screen.
⭐️ async
onShortcutCheckBot API 8.0+ A method that sets event handler. An alias for onHomeScreenChecked.
versionThe version of the Bot API available in the user's Telegram app.
isVersionAtLeastReturns true if the user's app supports a version of the Bot API that is equal to or higher than the version passed as the parameter.

useLocationManager

ts
import { useLocationManager } from 'vue-tg'

const locationManager = useLocationManager()
NameDescription
isInitedShows whether the LocationManager object has been initialized.
⚡️ readonly reactive
isLocationAvailableShows whether location services are available on the current device.
⚡️ readonly reactive
isAccessRequestedShows whether permission to use location has been requested.
⚡️ readonly reactive
isAccessGrantedShows whether permission to use location has been granted.
⚡️ readonly reactive
initBot API 8.0+ A method that initializes the LocationManager object. It should be called before the object's first use. If an optional callback parameter is provided, the callback function will be called when the object is initialized.
⭐️ async
onManagerUpdateBot API 8.0+ A method that sets event handler. An alias for onLocationManagerUpdated.
getLocationBot API 8.0+ A method that requests location data. The callback function will be called with null as the first argument if access to location was not granted, or an object of type LocationData as the first argument if access was successful.
⭐️ async
onRequestBot API 8.0+ A method that sets event handler. An alias for onLocationRequested.
openSettingsBot API 8.0+ A method that opens the location access settings for bots. Useful when you need to request location access from users who haven't granted it yet.

Note 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).
versionThe version of the Bot API available in the user's Telegram app.
isVersionAtLeastReturns true if the user's app supports a version of the Bot API that is equal to or higher than the version passed as the parameter.

useMainButton

ts
import { useMainButton } from 'vue-tg'

const mainButton = useMainButton()
NameDescription
textCurrent button text. Set to Continue for the main button and Cancel for the secondary button by default.
⚡️ reactive
colorCurrent button color. Set to themeParams.button_color for the main button and themeParams.bottom_bar_bg_color for the secondary button by default.
⚡️ reactive
textColorCurrent button text color. Set to themeParams.button_text_color for the main button and themeParams.button_color for the secondary button by default.
⚡️ reactive
isVisibleShows whether the button is visible. Set to false by default.
⚡️ reactive
isActiveShows whether the button is active. Set to true by default.
⚡️ reactive
isProgressVisibleReadonly. Shows whether the button is displaying a loading indicator.
⚡️ reactive
hasShineEffectBot API 7.10+ Shows whether the button has a shine effect. Set to false by default.
⚡️ reactive
showA method to make the button visible.
Note that opening the Mini App from the attachment menu hides the main button until the user interacts with the Mini App interface.
hideA method to hide the button.
enableA method to enable the button.
disableA method to disable the button.
showProgressA method to show a loading indicator on the button.
It is recommended to display loading progress if the action tied to the button may take a long time. By default, the button is disabled while the action is in progress. If the parameter leaveActive=true is passed, the button remains enabled.
hideProgressA method to hide the loading indicator.
setParamsA method to set the button parameters. The params parameter is an object containing one or several fields that need to be changed:
text - button text;
color - button color;
text_color - button text color;
has_shine_effect - Bot API 7.10+ enable shine effect;
position - position of the secondary button;
is_active - enable the button;
is_visible - show the button.
onClickA method that sets the button's press event handler. An alias for Telegram.WebApp.onEvent('mainButtonClicked', callback)
versionThe version of the Bot API available in the user's Telegram app.
isVersionAtLeastReturns true if the user's app supports a version of the Bot API that is equal to or higher than the version passed as the parameter.

usePopup

ts
import { usePopup } from 'vue-tg'

const popup = usePopup()
NameType
showConfirmBot API 6.2+ A method that shows message in a simple confirmation window with 'OK' and 'Cancel' buttons. 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.
⭐️ async
showAlertBot API 6.2+ A method that shows message in a simple alert with a 'Close' button. If an optional callback parameter was passed, the callback function will be called when the popup is closed.
⭐️ async
showPopupBot API 6.2+ A method that shows a native popup described by the params argument of the type PopupParams. The Mini App will receive the event popupClosed when the popup is closed. If an optional callback parameter was passed, the callback function will be called and the field id of the pressed button will be passed as the first argument.
⭐️ async
onCloseBot API 6.2+ A method that sets event handler. An alias for onPopupClosed.
versionThe version of the Bot API available in the user's Telegram app.
isVersionAtLeastReturns true if the user's app supports a version of the Bot API that is equal to or higher than the version passed as the parameter.

useQrScanner

ts
import { useQrScanner } from 'vue-tg'

const qrScanner = useQrScanner()
NameDescription
showBot API 6.4+ A method that shows a native popup for scanning a QR code described by the params argument of the type ScanQrPopupParams. The Mini App will receive the event qrTextReceived every time the scanner catches a code with text data. If an optional callback parameter was passed, the callback function will be called and the text from the QR code will be passed as the first argument. Returning true inside this callback function causes the popup to be closed. 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.
closeBot API 6.4+ A method that closes the native popup for scanning a QR code opened with the showScanQrPopup method. Run it if you received valid data in the event qrTextReceived.
onScanBot API 6.4+ A method that sets event handler. An alias for onQrTextReceived.
onCloseBot API 7.7+ A method that sets event handler. An alias for onScanQrPopupClosed.
versionThe version of the Bot API available in the user's Telegram app.
isVersionAtLeastReturns true if the user's app supports a version of the Bot API that is equal to or higher than the version passed as the parameter.

useSecondaryButton

ts
import { useSecondaryButton } from 'vue-tg'

const secondaryButton = useSecondaryButton()
NameDescription
textCurrent button text. Set to Continue for the main button and Cancel for the secondary button by default.
⚡️ reactive
colorCurrent button color. Set to themeParams.button_color for the main button and themeParams.bottom_bar_bg_color for the secondary button by default.
⚡️ reactive
textColorCurrent button text color. Set to themeParams.button_text_color for the main button and themeParams.button_color for the secondary button by default.
⚡️ reactive
isVisibleShows whether the button is visible. Set to false by default.
⚡️ reactive
isActiveShows whether the button is active. Set to true by default.
⚡️ reactive
isProgressVisibleReadonly. Shows whether the button is displaying a loading indicator.
⚡️ reactive
hasShineEffectBot API 7.10+ Shows whether the button has a shine effect. Set to false by default.
⚡️ reactive
positionBot API 7.10+ Position of the secondary button. Not defined for the main button. It applies only if both the main and secondary buttons are visible. Set to left by default.
Supported values:
- left, displayed to the left of the main button,
- right, displayed to the right of the main button,
- top, displayed above the main button,
- bottom, displayed below the main button.
⚡️ reactive
showBot API 7.10+ A method to make the button visible.
Note that opening the Mini App from the attachment menu hides the main button until the user interacts with the Mini App interface.
hideBot API 7.10+ A method to hide the button.
enableBot API 7.10+ A method to enable the button.
disableBot API 7.10+ A method to disable the button.
showProgressBot API 7.10+ A method to show a loading indicator on the button.
It is recommended to display loading progress if the action tied to the button may take a long time. By default, the button is disabled while the action is in progress. If the parameter leaveActive=true is passed, the button remains enabled.
hideProgressBot API 7.10+ A method to hide the loading indicator.
setParamsBot API 7.10+ A method to set the button parameters. The params parameter is an object containing one or several fields that need to be changed:
text - button text;
color - button color;
text_color - button text color;
has_shine_effect - Bot API 7.10+ enable shine effect;
position - position of the secondary button;
is_active - enable the button;
is_visible - show the button.
onClickBot API 7.10+ A method that sets the button's press event handler. An alias for Telegram.WebApp.onEvent('mainButtonClicked', callback)
versionThe version of the Bot API available in the user's Telegram app.
isVersionAtLeastReturns true if the user's app supports a version of the Bot API that is equal to or higher than the version passed as the parameter.

useSettingsButton

ts
import { useSettingsButton } from 'vue-tg'

const settingsButton = useSettingsButton()
NameDescription
isVisibleShows whether the context menu item is visible. Set to false by default.
⚡️ reactive
showBot API 7.0+ A method to make the Settings item in the context menu visible.
hideBot API 7.0+ A method to hide the Settings item in the context menu.
onClickBot API 7.0+ A method that sets the press event handler for the Settings item in the context menu. An alias for Telegram.WebApp.onEvent('settingsButtonClicked', callback)
versionThe version of the Bot API available in the user's Telegram app.
isVersionAtLeastReturns true if the user's app supports a version of the Bot API that is equal to or higher than the version passed as the parameter.

useTheme

ts
import { useTheme } from 'vue-tg'

const theme = useTheme()
NameDescription
colorSchemeThe color scheme currently used in the Telegram app. Either “light” or “dark”.
Also available as the CSS variable var(--tg-color-scheme).
⚡️ readonly reactive
themeParamsAn object containing the current theme settings used in the Telegram app.
⚡️ readonly reactive
headerColorCurrent header color in the #RRGGBB format.
⚡️ reactive
backgroundColorCurrent background color in the #RRGGBB format.
⚡️ reactive
bottomBarColorCurrent bottom bar color in the #RRGGBB format.
⚡️ reactive
onChangeA method that sets event handler. An alias for onThemeChanged.
versionThe version of the Bot API available in the user's Telegram app.
isVersionAtLeastReturns true if the user's app supports a version of the Bot API that is equal to or higher than the version passed as the parameter.

useViewport

ts
import { useViewport } from 'vue-tg'

const viewport = useViewport()
NameDescription
isExpandedTrue, if the Mini App is expanded to the maximum available height. False, if the Mini App occupies part of the screen and can be expanded to the full height using the expand() method.
⚡️ readonly reactive
expandA method that expands the Mini App to the maximum available height. To find out if the Mini App is expanded to the maximum height, refer to the value of the Telegram.WebApp.isExpanded parameter
viewportHeightThe current height of the visible area of the Mini App. Also available in CSS as the variable var(--tg-viewport-height).

The application can display just the top part of the Mini App, with its lower part remaining outside the screen area. From this position, the user can “pull” the Mini App to its maximum height, while the bot can do the same by calling the expand() method. As the position of the Mini App changes, the current height value of the visible area will be updated in real time.

Please note that the refresh rate of this value is not sufficient to smoothly follow the lower border of the window. It should not be used to pin interface elements to the bottom of the visible area. It's more appropriate to use the value of the viewportStableHeight field for this purpose.
⚡️ readonly reactive
viewportStableHeightThe height of the visible area of the Mini App in its last stable state. Also available in CSS as a variable var(--tg-viewport-stable-height).

The application can display just the top part of the Mini App, with its lower part remaining outside the screen area. From this position, the user can “pull” the Mini App to its maximum height, while the bot can do the same by calling the expand() method. Unlike the value of viewportHeight, the value of viewportStableHeight does not change as the position of the Mini App changes with user gestures or during animations. The value of viewportStableHeight will be updated after all gestures and animations are completed and the Mini App reaches its final size.

Note the event viewportChanged with the passed parameter isStateStable=true, which will allow you to track when the stable state of the height of the visible area changes.
⚡️ readonly reactive
onChangeA method that sets event handler. An alias for onViewportChanged.
isFullscreenTrue, if the Mini App is currently being displayed in fullscreen mode.
⚡️ reactive
onFullscreenChangeBot API 8.0+ A method that sets event handler. An alias for onFullscreenChanged.
onFullscreenFailBot API 8.0+ A method that sets event handler. An alias for onFullscreenFailed.
isOrientationLockedTrue, if the Mini App’s orientation is currently locked. False, if orientation changes freely based on the device’s rotation.
⚡️ reactive
isVerticalSwipesEnabledTrue, if vertical swipes to close or minimize the Mini App are enabled. False, if vertical swipes to close or minimize the Mini App are disabled. In any case, the user will still be able to minimize and close the Mini App by swiping the Mini App's header.
⚡️ reactive
safeAreaInsetAn object representing the device's safe area insets, accounting for system UI elements like notches or navigation bars.
⚡️ readonly reactive
onSafeAreaChangeBot API 8.0+ A method that sets event handler. An alias for onSafeAreaChanged.
contentSafeAreaInsetAn object representing the safe area for displaying content within the app, free from overlapping Telegram UI elements.
⚡️ readonly reactive
onContentSafeAreaChangeBot API 8.0+ A method that sets event handler. An alias for onContentSafeAreaChanged.
versionThe version of the Bot API available in the user's Telegram app.
isVersionAtLeastReturns true if the user's app supports a version of the Bot API that is equal to or higher than the version passed as the parameter.

Composables (Legacy)

useWebApp

Deprecated

Use useMiniApp instead.

ts
// Hover to inspect type
import { 
useWebApp
} from 'vue-tg'
NameDescription
initDataA string with raw data transferred to the Mini App, convenient for validating data.
WARNING: Validate data from this field before using it on the bot's server.
initDataUnsafeAn object with input data transferred to the Mini App.
WARNING: Data from this field should not be trusted. You should only use data from initData on the bot's server and only after it has been validated.
versionThe version of the Bot API available in the user's Telegram app.
platformThe name of the platform of the user's Telegram app.
isVersionAtLeastReturns true if the user's app supports a version of the Bot API that is equal to or higher than the version passed as the parameter.
sendDataA method used to send data to the bot. 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.

This method is only available for Mini Apps launched via a Keyboard button.
readyA 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. Once this method is called, the loading placeholder is hidden and the Mini App is shown.
If the method is not called, the placeholder will be hidden only when the page is fully loaded.
closeA method that closes the Mini App.
isReadyBoolean indicating if the app is ready.
🔋 custom⚡️ readonly reactive
isPlatformFunction to check if the app is running on a specified platform.
🔋 custom
isPlatformUnknownBoolean indicating if the platform is unknown.
🔋 custom
isFeatureSupportedFunction to check if a specified feature is supported.
🔋 custom

useWebAppBackButton

Deprecated

Use useBackButton instead.

ts
// Hover to inspect type
import { 
useWebAppBackButton
} from 'vue-tg'
NameDescription
isBackButtonVisibleShows whether the button is visible. Set to false by default.
⚡️ reactive
showBackButtonBot API 6.1+ A method to make the button active and visible.
hideBackButtonBot API 6.1+ A method to hide the button.

useWebAppBiometricManager

Deprecated

Use useBiometricManager instead.

ts
// Hover to inspect type
import { 
useWebAppBiometricManager
} from 'vue-tg'
NameType
isBiometricInitedShows whether biometrics object is initialized.
⚡️ readonly reactive
isBiometricAvailableShows whether biometrics is available on the current device.
⚡️ readonly reactive
biometricTypeThe type of biometrics currently available on the device. Can be one of these values:
- finger, fingerprint-based biometrics,
- face, face-based biometrics,
- unknown, biometrics of an unknown type.
⚡️ readonly reactive
isBiometricAccessRequestedShows whether permission to use biometrics has been requested.
⚡️ readonly reactive
isBiometricAccessGrantedShows whether permission to use biometrics has been granted.
⚡️ readonly reactive
isBiometricTokenSavedShows whether the token is saved in secure storage on the device.
⚡️ readonly reactive
biometricDeviceIdA unique device identifier that can be used to match the token to the device.
⚡️ readonly reactive
initBiometricBot API 7.2+ A method that initializes the BiometricManager object. It should be called before the object's first use. If an optional callback parameter was passed, the callback function will be called when the object is initialized.
requestBiometricAccessBot API 7.2+ A method that requests permission to use biometrics according to the params argument of type BiometricRequestAccessParams. If an optional callback parameter was passed, the callback function will be called and the first argument will be a boolean indicating whether the user granted access.
authenticateBiometricBot API 7.2+ A method that authenticates the user using biometrics according to the params argument of type BiometricAuthenticateParams. If an optional callback parameter was passed, the callback function will be called and the first argument will be a boolean indicating whether the user authenticated successfully. If so, the second argument will be a biometric token.
updateBiometricTokenBot API 7.2+ A method that updates the biometric token in secure storage on the device. To remove the token, pass an empty string. If an optional callback parameter was passed, the callback function will be called and the first argument will be a boolean indicating whether the token was updated.
openBiometricSettingsBot API 7.2+ A method that opens the biometric access settings for bots. Useful when you need to request biometrics access to users who haven't granted it yet.

Note 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)
onManagerUpdatedBot API 7.2+ A method that sets the biometricManagerUpdated event handler.
onAuthRequestedBot API 7.2+ A method that sets the biometricAuthRequested event handler.
onTokenUpdatedBot API 7.2+ A method that sets the biometricTokenUpdated event handler.

useWebAppClipboard

Deprecated

Use useClipboard instead.

ts
// Hover to inspect type
import { 
useWebAppClipboard
} from 'vue-tg'
NameType
readTextFromClipboardBot API 6.4+ A method that requests text from the clipboard. The Mini App will receive the event clipboardTextReceived. If an optional callback parameter was passed, the callback function will be called and the text from the clipboard will be passed as the first argument.

Note: this method can be called only for Mini Apps launched from the attachment menu and only in response to a user interaction with the Mini App interface (e.g. a click inside the Mini App or on the main button).

useWebAppClosingConfirmation

Deprecated

Use useMiniApp instead.

ts
// Hover to inspect type
import { 
useWebAppClosingConfirmation
} from 'vue-tg'
NameType
isClosingConfirmationEnabledTrue, if the confirmation dialog is enabled while the user is trying to close the Mini App. False, if the confirmation dialog is disabled.
⚡️ reactive
enableClosingConfirmationBot API 6.2+ A method that enables a confirmation dialog while the user is trying to close the Mini App.
disableClosingConfirmationBot API 6.2+ A method that disables the confirmation dialog while the user is trying to close the Mini App.

useWebAppCloudStorage

Deprecated

Use useCloudStorage instead.

ts
// Hover to inspect type
import { 
useWebAppCloudStorage
} from 'vue-tg'
NameType
setStorageItemBot API 6.9+ A method that stores a value in the cloud storage using the specified key. The key should contain 1-128 characters, only A-Z, a-z, 0-9, _ and - are allowed. The value should contain 0-4096 characters. You can store up to 1024 keys in the cloud storage. If an optional callback parameter was passed, the callback function will be called. In case of an error, the first argument will contain the error. In case of success, the first argument will be null and the second argument will be a boolean indicating whether the value was stored.
getStorageItemBot API 6.9+ A method that receives a value from the cloud storage using the specified key. The key should contain 1-128 characters, only A-Z, a-z, 0-9, _ and - are allowed. In case of an error, the callback function will be called and the first argument will contain the error. In case of success, the first argument will be null and the value will be passed as the second argument.
getStorageItemsBot API 6.9+ A method that receives values from the cloud storage using the specified keys. The keys should contain 1-128 characters, only A-Z, a-z, 0-9, _ and - are allowed. In case of an error, the callback function will be called and the first argument will contain the error. In case of success, the first argument will be null and the values will be passed as the second argument.
removeStorageItemBot API 6.9+ A method that removes a value from the cloud storage using the specified key. The key should contain 1-128 characters, only A-Z, a-z, 0-9, _ and - are allowed. If an optional callback parameter was passed, the callback function will be called. In case of an error, the first argument will contain the error. In case of success, the first argument will be null and the second argument will be a boolean indicating whether the value was removed.
removeStorageItemsBot API 6.9+ A method that removes values from the cloud storage using the specified keys. The keys should contain 1-128 characters, only A-Z, a-z, 0-9, _ and - are allowed. If an optional callback parameter was passed, the callback function will be called. In case of an error, the first argument will contain the error. In case of success, the first argument will be null and the second argument will be a boolean indicating whether the values were removed.
getStorageKeysBot API 6.9+ A method that receives the list of all keys stored in the cloud storage. In case of an error, the callback function will be called and the first argument will contain the error. In case of success, the first argument will be null and the list of keys will be passed as the second argument.

useWebAppHapticFeedback

Deprecated

Use useHapticFeedback instead.

ts
// Hover to inspect type
import { 
useWebAppHapticFeedback
} from 'vue-tg'
NameType
impactOccurredBot API 6.1+ A method tells that an impact occurred. The Telegram app may play the appropriate haptics based on style value passed. Style can be one of these values:
- light, indicates a collision between small or lightweight UI objects,
- medium, indicates a collision between medium-sized or medium-weight UI objects,
- heavy, indicates a collision between large or heavyweight UI objects,
- rigid, indicates a collision between hard or inflexible UI objects,
- soft, indicates a collision between soft or flexible UI objects.
notificationOccurredBot API 6.1+ A method tells that a task or action has succeeded, failed, or produced a warning. The Telegram app may play the appropriate haptics based on type value passed. Type can be one of these values:
- error, indicates that a task or action has failed,
- success, indicates that a task or action has completed successfully,
- warning, indicates that a task or action produced a warning.
selectionChangedBot API 6.1+ A method tells that the user has changed a selection. The Telegram app may play the appropriate haptics.

Do not use this feedback when the user makes or confirms a selection; use it only when the selection changes.

useWebAppMainButton

Deprecated

Use useMainButton instead.

ts
// Hover to inspect type
import { 
useWebAppMainButton
} from 'vue-tg'
NameType
mainButtonTextCurrent button text. Set to Continue for the main button and Cancel for the secondary button by default.
⚡️ reactive
mainButtonColorCurrent button color. Set to themeParams.button_color for the main button and themeParams.bottom_bar_bg_color for the secondary button by default.
⚡️ reactive
mainButtonTextColorCurrent button text color. Set to themeParams.button_text_color for the main button and themeParams.button_color for the secondary button by default.
⚡️ reactive
isMainButtonVisibleShows whether the button is visible. Set to false by default.
⚡️ reactive
isMainButtonActiveShows whether the button is active. Set to true by default.
⚡️ reactive
isMainButtonProgressVisibleReadonly. Shows whether the button is displaying a loading indicator.
⚡️ reactive
setMainButtonTextA method to set the button text.
showMainButtonA method to make the button visible.
Note that opening the Mini App from the attachment menu hides the main button until the user interacts with the Mini App interface.
hideMainButtonA method to hide the button.
enableMainButtonA method to enable the button.
disableMainButtonA method to disable the button.
showMainButtonProgressA method to show a loading indicator on the button.
It is recommended to display loading progress if the action tied to the button may take a long time. By default, the button is disabled while the action is in progress. If the parameter leaveActive=true is passed, the button remains enabled.
hideMainButtonProgressA method to hide the loading indicator.
setMainButtonParamsA method to set the button parameters. The params parameter is an object containing one or several fields that need to be changed:
text - button text;
color - button color;
text_color - button text color;
has_shine_effect - Bot API 7.10+ enable shine effect;
position - position of the secondary button;
is_active - enable the button;
is_visible - show the button.

useWebAppNavigation

Deprecated

Use useMiniApp instead.

ts
// Hover to inspect type
import { 
useWebAppNavigation
} from 'vue-tg'
NameType
openInvoiceBot API 6.1+ A method that opens an invoice using the link url. The Mini App will receive the event invoiceClosed when the invoice is closed. If an optional callback parameter was passed, the callback function will be called and the invoice status will be passed as the first argument.
openLinkA method that opens a link in an external browser. The Mini App will not be closed.
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.

Note 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)
openTelegramLinkA method that opens a telegram link inside the Telegram app. The Mini App will not be closed after this method is called.

Up to Bot API 7.0 The Mini App will be closed after this method is called.
switchInlineQueryBot API 6.7+ A method that inserts the bot's username and the specified inline query in the current chat's input field. Query may be empty, in which case only the bot's username will be inserted. If an optional choose_chat_types parameter was passed, the client prompts the user to choose a specific chat, then opens that chat and inserts the bot's username and the specified inline query in the input field. You can specify which types of chats the user will be able to choose from. It can be one or more of the following types: users, bots, groups, channels.

useWebAppPopup

Deprecated

Use usePopup instead.

ts
// Hover to inspect type
import { 
useWebAppPopup
} from 'vue-tg'
NameType
showAlertBot API 6.2+ A method that shows message in a simple alert with a 'Close' button. If an optional callback parameter was passed, the callback function will be called when the popup is closed.
showConfirmBot API 6.2+ A method that shows message in a simple confirmation window with 'OK' and 'Cancel' buttons. 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.
showPopupBot API 6.2+ A method that shows a native popup described by the params argument of the type PopupParams. The Mini App will receive the event popupClosed when the popup is closed. If an optional callback parameter was passed, the callback function will be called and the field id of the pressed button will be passed as the first argument.

useWebAppQrScanner

Deprecated

Use useQrScanner instead.

ts
// Hover to inspect type
import { 
useWebAppQrScanner
} from 'vue-tg'
NameType
showScanQrPopupBot API 6.4+ A method that shows a native popup for scanning a QR code described by the params argument of the type ScanQrPopupParams. The Mini App will receive the event qrTextReceived every time the scanner catches a code with text data. If an optional callback parameter was passed, the callback function will be called and the text from the QR code will be passed as the first argument. Returning true inside this callback function causes the popup to be closed. 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.
closeScanQrPopupBot API 6.4+ A method that closes the native popup for scanning a QR code opened with the showScanQrPopup method. Run it if you received valid data in the event qrTextReceived.

useWebAppRequests

Deprecated

Use useMiniApp instead.

ts
// Hover to inspect type
import { 
useWebAppRequests
} from 'vue-tg'
NameType
requestContactBot API 6.9+ A method that shows a native popup prompting the user for their phone number. 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 shared its phone number.
requestWriteAccessBot API 6.9+ A method that shows a native popup requesting permission for the bot to send messages to the user. 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.

useWebAppSettingsButton

Deprecated

Use useSettingsButton instead.

ts
// Hover to inspect type
import { 
useWebAppSettingsButton
} from 'vue-tg'
NameType
isSettingsButtonVisibleShows whether the context menu item is visible. Set to false by default.
⚡️ reactive
showSettingsButtonBot API 7.0+ A method to make the Settings item in the context menu visible.
hideSettingsButtonBot API 7.0+ A method to hide the Settings item in the context menu.

useWebAppShare

Deprecated

Use useMiniApp instead.

ts
// Hover to inspect type
import { 
useWebAppShare
} from 'vue-tg'
NameType
shareToStoryBot API 7.8+ A method that opens the native story editor with the media specified in the media_url parameter as an HTTPS URL. An optional params argument of the type StoryShareParams describes additional sharing settings.

useWebAppTheme

Deprecated

Use useTheme instead.

ts
// Hover to inspect type
import { 
useWebAppTheme
} from 'vue-tg'
NameType
colorSchemeThe color scheme currently used in the Telegram app. Either “light” or “dark”.
Also available as the CSS variable var(--tg-color-scheme).
⚡️ readonly reactive
themeParamsAn object containing the current theme settings used in the Telegram app.
⚡️ readonly reactive
headerColorCurrent header color in the #RRGGBB format.
⚡️ reactive
backgroundColorCurrent background color in the #RRGGBB format.
⚡️ reactive
setHeaderColorBot API 6.1+ A method that sets the app header color in the #RRGGBB format. You can also use keywords bg_color and secondary_bg_color.

Up to Bot API 6.9 You can only pass Telegram.WebApp.themeParams.bg_color or Telegram.WebApp.themeParams.secondary_bg_color as a color or bg_color, secondary_bg_color keywords.
setBackgroundColorBot API 6.1+ A method that sets the app background color in the #RRGGBB format. You can also use keywords bg_color and secondary_bg_color.

useWebAppViewport

Deprecated

Use useViewport instead.

ts
// Hover to inspect type
import { 
useWebAppViewport
} from 'vue-tg'
NameType
isExpandedTrue, if the Mini App is expanded to the maximum available height. False, if the Mini App occupies part of the screen and can be expanded to the full height using the expand() method.
⚡️ readonly reactive
viewportHeightThe current height of the visible area of the Mini App. Also available in CSS as the variable var(--tg-viewport-height).

The application can display just the top part of the Mini App, with its lower part remaining outside the screen area. From this position, the user can “pull” the Mini App to its maximum height, while the bot can do the same by calling the expand() method. As the position of the Mini App changes, the current height value of the visible area will be updated in real time.

Please note that the refresh rate of this value is not sufficient to smoothly follow the lower border of the window. It should not be used to pin interface elements to the bottom of the visible area. It's more appropriate to use the value of the viewportStableHeight field for this purpose.
⚡️ readonly reactive
viewportStableHeightThe height of the visible area of the Mini App in its last stable state. Also available in CSS as a variable var(--tg-viewport-stable-height).

The application can display just the top part of the Mini App, with its lower part remaining outside the screen area. From this position, the user can “pull” the Mini App to its maximum height, while the bot can do the same by calling the expand() method. Unlike the value of viewportHeight, the value of viewportStableHeight does not change as the position of the Mini App changes with user gestures or during animations. The value of viewportStableHeight will be updated after all gestures and animations are completed and the Mini App reaches its final size.

Note the event viewportChanged with the passed parameter isStateStable=true, which will allow you to track when the stable state of the height of the visible area changes.
⚡️ readonly reactive
isVerticalSwipesEnabledTrue, if vertical swipes to close or minimize the Mini App are enabled. False, if vertical swipes to close or minimize the Mini App are disabled. In any case, the user will still be able to minimize and close the Mini App by swiping the Mini App's header.
⚡️ reactive
expandA method that expands the Mini App to the maximum available height. To find out if the Mini App is expanded to the maximum height, refer to the value of the Telegram.WebApp.isExpanded parameter
enableVerticalSwipesBot API 7.7+ A method that enables vertical swipes to close or minimize the Mini App. For user convenience, it is recommended to always enable swipes unless they conflict with the Mini App's own gestures.
disableVerticalSwipesBot API 7.7+ A method that disables vertical swipes to close or minimize the Mini App. This method is useful if your Mini App uses swipe gestures that may conflict with the gestures for minimizing and closing the app.