← 返回 Skills 市场
zenith2828

Telegram Mini App Dev

作者 Zenith2828 · GitHub ↗ · v1.0.1
cross-platform ✓ 安全检测通过
2320
总下载
1
收藏
3
当前安装
2
版本数
在 OpenClaw 中安装
/install tg-miniapp
功能描述
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.
使用说明 (SKILL.md)

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

  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 && \x3Cspan>{count}\x3C/span>}

// CORRECT
{count > 0 && \x3Cspan>{count}\x3C/span>}

Detailed Guides

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
安全使用建议
This skill appears coherent and safe for its stated purpose: reusable React hooks/components and a knowledge base for Telegram Mini Apps. Before using, ensure you do not copy any server-side bot tokens or other secrets into client code — server-side calls that prepare inline messages must hold bot credentials on the server only. If you implement the suggested server-side image generation (resvg-wasm, R2/CDN), secure those services and credentials appropriately. Review any third-party packages (@telegram-apps/sdk, resvg) you add to your project for supply-chain risk, and verify behavior on actual iOS/Android Telegram clients as recommended in the testing checklist.
功能分析
Type: OpenClaw Skill Name: tg-miniapp Version: 1.0.1 The skill bundle provides React components and hooks, along with extensive documentation, for developing Telegram Mini Apps. The `DebugOverlay` component exposes browser-level and Telegram WebApp API information (e.g., platform, safe area insets) but is gated for development mode only (`localhost`, `127.0.0.1`, or `?debug=1` URL parameter). The markdown files (`SKILL.md`, `references/KNOWLEDGE.md`) serve as technical guides, detailing how to implement features like sharing which involve backend API calls, but they do not contain instructions for the AI agent to perform these actions or any other malicious prompt injection attempts. All code and documentation are aligned with the stated purpose of assisting Telegram Mini App development and lack any indicators of intentional harmful behavior.
能力评估
Purpose & Capability
Name/description match the included files (hooks, components, knowledge base). The referenced APIs (window.Telegram.WebApp, WebApp.shareMessage, bot.savePreparedInlineMessage, R2/CDN, resvg-wasm) are relevant to building Telegram Mini Apps.
Instruction Scope
SKILL.md and code only instruct reading Telegram WebApp state, handling UI issues, preparing inline messages, and server-side image generation patterns. No instructions ask the agent to read unrelated system files, environment variables, or transmit arbitrary data to unknown endpoints.
Install Mechanism
No install spec is provided (instruction-only), so nothing is downloaded or written to disk. References to libraries (e.g., @resvg/resvg-wasm, @telegram-apps/sdk) are typical dependencies for the documented tasks and would be installed by the user if needed.
Credentials
The skill declares no required environment variables or credentials. The documentation correctly separates client-side code from server-side needs (e.g., backend calling bot.savePreparedInlineMessage). No unexpected secret access is requested.
Persistence & Privilege
always is false and the skill is user-invocable; it does not request persistent/system-level privileges or modify other skills' configs. All code is client-side utilities meant to be copy/pasted into projects.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install tg-miniapp
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /tg-miniapp 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.1
- Improved sharing instructions for inline mode, clarifying the `prepared_message_id` flow. - Added a note that `prepared_message_id` is single-use; advise preparing a fresh ID for each share. - Suggested caching images on R2/CDN for static content to optimize sharing. - Expanded the testing checklist: now includes checks for repeat share flow and sharing to different chat types.
v1.0.0
- Initial release of tg-miniapp. - Provides solutions for safe area insets, fullscreen mode, BackButton handling, WebApp API issues, and position:fixed bugs. - Offers React hooks and components for easier integration with Telegram Mini Apps. - Includes detailed guides, copy-paste code samples, and a pre-launch testing checklist.
元数据
Slug tg-miniapp
版本 1.0.1
许可证
累计安装 4
当前安装数 3
历史版本数 2
常见问题

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。

💬 留言讨论