panda-publish

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Social Publish

社交媒体发布

Publish social media posts to connected platforms via the Nosy Pandas API from Claude Code.
通过Claude Code的Nosy Pandas API将社交媒体帖子发布至已关联的平台。

Configuration

配置

Configuration is stored in
~/.pandas
as simple key=value pairs:
api_url=https://nosypandas.com/api
api_key=your-key-here
media_folder=~/social-media
If this file doesn't exist or is missing values, the skill will walk the user through setup:
  1. Ask them to paste their API key (generated from the dashboard under API Keys)
  2. Write
    ~/.pandas
    automatically
The user can also just paste their API key directly in chat at any time — the skill should detect it and offer to save it.
media_folder
is optional and defaults to
~/social-media/
.
配置信息以简单的键值对形式存储在
~/.pandas
文件中:
api_url=https://nosypandas.com/api
api_key=your-key-here
media_folder=~/social-media
如果该文件不存在或缺少必要值,本工具会引导用户完成设置:
  1. 要求用户粘贴其API密钥(可在控制台的API Keys页面生成)
  2. 自动写入
    ~/.pandas
    文件
用户也可以随时在聊天中直接粘贴API密钥,工具会自动检测并提供保存选项。
media_folder
为可选配置,默认值为
~/social-media/

Reading Configuration

读取配置

bash
undefined
bash
undefined

Read config values (use these instead of env vars in all curl commands)

读取配置值(在所有curl命令中使用这些变量而非环境变量)

PANDAS_API_URL="https://nosypandas.com/api" PANDAS_API_KEY=$(grep '^api_key=' ~/.pandas 2>/dev/null | cut -d= -f2-) PANDAS_MEDIA_FOLDER=$(grep '^media_folder=' ~/.pandas 2>/dev/null | cut -d= -f2-) PANDAS_MEDIA_FOLDER="${PANDAS_MEDIA_FOLDER:-$HOME/social-media}"
undefined
PANDAS_API_URL="https://nosypandas.com/api" PANDAS_API_KEY=$(grep '^api_key=' ~/.pandas 2>/dev/null | cut -d= -f2-) PANDAS_MEDIA_FOLDER=$(grep '^media_folder=' ~/.pandas 2>/dev/null | cut -d= -f2-) PANDAS_MEDIA_FOLDER="${PANDAS_MEDIA_FOLDER:-$HOME/social-media}"
undefined

Available Commands

可用命令

CommandDescription
PublishCreate and publish a post to one or more platforms
HistoryView recent posts and their statuses
DetailCheck a specific post's full details
RetryRetry a failed post
DeleteDelete a scheduled or failed post
命令描述
Publish创建并将帖子发布至一个或多个平台
History查看近期帖子及其状态
Detail查看特定帖子的完整详情
Retry重试发布失败的帖子
Delete删除已排期或发布失败的帖子

Publish Flow

发布流程

Follow these steps in order:
按以下步骤依次操作:

Step 0: Permission Setup (first run only)

步骤0:权限设置(仅首次运行)

Check if the user's Claude Code permissions already include the skill's bash patterns:
bash
grep -q "nosypandas.com" ~/.claude/settings.json 2>/dev/null && echo "CONFIGURED" || echo "NOT_CONFIGURED"
If
CONFIGURED
, skip to Step 1.
If
NOT_CONFIGURED
, explain to the user:
Quick setup: This skill runs bash commands to call the Nosy Pandas API, read your config, scan for media files, and move them after posting. By default, Claude Code asks you to approve each one — that's 6-11 prompts every time you publish.
I can add permission patterns to your Claude Code settings (
~/.claude/settings.json
) so these commands auto-approve. The patterns are scoped narrowly:
  • API calls only to
    nosypandas.com
  • Config reads/writes only to
    ~/.pandas
  • File operations only in your
    social-media/
    folder
