tg search "release" --account work --json
{
"ok": true,
"schema_version": "2",
"data": [{
"chat_name": "Build room",
"sender_name": "Maya",
"content": "Release is ready…"
}]
}
Open-source TypeScript CLI
Read live chats, build a searchable local memory, and manage conversations without leaving your terminal. Clear enough for people. Structured enough for agents.
tgtg search "release" --account work --json
{
"ok": true,
"schema_version": "2",
"data": [{
"chat_name": "Build room",
"sender_name": "Maya",
"content": "Release is ready…"
}]
}
One command surface
Choose when to talk to Telegram, when to work from SQLite, and when a remote write is allowed. The boundary stays visible in every workflow.
Inspect unread chats, read recent messages, or listen to the stream without storing results locally.
tg inbox --markdown
Sync the chats you need into SQLite, then search and analyze them without reconnecting.
tg sync @team
Send messages and manage groups with explicit commands and a global remote-write switch.
tg config write-access off
The useful parts, close at hand
Use one account or several. Stay online for the live moment, or bring the history home for work that should be fast and repeatable.
inbox · read · listenWatch incoming messages, reply from interactive listen mode, and download attachments as they arrive.
Filter synced messages by keyword, regex, sender, chat, or time range.
tg search "incident" --hours 48
Create incremental, rebuildable chat archives with optional media downloads.
tg archive @team --download-media
Keep authentication sessions and message databases isolated per account.
tg account switch work
Use stable JSON or YAML envelopes, nonzero exits, and explicit error codes in automation.
tg stats --json
members · admins · invites · topicsExplore group state, then use explicit commands for members, settings, invitations, forum topics, and messages.
Built for agent workflows
After interactive account authentication, coding agents can query synced history, read structured results, and target a named account without changing your default.
--account selectiontg.npx skills add https://github.com/will-17173/telegram-cli \
--skill using-telegram-cli
The included skill documents authentication, synchronization, structured querying, and safe write workflows.
Start here
Telegram CLI needs Node.js 22.12.0 or later. Account authentication runs interactively and stores each account session locally.
npm install -g @will-17173/telegram-cli
tg account add
tg status
tg chats
A visible safety boundary
Turn off Telegram mutations globally while keeping online reads and local database commands available. When you need to act, turn access back on intentionally.
tg config write-access off
tg config write-access on
Telegram permissions and rate limits still apply. Large history or media requests may trigger flood waits.