🎁 福利专区全网大模型免费应用 + 新用户福利 + 注册活动入口,低成本玩转 AI

社媒定时发布助手 gitroomhq/postiz-agent

DeepSeek Harnessv2.0.26
gitroomhq4 天前有提交已提供中文文档扫描:高危

用智能体定时发布帖子到: ChatGPT · Claude · Claude Cowork · Claude Code…

69.7/100
综合分
558
GitHub 星标
3,020
npm 周下载
—/5
用户评分

数据截至 2026/10/30 · 周下载取自 npm 全网(含 CI / 镜像),非本站安装数;综合分由星标、活跃度与兼容性检查合成。

自动兼容检查未通过:engines.node 要求 22.23.4,不满足 Node 22.19.0。以下命令仍可尝试,但可能失败。
安装命令 · 需先装 dsh CLI 引擎
dsh plugin --profile web add gitroomhq/postiz-agent
该包不可直接 npm 安装,改从 GitHub 源安装(明细见下方安装检查)

状态速览

判定依据:实装验证 · 静态安装检查 · 自动扫描 · 仓库维护状态
信任档位:已验证
是什么
dsh 原生插件 · tool
装得上吗
本站已在 dsh 0.2.1-rc.2 下真实安装成功
非静态推断
L4 · 真实安装等级说明 →
安全吗
本站尚未对该插件做风险分级
暂未覆盖,不等同于无风险
还在维护吗
活跃:最近一次提交在 4 天前
档位由哪些信号合成

本站实装验证(真实安装 L4 覆盖全站;L5 为运行时冒烟或实机截图,覆盖范围小于 L4) · 验证所用 dsh 版本 · 静态安装检查 · 风险分级 · 仓库维护状态。 下方各区块是它的证据明细。

验证判据与等级说明 →
社区实装还没有人打卡 · 装过的第一个就是你
安装兼容性检查需源码安装

engines.node 要求 22.23.4,不满足 Node 22.19.0

展开查看检查明细 ↓

以下结论由程序自动检查 npm 包、engines 声明与入口文件得出,未做人工实机验证——能装不等于用着没问题。

✓npm 包postiz @ 2.0.26
✗Node 引擎要求 22.23.4 · 基线 Node 22.19 不满足
✓dsh CLI 依赖未声明 dsh 版本约束
✓入口文件main/exports/bin 已声明

源码安装时若 pnpm 拦截 prepare 脚本,按其提示在 pnpm-workspace.yaml 的 allowBuilds 中放行后重跑。

验证方式:npm registry 存在性 + package.json 静态校验 · 最后检查 2026/10/29 01:38:55

🔴 安全扫描发现高危能力自动 · 静态分析源码
v2.7.0
🔴 扫描:高危尚无人工评估

静态扫描发现安装期即执行代码,或命令参数由运行时变量拼接(参数来源无法静态判定,从严处理)。