Want me to set this up?
If the user agrees, read
~/.claude/settings.json
, merge these patterns into the
permissions.allow
array (avoiding duplicates), and write it back:
json
"Bash(cat > ~/.pandas *)",
"Bash(chmod 600 ~/.pandas)",
"Bash(grep * ~/.pandas *)",
"Bash(find * social-media *)",
"Bash(curl * https://nosypandas.com/*)",
"Bash(sleep *)",
"Bash(mkdir -p * social-media/*)",
"Bash(mv * social-media/*)"
If the user declines, proceed normally — they'll just see approval prompts for each command.
检查用户的Claude Code权限是否已包含本工具的bash命令规则:
bash
grep -q "nosypandas.com" ~/.claude/settings.json 2>/dev/null && echo "CONFIGURED" || echo "NOT_CONFIGURED"
如果返回
CONFIGURED
,直接跳至步骤1。
如果返回
NOT_CONFIGURED
,向用户说明:
快速设置: 本工具通过执行bash命令来调用Nosy Pandas API、读取配置、扫描媒体文件并在发布后移动文件。默认情况下,Claude Code会要求您批准每个命令——每次发布可能需要6-11次确认。
我可以将权限规则添加到您的Claude Code设置文件(
~/.claude/settings.json
)中,让这些命令自动获得批准。这些规则的范围被严格限定:
  • 仅允许调用
    nosypandas.com
    的API
  • 仅允许读写
    ~/.pandas
    配置文件
  • 仅允许在
    social-media/
    文件夹中进行文件操作
是否需要我帮您完成设置?
如果用户同意,读取
~/.claude/settings.json
文件,将以下规则合并到
permissions.allow
数组中(避免重复),然后写回文件:
json
"Bash(cat > ~/.pandas *)",
"Bash(chmod 600 ~/.pandas)",
"Bash(grep * ~/.pandas *)",
"Bash(find * social-media *)",
"Bash(curl * https://nosypandas.com/*)",
"Bash(sleep *)",
"Bash(mkdir -p * social-media/*)",
"Bash(mv * social-media/*)"
如果用户拒绝,正常继续流程——用户将看到每个命令的确认提示。

Step 1: Verify Configuration & Fetch Accounts

步骤1:验证配置并获取账号

Read
~/.pandas
and check that
api_key
is present.
If the file doesn't exist or is missing
api_key
:
  1. Ask: "Paste your API key" (tell them to generate one from the dashboard under API Keys)
  2. Write the values to
    ~/.pandas
    :
bash
cat > ~/.pandas << 'EOF'
api_url=https://nosypandas.com/api
api_key=the-pasted-key
media_folder=~/social-media
EOF
chmod 600 ~/.pandas
If the user pastes what looks like an API key without being asked, detect it and offer to save it to
~/.pandas
.
Once config is confirmed, read config and fetch accounts in a single call:
bash
PANDAS_API_KEY=$(grep '^api_key=' ~/.pandas 2>/dev/null | cut -d= -f2-) && \
curl -s "https://nosypandas.com/api/accounts" \
  -H "Authorization: Bearer $PANDAS_API_KEY" \
  -H "Accept: application/json"
Response:
json
{
  "accounts": [
    { "id": 1, "platform": "twitter", "account_name": "@myhandle" },
    { "id": 2, "platform": "bluesky", "account_name": "@me.bsky.social" }
  ]
}
If no accounts are returned, tell the user to connect accounts via the web dashboard.
读取
~/.pandas
文件并检查
api_key
是否存在。
如果文件不存在或缺少
api_key
  1. 询问:"请粘贴您的API密钥"(告知用户可在控制台的API Keys页面生成)
  2. 将值写入
    ~/.pandas
    文件:
