telegram-chip
Skill4 starsChanged 4 months agoMITView on GitHub
Unified Telegram core (HTTP API + MCP stdio + tgdl export) with single-session Telethon architecture. Use when setting up Telegram automation, reading/sending Telegram messages via local API, exporting chat history, or troubleshooting Telethon auth/session conflicts.
- Reads credentials
In this repository43 other files it gives its agents.
- agent-browserSkill
- agent-introspectionSkill
- agentos-contentSkill
- carousel-instagramSkill
- chat-archiveSkill
- codex-imageSkill
- content-engineSkill
- cross-reviewSkill
- datawrapperSkill
- dev-pipelineSkill
- excalidrawSkill
- fast-loop-codingSkill
- groq-voiceSkill
- higgsfield-generateSkill
- higgsfield-marketplace-cardsSkill
- higgsfield-product-photoshootSkill
- higgsfield-soul-idSkill
- instagram-superpowerSkill
- learningsSkill
- loop-codingSkill
- markdown-newSkill
- mcp-api-buildSkill
- mcp-builderSkill
- memory-auditSkill
- miro-boardSkill
- perplexity-researchSkill
- presentSkill
- reel-radarSkill
- reels-analytics-for-brokersSkill
- reelsSkill
- remote-agent-desktopSkill
- security-auditSkill
- senior-brainstormSkill
- seo-tuneSkill
- server-doctorSkill
- threads-contentSkill
- topic-monitorSkill
- transcriptSkill
- twitterSkill
- workshopSkill
- youtube-producerSkill
- youtube-thumbnailSkill
- yt-researchSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
13 rules. About 0 are common, 6 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 19
Use this exact order:
- Very specific: line 22
Run ./generate-session.sh and complete interactive login:
- Very specific: line 26
Verify TELEGRAM_SESSION_STRING is present in .env.
- Distinctive: line 27
Start only one active Telethon process for this session string.
- Very specific: line 31
When obtaining TELEGRAM_API_ID / TELEGRAM_API_HASH at my.telegram.org/apps:
- Distinctive: line 32
Prefer phone mobile internet (without Wi‑Fi/VPN), or
- Distinctive: line 33
Use a clean private/incognito browser session.
- Very specific: line 39
Never share TELEGRAM_SESSION_STRING in chats/logs.
- Distinctive: line 40
If session leaks, revoke/regenerate immediately.
- Very specific: line 42
Use HTTP API (api.py) as the only integration point.
- Very specific: line 43
Do not use direct Telethon imports outside this skill runtime (skills/telegram-chip/.venv).
- Distinctive: line 53
Never split one thought across many sends: If several instructions about the same person arrive while you work, accumulate them and send …
- Very specific: line 71
All Telegram calls go through the shared rate limiter.
≈ “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
telegram-chip
Если диалога нет – не пишем. Первым пишет только человек. Hard rule (ban risk): the owner's account NEVER writes first.
POST /messages/send,/messages/send-fileand/messages/forwardto a private chat are refused with HTTP 403{"success": false, "data": null, "error": "no dialog: contact never wrote first – sending is forbidden (ban risk)"}unless that user has at least one incoming message in the chat. Groups/channels and Saved Messages are unaffected. Do not work around it (other clients, drafts-as-send, invites). The legacymain.pyMCP server does NOT enforce it – keep it disabled.
Unified Telegram core with a single Telethon client.
Correct authorization procedure (important)
Use this exact order:
- Prepare
.envwithTELEGRAM_API_IDandTELEGRAM_API_HASH. - Run
./generate-session.shand complete interactive login:- phone number (
+<country code><number>), - Telegram login code,
- 2FA password (if enabled).
- phone number (
- Verify
TELEGRAM_SESSION_STRINGis present in.env. - Start only one active Telethon process for this session string.
Credential acquisition recommendations
When obtaining TELEGRAM_API_ID / TELEGRAM_API_HASH at my.telegram.org/apps:
- Prefer phone mobile internet (without Wi‑Fi/VPN), or
- Use a clean private/incognito browser session.
This reduces auth friction and weird web-session/cache issues.
Hard rules
- Never share
TELEGRAM_SESSION_STRINGin chats/logs. - If session leaks, revoke/regenerate immediately.
- One session string must not be used by multiple concurrent Telethon processes (prevents
AuthKeyDuplicatedError). - Use HTTP API (
api.py) as the only integration point. - Do not use direct Telethon imports outside this skill runtime (
skills/telegram-chip/.venv).
Sending discipline
This skill drives the OWNER'S OWN account. Every message you send lands on a real person as if the owner wrote it himself, so outbound cadence is part of the contract, not a style preference.
- Two short messages maximum, then stop and wait for a reply. The counter resets only when the human answers.
- Never split one thought across many sends. If several instructions about the same person arrive while you work, accumulate them and send ONE message.
- Sending 5-10 messages in a row reads as bot spam and kills the personal contact these conversations exist to build.
Why: relaying each live instruction as its own send once produced six messages to one person within twenty minutes. It read as spam, and it was.
A monitoring loop must READ ONLY (GET /chats/...). Reading is unlimited;
sending is not.
Chat folders (chat tags)
GET /folders?include_chats=true— list folders:id, title, type (filter|chatlist|default), color, emoticon, pinned_count, include_count, exclude_count, pinned_peer_ids, include_peer_ids(+chatswheninclude_chats=true; useinclude_chats=falsefor a cheap call).POST /folders/upsert— body{"title": "Горячие", "color": 0-6|null, "emoticon": "🔥", "include_chat_ids": [123, "-100..."], "mode": "replace"|"add"|"remove"}. Finds the folder by EXACT title (creates it with the lowest free id 2..255 if absent) and sets its chats. Only that folder is touched – other folders are never modified; there is no delete endpoint.color/emoticonchange only when sent (color: nullclears). Responsedata:{action: created|updated|unchanged, id, title, mode, color, emoticon, pinned_count, include_count, added, removed, include_peer_ids}. Errors: 422 validation / title >12 chars / >200 chats (premium limit) / unresolvable chat ids (nothing written) / result would be empty; 409 title is a shared chat list or no free id; 429 FloodWait; 502 upstream. All Telegram calls go through the shared rate limiter. Unknown ids trigger oneget_dialogscache warm-up per request.
Supergroups (create + invite + visible history)
POST /supergroups— body{"title": "Иван | Проект", "about": "…", "users": ["@bot1", 123]}. Creates a megagroup (one attempt, never retried; FloodWait → error, nothing created), invites users one by one, makes history visible to new members.data= JSON{created, chat_id (marked -100…), title, invites: [{user, status: invited|not_invited|error|skipped, error?}], history: {history_visible, changed}}.success:true= the chat exists – do NOT retry even if an invite failed; fix invites viaPOST /groups/invite. Error «outcome unknown» (timeout/connection/Telegram 5xx on create) = the chat MAY exist – do NOT retry, check/chats/listfor the title.POST /chats/{id}/history-visible— body{"visible": true}(default true). Supergroups/channels only; basic groups get a clear error.- Then
POST /admin/promote{chat_id: "-100…", user_id: "@bot"}per bot, andGET /chats/{id}/invite-link(each call exports a NEW additional link). POST /groupsstill creates a basic group (no history toggle, no admin promote) – prefer/supergroups.
Media: empty text = check media
In GET /chats/{id}/messages a media message shows a marker instead of empty text: [файл: a.pdf, 1.2 MB], [голосовое 0:10], [фото], [кружок 0:12], [видео 0:35], [стикер], [опрос: …] + caption. Never treat a media message as «nothing was said».
GET /chats/{id}/messages/{msg}— addsmedia_kind,file_name,mime_type,size,duration.GET /chats/{id}/messages/{msg}/media?v=2— download to the chip host cache, returns{path, file_name, mime_type, size, kind, duration, cached}. Withoutv=2the legacy contract applies (always HTTP 200, errors as{success:false,error}indata).GET /chats/{id}/messages/{msg}/media/file— the bytes (use this when the chip runs on another host, e.g. behind an SSH tunnel:pathis a path on the chip host). Save, then Read the file.GET /chats/{id}/messages/{msg}/media?transcribe=1— voice/кружок/audio transcript via Groq Whisper (transcriptfield). 503 = Groq key not configured on the chip host.
Errors (v=2 / transcribe / file): 404 no media, 413 over 50 MB (25 MB for transcription), 422 not downloadable, 429 FloodWait. Max 2 parallel downloads and 2 parallel transcriptions; global limit 5 req/s, permits serialized. A download slot can be held ≤60 s by Telethon's internal FloodWait sleep – extra requests queue, not fail. Details: README.md → «Media».
Reading polls
Anonymous multi-choice polls hide per-option vote counts from non-participants. Ask the session-owner human to vote manually in Telegram first, then GET /chats/{chat_id}/messages/{message_id} returns poll.results[].voters. See README.md → "Reading polls" for details.
Read receipts (read_outbox_max_id)
To check if a peer has read a message you sent: sent_message_id <= read_outbox_max_id ⇒ read.
GET /chats/listreturnsread_outbox_max_id,read_inbox_max_id,top_message_idper chat (alongsideunread_count).GET /chats/{chat_id}/read_status— single-peer endpoint, lighter than/chats/list(usesGetPeerDialogsRequest).
read_outbox_max_id == top_message_id ⇒ peer прочитал всё.
See README.md → "Read receipts" for details.
See README.md and TROUBLESHOOTING.md for full setup and failure recovery.
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.

