# How do I build a Telegram mini app, and when should I list it in Cherry?

> Build a Telegram mini app with @BotFather, an HTTPS web app, Telegram's script and Stars or TON. If users hold Solana assets, list it in Cherry free.


Building a Telegram mini app takes five moves: create a bot with @BotFather, host your web app at an HTTPS address, load Telegram's `telegram-web-app.js` script, check the user data on your backend and set the app as the bot's Main Mini App. Payments follow Telegram's rules: Telegram Stars for digital goods and the TON blockchain, through TON Connect, for anything on-chain. If you want to reach people with wallets on Solana, BNB, Base and Robinhood Chain, the same web app can be listed in [Cherry.fun](https://cherry.fun/learn/features/cherry-wallet/) for free, with no review queue; its transactions run on Solana.

The reason to bother is reach without a rebuild. Cherry users open your app already signed in, wallet connected, on iPhone, Android, the Solana Seeker and the web, so a Solana app can charge from the first day instead of reworking itself around TON.

## What you need before @BotFather

You need four things:

- A Telegram account, plus a second one on Telegram's test server if you want a sandbox.
- A web app deployed at an HTTPS address. Telegram's [Bot API](https://core.telegram.org/bots/api) asks for an HTTPS URL for every mini app.
- A small backend, because user data has to be validated server-side before you trust it.
- A decision on payments, made early, since Stars and TON shape your code.

Any front end works: a Telegram mini app is a web page that Telegram opens in its own frame.

## Step 1: Create the bot in @BotFather

Open @BotFather and send `/newbot`. It asks for a display name and a username, then hands you a token, per Telegram's [bot features guide](https://core.telegram.org/bots/features). The username must end in "bot" and cannot be changed later. The token controls the bot, so keep it on your server; `/token` issues a new one if it leaks.

Check that the bot opens at `t.me/<username>` and shows up in @BotFather under `/mybots`.

## Step 2: Load Telegram's script in your web app

Add the script to the page head before your own bundle, as Telegram's [Mini Apps docs](https://core.telegram.org/bots/webapps) instruct. It creates `window.Telegram.WebApp`.

```html
<script src="https://telegram.org/js/telegram-web-app.js?65"></script>
<script>
  const tg = window.Telegram.WebApp;
  tg.ready();   // hide Telegram's loading placeholder
  tg.expand();  // use the full available height
</script>
```

Call `ready()` as soon as the essential interface has loaded; until then Telegram shows its placeholder.

## Step 3: Validate initData on your backend

Telegram passes user data in two forms. `initDataUnsafe` is convenient for display and must never be trusted. Send the raw `initData` string to your server and check its hash there: the secret key is an HMAC-SHA-256 of your bot token keyed with the string `WebAppData`, and the hash is an HMAC-SHA-256 of the sorted fields with that key.

```ts
import crypto from 'node:crypto';

export function isFromTelegram(initData: string, botToken: string): boolean {
  const params = new URLSearchParams(initData);
  const hash = params.get('hash');
  params.delete('hash');
  const dataCheckString = [...params.entries()]
    .sort(([a], [b]) => (a < b ? -1 : 1))
    .map(([key, value]) => `${key}=${value}`)
    .join('\n');
  const secret = crypto.createHmac('sha256', 'WebAppData').update(botToken).digest();
  const check = crypto.createHmac('sha256', secret).update(dataCheckString).digest('hex');
  return check === hash;
}
```

Also reject old `auth_date` values. If a partner service needs to verify the same data without your token, Telegram adds an Ed25519 `signature` field that checks against Telegram's published public key.

To test it, edit the `user` field in a request. It should fail.

## Step 4: Set the Main Mini App and the launch points

In @BotFather, set your app's URL as the bot's Main Mini App. That adds a Launch app button and media previews to the bot's profile, and the app shows in the Apps tab of search for people who have opened it. Telegram supports seven ways in: the profile button, a keyboard button, an inline button, the menu button (`/setmenubutton`), inline mode, a direct link and the attachment menu.

Direct links are the easiest to share. `https://t.me/<bot>?startapp=ref42` opens the app inside the current chat and passes `ref42` as the start parameter; add `mode=compact` for a half-height sheet. For games, `requestFullscreen()` (Bot API 8.0 and later) switches to fullscreen in either orientation.

## Step 5: Test on real devices

Telegram's test environment is fully separate: a new account, a new bot from the test server's @BotFather, and Bot API calls at `/bot<token>/test/METHOD_NAME`. There, plain HTTP without TLS is allowed, which speeds up local work.

Each Telegram client has a WebView inspector; on desktop it ships in the beta builds of Telegram Desktop (Windows, Linux) and Telegram for macOS.

## Step 6: Choose how the app takes payments

Telegram's [Stars payments page](https://core.telegram.org/bots/payments-stars) sets the rule for digital goods and services: they are sold only in Telegram Stars. You send a payment request with currency `XTR` and an empty provider token, answer the pre-checkout query within 10 seconds, and deliver only after the successful-payment update arrives. Users buy Stars through Apple and Google in-app purchases or @PremiumBot. Physical goods may use other currencies and providers. Our [Telegram Stars payment guide](https://cherry.fun/learn/guides/telegram-stars-payment/) goes deeper.

On-chain features have a stricter rule. Telegram's [blockchain guidelines](https://core.telegram.org/bots/blockchain-guidelines) require mini apps to use the TON blockchain exclusively, connect wallets only through the TON Connect SDK, and leave out tokens and NFTs on Ethereum, BNB and other chains. [TON Connect](https://docs.ton.org/applications/ton-connect/overview) ships `@tonconnect/ui-react` for React apps. Our explainer on [Telegram mini app wallets](https://cherry.fun/learn/guides/telegram-mini-app-wallet/) covers what the guidelines allow in detail.

## When should you list the app in Cherry instead?

When your app runs on Solana, or your audience holds wallets on Solana, BNB, Base and Robinhood Chain. Telegram's route suits a TON game or a Stars-paid tool, but it asks a Solana app to rebuild around another chain first.