bash
cat > ~/.pandas << 'EOF'
api_url=https://nosypandas.com/api
api_key=the-pasted-key
media_folder=~/social-media
EOF
chmod 600 ~/.pandas
如果用户在未被要求的情况下粘贴了类似API密钥的内容,工具会自动检测并提供保存到
~/.pandas
的选项。
配置确认后,读取配置并通过单次调用获取账号信息:
bash
PANDAS_API_KEY=$(grep '^api_key=' ~/.pandas 2>/dev/null | cut -d= -f2-) && \
curl -s "https://nosypandas.com/api/accounts" \
  -H "Authorization: Bearer $PANDAS_API_KEY" \
  -H "Accept: application/json"
响应:
json
{
  "accounts": [
    { "id": 1, "platform": "twitter", "account_name": "@myhandle" },
    { "id": 2, "platform": "bluesky", "account_name": "@me.bsky.social" }
  ]
}
如果未返回任何账号信息,告知用户需通过网页控制台关联账号。

Step 3: Select Platforms

步骤3:选择平台

Show the user their connected accounts as a numbered list and ask which to post to:
Which platforms do you want to post to?
  1. Twitter/X (@myhandle)
  2. Bluesky (@me.bsky.social)
  3. LinkedIn (My Profile)
After selection, show the character limits and media requirements for the selected platforms using the Platform Reference Table below.
将用户已关联的账号以编号列表形式展示,并询问要发布到哪些平台:
您想要发布到哪些平台?
  1. Twitter/X (@myhandle)
  2. Bluesky (@me.bsky.social)
  3. LinkedIn (我的个人主页)
用户选择后,根据下方的平台参考表,展示所选平台的字符限制和媒体要求。

Step 4: Ask for Content

步骤4:请求内容

Ask: "What do you want to post?"
Show character limits for each selected platform so the user knows constraints before writing. If content exceeds a platform's limit and that platform supports threading (Twitter, Threads, Bluesky), note the content will be auto-split into a thread.
If content exceeds LinkedIn's 3000 character hard limit, warn the user and ask them to shorten it.
询问:"您想要发布什么内容?"
展示每个所选平台的字符限制,让用户在撰写内容前了解约束条件。如果内容超过某平台的限制且该平台支持分帖(Twitter、Threads、Bluesky),需说明内容将自动拆分为多帖。
如果内容超过LinkedIn的3000字符硬限制,需警告用户并要求缩短内容。

Step 5: Platform-Specific Fields

步骤5:平台特定字段

  • If YouTube is selected, ask: "What's the video title?" (required, max 500 chars)
  • If Pinterest is selected, ask: "What's the destination URL for this pin?" (required, must be a valid URL)
  • 如果选择了YouTube,询问:"视频标题是什么?"(必填,最多500字符)
  • 如果选择了Pinterest,询问:"此Pin的目标URL是什么?"(必填,必须是有效的URL)

Step 6: Media Selection

步骤6:媒体选择

Scan the configured media folder using
find
:
bash
MEDIA_DIR="${PANDAS_MEDIA_FOLDER:-$HOME/social-media}"
find "$MEDIA_DIR" -maxdepth 1 -type f \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" -o -iname "*.gif" -o -iname "*.webp" -o -iname "*.mp4" -o -iname "*.mov" -o -iname "*.avi" -o -iname "*.webm" \) 2>/dev/null
If files are found, list them (distinguishing images vs videos by extension) and ask which to attach. If no files found, ask: "Do you want to attach any media? Provide a file path, or skip."
Important checks before proceeding:
  • If a selected platform requires media (Instagram, YouTube, Pinterest, TikTok) and no media is attached, warn the user and ask them to provide media.
  • If a selected platform requires video (YouTube, TikTok) and only images are attached, warn the user that video is required.
  • Check media counts against the Platform Reference Table limits below and warn about any violations.
  • If a platform has
    noMix: true
    and both images and videos are selected, warn the user.
  • Accepted file types: jpg, jpeg, png, gif, webp (images); mp4, mov, avi, webm (videos).