命令参数由运行时变量拼接读写/删除本地文件读取剪贴板或密钥环境变量发起外部网络请求
查看扫描证据(共 48 处,展示前 31 条)
  • 读取密钥环境变量
    server/index.ts:10
    const CLIENT_SECRET = process.env.POSTIZ_OAUTH_CLIENT_SECRET!;
  • 发起网络请求
    server/index.ts:206
    const tokenResponse = await fetch(`${API_URL}/oauth/token`, {
  • 发起网络请求
    server/index.ts:206
    const tokenResponse = await fetch(`${API_URL}/oauth/token`, {
  • 发起网络请求
    src/api.ts:26
    const response = await fetch(url, {
  • 发起网络请求
    src/api.ts:26
    const response = await fetch(url, {
  • 发起网络请求
    src/api.ts:43
    return this.request('/public/v1/posts', {
  • 发起网络请求
    src/api.ts:63
    return this.request(endpoint, {
  • 发起网络请求
    src/api.ts:69
    return this.request(`/public/v1/posts/${id}`, {
  • 发起网络请求
    src/api.ts:79
    return this.request(
  • 读取本地文件
    src/commands/auth.ts:19
    if (!existsSync(CREDENTIALS_FILE)) return null;
  • 读取本地文件
    src/commands/auth.ts:20
    const data = JSON.parse(readFileSync(CREDENTIALS_FILE, 'utf-8'));
  • 读取本地文件
    src/commands/auth.ts:29
    if (!existsSync(CREDENTIALS_DIR)) {
  • 写入本地文件
    src/commands/auth.ts:30
    mkdirSync(CREDENTIALS_DIR, { recursive: true, mode: 0o700 });
  • 写入本地文件
    src/commands/auth.ts:32
    writeFileSync(CREDENTIALS_FILE, JSON.stringify(credentials, null, 2), { encoding: 'utf-8', mode: 0o600 });
  • 写入本地文件
    src/commands/auth.ts:34
    chmodSync(CREDENTIALS_FILE, 0o600);
  • 读取本地文件
    src/commands/auth.ts:38
    if (existsSync(CREDENTIALS_FILE)) {
  • 删除本地文件
    src/commands/auth.ts:39
    unlinkSync(CREDENTIALS_FILE);
  • 执行外部命令运行时拼接
    src/commands/auth.ts:48
    exec(`open "${url}"`);
  • 执行外部命令运行时拼接
    src/commands/auth.ts:50
    exec(`start "" "${url}"`);
  • 执行外部命令运行时拼接
    src/commands/auth.ts:52
    exec(`xdg-open "${url}"`);
  • 发起网络请求
    src/commands/auth.ts:73
    const response = await fetch(`${authServer}/device/code`, {
  • 发起网络请求
    src/commands/auth.ts:73
    const response = await fetch(`${authServer}/device/code`, {
  • 发起网络请求
    src/commands/auth.ts:114
    const response = await fetch(`${authServer}/device/token`, {
  • 发起网络请求
    src/commands/auth.ts:114
    const response = await fetch(`${authServer}/device/token`, {
  • 读取密钥环境变量
    src/commands/auth.ts:171
    const envKey = process.env.POSTIZ_API_KEY;
  • 发起网络请求
    src/commands/auth.ts:203
    const response = await fetch(`${apiUrl}/public/v1/integrations`, {
  • 发起网络请求
    src/commands/auth.ts:203
    const response = await fetch(`${apiUrl}/public/v1/integrations`, {
  • 读取本地文件
    src/commands/posts.ts:60
    if (!existsSync(jsonPath)) {
  • 读取本地文件
    src/commands/posts.ts:64
    const jsonContent = readFileSync(jsonPath, 'utf-8');
  • 读取本地文件
    src/commands/upload.ts:15
    const fileBuffer = readFileSync(args.file);
  • 读取密钥环境变量
    src/config.ts:15
    const apiKey = process.env.POSTIZ_API_KEY;
扫描于 2026/11/3(0 天前) · 范围 全包扫描(包内未声明入口) · 来源 GitHub 仓库

静态扫描只反映源码中出现的调用,不构成安全背书;人工评估与自动扫描相互独立、互不覆盖。

给这个插件打分还没有人投票↓
用户评分
还没有人投票,来当第一个

功能亮点

  • 定时发布社交媒体帖子
  • 接入智能体命令行

Postiz Agents 命令行——接上 Claude / OpenClaw 等,就能定时发社交媒体帖子 🤖

v2.0.262026-10-20
· 新增 · upload --adjust - 按平台限制调整上传的文件(视频缩放到 1080p 并重新编码为 H.264 MP4、AAC 音频,过大的图片缩小)。默认关闭。用返回的路径发布帖子前,先等 media:status 返回 ready,否则帖子会用原始文件。 · media:status - 通过 GET /public/v1/media/:id/status 检查用 --adjust 上传的文件:调整后的文件就位前为 processing,就位后为 ready,调整失败并保留原文件时为 ready 并带警告。
v2.0.252026-10-15
· 已更改 · README.md:补充 media:list 的说明(媒体章节、API 端点表和快速参考),并新增 CONTRIBUTING.md,内含拉取请求检查清单(版本号更新、变更日志条目、文档和发布步骤),README 中已链接到该文件。
v2.0.242026-10-15
· 已修复 · npm 发布工作流:pnpm publish 发布后会立刻把 package.json 里的 publish 脚本当作生命周期钩子执行,结果触发了第二次发布,报 E409 失败。脚本已改名为 publish-cli(文档同步更新),工作流现在只发布一次。 · 已变更 · PUBLISHING.md:发布步骤里加上了 gh release create 命令。
数据来自仓库的 GitHub Release,可能与插件实际版本不一致。

README

由 DeepSeek 最新模型翻译生成
用智能体定时发布帖子到: ChatGPT · Claude · Claude Cowork · Claude Code · Codex · Cursor · OpenClaw · Hermes Agent · Grok Bot · Grok Build · Muse · Perplexity Computer · nanoclaw · Paperclip · MCP Server · AI Agents CLI 安装为技能 npx skills add gitroomhq/postiz-agent Claude Code 插件 /plugin marketplace add gitroomhq/postiz-agent /plugin install postiz@postiz-agent Grok Build 插件 Postiz 已收录在 xAI 插件市场里,你可以在 Grok Build 内从市场安装。本仓库也自带 .grok-plugin/plugin.json 清单和 .grok-plugin/marketplace.json 目录,因此可以直接作为市场源添加。
展开完整文档(README 剩余 1 节)
用智能体定时发布帖子到: ChatGPT · Claude · Claude Cowork · Claude Code · Codex · Cursor · OpenClaw · Hermes Agent · Grok Bot · Grok Build · Muse · Perplexity Computer · nanoclaw · Paperclip · MCP Server · AI Agents CLI

安装为技能

npx skills add gitroomhq/postiz-agent

Claude Code 插件

/plugin marketplace add gitroomhq/postiz-agent
/plugin install postiz@postiz-agent

Grok Build 插件

Postiz 已收录在 xAI 插件市场里,你可以在 Grok Build 内从市场安装。本仓库也自带 .grok-plugin/plugin.json 清单和 .grok-plugin/marketplace.json 目录,因此可以直接作为市场源添加。

Grok 插件还通过 .grok-plugin/plugin.json 里的 mcpServers 字段,打包了托管版 Postiz MCP 服务器(https://mcp.postiz.com/mcp-oauth-dynamic)。首次连接时会要求你登录 Postiz,无需 token,也无需本地安装。Claude Code 和 Cursor 插件只提供技能和命令行,不注册 MCP 服务器。

Cursor 插件

本仓库在 .cursor-plugin/plugin.json 提供了 Cursor 插件清单。

- 从市场 / Customize 面板安装: 打开 Cursor 侧边栏的 Customize,找到 postiz,选择 Install(项目级或用户级)。
- 本地安装(开发用):

git clone https://github.com/gitroomhq/postiz-agent.git
ln -s "$(pwd)/postiz-agent" ~/.cursor/plugins/local/postiz

然后重启 Cursor,或运行 Developer: Reload Window。

插件提供 postiz 技能,由它驱动 postiz 命令行(命令行负责上传媒体,发布图片和视频帖子必须用到)。让智能体发帖之前,请先装好命令行(npm install -g postiz)并完成认证(postiz auth:login 或 export POSTIZ_API_KEY=...)。

Gemini CLI 扩展

本仓库是 Gemini CLI 扩展(根目录下有 gemini-extension.json),已收录进扩展画廊。
gemini extensions install https://github.com/gitroomhq/postiz-agent

这条命令会安装 postiz 技能和托管的 Postiz MCP 服务器(https://mcp.postiz.com/mcp-oauth-dynamic)。首次使用时,Gemini CLI 会打开浏览器让你登录 Postiz;要重新认证,运行 /mcp auth postiz。该技能通过 postiz 命令行上传媒体,所以发图片或视频帖之前,先执行 npm install -g postiz 把它装上。

Qwen Code

Qwen Code 直接安装 Claude Code 市场,不需要单独的清单文件:

qwen extensions install gitroomhq/postiz-agent:postiz

DeepSeek Harness 插件

本仓库在 plugins/dsh-postiz 提供一个 DeepSeek Harness(dsh)插件包。它把智能体连接到托管的 Postiz MCP 服务器,并注册 postiz 工作流技能。

dsh plugin --profile web add "github:gitroomhq/postiz-agent#path:/plugins/dsh-postiz"
export POSTIZ_API_KEY=your-api-key # Postiz → Settings → Developers → Public API
dsh web

之后 Postiz 工具会以 mcp__postiz__ 的形式出现(integrationList、integrationSchema、schedulePostTool 等)。自托管实例需要覆盖 postiz 这一行的 baseUrl。配置说明见插件 README。

Postiz CLI

面向 AI 智能体的社交媒体自动化命令行 —— 用程序在 28+ 个平台上定时发帖。

Postiz CLI 提供一套命令行接口,对接 Postiz API,让开发者和 AI 智能体自动发帖、管理内容、上传媒体,覆盖 Twitter/X、LinkedIn、Reddit、YouTube、TikTok、Instagram、Facebook 等平台。

安装

从 npm 安装(推荐)

npm install -g postiz
or
pnpm install -g postiz

认证

方式一:OAuth2(推荐)

用设备码流程认证 —— 不需要 client ID 或 secret:

postiz auth:login

它会:
1. 在终端显示一次性验证码
2. 打开浏览器让你授权
3. 自动把凭据保存到 ~/.postiz/credentials.json

Check current auth status (verifies credentials are still valid)
postiz auth:status

Remove stored credentials
postiz auth:logout

自托管认证服务器

默认情况下,postiz auth:login 使用托管在 cli-auth.postiz.com 的认证服务器。如果你想自托管 OAuth2 设备码流程服务器,请按 server/SERVER.md 里的指南操作。

方式二:API Key

export POSTIZ_API_KEY=your_api_key_here

可选: 自定义 API 端点

export POSTIZ_API_URL=https://your-custom-api.com

注意: 两者同时存在时,OAuth2 凭据优先于 API Key。

命令

发现与设置

列出所有已连接的集成 postiz integrations:list postiz integrations:list --group "customer-id" 返回集成 ID、服务商名称和元数据。用 --group 只返回分配给特定分组(客户)的渠道。

列出所有分组(客户) postiz integrations:groups

返回你所在组织的所有分组(客户),格式为 {id, name}。把分组的 id 传给 integrations:list --group,即可筛选渠道。

获取集成设置 schema postiz integrations:settings <integration-id>

返回字符数限制、必填设置,以及可用于拉取动态数据的工具。

触发集成工具 postiz integrations:trigger <integration-id> <method-name> postiz integrations:trigger <integration-id> <method-name> -d '{"key":"value"}'

拉取动态数据,比如 Reddit flairs、YouTube 播放列表、LinkedIn 公司等。

示例: Get Reddit flairs postiz integrations:trigger reddit-123 getFlairs -d '{"subreddit":"programming"}'

Get YouTube playlists
postiz integrations:trigger youtube-456 getPlaylists

Get LinkedIn companies
postiz integrations:trigger linkedin-789 getCompanies

Find a LinkedIn company page to tag, by its exact vanity name
postiz integrations:trigger linkedin-789 mention -d '{"query":"microsoft"}'

创建帖子

简单的定时帖子 postiz posts:create -c "Content" -s "2024-12-31T12:00:00Z" -i "integration-id"

草稿帖子 postiz posts:create -c "Content" -s "2024-12-31T12:00:00Z" -t draft -i "integration-id"

带媒体的帖子 postiz posts:create -c "Content" -m "img1.jpg,img2.jpg" -s "2024-12-31T12:00:00Z" -i "integration-id"

带评论的帖子(每条评论都可以有自己的媒体)
postiz posts:create \
-c "Main post" -m "main.jpg" \
-c "First comment" -m "comment1.jpg" \
-c "Second comment" -m "comment2.jpg,comment3.jpg" \
-s "2024-12-31T12:00:00Z" \
-i "integration-id"

多平台帖子 postiz posts:create -c "Content" -s "2024-12-31T12:00:00Z" -i "twitter-id,linkedin-id,facebook-id"

平台专属设置
postiz posts:create \
-c "Content" \
-s "2024-12-31T12:00:00Z" \
--settings '{"subreddit":[{"value":{"subreddit":"programming","title":"Post Title","type":"text"}}]}' \
-i "reddit-id"

从 JSON 文件创建复杂帖子 postiz posts:create --json post.json

选项:
- -c, --content - 帖子/评论内容(带评论的帖子可多次使用)
- -s, --date - 定时日期,ISO 8601 格式(必填)
- -t, --type - 帖子类型:"schedule" 或 "draft"(默认:"schedule")
- -m, --media - 媒体 URL,逗号分隔,与对应的 -c 一一对应
- --alt - 媒体替代文本,逗号分隔,与对应的 -m 顺序一致(替代文本含逗号时,改用 --json 的 image[].alt)
- -i, --integrations - 集成 ID,逗号分隔(必填)
- -d, --delay - 评论之间的间隔,单位分钟(默认:0)
- --settings - 平台专属设置,JSON 字符串
- -j, --json - 完整帖子结构 JSON 文件的路径
- --shortLink - 使用短链接(默认:true)

管理帖子

列出帖子 postiz posts:list postiz posts:list --startDate "2024-01-01T00:00:00Z" --endDate "2024-12-31T23:59:59Z" postiz posts:list --customer "customer-id"

不指定日期时,默认范围是过去 30 天到未来 30 天。每条返回的帖子都带有当前 settings(以 JSON 字符串返回,用 JSON.parse 解析)。推荐的工作流是 posts:list(读取当前设置)→ posts:settings(打补丁修改)。

删除帖子 postiz posts:delete <post-id>

切换帖子状态(草稿 ↔ 定时) postiz posts:status <post-id> --status draft postiz posts:status <post-id> --status schedule

把定时帖子退回草稿,或把草稿推进发布队列。切到 draft 还会终止该帖子已在运行的工作流,因此不会发布。切到 schedule 会把帖子排入队列,到存储的日期发布。

更新帖子的服务商专属设置 postiz posts:settings <post-id> --settings '{"content_posting_method":"DIRECT_POST"}' postiz posts:settings <post-id> --settings '{"subreddit":[{"value":{"subreddit":"/r/selfhosted","title":"My title","type":"self","is_flair_required":true}}]}'

在服务端给帖子设置打补丁。后端会合并对象——只改你传入的键,其余全部保留——所以传部分对象,不要传完整设置块。只有 DRAFT/QUEUE(未发布)的帖子能更新,已发布的帖子会被拒绝。传主帖子 id,不要传评论 id。不要包含 __type——后端会根据集成自动补上。

分析

获取平台分析 postiz analytics:platform <integration-id> postiz analytics:platform <integration-id> -d 30

返回指定集成/渠道的粉丝数、曝光量、互动量等随时间变化的指标。-d 参数指定回溯天数(默认:7)。

获取帖子分析 postiz analytics:post <post-id> postiz analytics:post <post-id> -d 30

返回指定已发布帖子的点赞、评论、分享、曝光量等指标。

⚠️ 如果 analytics:post 返回 {"missing": true},说明帖子已发布,但平台没有返回可用的帖子 ID。必须先解决这个问题,分析才能正常工作:

1. List available content from the provider
postiz posts:missing <post-id>

2. Connect the correct content to the post
postiz posts:connect <post-id> --release-id "7321456789012345678"

3. Analytics will now work
postiz analytics:post <post-id>

连接缺失的帖子

有些平台(例如 TikTok)发布后不会立即返回帖子 ID。帖子的 releaseId 会被设为 "missing",在解决之前分析无法工作。
列出服务商提供的可用内容 postiz posts:missing <post-id>

返回一个数组,元素为 {id, url},代表服务商最近的内容。服务商不支持这项功能时,返回空数组。

把帖子关联到已发布的内容 postiz posts:connect <post-id> --release-id "<content-id>"

媒体上传

上传文件并获取 URL postiz upload <file-path>

⚠️ 重要:发帖前先上传文件

在帖子里使用媒体文件之前,你必须先把它们上传到 Postiz。很多平台(尤其是 TikTok、Instagram 和 YouTube)只接受经过验证的可信 URL,会拒绝外部链接。

工作流:
1. 用 postiz upload 上传文件
2. 取出返回的 URL
3. 在帖子的 -m 参数里使用这个 URL

支持的格式:
- 图片: PNG、JPG、JPEG、GIF
- 视频: MP4

示例:
1. Upload the file first
RESULT=$(postiz upload video.mp4)
PATH=$(echo "$RESULT" | jq -r '.path')

2. Use the Postiz URL in your post
postiz posts:create -c "Check out my video!" -s "2024-12-31T12:00:00Z" -m "$PATH" -i "tiktok-id"

按平台限制调整媒体

平台会拒绝过大、过小或编码不被接受的媒体。加上 --adjust(默认关闭),上传后调整文件:视频短边缩放到 1080 px(长边最多 1920 px),重新编码为 H.264 MP4,音频用 AAC;图片只做缩小,适配 1080 x 1920,格式不变。
postiz upload video.mp4 --adjust
postiz media:status <id> # "processing" until the adjusted file is in place, then "ready"

调整后的文件替换同一 path 上的原文件之前,状态一直是 processing,通常几秒内完成。轮询 media:status,等到 ready 再用这个 path 发布帖子:在 processing 期间发布的帖子会用原始未调整的文件。调整失败时保留原文件并用于发布,状态为 ready,同时带一个 warning。不加 --adjust 时上传是同步的,path 立即可用。

复用已上传的媒体

媒体库里的文件不用再传一遍。列出文件(最新的在前,每页 18 个),复用某个文件的 path: postiz media:list postiz media:list -s banner # filter by original file name (case-insensitive) postiz media:list -p 2 # page number, starting at 1

返回一个对象,包含 pages(总页数)和 results,后者是文件列表,每个文件有 id、name、originalName、path(发帖时复用的 URL)和 createdAt。

为什么必须这样做:
- TikTok、Instagram、YouTube 只接受可信域名下的 URL
- 安全: 平台会核验媒体来源,防止滥用
- 可靠: Postiz 确保你的媒体始终可访问

剪辑

把长 YouTube 视频剪成竖屏短片,并烧录字幕。系统自动挑出精彩片段,每段都保存到你的媒体库。传入集成后,每段短片还会在每个渠道生成一条草稿帖(不排期、不发布)。

开始剪辑 postiz clipping:create "https://www.youtube.com/watch?v=VIDEO_ID" postiz clipping:create "https://www.youtube.com/watch?v=VIDEO_ID" -n 3 -f crop -i "tiktok-id,instagram-id"

| 选项 | 别名 | 说明 |
| --integrations | -i | 逗号分隔的集成 ID,为每段短片创建一条草稿帖 |
| --clips | -n | 短片数量上限,1-10(默认:5) |
| --fit | -f | blur(默认)保留完整画面,叠在自身模糊副本上;crop 填满短片并裁掉两侧 |

立即返回 {"id": "<clipping-id>"} —— 剪辑要花几分钟。

查看状态并获取短片 postiz clipping:status <clipping-id>

status 依次经过 analysing、transcribing(仅当视频没有可用字幕时)、picking 和 rendering,最后停在 completed 或 failed。完成时,每段短片都带有 title、content、托管视频 path 和 thumbnail。失败时,error 说明原因,并退还剪辑分钟数。

列出剪辑任务 postiz clipping:list postiz clipping:list --page 2

剪辑消耗订阅的剪辑分钟数:源视频每分钟扣一分钟。每个账号同一时间只运行一个剪辑任务。

平台专属功能

Reddit

Get available flairs
postiz integrations:trigger reddit-id getFlairs -d '{"subreddit":"programming"}'

Post with subreddit and flair
postiz posts:create \
-c "Content" \
-s "2024-12-31T12:00:00Z" \
--settings '{"subreddit":[{"value":{"subreddit":"programming","title":"My Post","type":"text","is_flair_required":true,"flair":{"id":"flair-123","name":"Discussion"}}}]}' \
-i "reddit-id"

YouTube

Get playlists
postiz integrations:trigger youtube-id getPlaylists

Upload video FIRST (required!)
VIDEO=$(postiz upload video.mp4)
VIDEO_URL=$(echo "$VIDEO" | jq -r '.path')

Post with uploaded video URL
postiz posts:create \
-c "Video description" \
-s "2024-12-31T12:00:00Z" \
--settings '{"title":"Video Title","type":"public","tags":[{"value":"tech","label":"Tech"}],"playlistId":"playlist-id"}' \
-m "$VIDEO_URL" \
-i "youtube-id"

TikTok

Upload video FIRST (TikTok only accepts verified URLs!)
VIDEO=$(postiz upload video.mp4)
VIDEO_URL=$(echo "$VIDEO" | jq -r '.path')

Post with uploaded video URL
postiz posts:create \
-c "Video caption #fyp" \
-s "2024-12-31T12:00:00Z" \
--settings '{"privacy_level":"PUBLIC_TO_EVERYONE","duet":true,"stitch":true,"content_posting_method":"DIRECT_POST"}' \
-m "$VIDEO_URL" \
-i "tiktok-id"

LinkedIn

获取可发布内容的公司列表 postiz integrations:trigger linkedin-id getCompanies

以公司身份发布
postiz posts:create \
-c "Company announcement" \
-s "2024-12-31T12:00:00Z" \
--settings '{"companyId":"company-123"}' \
-i "linkedin-id"

X (Twitter)

创建推文串
postiz posts:create \
-c "Thread 1/3 🧵" \
-c "Thread 2/3" \
-c "Thread 3/3" \
-s "2024-12-31T12:00:00Z" \
-d 2000 \
-i "twitter-id"

带回复设置
postiz posts:create \
-c "Tweet content" \
-s "2024-12-31T12:00:00Z" \
--settings '{"who_can_reply_post":"everyone"}' \
-i "twitter-id"

Instagram

先上传图片(Instagram 要求 URL 已验证!)
IMAGE=$(postiz upload image.jpg)
IMAGE_URL=$(echo "$IMAGE" | jq -r '.path')

普通帖子
postiz posts:create \
-c "Caption #hashtag" \
-s "2024-12-31T12:00:00Z" \
--settings '{"post_type":"post"}' \
-m "$IMAGE_URL" \
-i "instagram-id"

快拍(先上传)
STORY=$(postiz upload story.jpg)
STORY_URL=$(echo "$STORY" | jq -r '.path')

postiz posts:create \
-c "" \
-s "2024-12-31T12:00:00Z" \
--settings '{"post_type":"story"}' \
-m "$STORY_URL" \
-i "instagram-id"

全部 28+ 平台的设置见 PROVIDER_SETTINGS.md。

面向 AI 智能体的功能

发现工作流

命令行支持动态发现集成能力:

1. 列出集成 - 获取可用的社交媒体账号
2. 获取设置 - 读取字符限制、必填字段和可用工具
3. 触发工具 - 拉取动态数据(flairs、播放列表、版块等)
4. 创建帖子 - 在帖子中使用发现的数据
5. 分析 - 获取帖子分析;若返回 {"missing": true},用 posts:missing + posts:connect 解决

这样 AI 智能体无需硬编码知识,就能适配不同平台。

JSON 模式

处理跨多个平台、带复杂设置的帖子:

postiz posts:create --json complex-post.json

JSON 结构: {
"integrations": ["twitter-123", "linkedin-456"],
"posts": [
{
"provider": "twitter",
"post": [
{
"content": "Tweet version",
"image": ["twitter-image.jpg"]
}
]
},
{
"provider": "linkedin",
"post": [
{
"content": "LinkedIn version with more context...",
"image": ["linkedin-image.jpg"]
}
],
"settings": {
"__type": "linkedin",
"companyId": "company-123"
}
}
]
}

所有输出都是 JSON

每条命令都输出 JSON,方便解析:

INTEGRATIONS=$(postiz integrations:list | jq -r '.')
REDDIT_ID=$(echo "$INTEGRATIONS" | jq -r '.[] | select(.identifier=="reddit") | .id')

推文串支持

评论会按平台自动转成推文串/回复:
- Twitter/X:推文串
- Reddit:评论回复
- LinkedIn:帖子评论
- Instagram:首条评论

postiz posts:create \
-c "Main post" \
-c "Comment 1" \
-c "Comment 2" \
-i "integration-id"

常用工作流

带 Flair 的 Reddit 帖子

#!/bin/bash
REDDIT_ID=$(postiz integrations:list | jq -r '.[] | select(.identifier=="reddit") | .id')
FLAIRS=$(postiz integrations:trigger "$REDDIT_ID" getFlairs -d '{"subreddit":"programming"}')
FLAIR_ID=$(echo "$FLAIRS" | jq -r '.output[0].id')

postiz posts:create \
-c "My post content" \
-s "2024-12-31T12:00:00Z" \
--settings "}}]}" \
-i "$REDDIT_ID"

上传 YouTube 视频

#!/bin/bash
VIDEO=$(postiz upload video.mp4)
VIDEO_PATH=$(echo "$VIDEO" | jq -r '.path')

postiz posts:create \
-c "Video description..." \
-s "2024-12-31T12:00:00Z" \
--settings '{"title":"My Video","type":"public","tags":[{"value":"tech","label":"Tech"}]}' \
-m "$VIDEO_PATH" \
-i "youtube-id"

多平台投放

#!/bin/bash
postiz posts:create \
-c "Same content everywhere" \
-s "2024-12-31T12:00:00Z" \
-m "image.jpg" \
-i "twitter-id,linkedin-id,facebook-id"

批量排期

#!/bin/bash
DATES=("2024-02-14T09:00:00Z" "2024-02-15T09:00:00Z" "2024-02-16T09:00:00Z")
CONTENT=("Monday motivation 💪" "Tuesday tips 💡" "Wednesday wisdom 🧠")

for i in "${!DATES[@]}"; do
postiz posts:create \
-c "${CONTENT[$i]}" \
-s "${DATES[$i]}" \
-i "twitter-id"
done

文档

给 AI 智能体看:
- SKILL.md - 完整技能参考,含模式与示例

深入指南:
- HOW_TO_RUN.md - 安装与配置方法
- COMMAND_LINE_GUIDE.md - 完整命令语法参考
- PROVIDER_SETTINGS.md - 所有平台设置的结构定义
- INTEGRATION_TOOLS_WORKFLOW.md - 工具工作流指南
- INTEGRATION_SETTINGS_DISCOVERY.md - 设置发现
- SUPPORTED_FILE_TYPES.md - 媒体格式参考
- PROJECT_STRUCTURE.md - 代码架构
- PUBLISHING.md - npm 发布指南

示例:
- examples/EXAMPLES.md - 综合示例
- examples/ - 开箱即用的脚本与 JSON 文件

API 端点

命令行会调用以下 Postiz API 端点:

| 端点 | 方法 | 用途 |
| /public/v1/posts | POST | 创建帖子 |
| /public/v1/posts | GET | 列出帖子 |
| /public/v1/posts/:id | DELETE | 删除帖子 |
| /public/v1/posts/:id/settings | PUT | 更新帖子的服务商设置(合并写入;仅限未发布的帖子) |
| /public/v1/posts/:id/missing | GET | 从服务商获取缺失内容 |
| /public/v1/posts/:id/release-id | PUT | 更新帖子的 release ID |
| /public/v1/integrations | GET | 列出集成(可选 ?group= 过滤) |
| /public/v1/groups | GET | 列出分组(客户) |
| /public/v1/integration-settings/:id | GET | 获取集成设置 |
| /public/v1/integration-trigger/:id | POST | 触发集成工具 |
| /public/v1/analytics/:integration | GET | 获取平台分析数据 |
| /public/v1/analytics/post/:postId | GET | 获取帖子分析数据 |
| /public/v1/upload | POST | 上传媒体 |
| /public/v1/media | GET | 列出已上传媒体(可选 ?page=、?search=) |
| /public/v1/media/:id/status | GET | 查询用 adjust 上传的媒体状态 |
| /public/v1/clipping | POST | 开始剪辑 YouTube 视频 |
| /public/v1/clipping | GET | 列出剪辑任务(可选 ?page=) |
| /public/v1/clipping/:id | GET | 获取剪辑任务及其片段 |

环境变量

| 变量 | 必填 | 默认值 | 说明 |
| POSTIZ_API_KEY | 否 | - | 你的 Postiz API 密钥 |
| POSTIZ_API_URL | 否 | https://api.postiz.com | 自定义 API 端点 |
| POSTIZ_AUTH_SERVER | 否 | https://cli-auth.postiz.com | 自定义认证服务器 URL |

*OAuth2(通过 postiz auth:login)或 POSTIZ_API_KEY 二者必选其一。

错误处理

命令行会给出清晰的错误信息,并附带退出码:

- 退出码 0:成功
- 退出码 1:发生错误

常见错误:

| 错误 | 解决办法 |
| Not authenticated | 运行 postiz auth:login 或设置 POSTIZ_API_KEY |
| Integration not found | 运行 integrations:list 获取有效 ID |
| startDate/endDate required | 使用 ISO 8601 格式:"2024-12-31T12:00:00Z" |
| Invalid settings | 查看 integrations:settings 确认必填字段 |
| Tool not found | 在 integrations:settings 输出中查看可用工具 |
| Upload failed | 确认文件存在且格式受支持 |
| analytics:post 返回 {"missing": true} | 先运行 posts:missing <id>,再运行 posts:connect <id> --release-id "<rid>" |

开发

项目结构

src/
├── index.ts # CLI entry point with yargs
├── api.ts # PostizAPI client class
├── config.ts # Configuration (OAuth2 + API key)
└── commands/
├── auth.ts # OAuth2 authentication (login/logout/status)
├── posts.ts # Post management commands
├── integrations.ts # Integration commands
├── analytics.ts # Analytics commands
└── upload.ts # Media upload command
examples/ # Example scripts and JSON files
package.json
tsconfig.json
tsup.config.ts # Build configuration
README.md # This file
SKILL.md # AI agent reference

脚本

pnpm run dev # Watch mode for developmentbash
pnpm run build # Build the CLI
pnpm run start # Run the built CLI

构建

命令行用 tsup 打包: bash
pnpm run build

产物在 dist/ 下:
- index.js - 带 shebang 的可执行文件
- index.js.map - Source map

快速参考 bash

Authentication

postiz auth:login # OAuth2 device flow
postiz auth:status # Check auth
postiz auth:logout # Remove credentials
export POSTIZ_API_KEY=your_key # Or use API key

Discovery

postiz integrations:list # List integrations
postiz integrations:list --group "<group-id>" # List integrations in a group
postiz integrations:groups # List groups (customers)
postiz integrations:settings <id> # Get settings
postiz integrations:trigger <id> <method> -d '{}' # Fetch data

Posting (date is required)

postiz posts:create -c "text" -s "2024-12-31T12:00:00Z" -i "id" # Simple
postiz posts:create -c "text" -s "2024-12-31T12:00:00Z" -t draft -i "id" # Draft
postiz posts:create -c "text" -m "img.jpg" -s "2024-12-31T12:00:00Z" -i "id" # With media
postiz posts:create -c "main" -c "comment" -s "2024-12-31T12:00:00Z" -i "id" # With comment
postiz posts:create -c "text" -s "2024-12-31T12:00:00Z" --settings '{}' -i "id" # Platform-specific
postiz posts:create --json file.json # Complex

Management

postiz posts:list # List posts
postiz posts:delete <id> # Delete post
postiz posts:status <id> --status draft # Move to draft (stops workflow)
postiz posts:status <id> --status schedule # Queue draft for publishing
postiz posts:settings <id> --settings '{}' # Patch a post's settings (merged; DRAFT/QUEUE only)
postiz upload <file> # Upload media
postiz upload <file> --adjust # Upload and adjust to the platforms' limits
postiz media:status <id> # Check an --adjust upload
postiz media:list -s <name> # Find already uploaded media to reuse

Analytics

postiz analytics:platform <id> # Platform analytics (7 days)
postiz analytics:platform <id> -d 30 # Platform analytics (30 days)
postiz analytics:post <id> # Post analytics (7 days)
postiz analytics:post <id> -d 30 # Post analytics (30 days)

If analytics:post returns {"missing": true}, resolve it:

postiz posts:missing <id> # List provider content
postiz posts:connect <id> --release-id "<rid>" # Connect content to post

Help

postiz --help # Show help
postiz posts:create --help # Command help

贡献

安装步骤和 pull request 检查清单(版本号升级、更新 changelog、文档与发布步骤)见 CONTRIBUTING.md。

许可证

AGPL-3.0

链接

- 网站: postiz.com

- API Docs: docs.postiz.com
- GitHub: gitroomhq/postiz-app
- Issues: Report bugs

Supported Platforms

28+ platforms including:

| Platform | Integration Tools | Settings |
| Twitter/X | getLists, getCommunities | who_can_reply_post |
| LinkedIn | getCompanies | companyId, carousel |
| Reddit | getFlairs, searchSubreddits | subreddit, title, flair |
| YouTube | getPlaylists, getCategories | title, type, tags, playlistId |
| TikTok | - | content_posting_method, privacy_level, comment, brand toggles, duet/stitch/video_made_with_ai (video only), autoAddMusic (photo only) |
| Instagram | - | post_type (post/story) |
| Facebook | getPages | - |
| Pinterest | getBoards, getBoardSections | - |
| Discord | getChannels | - |
| Slack | getChannels | - |
| And 18+ more... | | |

See PROVIDER_SETTINGS.md for complete documentation.
预览分享卡片长什么样 ↓gitroomhq/postiz-agent
分享 · DeepSeek Harness Hub
gitroomhq/postiz-agent

用智能体定时发布帖子到: ChatGPT · Claude · Claude Cowork · Claude Code…

回到顶部