tg-notipy
Skill0 starsChanged 3 months agoMITView on GitHub
Send messages, files, and albums to Telegram chats via the Bot API. Use when sending notifications, alerts, media, or albums from Crush to Telegram, discovering chat IDs, or checking bot identity.
- Reads credentials
In this repository9 other files it gives its agents.
- AGENTS.mdAGENTS.md
- agentSkill
- agents-md-syncSkill
- aur-pkg-analysisSkill
- commitSkill
- crush-sessionSkill
- gen-agentSkill
- git-aware-mvSkill
- tg-notifySkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 2 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 29
Use the tg-notipy CLI. One Python script (scripts/tg_notify.py, stdlib only) sends messages, files, and albums to Telegram via the Bot API, …
- Very specific: line 45
All fixed values (message and caption char limits, upload size limits, album item bounds, retry defaults, extension and MIME type maps) …
- Very specific: line 77
Read references/gotchas.md before executing operations.
- Distinctive: line 121
Do not ask the user what to do.
- Very specific: line 124
Verify configuration: TELEGRAM_BOT_TOKEN is set (else ask the user), and TELEGRAM_CHAT_ID or --chat-id is available for send modes.
- Very specific: line 129
Read references/gotchas.md and apply every relevant entry.
- Distinctive: line 130
Run the command from the mode recipes and run the verification probe from the mode file.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Initialize todos for tg-notipy operation:
{
"todos": [
{"content": "Parse user request and detect mode", "status": "in_progress", "activeForm": "Parsing user request and detecting mode"},
{"content": "Verify configuration (bot token and chat ID)", "status": "pending", "activeForm": "Verifying configuration"},
{"content": "Load mode reference and cross-reference guides", "status": "pending", "activeForm": "Loading mode reference and guides"},
{"content": "Execute operation via scripts/tg_notify.py", "status": "pending", "activeForm": "Executing operation via tg_notify.py"},
{"content": "Handle response and errors", "status": "pending", "activeForm": "Handling response and errors"},
{"content": "Complete tg-notipy operation", "status": "pending", "activeForm": "Completing tg-notipy operation"}
]
}Telegram Bot Notifications (Python)
Use the tg-notipy CLI. One Python script
(scripts/tg_notify.py, stdlib only) sends messages, files, and
albums to Telegram via the Bot API, with MarkdownV2 and HTML
formatting, auto-retry on rate limits and transient errors, chat ID
discovery, bot identity checks, JSON output, dry-run verification, and
proxy or self-hosted base URL support. Flags may appear anywhere on the
command line; one positional text argument is accepted (message text,
or caption when a file flag is present, or extra album items in album
mode). When no message source is given, the message is read from
stdin. Each operation maps to a mode file in references/modes/.
Operation-independent knowledge lives in references/guide-*.md files
that modes load on demand. Field-verified failure modes live in
references/gotchas.md.
Single Source of Truth
All fixed values (message and caption char limits, upload size limits,
album item bounds, retry defaults, extension and MIME type maps) live
in assets/constant-limits.md and assets/constant-filetypes.md. The
script loads them at startup via scripts/tg_constants.py; the agent
reads the same files. Prose references the constant files and never
re-lists a value. Dump current values:
python3 scripts/tg_constants.py --dump allPrerequisites
- Telegram bot created via @BotFather (bot token required)
- Bot added to target chat (private, group, or channel)
python3available in PATH (stdlib only, no pip dependencies)
Full environment setup and flag reference:
references/guide-config.md.
Configuration Resolution
--tokenCLI flag, elseTELEGRAM_BOT_TOKENenv var (or./.env)--chat-idCLI flag, elseTELEGRAM_CHAT_IDenv var (or./.env)- Base URL:
--base-urlflag, elseTELEGRAM_BASE_URL, else official API - Proxy:
--proxyflag, elseTELEGRAM_PROXY
A ./.env file fills token and chat ID only when they are not already
set in the environment. Details: references/guide-config.md.
Gotchas (field-verified friction)
Read references/gotchas.md before executing operations. Top entries:
- G3: never re-run a send to re-check its exit status; re-running re-delivers the content as a duplicate
- G5: MarkdownV2 rejects the first unescaped reserved character with HTTP 400 naming it; prefer plain text or HTML for generated text
- G8: the local upload limit relaxes for self-hosted servers only with
the
--base-urlflag, notTELEGRAM_BASE_URLalone
Mode Detection
Map user intent to a mode. Load the mode file, then load the guides in the Guides column before composing commands.
| Trigger Keywords | Mode | Mode File | Guides |
| send message, notify, alert, text, announce, stdin, reply, silent | Message | references/modes/mode-message.md | references/guide-formatting.md |
| send file, upload, screenshot, photo, document, audio, video, voice, url file, file-id | File | references/modes/mode-file.md | references/guide-filetypes.md, references/guide-formatting.md |
| album, media group, gallery, multiple photos | Album | references/modes/mode-album.md | references/guide-filetypes.md, references/guide-formatting.md |
| discover, find chat id, setup chat | Discover | references/modes/mode-discover.md | references/guide-config.md |
| whoami, bot identity, validate token | Whoami | references/modes/mode-whoami.md | references/guide-config.md |
Cross-Reference Guides
Load a guide when its trigger matches. Guides are independent of any single operation:
| Guide | Purpose | Load Trigger |
references/guide-config.md | Env vars, flag table, precedence, exit codes, JSON shapes, dry-run, testing | Any configuration question or error diagnosis |
references/guide-filetypes.md | Detection order, limit semantics, self-hosted relaxation, album item rules | Any file or album send |
references/guide-formatting.md | MarkdownV2, HTML, plain text, escaping rules | Any formatted text or caption |
references/guide-retry.md | 429 and transient retry policy and override flags | Any failure, timeout, or retry tuning |
Response Handling
On success the script prints Sent (message_id: <id>), Sent album
(N messages), the chat ID (discover), or @username (id: N)
(whoami) to stdout; with --json it prints {"ok":true,...} shapes.
On failure it prints Failed: <reason> to stderr and exits 1. HTTP
error codes and actions: references/guide-config.md.
BEGIN EXECUTION IMMEDIATELY
Do not ask the user what to do. Start with step 1:
- Detect the mode from the request using the Mode Detection table.
- Verify configuration:
TELEGRAM_BOT_TOKENis set (else ask the user), andTELEGRAM_CHAT_IDor--chat-idis available for send modes. Run--whoamifirst when the token validity is unknown. - Load the mode file for the detected mode.
- Load every guide listed in the mode's Guides column.
- Read
references/gotchas.mdand apply every relevant entry. - Run the command from the mode recipes and run the verification probe from the mode file. Handle the response per the mode file.
Update todos at each step. After completion, output a summary and clear with
todos([]).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

