技能
- 作者仓库星标 1,952
- 作者仓库 instagram-cli
- 领域
- 通用
- 作者声明的智能体
- 未找到明确声明;不据此推断已兼容或已测试
- 静态检查
- 88 / 100 · 启发式扫描,不代表运行安全
- 运行环境证据
- 未执行;当前没有隔离运行测试证据
- 作者 / 版本 / 许可证
- @supreme-gg-gg · 未声明许可证
- 上下文用量评级
- 低消耗
- 接入复杂程度
- 即装即用
- 是否需要外部接口密钥
- 不需要
- 兼容的系统
- 未声明(默认跨平台)
- 运行环境要求
- 未检出明确要求
- 检测到的文件与系统行为
-
- 只读
- 网络行为
- 仅限本地
- 安装命令数
- 无(仅作为资料)
需要注意: 未声明工具权限范围;实际权限由运行环境决定。
{ "ok": true, "data": { ... } }
{ "ok": false, "error": "message" }
# Instagram CLI — Agent Usage Guide
Instagram CLI (`instagram-cli`) is a terminal client for Instagram. For agents, it exposes
**one-turn commands** that print to stdout and exit — perfect for scripting and tool-use.
> All one-turn commands require the user to already be logged in (`instagram-cli auth login`).
> If a command returns an auth error, prompt the user to log in first. Do not attempt to login using the CLI by yourself.
---
## Thread Resolution
Every command that targets a thread accepts a `<thread>` argument resolved in this order:
1. **Thread ID** (20+ digit number like `340282366920938463...`) — direct, zero extra API calls
2. **Username** — exact Instagram username (e.g. `johndoe`)
3. **Thread title** — fuzzy search across inbox (e.g. `"Book Club"`)
**Best practice for multi-step workflows:** call `inbox --output json` first to get thread IDs,
then pass those IDs directly to subsequent commands. This avoids redundant search API calls and
is more reliable than username/title matching.
---
## JSON Output
All commands accept `-o json` / `--output json`. Responses follow this envelope:
```json
{ "ok": true, "data": { ... } }
{ "ok": false, "error": "message" }
```
Always use `--output json` when you need to parse results programmatically.
---
## Commands
### List inbox
```bash
instagram-cli inbox [--limit <n>] [--output json]
```
Returns recent threads. Each thread includes: `id`, `title`, `users`, `lastMessage`, `lastActivity`, `unread`.
```bash
# Get 10 most recent threads as JSON
instagram-cli inbox --limit 10 --output json
```
### Search threads
```bash
instagram-cli inbox --search <query> [--limit <n>] [--output json]
```
Searches by both username and thread title, merging results by relevance score.
```bash
instagram-cli inbox --search "alice" --output json
```
### Send a message
```bash
instagram-cli send <thread> --text <message> [--output json]
instagram-cli send <thread> --file <path> [--type photo|video] [--output json]
```
`<thread>` is a thread ID, username, or title. `--text` and `--file` are mutually exclusive.
Media type is auto-detected from extension; use `--type` to override.
```bash
instagram-cli send johndoe --text "Hey, are you free tonight?"
instagram-cli send 340282366920938463123456789 --text "Got it!"
instagram-cli send "Book Club" --file ./photo.jpg --output json
```
### Read messages
```bash
instagram-cli read <thread> [--limit <n>] [--cursor <cursor>] [--mark-seen] [--output json]
```
Returns messages newest-first. Use `cursor` from the previous response to paginate older messages.
Pass `--mark-seen` to mark the thread as read after fetching.
```bash
instagram-cli read johndoe --limit 20 --output json
instagram-cli read 340282366920938463123456789 --mark-seen
```
Each message in JSON output includes: `id`, `itemType`, `text`, `userId`, `username`, `timestamp`, `isOutgoing`.
### Download media from a message
```bash
instagram-cli read <thread> --message-id <id> --download <path> [--output json]
```
Finds the message by ID (paginates up to `--max-pages`, default 10) and saves the media file.
The file extension is automatically inferred if not provided.
```bash
instagram-cli read johndoe --message-id 340282366... --download ./media
```
### Reply to a message
```bash
instagram-cli reply <thread> --message-id <id> --text <text> [--output json]
```
Sends a threaded reply to a specific message.
```bash
instagram-cli reply johndoe --message-id 340282366... --text "Totally agree!"
```
### Unsend a message
```bash
instagram-cli unsend <thread> --message-id <id> [--output json]
```
```bash
instagram-cli unsend johndoe --message-id 340282366...
```
---
## Multi-Account Support
All commands accept `-u <username>` / `--username <username>` to target a specific logged-in account.
Omitting it uses the default account set via `instagram-cli auth switch`.
```bash
instagram-cli inbox -u myworkaccount --output json
instagram-cli send johndoe --text "Hi" -u mypersonalaccount
```
---
## Typical Agent Workflow
```bash
# 1. Get inbox to find the right thread
INBOX=$(instagram-cli inbox --output json --limit 20)
# Parse "id" fields from INBOX to find the target thread
# 2. Read recent messages (use thread ID for speed)
THREAD_ID="340282366920938463..."
instagram-cli read "$THREAD_ID" --limit 10 --output json
# 3. Reply or send
instagram-cli send "$THREAD_ID" --text "On my way!" --output json
# 4. Mark as seen
instagram-cli read "$THREAD_ID" --mark-seen
```
---
## Error Handling
- **Auth errors** → user needs to run `instagram-cli auth login`
- **"No thread found matching"** → the username/title didn't resolve; try `inbox --search` first
- **`"ok": false`** in JSON output → the `error` field contains the reason
- Rate limits / network errors are surfaced as error messages; retry with backoff if needed
章节与文件索引
按说明文件中的顺序排列。
线程分辨率
JSON 输出
列出收件箱
搜索主题
发送消息
文件/命令 -> instagram-cli · instagram-cli auth login · <thread> · 340282366920938463... · johndoe · "Book Club" · inbox --output json · -o json
内容校验值 -> 7ab8bb154bee
当前原文的自动摘译,尚未人工审校。
线程分辨率
每个针对线程的命令都接受按以下顺序解析的
<thread>参数: 线程 ID(20+ 位数字,如340282366920938463...) - 直接,零额外 API 调用 用户名 - 准确的 Instagram 用户名(例如johndoe) 线程标题 - 整个收件箱中的模糊搜索(例如"Book Club") 多步骤工作流程的最佳实践:首先调用inbox --output json获取线程 ID,JSON 输出
所有命令均接受
-o json/--output json。响应遵循以下信封:当您需要以编程方式解析结果时,始终使用--output json。列出收件箱
返回最近的线程。每个线程包括:
id、title、users、lastMessage、lastActivity、unread。搜索主题
按用户名和话题标题搜索,按相关性得分合并结果。
发送消息
<thread>是线程 ID、用户名或标题。--text和--file是互斥的。分机自动检测媒体类型;使用--type覆盖。