使用
find
命令扫描配置的媒体文件夹:
bash
MEDIA_DIR="${PANDAS_MEDIA_FOLDER:-$HOME/social-media}"
find "$MEDIA_DIR" -maxdepth 1 -type f \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" -o -iname "*.gif" -o -iname "*.webp" -o -iname "*.mp4" -o -iname "*.mov" -o -iname "*.avi" -o -iname "*.webm" \) 2>/dev/null
如果找到文件,列出它们(按扩展名区分图片和视频)并询问要附加哪些。如果未找到文件,询问:"是否要附加媒体文件?提供文件路径,或跳过。"
继续操作前的重要检查:
  • 如果所选平台要求媒体(Instagram、YouTube、Pinterest、TikTok)但未附加任何媒体,需警告用户并要求提供媒体文件。
  • 如果所选平台要求视频(YouTube、TikTok)但仅附加了图片,需警告用户该平台要求视频。
  • 根据下方的平台参考表检查媒体数量是否符合限制,并对违规情况发出警告。
  • 如果平台设置了
    noMix: true
    且同时选择了图片和视频,需警告用户。
  • 支持的文件类型:jpg、jpeg、png、gif、webp(图片);mp4、mov、avi、webm(视频)。

Step 7: Schedule or Publish Now

步骤7:立即发布或排期

Ask: "Publish now or schedule for later?"
If scheduling, ask for the date and time. Accept natural language like "tomorrow at 9am" and convert to ISO 8601 format. Also ask for timezone if not obvious.
询问:"立即发布还是排期至稍后发布?"
如果选择排期,询问日期和时间。接受自然语言输入(如"明天上午9点")并转换为ISO 8601格式。如果时区不明确,需询问时区。

Step 8: Confirmation Summary

步骤8:确认摘要

Show a summary with any applicable warnings:
Content: [first 100 chars...]
Media: [count] files ([list filenames])
Platforms: Twitter, Bluesky
Timing: Publish now
Title: [if YouTube]
Link URL: [if Pinterest]

Warnings:
- Twitter: Content will be split into a thread (exceeds 280 chars)
Ask: "Look good? (yes/no)"
展示包含所有适用警告的摘要:
内容:[前100个字符...]
媒体:[数量]个文件([文件名列表])
平台:Twitter、Bluesky
发布时间:立即发布
标题:[如果是YouTube]
链接URL:[如果是Pinterest]

警告:
- Twitter:内容将拆分为多帖(超过280字符限制)
询问:"看起来没问题吗?(是/否)"

Step 9: Execute Post

步骤9:执行发布

This step has two parts: stage media (if any), then create the post.
此步骤分为两部分:暂存媒体(如有),然后创建帖子。

Step 9a: Stage Media, Create Post & Check Status

步骤9a:暂存媒体、创建帖子并检查状态

Run all of media staging, post creation, and status checking in a single bash call. The script stages each file, collects tokens, creates the post, and (if needed) waits 5s to recheck status.
For posts with media:
bash
PANDAS_API_KEY=$(grep '^api_key=' ~/.pandas 2>/dev/null | cut -d= -f2-) && \
PANDAS_API_URL="https://nosypandas.com/api" && \
TOKENS="" && \
for FILE in /path/to/file1.jpg /path/to/file2.png; do \
  RESULT=$(curl -s -X POST "$PANDAS_API_URL/media/stage" \
    -H "Authorization: Bearer $PANDAS_API_KEY" \
    -H "Accept: application/json" \
    -F "file=@$FILE") && \
  T=$(echo "$RESULT" | jq -r '.token') && \
  TOKENS="${TOKENS:+$TOKENS,}\"$T\""; \
