Twitter 文章同步:Notion 转 X 长文工具 - Openclaw Skills
作者:互联网
2026-04-13
什么是 Twitter 文章同步技能?
该技能在 Notion 与 Twitter 长篇文章平台之间建立了稳健的桥梁,专为希望简化内容分发的 Openclaw Skills 用户设计。它能自动将 Notion 块转换为 Twitter API 所需的特定 Draft.js 格式 JSON,处理从标题到媒体附件的所有内容。
通过在 Openclaw Skills 生态系统中使用此技能,创作者可以在 Notion 中保持其主要的写作环境,同时确保其 X Premium+ 内容格式完美,且无需人工干预即可随时发布。
下载入口:https://github.com/openclaw/skills/tree/main/skills/sit-in/twitter-article
安装与下载
1. ClawHub CLI
从源直接安装技能的最快方式。
npx clawhub@latest install twitter-article
2. 手动安装
将技能文件夹复制到以下位置之一
全局模式~/.openclaw/skills/
工作区
/skills/
优先级:工作区 > 本地 > 内置
3. 提示词安装
将此提示词复制到 OpenClaw 即可自动安装。
请帮我使用 Clawhub 安装 twitter-article。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。
Twitter 文章同步技能 应用场景
- 将技术博客文章从 Notion 直接同步到 Twitter 文章。
- 使用 Openclaw Skills 处理跨平台格式,自动化社交媒体内容流水线。
- 通过命令行界面管理 Twitter 文章草稿库。
- 将多媒体 Notion 页面转换为 X 上的高参与度长篇帖子。
- 该技能使用提供的页面 ID 和集成密钥从特定的 Notion 页面提取内容。
- 它将标准的 Markdown/Notion 块映射到兼容 Twitter 的 Draft.js 结构(snake_case 格式)。
- 媒体资产上传到 Twitter 服务器以生成唯一的媒体 ID。
- 使用生成的内容状态和元数据在 Twitter 平台上创建草稿。
- 该技能允许在最终发布前对标题、封面图和正文进行细粒度更新。
Twitter 文章同步技能 配置指南
要开始在 Openclaw Skills 中使用此工具,请配置环境变量并运行同步命令:
# 配置身份验证和代理
export AUTH_TOKEN="<您的_twitter_auth_token_cookie>"
export CT0="<您的_twitter_ct0_cookie>"
export HTTPS_PROXY="http://127.0.0.1:7897"
# 将 Notion 页面同步到 Twitter 文章草稿
node twitter-article.js notion-to-article --notion-key --page-id
Twitter 文章同步技能 数据架构与分类体系
该技能跨多个关键结构管理数据,以确保与 Openclaw Skills 框架的兼容性:
| 属性 | 类型 | 描述 |
|---|---|---|
content_state |
JSON | 包含块和实体的内部 Draft.js 结构 |
article_entity |
String | 用于内容更新和发布的唯一标识符 |
media_id_string |
String | 字符串格式的 19 位 ID,以防止 JavaScript 精度丢失 |
entity_map |
Object | 将嵌入的媒体和链接映射到特定的文本偏移量 |
Twitter Article Skill
Notion 文章一键同步到 Twitter/X Article(Premium+ 长文,图文混排)。
快速使用
# 环境变量(必须)
export AUTH_TOKEN=""
export CT0=""
export HTTPS_PROXY="http://127.0.0.1:7897"
# Notion 文章 → Twitter 草稿(一条命令搞定)
node twitter-article.js notion-to-article --notion-key --page-id
# 或者分步操作
node twitter-article.js upload-media --file image.png # 上传图片
node twitter-article.js create --title "标题" --file a.md # 创建含内容的草稿
node twitter-article.js update-content --id --file a.md # 更新已有草稿内容
node twitter-article.js update-cover --id --media-id # 设封面
node twitter-article.js publish --id # 发布
命令一览
| 命令 | 说明 |
|---|---|
list |
列出所有草稿 |
create-draft --title "xxx" |
创建空草稿 |
create --title "xxx" --file a.md |
创建并写入内容 |
update-content --id |
更新内容(.md 或 .json) |
update-title --id |
更新标题 |
update-cover --id |
设封面 |
upload-media --file image.png |
上传图片 → media_id |
get --id |
查看文章详情 |
publish --id |
发布 |
delete --id |
删除 |
前提条件
- Twitter Premium+ 账号(Article 功能需要)
- Cookies 认证:
AUTH_TOKEN+CT0(从浏览器获取) - 代理:
HTTPS_PROXY(国内需要)
内容格式(核心)
Twitter Article 使用修改版 Draft.js 格式。发送用 snake_case,返回用 camelCase。
Block
{
"data": {},
"text": "段落文字",
"key": "a1b2c",
"type": "unstyled",
"entity_ranges": [],
"inline_style_ranges": []
}
支持的 type:unstyled header-one header-two blockquote unordered-list-item ordered-list-item atomic
不支持:header-three header-four code-block(服务端 500)
内嵌图片
Atomic block + MEDIA entity:
// entity_map 条目
{
"key": "0",
"value": {
"type": "MEDIA",
"mutability": "Immutable",
"data": {
"entity_key": "",
"media_items": [{
"local_media_id": 1,
"media_category": "DraftTweetImage",
"media_id": ""
}]
}
}
}
// 对应的 atomic block
{
"data": {},
"text": " ",
"key": "xxx",
"type": "atomic",
"entity_ranges": [{"key": 0, "offset": 0, "length": 1}],
"inline_style_ranges": []
}
API 变量名速查
| Mutation | 文章ID变量名 | 其他关键变量 |
|---|---|---|
| DraftCreate | (无) | content_state, title, plaintext, word_count |
| UpdateContent | article_entity |
content_state, plaintext, word_count |
| UpdateTitle | articleEntityId |
title |
| UpdateCoverMedia | articleEntityId |
coverMedia: {media_id, media_category} |
| Delete/Publish | articleEntityId |
(无) |
?? UpdateContent 用 article_entity,其他用 articleEntityId!
?? 关键注意事项
- media_id 必须用字符串 — JS Number 对 19 位数字丢精度,用
media_id_string - 第一个 # 标题自动跳过 — 作为 title 参数传递,不重复写入正文
- h3/h4 → h2 — Twitter 不支持三级以下标题
- code → blockquote — code-block 类型会报错
- QueryID 可能变 — Twitter 前端更新后需要重新抓取
- 封面图格式 —
coverMedia: {media_id, media_category: "DraftTweetImage"},不是平铺的 media_id
文件结构
skills/twitter-article/
├── SKILL.md # 本文档
└── twitter-article.js # CLI 工具(所有功能)
相关推荐
专题
+ 收藏
+ 收藏
+ 收藏
+ 收藏
+ 收藏
+ 收藏
最新数据
相关文章
Clawdbot 安全审计:保护您的 AI 智能体网关 - Openclaw Skills
缓存策略:AI 驱动的 API 缓存优化 - Openclaw Skills
Branch Namer: AI Git 分支命名生成器 - Openclaw Skills
auth-auditor:安全身份验证审计 - Openclaw Skills
动画生成器:从自然语言生成 CSS 和 Framer Motion - Openclaw Skills
快照测试生成器:自动生成 Jest 和 Vitest 测试 - Openclaw Skills
权限生成器:自动化 RBAC 系统创建 - Openclaw Skills
代码解释器:使用 Openclaw Skills 简化复杂逻辑
Deps Analyzer:为 Openclaw Skills 打造的 AI 驱动依赖清理工具
覆盖率提升:自动生成单元测试 - Openclaw Skills
AI精选
