# TMA (Telegram Mini App)

## What is Telegram Mini Apps (TMA)

[Telegram Mini Apps](https://core.telegram.org/bots/webapps) is an open platform for businesses to build and deploy web-apps right into Telegram. Like bots, **Mini Apps** support seamless authorization.

## Directual TMA plugin

Directual TMA plugin allows you to deploy your Directual-based web-app to Telegram, send notifications via bot, and use seamless authorization for your users.

### Step 1. Install free TMA plugin from the Marketplace in your Directual app

<figure><img src="https://3071851461-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M4Nnmtk9_gFGWOddsf6%2Fuploads%2FBUCqp4y326MPzfB2BZCB%2Fplugin.webp?alt=media&#x26;token=14d2c77c-115e-492b-b99d-9af04fa29ea5" alt=""><figcaption></figcaption></figure>

There are two settings for the TMA plugin:

<figure><img src="https://3071851461-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M4Nnmtk9_gFGWOddsf6%2Fuploads%2F172V1U2tvlx3QaRHJ6Rk%2Fplugin2.webp?alt=media&#x26;token=5c3a593a-a2d0-401b-b045-d6aeba2c6c10" alt=""><figcaption></figcaption></figure>

* **Auto log in.** `True`: authorises users automatically when they open TMA' `False`: user pushes the button "Log in with Telegram" when open TMA. The latter is used when you want to let your users to authorise in TMA with email, Google, etc.
* **Disable registration**. `True`: user can't log in if there is no `WebUser` with such an ID. `False`: the `WebUser` will be created automatically when user logs in.

{% hint style="warning" %}
If user is signed up with TMA and then wants to log in on the web-browser, he'll need a pair `username/password.` You can generate the one-time password and send the login credentials to the user in Telegram bot.
{% endhint %}

### Step 2. Deploy your Directual app to Telegram

Open [BotFather](https://t.me/BotFather) and create new bot (skip this if you already have a Telegram bot) using command `/newbot`

<figure><img src="https://3071851461-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M4Nnmtk9_gFGWOddsf6%2Fuploads%2FNMV4UI5y1LrN3G1wOJbN%2Fbotfather1.webp?alt=media&#x26;token=ff73029c-194e-49d6-8073-1c7f62518c00" alt=""><figcaption></figcaption></figure>

Then, deploy your Directual-based app as a webapp to that bot using command `/newapp`. Follow the BotFather instructions.

<div><figure><img src="https://3071851461-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M4Nnmtk9_gFGWOddsf6%2Fuploads%2FZz2BXAZDInqhZ9ZtUDI0%2Fbf2.webp?alt=media&#x26;token=7c7c9066-2baf-4ae0-871c-55533af4b32a" alt=""><figcaption></figcaption></figure> <figure><img src="https://3071851461-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M4Nnmtk9_gFGWOddsf6%2Fuploads%2F0XyIgrF7QXWoyqDnpoO1%2Fbf4.webp?alt=media&#x26;token=1a5628e8-ab8c-4434-b32d-fc5800e6d9a1" alt=""><figcaption></figcaption></figure></div>

Success! Let's test it out! Pay attention, that authentication happens automatically if the user gets to the login page.

<figure><img src="https://3071851461-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M4Nnmtk9_gFGWOddsf6%2Fuploads%2FRvKZuzQoHqqqXGB4mn8s%2Flive_demo.gif?alt=media&#x26;token=18c13d4c-b65b-441d-a9a3-8111e2df374f" alt="" width="288"><figcaption></figcaption></figure>
