Telegram Bot API

Build Telegram bots with correct API calls, message formatting, keyboards, and webhook setup.

MIT-0 · Free to use, modify, and redistribute. No attribution required.
0 · 316 · 1 current installs · 1 all-time installs
byIván@ivangdavila
MIT-0
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
high confidence
Purpose & Capability
Name/description (Telegram Bot API helper) match the contents: comprehensive docs, curl examples, webhook/polling guidance, keyboard/media handling. The only required binary is curl and the only external endpoint used is api.telegram.org, which is appropriate for this purpose.
Instruction Scope
Instructions explicitly tell the agent to save bot configuration and tokens under ~/telegram-bot-api/ (but only with explicit user permission). This is expected for a helper that manages bot tokens, but users should be aware the skill suggests persisting secrets locally and should only permit that if they trust the environment. Other instructions remain scoped to Telegram API usage and local config.
Install Mechanism
No install spec or downloads — instruction-only with examples. Nothing is written to disk by an installer; only recommended local files are in the user's home directory (and only when the user consents).
Credentials
The skill declares no required environment variables or credentials. Examples use a ${TOKEN} placeholder and scripts that expect a token; storing a bot token is required for operation but the skill asks for permission before saving. This is proportionate, but confirm how/where you want secrets stored (env vars, secret manager, or the suggested home dir).
Persistence & Privilege
always:false and normal invocation settings. The only persistence is optional local files under the user's home directory for bot configs and templates; the skill does not request system-wide changes or modify other skills' settings.
Assessment
This skill is an instruction-only Telegram Bot API guide and is internally consistent. Key points before installing/using: 1) The skill may ask to save your bot token to ~/telegram-bot-api/bots/{name}.md — only allow this if you trust the environment and the machine's filesystem; prefer using a secrets manager or environment variables if you prefer. 2) Never paste your bot token into public chat or logs; if you suspect it was exposed, regenerate it with @BotFather. 3) Webhook examples require exposing an HTTPS endpoint (ngrok/cloudflared); be careful when exposing localhost to the public. 4) The skill's examples reference ${TOKEN} but it does not require any platform-level credentials — the token is a Telegram credential you provide. 5) Because this is instruction-only, there is no installer, no external downloads, and the repo contained only documentation — that reduces risk. If the skill later asked to run downloaded code, contact external endpoints other than api.telegram.org, or required unrelated credentials (AWS, GitHub tokens, etc.), reconsider or mark as suspicious.

Like a lobster shell, security has layers — review code before you run it.

Current versionv1.0.0
Download zip
latestvk9761wvzvay90t5t6hzp9fsqqs81reev

License

MIT-0
Free to use, modify, and redistribute. No attribution required.

Runtime requirements

🤖 Clawdis
OSLinux · macOS · Windows
Binscurl

SKILL.md

Setup

On first use, read setup.md for integration guidelines.

When to Use

User needs to interact with the Telegram Bot API. Building bots, sending messages, handling updates, setting up webhooks, creating keyboards, or managing bot commands.

Architecture

Memory lives in ~/telegram-bot-api/. See memory-template.md for structure.

~/telegram-bot-api/
├── memory.md          # Bot tokens, preferences, defaults
├── bots/              # Per-bot configurations
│   └── {botname}.md   # Token, webhook URL, defaults
└── templates/         # Reusable message templates

Quick Reference

TopicFile
Setup processsetup.md
Memory templatememory-template.md
All API methodsmethods.md
Message formattingformatting.md
Keyboards & buttonskeyboards.md
Webhooks & pollingwebhooks.md
Media handlingmedia.md
Error codeserrors.md

Core Rules

1. API Base URL

All requests go to:

https://api.telegram.org/bot{TOKEN}/{METHOD}

Never expose the token in logs or user-visible output.

2. Required Parameters by Method

MethodRequiredOptional (common)
sendMessagechat_id, textparse_mode, reply_markup, disable_notification
sendPhotochat_id, photocaption, parse_mode
sendDocumentchat_id, documentcaption, thumbnail
getUpdatesoffset, limit, timeout
setWebhookurlcertificate, max_connections
deleteWebhookdrop_pending_updates
getMe

3. Parse Mode Selection

FormatUse whenEscape chars
MarkdownV2Rich formatting needed_*[]()~\>#+-=
HTMLComplex nesting, safer<>&
NonePlain text onlyNone

Default to HTML — fewer escape issues than MarkdownV2.

4. Chat ID Types

TypeFormatExample
UserPositive integer123456789
GroupNegative integer-123456789
Supergroup/Channel-100 prefix-1001234567890

5. Rate Limits

ScopeLimit
Same chat1 msg/sec
Different chats30 msg/sec
Groups20 msg/min per group
Bulk notificationsUse sendMessage with different chat_ids

When hitting 429 errors, use exponential backoff starting at retry_after seconds.

6. Message Length Limits

TypeLimit
Text message4096 chars
Caption1024 chars
Callback data64 bytes
Inline query256 chars

Split long messages at sentence boundaries, not mid-word.

7. Keyboard Best Practices

Inline keyboards (in message):

  • Max 8 buttons per row
  • Max 100 buttons total
  • Use callback_data for bot actions
  • Use url for external links

Reply keyboards (below input):

  • Use for frequent options
  • one_time_keyboard: true to hide after use
  • resize_keyboard: true for better mobile UX

Common Traps

  • Forgetting to escape MarkdownV2 → Message fails silently or partially. Use HTML instead, or escape all special chars.
  • Using wrong chat_id format → Groups need negative IDs. Supergroups/channels need -100 prefix.
  • Not handling 429 errors → Bot gets temporarily blocked. Always implement retry logic.
  • Exposing bot token → Anyone can control your bot. Never log or display tokens.
  • Sending too fast to groups → 20 msg/min limit. Queue messages with delays.
  • Large file uploads → 50MB limit for sendDocument. Use URL method for larger files.
  • Webhook not HTTPS → Telegram requires valid SSL certificate.

External Endpoints

EndpointData SentPurpose
https://api.telegram.org/bot{TOKEN}/*Messages, media, commandsAll bot operations

No other data is sent externally. Bot token is required for all requests.

Security & Privacy

Data that leaves your machine:

  • Messages and media sent via the Bot API
  • Bot token in every request (required by Telegram)

Data that stays local:

  • Bot configurations in ~/telegram-bot-api/
  • Message templates

This skill does NOT:

  • Store message content long-term
  • Access user data beyond what Telegram provides
  • Make requests to endpoints other than api.telegram.org

Trust

By using this skill, data is sent to Telegram's Bot API servers. Only install if you trust Telegram with your bot's messages.

Related Skills

Install with clawhub install <slug> if user confirms:

  • api — REST API best practices
  • http — HTTP protocol essentials
  • json — JSON parsing and manipulation

Feedback

  • If useful: clawhub star telegram-bot-api
  • Stay updated: clawhub sync

Files

9 total
Select a file
Select a file to preview.

Comments

Loading comments…