node-telegram-cli

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.

3,891 stars

Best use case

node-telegram-cli is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

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.

Teams using node-telegram-cli should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/telegram-cli/SKILL.md --create-dirs "https://raw.githubusercontent.com/openclaw/skills/main/skills/baontq23/telegram-cli/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/telegram-cli/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How node-telegram-cli Compares

Feature / Agentnode-telegram-cliStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

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.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

### Source & Trust

1. Repository: https://github.com/baontq23/node-telegram-cli
2. npm: https://www.npmjs.com/package/node-telegram-cli (published with provenance)
3. Credentials are stored securely via OS Keychain (macOS Keychain / Windows Credential Manager / Linux Secret Service), not in plaintext files

### Installation

1. Requires Node.js >= 20
2. Install globally: `npm install -g node-telegram-cli`
3. Verify: `ntg --version`
4. Run `ntg login` once — interactive, requires phone number + OTP code from Telegram

### Critical Rule: Always Use JSON Mode

1. Add `--json` flag to every command for machine-readable output
2. `--json` is a global flag — place it before or after the subcommand
3. Example: `ntg --json inbox`, `ntg --json search @user "keyword"`

### Peer Format

1. `@username` — most reliable, e.g. `@johndoe`
2. Phone number — for contacts without username, e.g. `+84901234567`
3. `me` — your own Saved Messages
4. Chat title — group/channel name in quotes, e.g. `"My Group"`

### Read Commands (No Side Effects)

1. `ntg --json inbox` — list recent conversations
2. `ntg --json inbox --unread` — only unread conversations
3. `ntg --json inbox --private` — only private 1-on-1 chats
4. `ntg --json inbox --unread --private` — combine filters
5. `ntg --json inbox --chat <peer> --limit <n>` — messages from a specific chat
6. `ntg --json search <peer> "keyword"` — search in a specific chat
7. `ntg --json global-search "keyword"` — search across all chats
8. `ntg --json chat-info <chat>` — show group/channel info

### Write Commands (Has Side Effects)

1. `ntg msg <peer> "text"` — send a text message
2. `ntg msg <peer> "text" --silent` — send silently (no notification sound)
3. `ntg fwd <user> <msgId>` — forward a message by ID
4. `ntg mark-read <peer>` — mark all messages as read
5. `ntg delete-msg <msgId>` — delete a message
6. `ntg send-photo <peer> <file>` — send a photo
7. `ntg send-video <peer> <file>` — send a video
8. `ntg send-file <peer> <file>` — send a text file as plain messages
9. `ntg download <msgId> --chat <peer>` — download media from a message
10. `ntg download <msgId> --chat <peer> --type <type>` — specify media type (photo, video, audio, doc)
11. `ntg view <msgId> --chat <peer>` — download and open with system viewer
12. `ntg clean-downloads` — delete all downloaded media files

### Group Management

1. `ntg create-group "Topic" @user1 @user2` — create a new group
2. `ntg chat-add <chat> <user>` — add a user to a group
3. `ntg chat-kick <chat> <user>` — remove a user from a group
4. `ntg chat-rename <chat> "New Name"` — rename a group
5. `ntg chat-set-photo <chat> <file>` — set group photo

### Contact Management

1. `ntg add-contact <phone> <firstName> <lastName>` — add a contact
2. `ntg rename-contact <user> <firstName> <lastName>` — rename a contact

### JSON Output Schemas

#### Inbox (conversation list)

1. `name` — contact/chat display name
2. `peer` — identifier to use as `<peer>` argument
3. `peerType` — "username" | "phone" | "id"
4. `type` — "user" | "group" | "channel"
5. `unreadCount` — number of unread messages
6. `lastMessage` — text/caption (empty string if media-only)
7. `lastMessageId` — use with `ntg download <id>` for media
8. `mediaType` — "photo" | "video" | "document" | "audio" | "voice" | "sticker" | "location" | "contact" | "poll" | null
9. `date` — ISO 8601 timestamp

#### Chat messages (inbox --chat)

1. `id` — message ID
2. `date` — ISO 8601 timestamp
3. `sender` — sender display name
4. `text` — message text/caption
5. `mediaType` — same values as above
6. `isOutgoing` — true if sent by you

