tgbot
/tgbot
Send Telegram messages, photos and files, read bot updates, and call any Telegram Bot API method through the tgbot CLI. Use when the task involves Telegram, a Telegram bot, notifications to a chat or channel, or reading messages sent to a bot.
- Author
- swtormy ↗
- Repository
- tgbot-cli ↗
- Licence
- MIT
- Last repository change
- 10.11.2026
Assessment and security
- Files in this package
- 16
- Scripts
- 14
- HTML comments
- 0
- URLs in SKILL.md
- 1
No signals detected. Repository changed on 10.11.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
- 14 scripts in this package. Review them before installing, as Claude may execute them.
Scripts: cli_test.go, coerce.go, download.go, methods.go, output.go, root.go, schema.go, skill.go, updates.go, user.go, user_account.go, user_read.go, user_test.go, user_write.go
What it does and when to use it
Send Telegram messages, photos and files, read bot updates, and call any Telegram Bot API method through the tgbot CLI. Use when the task involves Telegram, a Telegram bot, notifications to a chat or channel, or reading messages sent to a bot.
Original author description
Send Telegram messages, photos and files, read bot updates, and call any Telegram Bot API method through the tgbot CLI. Use when the task involves Telegram, a Telegram bot, notifications to a chat or channel, or reading messages sent to a bot.
How it works
- Before you start
- Discover instead of guessing
- Common calls
- Output and errors
- Ask before
SKILL.md preview
---
name: tgbot
description: Send Telegram messages, photos and files, read bot updates, and call any Telegram Bot API method through the tgbot CLI. Use when the task involves Telegram, a Telegram bot, notifications to a chat or channel, or reading messages sent to a bot.
---
# tgbot: Telegram Bot API from the shell
`tgbot` is a CLI for the Telegram Bot API. The token comes from the environment, output is JSON.
## Before you start
- The token must be in `TELEGRAM_BOT_TOKEN`. Never print it, never put it on a command line.
- Check the setup without a token: `tgbot send 1 hi --dry-run` shows the request that would be sent.
- Bots only see chats they were added to. A bot cannot message a user who has not started it.
## Discover instead of guessing
1. `tgbot methods` lists every Bot API method.
2. `tgbot <method> --help` shows its parameters. Names are exactly the Bot API names (snake_case).
3. `tgbot <method> --schema` prints the JSON Schema of the request body.
4. Add `--dry-run` to preview any call before sending.
## Common calls
```bash
tgbot send 123456789 "text" # sendMessage shortcut; "-" reads text from stdin
tgbot send @channelname "<b>hi</b>" --parse_mode HTML
tgbot sendPhoto --chat_id 123456789 --photo @./pic.jpg --caption "caption"
tgbot sendDocument --chat_id 123456789 --document @./report.pdf
tgbot updates --state-file ~/.tgbot-offset # new updates only, offset saved between calls
tgbot updates --timeout 30 --jq '.updates[].message.text'
tgbot download <file_id> --out ./downloads/ # prints the saved path
tgbot sendMessage --chat_id 123 --text hi --reply_markup '{"inline_keyboard":[[{"text":"Open","url":"https://example.com"}]]}'
```
- File parameters: `@path` uploads a local file; a plain value is a `file_id` or URL.
- Object and array parameters are JSON strings; `@file.json` reads them from a file.
- `--jq EXPR` filters the result. Strings print raw, so `--jq '.message_id'` is safe in `$(...)`.
## Output and errors
- Success: the Bot API `result` as JSON on stdout.
- Failure: one JSON line on stderr, `{"ok":false,"error":{"type":...,"message":...}}`.
- Exit codes: 0 ok, 1 API or runtime failure, 2 usage error, 3 token missing or rejected.
- On a 429 error read `parameters.retry_after` and wait that many seconds.
## Ask before
Methods that change other people's state or cannot be undone: `deleteMessage`, `banChatMember`, `leaveChat`, `setChatPermissions`, `deleteWebhook`, `logOut`, `close`. Preview with `--dry-run` and confirm with the user first.
Files in this package (16)
- SKILL.md 2 KB
- SKILL_USER.md 9 KB
- cli_test.go 13 KB
- coerce.go 2 KB
- download.go 2 KB
- methods.go 6 KB
- output.go 2 KB
- root.go 8 KB
- schema.go 1 KB
- skill.go 3 KB
- updates.go 3 KB
- user.go 7 KB
- user_account.go 17 KB
- user_read.go 11 KB
- user_test.go 9 KB
- user_write.go 12 KB
Versions
| Repository | Score | Licence |
|---|---|---|
| This page · swtormy/tgbot-cli | 95 | MIT |
| santimator/x3-suite | 91 | MIT |
Database snapshot: 13.11.2026 · package version 60a39b95fc96 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 1 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100telegram
Read and send messages in the connected Telegram bot's chats via the Telegram Bot API, and help the user finish bot setup. Use when the user asks to send a Telegram message, reply in a chat or group, download a file someone sent, or connect a Telegram bot. - 100telegram-bot
Publish to your Telegram channel/group via a bot using the official Telegram Bot API — send text or photo posts, edit and delete messages, and verify the bot's access to a chat. Use when the user wants to broadcast to a Telegram channel/group with a bot token (BotFather),… - 95telegram-id
Find a Telegram ID — the user's own numeric Telegram user ID, or the ID of a public channel, group or bot — with Catalogue App (@catalogue_app). Use when the user asks "what is my Telegram ID", needs a user ID or chat ID for a bot, an API, an allowlist or an admin setting, or… - 100channel-bot
Work with messaging-channel bots (Telegram / Slack) — register a bot, route inbound messages through the AI agent, handle webhooks vs polling, or add a new channel adapter. Use when wiring chat into a messaging platform or debugging bot delivery. - 100telegram-channel
Telegram for a Pots bot. How to connect a Telegram bot yourself (BotFather, its token, groups, bot.json), topics, files and limits, and how to post buttons under a message (inline keyboards), get clicks, mark a question answered, and send tables. Use when you connect Telegram,… - 100telegram-bot-builder
Expert in building Telegram bots that solve real problems - from simple automation to complex AI-powered bots. Covers bot architecture, the Telegram Bot API, user experience, monetization strategies, and scaling bots to thousands of users. Use when: telegram bot, bot api,…