π¦ ClawHub
Telegram Mini App Dev
by @zenith2828
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.
TERMINAL
clawhub install tg-miniappπ About This Skill
name: tg-miniapp description: 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.
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
Header
position:fixed Broken
Telegram appliestransform to container. Use createPortal:
import { createPortal } from 'react-dom';
createPortal( , 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
1. Enable inline mode: @BotFather β/setinline β select bot
2. Backend calls savePreparedInlineMessage β returns prepared_message_id
3. 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 && {count}}// CORRECT
{count > 0 && {count}}
Detailed Guides
Testing Checklist
Before shipping, test: