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
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install tg-miniapp - 安装完成后,直接呼叫该 Skill 的名称或使用
/tg-miniapp触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
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. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 2320 次。
如何安装 Telegram Mini App Dev?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install tg-miniapp」即可一键安装,无需额外配置。
Telegram Mini App Dev 是免费的吗?
是的,Telegram Mini App Dev 完全免费(开源免费),可自由下载、安装和使用。
Telegram Mini App Dev 支持哪些平台?
Telegram Mini App Dev 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Telegram Mini App Dev?
由 Zenith2828(@zenith2828)开发并维护,当前版本 v1.0.1。