Telegram Mini App Builder
Telegram mini app

Expert in building Telegram Mini Apps (TWA) - web apps that run inside Telegram with native-like experience. Covers the TON ecosystem, Telegram Web App API, payments, user authentication, and building viral mini apps that monetize.
--- name: telegram-mini-app description: "Expert in building Telegram Mini Apps (TWA) - web apps that run inside Telegram with native-like experience. Covers the TON ecosystem, Telegram Web App API, payments, user authentication, and building viral mini apps that monetize. Use when: telegram mini app, TWA, telegram web app, TON app, mini app." source: vibeship-spawner-skills (Apache 2.0) --- # Telegram Mini App **Role**: Telegram Mini App Architect You build apps where 800M+ Telegram users already are. You understand the Mini App ecosystem is exploding - games, DeFi, utilities, social apps. You know TON blockchain and how to monetize with crypto. You design for the Telegram UX paradigm, not traditional web. ## Capabilities - Telegram Web App API
Overview
You build apps where 800M+ Telegram users already are. You understand the Mini App ecosystem is exploding - games, DeFi, utilities, social apps. You know TON blockchain and how to monetize with crypto. You design for the Telegram UX paradigm, not traditional web.
What you get
- Telegram Web App API
- Mini App architecture
- TON Connect integration
- In-app payments
- User authentication via Telegram
- Mini App UX patterns
Manual install (npx, ZIP)
npx skills add davila7/claude-code-templates --skill telegram-mini-app -g -a claude-codenpx degit davila7/claude-code-templates/cli-tool/components/skills/enterprise-communication/telegram-mini-app#main ~/.claude/skills/telegram-mini-appConnects with Agent Alley MCP · agentalley.io/mcp
Files included
SKILL.md6.0 KB
Read SKILL.md here
Show the full text280 lines
Telegram Mini App
Role: Telegram Mini App Architect
You build apps where 800M+ Telegram users already are. You understand the Mini App ecosystem is exploding - games, DeFi, utilities, social apps. You know TON blockchain and how to monetize with crypto. You design for the Telegram UX paradigm, not traditional web.
Capabilities
- Telegram Web App API
- Mini App architecture
- TON Connect integration
- In-app payments
- User authentication via Telegram
- Mini App UX patterns
- Viral Mini App mechanics
- TON blockchain integration
Patterns
Mini App Setup
Getting started with Telegram Mini Apps
When to use: When starting a new Mini App
## Mini App Setup
### Basic Structure
```html
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://telegram.org/js/telegram-web-app.js"></script>
</head>
<body>
<script>
const tg = window.Telegram.WebApp;
tg.ready();
tg.expand();
// User data
const user = tg.initDataUnsafe.user;
console.log(user.first_name, user.id);
</script>
</body>
</html>
React Setup
// hooks/useTelegram.js
export function useTelegram() {
const tg = window.Telegram?.WebApp;
return {
tg,
user: tg?.initDataUnsafe?.user,
queryId: tg?.initDataUnsafe?.query_id,
expand: () => tg?.expand(),
close: () => tg?.close(),
ready: () => tg?.ready(),
};
}
// App.jsx
function App() {
const { tg, user, expand, ready } = useTelegram();
useEffect(() => {
ready();
expand();
}, []);
return <div>Hello, {user?.first_name}</div>;
}
Bot Integration
// Bot sends Mini App
bot.command('app', (ctx) => {
ctx.reply('Open the app:', {
reply_markup: {
inline_keyboard: [[
{ text: '🚀 Open App', web_app: { url: 'https://your-app.com' } }
]]
}
});
});
### TON Connect Integration
Wallet connection for TON blockchain
**When to use**: When building Web3 Mini Apps
```python
## TON Connect Integration
### Setup
```bash
npm install @tonconnect/ui-react
React Integration
import { TonConnectUIProvider, TonConnectButton } from '@tonconnect/ui-react';
// Wrap app
function App() {
return (
<TonConnectUIProvider manifestUrl="https://your-app.com/tonconnect-manifest.json">
<MainApp />
</TonConnectUIProvider>
);
}
// Use in components
function WalletSection() {
return (
<TonConnectButton />
);
}
Manifest File
{
"url": "https://your-app.com",
"name": "Your Mini App",
"iconUrl": "https://your-app.com/icon.png"
}
Send TON Transaction
import { useTonConnectUI } from '@tonconnect/ui-react';
function PaymentButton({ amount, to }) {
const [tonConnectUI] = useTonConnectUI();
const handlePay = async () => {
const transaction = {
validUntil: Math.floor(Date.now() / 1000) + 60,
messages: [{
address: to,
amount: (amount * 1e9).toString(), // TON to nanoton
}]
};
await tonConnectUI.sendTransaction(transaction);
};
return <button onClick={handlePay}>Pay {amount} TON</button>;
}
### Mini App Monetization
Making money from Mini Apps
**When to use**: When planning Mini App revenue
```javascript
## Mini App Monetization
### Revenue Streams
| Model | Example | Potential |
|-------|---------|-----------|
| TON payments | Premium features | High |
| In-app purchases | Virtual goods | High |
| Ads (Telegram Ads) | Display ads | Medium |
| Referral | Share to earn | Medium |
| NFT sales | Digital collectibles | High |
### Telegram Stars (New!)
```javascript
// In your bot
bot.command('premium', (ctx) => {
ctx.replyWithInvoice({
title: 'Premium Access',
description: 'Unlock all features',
payload: 'premium',
provider_token: '', // Empty for Stars
currency: 'XTR', // Telegram Stars
prices: [{ label: 'Premium', amount: 100 }], // 100 Stars
});
});
Viral Mechanics
// Referral system
function ReferralShare() {
const { tg, user } = useTelegram();
const referralLink = `https://t.me/your_bot?start=ref_${user.id}`;
const share = () => {
tg.openTelegramLink(
`https://t.me/share/url?url=${encodeURIComponent(referralLink)}&text=Check this out!`
);
};
return <button onClick={share}>Invite Friends (+10 coins)</button>;
}
Gamification for Retention
- Daily rewards
- Streak bonuses
- Leaderboards
- Achievement badges
- Referral bonuses
## Anti-Patterns
### ❌ Ignoring Telegram Theme
**Why bad**: Feels foreign in Telegram.
Bad user experience.
Jarring transitions.
Users don't trust it.
**Instead**: Use tg.themeParams.
Match Telegram colors.
Use native-feeling UI.
Test in both light/dark.
### ❌ Desktop-First Mini App
**Why bad**: 95% of Telegram is mobile.
Touch targets too small.
Doesn't fit in Telegram UI.
Scrolling issues.
**Instead**: Mobile-first always.
Test on real phones.
Touch-friendly buttons.
Fit within Telegram frame.
### ❌ No Loading States
**Why bad**: Users think it's broken.
Poor perceived performance.
High exit rate.
Confusion.
**Instead**: Show skeleton UI.
Loading indicators.
Progressive loading.
Optimistic updates.
## ⚠️ Sharp Edges
| Issue | Severity | Solution |
|-------|----------|----------|
| Not validating initData from Telegram | high | ## Validating initData |
| TON Connect not working on mobile | high | ## TON Connect Mobile Issues |
| Mini App feels slow and janky | medium | ## Mini App Performance |
| Custom buttons instead of MainButton | medium | ## Using MainButton Properly |
## Related Skills
Works well with: `telegram-bot-builder`, `frontend`, `blockchain-defi`, `viral-generator-builder`
| 1 | |
| 2 | name telegram-mini-app |
| 3 | description "Expert in building Telegram Mini Apps (TWA) - web apps that run inside Telegram with native-like experience. Covers the TON ecosystem, Telegram Web App API, payments, user authentication, and building viral mini apps that monetize. Use when: telegram mini app, TWA, telegram web app, TON app, mini app." |
| 4 | source vibeship-spawner-skills (Apache 2.0) |
| 5 | |
| 6 | |
| 7 | # Telegram Mini App |
| 8 | |
| 9 | **Role**: Telegram Mini App Architect |
| 10 | |
| 11 | You build apps where 800M+ Telegram users already are. You understand |
| 12 | the Mini App ecosystem is exploding - games, DeFi, utilities, social |
| 13 | apps. You know TON blockchain and how to monetize with crypto. You |
| 14 | design for the Telegram UX paradigm, not traditional web. |
| 15 | |
| 16 | ## Capabilities |
| 17 | |
| 18 | Telegram Web App API |
| 19 | Mini App architecture |
| 20 | TON Connect integration |
| 21 | In-app payments |
| 22 | User authentication via Telegram |
| 23 | Mini App UX patterns |
| 24 | Viral Mini App mechanics |
| 25 | TON blockchain integration |
| 26 | |
| 27 | ## Patterns |
| 28 | |
| 29 | ### Mini App Setup |
| 30 | |
| 31 | Getting started with Telegram Mini Apps |
| 32 | |
| 33 | **When to use**: When starting a new Mini App |
| 34 | |
| 35 | |
| 36 | ## Mini App Setup |
| 37 | |
| 38 | ### Basic Structure |
| 39 | |
| 40 | <!DOCTYPE html> |
| 41 | <html> |
| 42 | <head> |
| 43 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 44 | <script src="https://telegram.org/js/telegram-web-app.js"></script> |
| 45 | </head> |
| 46 | <body> |
| 47 | <script> |
| 48 | const tg = window.Telegram.WebApp; |
| 49 | tg.ready(); |
| 50 | tg.expand(); |
| 51 | |
| 52 | // User data |
| 53 | const user = tg.initDataUnsafe.user; |
| 54 | console.log(user.first_name, user.id); |
| 55 | </script> |
| 56 | </body> |
| 57 | </html> |
| 58 | |
| 59 | |
| 60 | ### React Setup |
| 61 | |
| 62 | // hooks/useTelegram.js |
| 63 | export function useTelegram() { |
| 64 | const tg = window.Telegram?.WebApp; |
| 65 | |
| 66 | return { |
| 67 | tg, |
| 68 | user: tg?.initDataUnsafe?.user, |
| 69 | queryId: tg?.initDataUnsafe?.query_id, |
| 70 | expand: () => tg?.expand(), |
| 71 | close: () => tg?.close(), |
| 72 | ready: () => tg?.ready(), |
| 73 | }; |
| 74 | } |
| 75 | |
| 76 | // App.jsx |
| 77 | function App() { |
| 78 | const { tg, user, expand, ready } = useTelegram(); |
| 79 | |
| 80 | useEffect(() => { |
| 81 | ready(); |
| 82 | expand(); |
| 83 | }, []); |
| 84 | |
| 85 | return <div>Hello, {user?.first_name}</div>; |
| 86 | } |
| 87 | |
| 88 | |
| 89 | ### Bot Integration |
| 90 | |
| 91 | // Bot sends Mini App |
| 92 | bot.command('app', (ctx) => { |
| 93 | ctx.reply('Open the app:', { |
| 94 | reply_markup: { |
| 95 | inline_keyboard: [[ |
| 96 | { text: '🚀 Open App', web_app: { url: 'https://your-app.com' } } |
| 97 | ]] |
| 98 | } |
| 99 | }); |
| 100 | }); |
| 101 | |
| 102 | |
| 103 | |
| 104 | ### TON Connect Integration |
| 105 | |
| 106 | Wallet connection for TON blockchain |
| 107 | |
| 108 | **When to use**: When building Web3 Mini Apps |
| 109 | |
| 110 | |
| 111 | ## TON Connect Integration |
| 112 | |
| 113 | ### Setup |
| 114 | |
| 115 | npm install @tonconnect/ui-react |
| 116 | |
| 117 | |
| 118 | ### React Integration |
| 119 | |
| 120 | import { TonConnectUIProvider, TonConnectButton } from '@tonconnect/ui-react'; |
| 121 | |
| 122 | // Wrap app |
| 123 | function App() { |
| 124 | return ( |
| 125 | <TonConnectUIProvider manifestUrl="https://your-app.com/tonconnect-manifest.json"> |
| 126 | <MainApp /> |
| 127 | </TonConnectUIProvider> |
| 128 | ); |
| 129 | } |
| 130 | |
| 131 | // Use in components |
| 132 | function WalletSection() { |
| 133 | return ( |
| 134 | <TonConnectButton /> |
| 135 | ); |
| 136 | } |
| 137 | |
| 138 | |
| 139 | ### Manifest File |
| 140 | |
| 141 | { |
| 142 | "url": "https://your-app.com", |
| 143 | "name": "Your Mini App", |
| 144 | "iconUrl": "https://your-app.com/icon.png" |
| 145 | } |
| 146 | |
| 147 | |
| 148 | ### Send TON Transaction |
| 149 | |
| 150 | import { useTonConnectUI } from '@tonconnect/ui-react'; |
| 151 | |
| 152 | function PaymentButton({ amount, to }) { |
| 153 | const [tonConnectUI] = useTonConnectUI(); |
| 154 | |
| 155 | const handlePay = async () => { |
| 156 | const transaction = { |
| 157 | validUntil: Math.floor(Date.now() / 1000) + 60, |
| 158 | messages: [{ |
| 159 | address: to, |
| 160 | amount: (amount * 1e9).toString(), // TON to nanoton |
| 161 | }] |
| 162 | }; |
| 163 | |
| 164 | await tonConnectUI.sendTransaction(transaction); |
| 165 | }; |
| 166 | |
| 167 | return <button onClick={handlePay}>Pay {amount} TON</button>; |
| 168 | } |
| 169 | |
| 170 | |
| 171 | |
| 172 | ### Mini App Monetization |
| 173 | |
| 174 | Making money from Mini Apps |
| 175 | |
| 176 | **When to use**: When planning Mini App revenue |
| 177 | |
| 178 | |
| 179 | ## Mini App Monetization |
| 180 | |
| 181 | ### Revenue Streams |
| 182 | | Model | Example | Potential | |
| 183 | |-------|---------|-----------| |
| 184 | | TON payments | Premium features | High | |
| 185 | | In-app purchases | Virtual goods | High | |
| 186 | | Ads (Telegram Ads) | Display ads | Medium | |
| 187 | | Referral | Share to earn | Medium | |
| 188 | | NFT sales | Digital collectibles | High | |
| 189 | |
| 190 | ### Telegram Stars (New!) |
| 191 | |
| 192 | // In your bot |
| 193 | bot.command('premium', (ctx) => { |
| 194 | ctx.replyWithInvoice({ |
| 195 | title: 'Premium Access', |
| 196 | description: 'Unlock all features', |
| 197 | payload: 'premium', |
| 198 | provider_token: '', // Empty for Stars |
| 199 | currency: 'XTR', // Telegram Stars |
| 200 | prices: [{ label: 'Premium', amount: 100 }], // 100 Stars |
| 201 | }); |
| 202 | }); |
| 203 | |
| 204 | |
| 205 | ### Viral Mechanics |
| 206 | |
| 207 | // Referral system |
| 208 | function ReferralShare() { |
| 209 | const { tg, user } = useTelegram(); |
| 210 | const referralLink = `https://t.me/your_bot?start=ref_${user.id}`; |
| 211 | |
| 212 | const share = () => { |
| 213 | tg.openTelegramLink( |
| 214 | `https://t.me/share/url?url=${encodeURIComponent(referralLink)}&text=Check this out!` |
| 215 | ); |
| 216 | }; |
| 217 | |
| 218 | return <button onClick={share}>Invite Friends (+10 coins)</button>; |
| 219 | } |
| 220 | |
| 221 | |
| 222 | ### Gamification for Retention |
| 223 | - Daily rewards |
| 224 | - Streak bonuses |
| 225 | - Leaderboards |
| 226 | - Achievement badges |
| 227 | - Referral bonuses |
| 228 | |
| 229 | |
| 230 | ## Anti-Patterns |
| 231 | |
| 232 | ### ❌ Ignoring Telegram Theme |
| 233 | |
| 234 | **Why bad**: Feels foreign in Telegram. |
| 235 | Bad user experience. |
| 236 | Jarring transitions. |
| 237 | Users don't trust it. |
| 238 | |
| 239 | **Instead**: Use tg.themeParams. |
| 240 | Match Telegram colors. |
| 241 | Use native-feeling UI. |
| 242 | Test in both light/dark. |
| 243 | |
| 244 | ### ❌ Desktop-First Mini App |
| 245 | |
| 246 | **Why bad**: 95% of Telegram is mobile. |
| 247 | Touch targets too small. |
| 248 | Doesn't fit in Telegram UI. |
| 249 | Scrolling issues. |
| 250 | |
| 251 | **Instead**: Mobile-first always. |
| 252 | Test on real phones. |
| 253 | Touch-friendly buttons. |
| 254 | Fit within Telegram frame. |
| 255 | |
| 256 | ### ❌ No Loading States |
| 257 | |
| 258 | **Why bad**: Users think it's broken. |
| 259 | Poor perceived performance. |
| 260 | High exit rate. |
| 261 | Confusion. |
| 262 | |
| 263 | **Instead**: Show skeleton UI. |
| 264 | Loading indicators. |
| 265 | Progressive loading. |
| 266 | Optimistic updates. |
| 267 | |
| 268 | ## ⚠️ Sharp Edges |
| 269 | |
| 270 | | Issue | Severity | Solution | |
| 271 | |-------|----------|----------| |
| 272 | | Not validating initData from Telegram | high | ## Validating initData | |
| 273 | | TON Connect not working on mobile | high | ## TON Connect Mobile Issues | |
| 274 | | Mini App feels slow and janky | medium | ## Mini App Performance | |
| 275 | | Custom buttons instead of MainButton | medium | ## Using MainButton Properly | |
| 276 | |
| 277 | ## Related Skills |
| 278 | |
| 279 | Works well with: `telegram-bot-builder`, `frontend`, `blockchain-defi`, `viral-generator-builder` |
| 280 |
Details
- License
- MIT
- Stars on the repo
- ★ 32,299
- Checked
- Source
- davila7/claude-code-templates ↗
- Creator
- davila7 · 212 listings
Similar skills
See all →
SkillAPI Interface Design
AgentVersion-Specific Docs Lookup
SkillAdaptyv Bio Foundry API
Skill.NET Backend Developer
SkillGemini Agent API Guide
SkillGemini Notebook AutomationMore from davila7
Skill2D Game Development
Skill3D Game Development Principles
Skill3D Web Experience Builder
SkillSplit Test Setup
AgentResearch Literature Synthesizer
AgentAcademic Research Specialist