telegram-bot-api-schema-and-type-modeling
SKILL.md
Telegram Bot API: Schema and Type Modeling
Purpose
Use this skill when building or maintaining the typed integration layer between your code and Telegram.
Primary sources
- Bot API object and method docs
https://core.telegram.org/schema/json
What to model carefully
Updateas a tagged unionMessageas a multi-shape object with many optional content branchesUser,Chat,ChatFullInfo- reply/callback/business/payment/story/gift-specific objects
- entity arrays and nested media objects
Developer guidance
- Treat Telegram objects as versioned, sparse payloads.
- Prefer tagged unions or discriminated unions where your language supports them.
- Keep raw payload capture available for debugging unknown fields.
- Separate generated transport models from hand-written domain models.
Codegen strategy
- Use schema-driven generation for breadth and consistency.
- Use handwritten adapters for:
- business rules
- convenience helpers
- backward-compatible fallbacks
- normalization across update families
Compatibility guidance
- Expect new optional fields to appear.
- Never assume absent fields are invalid.
- Watch recent Bot API changes such as:
sendMessageDraft- private-chat topics
- direct-message topics
- tags
- stories/gifts/business additions
Common mistakes
- Flattening
Messageinto one rigid shape. - Treating Telegram integer identifiers as small signed ints in weakly typed stacks.
- Generating types once and never revisiting them after API updates.
- Hiding raw responses so debugging schema drift becomes impossible.
Read next
02-getting-updates03-messages-and-formatting04-media-and-files
Weekly Installs
2
Repository
nzhulikov/teleg…t-skillsFirst Seen
11 days ago
Security Audits
Installed on
amp2
cline2
opencode2
cursor2
kimi-cli2
codex2