← Back to Skills Marketplace
zenith2828

Telegram Mini App Dev

by Zenith2828 · GitHub ↗ · v1.0.1
cross-platform ✓ Security Clean
2320
Downloads
1
Stars
3
Active Installs
2
Versions
Install in OpenClaw
/install 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.
README (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
Usage Guidance
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.
Capability Analysis
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.
Capability Assessment
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.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install tg-miniapp
  3. After installation, invoke the skill by name or use /tg-miniapp
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
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.
Metadata
Slug tg-miniapp
Version 1.0.1
License
All-time Installs 4
Active Installs 3
Total Versions 2
Frequently Asked Questions

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.

💬 Comments