done && \
POST_RESULT=$(curl -s -X POST "$PANDAS_API_URL/posts" \
  -H "Authorization: Bearer $PANDAS_API_KEY" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d "{
    \"content\": \"POST_CONTENT\",
    \"platforms\": [ACCOUNT_ID_1, ACCOUNT_ID_2],
    \"publish_now\": true,
    \"media_tokens\": [$TOKENS]
  }") && \
echo "$POST_RESULT" && \
POST_ID=$(echo "$POST_RESULT" | jq -r '.post.id') && \
HAS_PENDING=$(echo "$POST_RESULT" | jq '[.post.platforms[] | select(.status == "pending" or .status == "publishing" or (.status == "failed" and (.error == null or .error == "")))] | length') && \
if [ "$HAS_PENDING" -gt 0 ]; then \
  sleep 5 && \
  curl -s "$PANDAS_API_URL/posts/$POST_ID" \
    -H "Authorization: Bearer $PANDAS_API_KEY" \
    -H "Accept: application/json"; \
fi
For posts without media:
bash
PANDAS_API_KEY=$(grep '^api_key=' ~/.pandas 2>/dev/null | cut -d= -f2-) && \
PANDAS_API_URL="https://nosypandas.com/api" && \
POST_RESULT=$(curl -s -X POST "$PANDAS_API_URL/posts" \
  -H "Authorization: Bearer $PANDAS_API_KEY" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "POST_CONTENT",
    "platforms": [ACCOUNT_ID_1, ACCOUNT_ID_2],
    "publish_now": true
  }') && \
echo "$POST_RESULT" && \
POST_ID=$(echo "$POST_RESULT" | jq -r '.post.id') && \
HAS_PENDING=$(echo "$POST_RESULT" | jq '[.post.platforms[] | select(.status == "pending" or .status == "publishing" or (.status == "failed" and (.error == null or .error == "")))] | length') && \
if [ "$HAS_PENDING" -gt 0 ]; then \
  sleep 5 && \
  curl -s "$PANDAS_API_URL/posts/$POST_ID" \
    -H "Authorization: Bearer $PANDAS_API_KEY" \
    -H "Accept: application/json"; \
fi
Optional fields (add to the JSON when applicable):
  • "title": "VIDEO_TITLE"
    — for YouTube
  • "link_url": "https://example.com"
    — for Pinterest
  • "scheduled_at": "2026-03-16T09:00:00Z"
    — for scheduled posts (omit
    publish_now
    or set to
    false
    )
  • "timezone": "America/New_York"
    — timezone for scheduled posts
Stage response (201):
json
{
  "token": "stg_abc123...",
  "original_filename": "photo.jpg",
  "type": "image",
  "expires_at": "2026-03-16T14:00:00+00:00"
}
Tokens are valid for 2 hours.
Post response (201):
json
{
  "post": {
    "id": 42,
    "content": "Hello world!",
    "status": "published",
    "platforms": [
      { "platform": "twitter", "status": "published", "url": "https://x.com/..." },
      { "platform": "bluesky", "status": "published", "url": "https://bsky.app/..." }
    ]
  }
}
Some platforms (especially Threads) take time to process. The script automatically does one 5-second recheck if any platform has a non-terminal status (
pending
,
publishing
, or
failed
with no error). Do not add additional retries — the server handles verification via background jobs and webhooks.
将媒体暂存、帖子创建和状态检查全部通过单次bash调用完成。脚本会暂存每个文件、收集令牌、创建帖子,并在需要时等待5秒重新检查状态。
对于包含媒体的帖子:
bash
PANDAS_API_KEY=$(grep '^api_key=' ~/.pandas 2>/dev/null | cut -d= -f2-) && \
PANDAS_API_URL="https://nosypandas.com/api" && \
TOKENS="" && \
for FILE in /path/to/file1.jpg /path/to/file2.png; do \
  RESULT=$(curl -s -X POST "$PANDAS_API_URL/media/stage" \
    -H "Authorization: Bearer $PANDAS_API_KEY" \
    -H "Accept: application/json" \
    -F "file=@$FILE") && \
  T=$(echo "$RESULT" | jq -r '.token') && \
  TOKENS="${TOKENS:+$TOKENS,}\"$T\""; \