| | Telegram mini app | Cherry mini app |
|---|---|---|
| Getting listed | A bot set up in @BotFather ([Mini Apps docs](https://core.telegram.org/bots/webapps)) | Self-listing at [portal.cherry.fun](https://portal.cherry.fun), free, no review queue |
| Who signs in | Telegram user data in initData, checked with your bot token | A signed launch token from Cherry, with the user's wallet connected |
| On-chain transactions | TON only, through TON Connect ([guidelines](https://core.telegram.org/bots/blockchain-guidelines)) | Solana today; users hold wallets on Solana, BNB, Base and Robinhood Chain |
| Digital goods | Telegram Stars ([Stars docs](https://core.telegram.org/bots/payments-stars)) | On-chain Solana payments the user signs |
| Where it opens | Telegram's apps | Inside Cherry on iPhone, Android, the Solana Seeker and the web |

You add the app yourself at [portal.cherry.fun](https://portal.cherry.fun); once the automated checks and test pass, Publish lists it in Cherry's marketplace immediately. Cherry is on the App Store, Google Play and the Solana dApp Store, so people from all three open your app inside Cherry, with no store listing or store review of your own.

Plan for two limits. A mini app asks users to sign Solana transactions only; Cherry's [wallet docs](https://portal.cherry.fun/docs/mini-apps/wallet) say requests for other chains are refused. New listings start Unverified with per-transaction and daily caps, and one identity check of the project owner raises them, as the [mini apps overview](https://portal.cherry.fun/docs/mini-apps) sets out. Users who hold no crypto top up inside Cherry with a card, Apple Pay, Google Pay or PayPal, so you build no on-ramp. Cherry charges nothing to list; developers who do well may send it a voluntary tip.

If you build with an AI agent, the listing wizard writes an integration brief filled with your app's details, and you paste it into Claude Code, Cursor or Codex, per the [AI agent docs](https://portal.cherry.fun/docs/mini-apps/ai-agents). Outside Cherry your site keeps its normal login, so a Telegram build and a Cherry listing can share one codebase. The full offer is on the [free mini app listing page](https://cherry.fun/learn/features/list-a-mini-app-for-free/).

## Common Telegram build errors

- **The loading placeholder never goes away.** Call `Telegram.WebApp.ready()` once the main interface renders; without it the placeholder waits for the full page load.
- **The initData hash never matches.** Remove only `hash` before sorting, join the fields with a line feed, and use `WebAppData` as the key for the first HMAC, with the bot token as the message.
- **The Stars payment request fails.** Digital goods need currency `XTR` and an empty provider token.
- **Cherry's automated test fails on a connect button.** Inside Cherry the wallet is already connected, so hide TON Connect and any wallet button when the app runs there.

## More on mini apps

- [How to build a mini app from a web app](https://cherry.fun/learn/guides/how-to-build-a-mini-app/): the Cherry steps with code.
- [Telegram mini app alternatives](https://cherry.fun/learn/compare/telegram-mini-app-alternatives/): every other host compared.
- [Telegram mini app vs web app](https://cherry.fun/learn/compare/telegram-mini-app-vs-web-app/): which one to build first.

Get Cherry on [iPhone](https://apps.apple.com/app/cherry-fun-solana-messenger/id6749173799), [Android](https://play.google.com/store/apps/details?id=fun.cherry) or [the web](https://chat.cherry.fun) to see mini apps from the user's side.

## FAQ

### Is there a review before a Telegram mini app goes live?

Telegram's Mini Apps documentation describes no review or approval step. You create the bot in @BotFather, point it at your HTTPS web app and it opens for anyone with the link. Featuring in the Telegram Mini App Store is a separate, selective step.

### How do I get my mini app featured in the Telegram Mini App Store?

Telegram says featured apps are chosen by how they enrich Telegram, and that bots which enable a Main Mini App and accept payments in Telegram Stars may be featured. It recommends high-quality media previews on the bot's profile and following its design guidelines.

### How do I make a Telegram mini app full screen?

A Main Mini App and a direct-link mini app open at full height by default. For true fullscreen in either orientation, call Telegram.WebApp.requestFullscreen(), available from Bot API 8.0, and keep your interface inside the safe area.

### Can a Telegram mini app use React?

Yes. A Telegram mini app is a web page, so any front end works, React included. Load Telegram's telegram-web-app.js script in the page head before your bundle and read window.Telegram.WebApp from your components.

### How do I test a Telegram mini app on my phone?

Start on Telegram's test server, which accepts plain HTTP without TLS for local work. On iOS, tap the Settings icon 10 times, turn on Allow Web View Inspection and attach Safari on a Mac. On Android, enable USB debugging and WebView Debug in Telegram's debug settings, then open chrome://inspect/#devices in Chrome.

## Sources

- [Telegram: Mini Apps documentation](https://core.telegram.org/bots/webapps)
- [Telegram: Bot features and @BotFather](https://core.telegram.org/bots/features)
- [Telegram: Bot API reference](https://core.telegram.org/bots/api)
- [Telegram: Payments in Telegram Stars](https://core.telegram.org/bots/payments-stars)
- [Telegram: Blockchain guidelines for Mini Apps](https://core.telegram.org/bots/blockchain-guidelines)
- [TON Docs: TON Connect overview](https://docs.ton.org/applications/ton-connect/overview)
- [Cherry Portal: Mini apps overview](https://portal.cherry.fun/docs/mini-apps)
- [Cherry Portal: Wallet and limits](https://portal.cherry.fun/docs/mini-apps/wallet)
- [Cherry Portal: Build with an AI agent](https://portal.cherry.fun/docs/mini-apps/ai-agents)
- [Cherry Portal: Mini app quickstart](https://portal.cherry.fun/docs/mini-apps/quickstart)

