Setup & Installation
clawhub install telegram-cliOr with OpenClaw CLI:
openclaw skills install telegram-cliWhat This Skill Does
Telegram cli is a Productivity & Workflow skill that cLI tool for Telegram via MTProto. Send/read messages, manage groups, search conversations, download media, and automate Telegram workflows. Use when the task involves any Telegram account interaction..
Source & Trust
- Repository: https://github.com/baontq23/node-telegram-cli
- npm: https://www.npmjs.com/package/node-telegram-cli (published with provenance)
- Credentials are stored securely via OS Keychain (macOS Keychain / Windows Credential Manager / Linux Secret Service), not in plaintext files
Installation
- Requires Node.js >= 20
- Install globally:
npm install -g node-telegram-cli - Verify:
ntg --version - Run
ntg loginonce โ interactive, requires phone number + OTP code from Telegram
Critical Rule: Always Use JSON Mode
- Add
--jsonflag to every command for machine-readable output --jsonis a global flag โ place it before or after the subcommand- Example:
ntg --json inbox,ntg --json search @user "keyword"
Peer Format
@usernameโ most reliable, e.g.@johndoe- Phone number โ for contacts without username, e.g.
+84901234567 meโ your own Saved Messages- Chat title โ group/channel name in quotes, e.g.
"My Group"
Read Commands (No Side Effects)
ntg --json inboxโ list recent conversationsntg --json inbox --unreadโ only unread conversationsntg --json inbox --privateโ only private 1-on-1 chatsntg --json inbox --unread --privateโ combine filtersntg --json inbox --chat <peer> --limit <n>โ messages from a specific chatntg --json search <peer> "keyword"โ search in a specific chatntg --json global-search "keyword"โ search across all chatsntg --json chat-info <chat>โ show group/channel info
Write Commands (Has Side Effects)
ntg msg <peer> "text"โ send a text messagentg msg <peer> "text" --silentโ send silently (no notification sound)ntg fwd <user> <msgId>โ forward a message by IDntg mark-read <peer>โ mark all messages as readntg delete-msg <msgId>โ delete a messagentg send-photo <peer> <file>โ send a photontg send-video <peer> <file>โ send a videontg send-file <peer> <file>โ send a text file as plain messagesntg download <msgId> --chat <peer>โ download media from a messagentg download <msgId> --chat <peer> --type <type>โ specify media type (photo, video, audio, doc)ntg view <msgId> --chat <peer>โ download and open with system viewerntg clean-downloadsโ delete all downloaded media files
Group Management
ntg create-group "Topic" @user1 @user2โ create a new groupntg chat-add <chat> <user>โ add a user to a groupntg chat-kick <chat> <user>โ remove a user from a groupntg chat-rename <chat> "New Name"โ rename a groupntg chat-set-photo <chat> <file>โ set group photo
Contact Management
ntg add-contact <phone> <firstName> <lastName>โ add a contactntg rename-contact <user> <firstName> <lastName>โ rename a contact
JSON Output Schemas
Inbox (conversation list)
nameโ contact/chat display namepeerโ identifier to use as<peer>argumentpeerTypeโ "username" | "phone" | "id"typeโ "user" | "group" | "channel"unreadCountโ number of unread messageslastMessageโ text/caption (empty string if media-only)lastMessageIdโ use withntg download <id>for mediamediaTypeโ "photo" | "video" | "document" | "audio" | "voice" | "sticker" | "location" | "contact" | "poll" | nulldateโ ISO 8601 timestamp
Chat messages (inbox --chat)
idโ message IDdateโ ISO 8601 timestampsenderโ sender display nametextโ message text/captionmediaTypeโ same values as aboveisOutgoingโ true if sent by you
Error Handling
- Exit code
0= success - Exit code
1= error (not logged in, peer not found, etc.) - If not logged in, commands fail with: "Not logged in. Run ntg login first."
Important Notes
- Do NOT use
ntg chat <peer>โ it is interactive, blocks stdin, not suitable for automation - Session persists until
ntg logoutis called โ no re-login needed between commands - Downloaded files are saved to
~/.telegram-cli/downloads/ - Always specify
--chat <peer>when downloading media to identify the source chat
Version History
Latest version: 1.0.5
First published: Mar 23, 2026. Last updated: Mar 23, 2026.
1 version released.
Frequently Asked Questions
Is Telegram cli free to use?
Yes. Telegram cli is a free, open-source skill available on the OpenClaw Skills Registry.
What platforms does Telegram cli support?
It runs on any platform that supports OpenClaw, including macOS, Linux, and Windows.