### Error Handling

1. Exit code `0` = success
2. Exit code `1` = error (not logged in, peer not found, etc.)
3. If not logged in, commands fail with: "Not logged in. Run ntg login first."

### Important Notes

1. Do NOT use `ntg chat <peer>` — it is interactive, blocks stdin, not suitable for automation
2. Session persists until `ntg logout` is called — no re-login needed between commands
3. Downloaded files are saved to `~/.telegram-cli/downloads/`
4. Always specify `--chat <peer>` when downloading media to identify the source chat

Related Skills

node-red-manager

3891
from openclaw/skills

Manage Node-RED instances via Admin API or CLI. Automate flow deployment, install nodes, and troubleshoot issues. Use when user wants to "build automation", "connect devices", or "fix node-red".

DevOps & Infrastructure

jqopenclaw-node-invoker

3891
from openclaw/skills

统一通过 Gateway 的 node.invoke 调用 JQOpenClawNode 能力(file.read、file.write、process.exec、process.manage、system.run、process.which、system.info、system.screenshot、system.notify、system.clipboard、system.input、node.selfUpdate)。当用户需要远程文件读写、文件移动/删除、目录创建/删除、进程管理(列表/搜索/终止)、远程进程执行、命令可执行性探测、系统信息采集、截图采集、系统弹窗、系统剪贴板读写、输入控制(鼠标/键盘)、节点自更新、节点命令可用性排查或修复 node.invoke 参数错误时使用。

DevOps & Infrastructure

Telegram Bot间群聊通信技能

3891
from openclaw/skills

**创建时间**: 2026-02-20 11:03 UTC+8

Communication

Telegram Shop Bot Developer - Python

3891
from openclaw/skills

I develop fully-featured Telegram shop bots using Python. My bots manage products, orders, and customers professionally.

OpenClaw Connect Enterprise — Node 节点

3891
from openclaw/skills

**版本**: 0.1.5

telegram-groupchat-setup

3891
from openclaw/skills

Configure a MoltBot agent to participate in a Telegram group chat. Automates adding the group to the allowlist, setting mention patterns, and configuring sender permissions — all via a single gateway config patch. Use when the user wants to set up their bot in a Telegram group, enable cross-bot communication, or configure group mention gating.

eth-node

3891
from openclaw/skills

Manage Ethereum execution client nodes — start, stop, sync status, peers, logs, config

telegram-business

3891
from openclaw/skills

Telegram bot for business automation — lead capture forms, inline keyboard menus, FAQ matching, appointment booking flows, and payment integration. Use for building customer-facing Telegram bots, community management, and lead generation.

linode

3891
from openclaw/skills

Linode (Akamai) — compute instances, volumes, networking, NodeBalancers, domains, and Kubernetes.

meganode-skill

3891
from openclaw/skills

Provides NodeReal MegaNode blockchain infrastructure APIs for 25+ chains including BSC, Ethereum, opBNB, Optimism, Polygon, Arbitrum, and Klaytn. Covers standard JSON-RPC endpoints, Enhanced APIs (nr_ methods for ERC-20 token balances, NFT holdings, asset transfers), MegaFuel gasless transactions via BEP-322 paymaster, Direct Route MEV protection, Debug/Trace APIs, WebSocket subscriptions, ETH Beacon Chain consensus layer, Portal API usage monitoring, API Marketplace (NFTScan, Contracts API, SPACE ID, Greenfield, BNB Staking, PancakeSwap, zkSync), non-EVM chains (Aptos, NEAR, Avalanche), and JWT authentication. Use when building blockchain dApps with NodeReal, querying token or NFT data, setting up RPC infrastructure, configuring gasless transactions, protecting against MEV, tracing transactions, verifying smart contracts, resolving .bnb domains, or monitoring validators and API usage.

🦞 Telegram 跨实例通信指南

3891
from openclaw/skills

让龙虾之间能准确聊天、艾特、跨 bot 通信。

Telegram Marketing Audit Command Handler Skill

3891
from openclaw/skills

## Purpose