自动将 RSS 订阅源中的新博客文章分享至社交媒体
一个 n8n RSS Feed Trigger 节点,或定时运行的简短脚本,通过 easyCoexistence 将博客 RSS 订阅源的每个新条目分享至 Facebook、Instagram、TikTok 等渠道。它将条目的标题、链接和图片发送至 easyCoexistence 的 posts API,该 API 通过各网络的官方 API 发布,可立即发布,也可按您选择的时间发布。Claude 应要求起草 LinkedIn 帖子,由人工审批后发布。
RSS 的 item 元素,保存可唯一标识该条目的字符串。
RSS enclosure 必需的三个属性:文件所在位置、字节大小和 MIME 类型。
LinkedIn 的 Posts API 不会读取链接来构建文章帖子,调用方需自行设置标题和描述。
Facebook 分享页面时读取的 Open Graph 标签,用于展示图片;图片按其 URL 缓存。
Claude 用于读取您提供的 URL 中完整内容的功能名称,属于其网页搜索功能的一部分。
n8n 如何分享每个新的订阅源条目?
借助 RSS Feed Trigger 节点,当订阅源发布新条目时启动工作流。输入 Feed URL,并选择 Poll Times,例如每隔设定的分钟数检查一次。每次运行会携带新条目,其中包含标题和链接等字段。
随后,为每个账户配置一个 HTTP Request 节点,调用 POST https://easycoexistence.com/api/v1/channels/<account_id>/posts,并使用保存 ec_live_ 密钥的 Header Auth 凭据:Facebook 发布链接帖子,Instagram 和 TikTok 发布附带文案的图片。若要为每个网络先改写文本,可添加一个 AI Agent 节点;通过 OAuth2 连接 easyCoexistence 的 MCP Client Tool,并仅选择 Facebook、Instagram 和 TikTok 的发布工具,它便可自行发布。
LinkedIn 帖子不纳入此工作流:Claude 或 ChatGPT 应要求为每篇起草,并由人工审批后再发出。
如果不使用 n8n,脚本如何分享新条目?
通过记住已分享的条目来实现。下方的 Python 脚本由 cron 运行,读取订阅源,若某条目的 guid 不在其已分享条目文件中,即视为新条目。首次运行时,它只记录条目,因此订阅源中的历史存档不会立即全部发出。
对每个新条目,脚本为每个账户调用一次 posts API,并使用由账户和 guid 组成的 Idempotency-Key。easyCoexistence 支持该标头,因此中途停止后重新运行的脚本不会重复发布同一条目。当订阅源包含 JPEG 格式的 enclosure 时,脚本还会据此创建一条 Instagram 图片帖子。LinkedIn 不纳入脚本,因为每条 LinkedIn 帖子都需由人工审批。
import hashlib, json, os, pathlib
import xml.etree.ElementTree as ET
import requests
EC = "https://easycoexistence.com/api/v1"
AUTH = {"Authorization": f"Bearer {os.environ['EC_API_KEY']}"} # ec_live_...
FEED = "https://example.com/feed/"
LINK_POSTS = ["<FACEBOOK_PAGE_ACCOUNT_ID>"] # not LinkedIn: a person approves each post there
PHOTO_POSTS = ["<INSTAGRAM_ACCOUNT_ID>"]
SHARED = pathlib.Path("shared.json")
def post(account: str, guid: str, body: dict) -> None:
key = hashlib.sha256(f"{account}|{guid}".encode()).hexdigest() # same item, same key
r = requests.post(f"{EC}/channels/{account}/posts", json=body, timeout=60,
headers={**AUTH, "Idempotency-Key": key})
if not r.ok:
print(account, r.status_code, r.text[:200])
def share(item: ET.Element, guid: str) -> None:
title, link = item.findtext("title", ""), item.findtext("link", "")
for account in LINK_POSTS:
post(account, guid, {"text": title, "link": {"url": link}})
image = item.find("enclosure")
if image is not None and image.get("type") == "image/jpeg":
for account in PHOTO_POSTS:
post(account, guid, {"text": f"{title}. Read it at {link}",
"media": [{"url": image.get("url"), "type": "image"}]})
items = ET.fromstring(requests.get(FEED, timeout=30).content).findall("./channel/item")
first_run = not SHARED.exists()
shared = set() if first_run else set(json.loads(SHARED.read_text()))
for item in reversed(items): # oldest first
guid = item.findtext("guid") or item.findtext("link")
if guid not in shared and not first_run:
share(item, guid)
shared.add(guid)
SHARED.write_text(json.dumps(sorted(shared)))每个网络应如何展示博客文章?
在支持的网络上以链接形式展示,在不支持的网络上以图片形式展示。LinkedIn 和 Facebook 支持链接帖子,但构建方式不同:LinkedIn 的 API 不读取页面,因此 easyCoexistence 发送您提供的标题和描述;Facebook 则读取页面的 Open Graph 标签生成预览。以此方式发出的 LinkedIn 链接帖子不显示缩略图,因此在该网络上应发布图片,并将地址写入正文。Instagram 和 TikTok 需要图片,因此请使用文章的主图,并采用各平台支持的格式,同时将地址以文字形式写入文案。
| What to send | What readers see | |
|---|---|---|
| Text, the article's link and its title | The text and a link card with your title | |
| Text and the article's link | A preview from og:title, og:description and og:image | |
| The main image as JPEG, a caption with the address | A photo post with the caption | |
| TikTok | 1 to 35 JPEG or WebP images, a title and a caption | A photo post; TikTok posts carry no link |
Claude 或 ChatGPT 能否应要求分享文章?
可以,只要您提出要求。将文章地址告知 Claude,并说明发布的平台和时间,例如:“请在明天伦敦时间上午 9 点,于 LinkedIn 和 Facebook 上分享 https://example.com/blog/spring-menu。”开启网页搜索后,Claude 会读取您提供的 URL 中的页面(Anthropic 称之为 web fetch),为每个网络撰写版本;您审批后,再使用 publish_linkedin_post 或 publish_facebook_post 及 scheduled_at 为每条帖子排期。
在 ChatGPT 中,将 easyCoexistence 添加为自定义 MCP 服务器后,粘贴文章正文和链接即可。两款助手在对话之间都不会监控订阅源,因此新条目只能通过 n8n 或脚本自动发出。
如何避免订阅源重复分享同一条目?
以 guid 作为判断依据。订阅源只列出最新的若干条目,该数量由 WordPress 在 设置 > 阅读 中设定,因此条目会下移并逐渐移出列表。应以 guid 而非位置判断是否为新内容;若订阅源没有 guid,则退而使用链接。一旦发出条目的帖子,即应立即记录其 guid。
同时注意分散发布的节奏。TikTok 的 API 每个账户每天最多接受 15 条图片帖子,Instagram 则在滚动的 24 小时内最多 100 条。因此,若博客集中发布,可为每个条目设置 publish_at,间隔一小时,而非一次性全部发出。
设置方法
- Connect the accountsConnect the Facebook Page, Instagram account or TikTok account in the easyCoexistence dashboard, and note each account_id.
- Find the feedCopy the blog's RSS feed address, such as https://example.com/feed/, and open it once to check that it lists the latest posts.
- Start sharingAdd an RSS Feed Trigger and an HTTP Request node per account in n8n, or run the script from cron with an ec_live_ key.
常见错误
- 首次运行即发出整个订阅源。订阅源会列出其近期条目,因此在工作流上线前,请将这些条目的 guid 值记录为已分享,否则历史存档会一次性涌入各账户。
- 将文章的 PNG 或 WebP 图片交给 Instagram。Instagram 仅发布 JPEG,因此应让帖子指向图片的 JPEG 版本,或对该条目不发布到 Instagram。
easyCoexistence 为您的博客及其周围的 AI 代理提供通往 Facebook、Instagram、TikTok 等渠道客户的触达能力,每个网络均通过其官方 API 实现:为 n8n 和脚本提供 posts API,为 Claude 和 ChatGPT 提供一个 MCP 连接器,并提供最多提前 90 天发布的队列,每个连接全天候受监控。每个连接每月 US$ 9 起,最低降至 US$ 0.75,连接越多越便宜;前 3 天免费。
常见问题
它能与 WordPress 博客配合使用吗?
可以。WordPress 会发布近期文章的 RSS 订阅源,其阅读设置可决定订阅源列出多少篇文章,以及每篇是包含全文还是摘要。
n8n 多久检查一次订阅源?
按 Poll Times 的设定:每小时、每天、每周或每月,可按设定的分钟或小时数,或使用您自定义的 cron 表达式。
AI 能为每个网络撰写不同的帖子吗?
可以。n8n 中的 AI Agent 节点可以把一篇文章改写为 Facebook 的短句,以及 Instagram 和 TikTok 的带话题标签文案;Claude 也可应要求为 LinkedIn 撰写更长的帖子,由人工审批。
用 easyCoexistence 分享博客订阅源要花多少钱?
每个连接每月 US$ 9 起,最低降至 US$ 0.75,连接越多越便宜,各网络价格相同。posts API、MCP 连接器和队列均包含在内,前 3 天免费。
继续阅读
两分钟连接您的第一个渠道。
无需等待平台审核。连接 WhatsApp、Instagram、TikTok 或其他渠道,然后让您的 AI 发布、回复或生成报告,看它如何运作。
- 免费试用 3 天
- 随时取消
- 仅使用官方 API
- 全天候 24/7 监控
验证时间