done && \
POST_RESULT=$(curl -s -X POST "$PANDAS_API_URL/posts" \
  -H "Authorization: Bearer $PANDAS_API_KEY" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d "{
    \"content\": \"POST_CONTENT\",
    \"platforms\": [ACCOUNT_ID_1, ACCOUNT_ID_2],
    \"publish_now\": true,
    \"media_tokens\": [$TOKENS]
  }") && \
echo "$POST_RESULT" && \
POST_ID=$(echo "$POST_RESULT" | jq -r '.post.id') && \
HAS_PENDING=$(echo "$POST_RESULT" | jq '[.post.platforms[] | select(.status == "pending" or .status == "publishing" or (.status == "failed" and (.error == null or .error == "")))] | length') && \
if [ "$HAS_PENDING" -gt 0 ]; then \
  sleep 5 && \
  curl -s "$PANDAS_API_URL/posts/$POST_ID" \
    -H "Authorization: Bearer $PANDAS_API_KEY" \
    -H "Accept: application/json"; \
fi
对于不包含媒体的帖子:
bash
PANDAS_API_KEY=$(grep '^api_key=' ~/.pandas 2>/dev/null | cut -d= -f2-) && \
PANDAS_API_URL="https://nosypandas.com/api" && \
POST_RESULT=$(curl -s -X POST "$PANDAS_API_URL/posts" \
  -H "Authorization: Bearer $PANDAS_API_KEY" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "POST_CONTENT",
    "platforms": [ACCOUNT_ID_1, ACCOUNT_ID_2],
    "publish_now": true
  }') && \
echo "$POST_RESULT" && \
POST_ID=$(echo "$POST_RESULT" | jq -r '.post.id') && \
HAS_PENDING=$(echo "$POST_RESULT" | jq '[.post.platforms[] | select(.status == "pending" or .status == "publishing" or (.status == "failed" and (.error == null or .error == "")))] | length') && \
if [ "$HAS_PENDING" -gt 0 ]; then \
  sleep 5 && \
  curl -s "$PANDAS_API_URL/posts/$POST_ID" \
    -H "Authorization: Bearer $PANDAS_API_KEY" \
    -H "Accept: application/json"; \
fi
可选字段(适用时添加到JSON中):
  • "title": "VIDEO_TITLE"
    — 适用于YouTube
  • "link_url": "https://example.com"
    — 适用于Pinterest
  • "scheduled_at": "2026-03-16T09:00:00Z"
    — 适用于排期帖子(省略
    publish_now
    或设为
    false
  • "timezone": "America/New_York"
    — 排期帖子的时区
暂存响应(201):
json
{
  "token": "stg_abc123...",
  "original_filename": "photo.jpg",
  "type": "image",
  "expires_at": "2026-03-16T14:00:00+00:00"
}
令牌有效期为2小时。
帖子创建响应(201):
json
{
  "post": {
    "id": 42,
    "content": "Hello world!",
    "status": "published",
    "platforms": [
      { "platform": "twitter", "status": "published", "url": "https://x.com/..." },
      { "platform": "bluesky", "status": "published", "url": "https://bsky.app/..." }
    ]
  }
}
部分平台(尤其是Threads)需要时间处理。如果任何平台处于非最终状态(
pending
publishing
或无错误的
failed
),脚本会自动进行一次5秒的重新检查。无需添加额外重试——服务器会通过后台任务和webhooks处理验证。

Step 10: Display Results

步骤10:展示结果

Show the result per platform:
  • Success: "Twitter/X: Published — https://x.com/..."
  • Pending: "LinkedIn: Pending — check back shortly"
  • Failed: "Instagram: Failed — Instagram requires media."
  • Still processing: "Threads: Still processing — check your dashboard for the final status."
按平台展示结果:
  • 成功:"Twitter/X: 已发布 — https://x.com/..."
  • 待处理:"LinkedIn: 待处理 — 请稍后查看"
  • 失败:"Instagram: 发布失败 — Instagram要求附加媒体。"
  • 处理中:"Threads: 处理中 — 请查看控制台获取最终状态。"

Step 11: Move Media

步骤11:移动媒体文件

After successful posting, move all used media files to a
posted/
subfolder in a single call:
bash
MEDIA_DIR="${PANDAS_MEDIA_FOLDER:-$HOME/social-media}" && \
mkdir -p "$MEDIA_DIR/posted/" && \
mv "$MEDIA_DIR/file1.jpg" "$MEDIA_DIR/file2.png" "$MEDIA_DIR/posted/"
List all used files as arguments to a single
mv
command.
发布成功后,将所有使用过的媒体文件通过单次调用移动到
posted/
子文件夹:
bash
MEDIA_DIR="${PANDAS_MEDIA_FOLDER:-$HOME/social-media}" && \
mkdir -p "$MEDIA_DIR/posted/" && \
mv "$MEDIA_DIR/file1.jpg" "$MEDIA_DIR/file2.png" "$MEDIA_DIR/posted/"
将所有使用过的文件作为参数传递给单个
mv
命令。

Post History Flow

帖子历史流程

Fetch recent posts:
bash
curl -s "$PANDAS_API_URL/posts" \
  -H "Authorization: Bearer $PANDAS_API_KEY" \
  -H "Accept: application/json"
Returns paginated posts with platform statuses. Display as a table showing post ID, content preview, status, and platform results.
获取近期帖子:
bash
curl -s "$PANDAS_API_URL/posts" \
  -H "Authorization: Bearer $PANDAS_API_KEY" \
  -H "Accept: application/json"
返回带平台状态的分页帖子。以表格形式展示帖子ID、内容预览、状态和平台结果。

Post Detail Flow

帖子详情流程

Check a specific post's full details:
bash
curl -s "$PANDAS_API_URL/posts/POST_ID" \
  -H "Authorization: Bearer $PANDAS_API_KEY" \
  -H "Accept: application/json"
Response:
json
{
  "post": {
    "id": 42,
    "content": "Hello world!",
    "title": null,
    "status": "published",
    "scheduled_at": null,
    "created_at": "2026-03-15T12:00:00Z",
    "platforms": [
      { "platform": "twitter", "status": "published", "url": "https://x.com/...", "error": null }
    ],
    "media": [
      { "url": "https://cdn.example.com/file.jpg", "type": "image", "filename": "photo.jpg" }
    ]
  }
}
查看特定帖子的完整详情:
bash
curl -s "$PANDAS_API_URL/posts/POST_ID" \
  -H "Authorization: Bearer $PANDAS_API_KEY" \
  -H "Accept: application/json"
响应:
json
{
  "post": {
    "id": 42,
    "content": "Hello world!",
    "title": null,
    "status": "published",
    "scheduled_at": null,
    "created_at": "2026-03-15T12:00:00Z",
    "platforms": [
      { "platform": "twitter", "status": "published", "url": "https://x.com/...", "error": null }
    ],
    "media": [
      { "url": "https://cdn.example.com/file.jpg", "type": "image", "filename": "photo.jpg" }
    ]
  }
}

Retry Flow

重试流程

Retry a failed post:
bash
curl -s -X POST "$PANDAS_API_URL/posts/POST_ID/retry" \
  -H "Authorization: Bearer $PANDAS_API_KEY" \
  -H "Accept: application/json"
Response:
json
{
  "post": {
    "id": 42,
    "status": "pending"
  }
}
Only posts with
failed
status can be retried. If the post is not in a failed state, the API will return a 404.
重试发布失败的帖子:
bash
curl -s -X POST "$PANDAS_API_URL/posts/POST_ID/retry" \
  -H "Authorization: Bearer $PANDAS_API_KEY" \
  -H "Accept: application/json"
响应:
json
{
  "post": {
    "id": 42,
    "status": "pending"
  }
}
仅状态为
failed
的帖子可重试。如果帖子未处于失败状态,API会返回404。

Delete Flow

删除流程

Delete a scheduled or failed post. Only posts with
scheduled
or
failed
status can be deleted — published posts cannot be removed.
删除已排期或发布失败的帖子。仅状态为
scheduled
failed
的帖子可删除——已发布的帖子无法删除。

Step 1: Identify the Post

步骤1:识别帖子

Use the Detail flow to fetch the post and confirm its status is
scheduled
or
failed
. Show the post summary to the user and ask for confirmation:
Are you sure you want to delete this post? Content: [first 100 chars...] Status: scheduled Platforms: Twitter, Bluesky
使用详情流程获取帖子信息并确认其状态为
scheduled
failed
。向用户展示帖子摘要并请求确认:
您确定要删除此帖子吗? 内容:[前100个字符...] 状态:已排期 平台:Twitter、Bluesky

Step 2: Send Delete Request

步骤2:发送删除请求

bash
curl -s -X DELETE "$PANDAS_API_URL/posts/POST_ID" \
  -H "Authorization: Bearer $PANDAS_API_KEY" \
  -H "Accept: application/json"
Response (200):
json
{
  "message": "Post deleted."
}
bash
curl -s -X DELETE "$PANDAS_API_URL/posts/POST_ID" \
  -H "Authorization: Bearer $PANDAS_API_KEY" \
  -H "Accept: application/json"
响应(200):
json
{
  "message": "Post deleted."
}

Step 3: Display Confirmation

步骤3:展示确认信息

Show: "Post #POST_ID has been deleted."
If the API returns 404, the post either doesn't exist or is in a non-deletable status (e.g., published). Inform the user accordingly.
展示:"帖子#POST_ID已被删除。"
如果API返回404,说明帖子不存在或处于不可删除状态(如已发布)。需相应告知用户。

Platform Reference Table

平台参考表

PlatformMax ContentThreadingRequires MediaRequires VideoMax ImagesMax VideosNo Mix
Twitter/X280 charsYesNoNo41Yes
Bluesky300 charsYesNoNo41No
Threads500 charsYesNoNo101No
InstagramNoneNoYesNo101No
LinkedIn3000 charsNoNoNo201No
YouTubeNoneNoYesYes01No
PinterestNoneNoYesNo11Yes
TikTokNoneNoYesYes351Yes
Notes:
  • "Threading" means content exceeding the character limit is auto-split into a thread.
  • "No Mix" means the platform does not allow images and videos in the same post.
  • YouTube requires a
    title
    field (max 500 chars). Pinterest requires a
    link_url
    field.
  • YouTube and TikTok require at least one video file — images alone will be rejected.
  • Accepted file types: jpg, jpeg, png, gif, webp (images); mp4, mov, avi, webm (videos).
平台内容最大长度支持分帖要求媒体要求视频最大图片数最大视频数不可混合
Twitter/X280字符41
Bluesky300字符41
Threads500字符101
Instagram无限制101
LinkedIn3000字符201
YouTube无限制01
Pinterest无限制11
TikTok无限制351
说明:
  • "支持分帖"指内容超过字符限制时会自动拆分为多帖。
  • "不可混合"指该平台不允许在同一帖子中同时包含图片和视频。
  • YouTube要求
    title
    字段(最多500字符)。Pinterest要求
    link_url
    字段。
  • YouTube和TikTok要求至少一个视频文件——仅图片会被拒绝。
  • 支持的文件类型:jpg、jpeg、png、gif、webp(图片);mp4、mov、avi、webm(视频)。

Error Handling

错误处理

StatusMeaningRecovery
401Invalid API keyCheck
api_key
in
~/.pandas
is correct
403Subscription requiredSubscribe at the dashboard
404Post not found or not retryableVerify the post ID and that its status is
failed
422Validation errorShow the specific error messages from the response body and help the user fix them
500Server errorTry again later
状态码含义恢复方法
401API密钥无效检查
~/.pandas
中的
api_key
是否正确
403需要订阅在控制台订阅服务
404帖子不存在或不可重试验证帖子ID及其状态是否为
failed
422验证错误展示响应体中的具体错误信息并帮助用户修复
500服务器错误稍后重试