Telegram Mini App Dev
/install tg-miniapp
Telegram Mini App Development
Battle-tested solutions for common Telegram Mini App issues.
Quick Reference
Safe Area (Fullscreen Mode)
// Use reactive hook - values are async and context-dependent
const safeArea = useSafeAreaInset(); // from references/hooks.ts
\x3Cdiv style={{ paddingTop: safeArea.top }}>Header\x3C/div>
position:fixed Broken
Telegram applies transform to container. Use createPortal:
import { createPortal } from 'react-dom';
createPortal(\x3CModal />, document.body);
BackButton Not Firing
Use @telegram-apps/sdk, not raw WebApp:
import { onBackButtonClick, showBackButton } from '@telegram-apps/sdk';
onBackButtonClick(handleBack);
Sharing with Inline Mode
- Enable inline mode: @BotFather →
/setinline→ select bot - Backend calls
savePreparedInlineMessage→ returnsprepared_message_id - Frontend calls
WebApp.shareMessage(prepared_message_id)
Note: prepared_message_id is single-use — prepare fresh for each share tap.
For static content, consider caching images on R2/CDN and preparing per-tap.
React "0" Rendering
// WRONG: renders literal "0"
{count && \x3Cspan>{count}\x3C/span>}
// CORRECT
{count > 0 && \x3Cspan>{count}\x3C/span>}
Detailed Guides
- references/KNOWLEDGE.md — Full knowledge base with all gotchas and solutions
- references/hooks.ts — Copy-paste React hooks (useSafeAreaInset, useFullscreen, etc.)
- references/components.tsx — Ready-to-use components (SafeAreaHeader, DebugOverlay)
Testing Checklist
Before shipping, test:
- Open from folder (chat list)
- Open from direct bot chat
- iOS device
- Android device
- Share flow (tap → dismiss → tap again)
- Share to different chat types (user, group, channel)
- Back button
- Scroll with sticky header
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install tg-miniapp - After installation, invoke the skill by name or use
/tg-miniapp - Provide required inputs per the skill's parameter spec and get structured output
What is Telegram Mini App Dev?
Build Telegram Mini Apps without the pain. Includes solutions for safe areas, fullscreen mode, BackButton handlers, sharing with inline mode, position:fixed issues, and React gotchas. Use when building or debugging Telegram Mini Apps, or when encountering issues with WebApp API, safe areas, or sharing. It is an AI Agent Skill for Claude Code / OpenClaw, with 2320 downloads so far.
How do I install Telegram Mini App Dev?
Run "/install tg-miniapp" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is Telegram Mini App Dev free?
Yes, Telegram Mini App Dev is completely free (open-source). You can download, install and use it at no cost.
Which platforms does Telegram Mini App Dev support?
Telegram Mini App Dev is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created Telegram Mini App Dev?
It is built and maintained by Zenith2828 (@zenith2828); the current version is v1.0.1.