公众号内容自动发布 - 自动化运营指南
title: 公众号内容自动发布 - 自动化运营指南 tags: [微信公众号, 自动化, 运营]
公众号内容自动发布 - 自动化运营指南
详解如何使用 OpenCLAW 实现微信公众号内容的自动生成和发布,提升运营效率。
内容自动发布概述
通过 OpenCLAW 实现公众号自动化运营:
┌─────────────────────────────────────────────────────────────┐
│ 内容自动发布流程 │
├─────────────────────────────────────────────────────────────┤
│ │
│ 1. 内容获取 │
│ ├─ RSS 订阅源 │
│ ├─ 热点话题抓取 │
│ ├─ 用户生成内容 │
│ └─ AI 生成内容 │
│ ↓ │
│ 2. 内容处理 │
│ ├─ 内容清洗 │
│ ├─ 格式转换 │
│ └─ 质量检测 │
│ ↓ │
│ 3. 内容发布 │
│ ├─ 草稿箱 │
│ ├─ 定时发布 │
│ └─ 群发推送 │
│ ↓ │
│ 4. 效果追踪 │
│ ├─ 阅读统计 │
│ ├─ 点赞转发 │
│ └─ 用户反馈 │
│ │
└─────────────────────────────────────────────────────────────┘
发布模式
1. 草稿箱模式(推荐)
先发布到草稿箱,人工审核后再发布:
wechat:
publish:
mode: draft # draft | direct
# 草稿箱配置
draft:
enabled: true
# 是否通知审核
notify:
enabled: true
channel: slack
message: "新草稿已生成,请审核"
2. 定时发布模式
在指定时间自动发布:
wechat:
publish:
mode: scheduled
# 发布时间表
schedule:
# 工作日早上 8:00
- cron: "0 8 * * 1-5"
type: morning_news
# 每天 20:00
- cron: "0 20 * * *"
type: evening_digest
# 周末 10:00
- cron: "0 10 * * 6,0"
type: weekend_special
3. 立即发布模式
内容生成后立即发布:
wechat:
publish:
mode: direct
# 发布前检查
pre_check:
enabled: true
checks:
# 内容长度检查
- type: length
min: 300
max: 8000
# 敏感词检查
- type: sensitive_words
action: block
# 原创检查
- type: originality
min_ratio: 0.8
内容源配置
1. RSS 订阅源
content_sources:
# RSS 订阅
rss:
enabled: true
feeds:
- name: tech_news
url: https://tech.example.com/feed
interval: 3600 # 每小时检查
- name: ai_weekly
url: https://ai.example.com/rss
interval: 86400 # 每天检查
# 内容过滤
filters:
- source: tech_news
keywords: ["AI", "人工智能", "机器学习"]
exclude: ["广告", "招聘"]
# 内容处理
processing:
# 摘要长度
summary_length: 200
# 是否保留原文链接
keep_source_link: true
2. 热点抓取
content_sources:
# 热点抓取
hot_topics:
enabled: true
sources:
# 微博热搜
- name: weibo_hot
type: web
url: https://weibo.com/hot
selector: ".hot-item"
# 知乎热榜
- name: zhihu_hot
type: web
url: https://zhihu.com/api/hot
json_path: "$.data[*].title"
# 热点聚合
aggregation:
enabled: true
top_n: 10
dedup: true
3. AI 内容生成
content_sources:
# AI 生成内容
ai_generation:
enabled: true
# 生成配置
generator:
model: gpt-4
temperature: 0.7
# 内容模板
templates:
- name: daily_news
prompt: |
请根据以下热点话题,生成一篇公众号文章:
热点话题:{topics}
要求:
- 标题吸引眼球
- 内容深度分析
- 字数 800-1500
- 适合微信阅读
- name: tech_explain
prompt: |
请用通俗易懂的语言解释以下技术概念:
概念:{concept}
要求:
- 使用类比
- 配合实例
- 字数 500-800
文章格式配置
1. 标题生成规则
content:
title:
# 自动生成标题
auto_generate: true
# 标题模板
templates:
- "{topic} | 深度解读"
- "一文读懂{topic}"
- "关于{topic},你需要知道的 N 件事"
- "{topic}完全指南"
# 标题限制
constraints:
max_length: 30 # 微信标题限制
min_length: 10
# 标题优化
optimization:
# 添加表情
add_emoji: true
emoji_list: ["🔥", "💡", "📈", "🎯", "📌"]
2. 正文格式
content:
body:
# 格式设置
format:
# 段落间距
paragraph_spacing: 2
# 行间距
line_height: 1.75
# 字号
font_size: 16
# 排版元素
elements:
# 引用样式
blockquote:
enabled: true
style: "border-left: 4px solid #42b983; padding-left: 15px;"
# 代码块样式
code_block:
enabled: true
theme: "github"
# 列表样式
list:
enabled: true
bullet: "•"
# 小标题
headings:
h2:
style: "color: #2c3e50; font-size: 18px; font-weight: bold;"
h3:
style: "color: #34495e; font-size: 16px;"
3. 封面图配置
content:
cover:
# 封面图来源
source:
# 优先使用文章图片
prefer_article_images: true
# 无图片时生成
auto_generate: true
# 封面图库
library:
enabled: true
path: ./covers
categories:
- tech
- business
- lifestyle
# 封面图规格
spec:
width: 900
height: 500
# 封面图生成(AI)
generation:
enabled: true
provider: dalle
prompt_template: "minimalist illustration about {topic}"
发布流程配置
完整发布流程
wechat:
publish:
# 流程配置
workflow:
# 步骤1:获取内容
- name: fetch_content
type: content_source
source: rss
# 步骤2:内容处理
- name: process_content
type: processor
processors:
- clean_html
- extract_summary
- check_sensitive
# 步骤3:AI 优化
- name: ai_optimize
type: ai_agent
agent: content-optimizer
# 步骤4:格式转换
- name: format_conversion
type: formatter
template: wechat_article
# 步骤5:上传素材
- name: upload_media
type: uploader
media_types:
- image
- video
# 步骤6:创建草稿
- name: create_draft
type: wechat_api
action: add_draft
# 步骤7:通知审核
- name: notify
type: notification
channel: slack
内容处理器配置
1. 敏感词过滤
processors:
- name: sensitive_filter
enabled: true
# 敏感词库
dictionary:
builtin: true
custom: ./config/sensitive_words.txt
# 处理动作
action: replace # replace | remove | block
# 替换字符
replacement: "*"
# 通知
on_detect:
log: true
notify: admin@example.com
2. 原创度检测
processors:
- name: originality_check
enabled: true
# 检测源
sources:
- search_engine
- wechat_articles
# 相似度阈值
threshold: 0.7
# 低原创度处理
on_low_originality:
action: rewrite # rewrite | block | tag
# AI 改写
rewrite:
enabled: true
provider: gpt-4
3. 内容摘要
processors:
- name: summary_generator
enabled: true
# 摘要长度
length: 100
# 生成方式
method: ai # ai | extract
# AI 配置
ai:
model: gpt-3.5-turbo
prompt: "请用一句话概括以下文章的主要内容(不超过100字):\n\n{content}"
4. 关键词提取
processors:
- name: keyword_extractor
enabled: true
# 提取数量
count: 5
# 方法
method: tfidf # tfidf | textrank | ai
# 用于标签和推荐
usage:
- tags
- category
- seo
定时发布配置
发布时间表
wechat:
publish:
schedule:
# 早间新闻
- name: morning_brief
cron: "0 8 * * 1-5"
content_source:
type: rss
feeds: [tech_news, business_news]
publish_mode: direct
# 午间文章
- name: lunch_article
cron: "0 12 * * 1-5"
content_source:
type: ai_generation
template: daily_article
publish_mode: draft
# 晚间推送
- name: evening_push
cron: "0 20 * * *"
content_source:
type: hot_topics
top_n: 5
publish_mode: direct
发布队列管理
wechat:
publish:
queue:
enabled: true
# 队列大小
max_size: 50
# 每次发布数量
batch_size: 1
# 发布间隔
interval: 60 # 秒
# 优先级
priority:
- name: breaking_news
priority: 10
- name: regular
priority: 5
统计与分析
发布统计
# 查看发布统计
openclaw wechat publish stats --period 7d
# 输出示例
# 发布统计(最近7天)
# ─────────────────────────────
# 发布文章:28 篇
# 草稿待审:3 篇
# 发布失败:2 篇
# 平均阅读:1,234 次
# 最高阅读:5,678 次
内容效果分析
# 自动收集文章数据
analytics:
enabled: true
metrics:
- read_count
- like_count
- share_count
- comment_count
# 效果分析
analysis:
# 最佳发布时间
best_publish_time: true
# 热门主题
hot_topics: true
# 用户偏好
user_preference: true
# 报告生成
reports:
- type: daily
time: "09:00"
channel: email
- type: weekly
time: "Monday 10:00"
channel: email
错误处理与重试
wechat:
publish:
# 错误处理
error_handling:
# 重试配置
retry:
enabled: true
max_attempts: 3
delay: 300 # 5分钟
# 可重试的错误
retry_on:
- APIError
- TimeoutError
- NetworkError
# 不可重试的错误
skip_on:
- ContentTooLong
- InvalidFormat
# 失败通知
on_failure:
- type: email
to: admin@example.com
- type: slack
channel: "#alerts"
最佳实践
1. 内容质量控制
# 发布前必须通过检查
pre_publish_checks:
# 敏感词检查
- type: sensitive_words
required: true
# 原创度检查
- type: originality
min_ratio: 0.7
# 内容长度
- type: length
min: 500
max: 8000
# 格式检查
- type: format
required_elements:
- title
- cover
- summary
2. 发布频率控制
# 频率限制
rate_limit:
# 每天最多发布
daily_max: 3
# 每周最多发布
weekly_max: 15
# 发布间隔
min_interval: 3600 # 1小时
3. 内容备份
# 内容备份
backup:
enabled: true
# 备份位置
path: ./backup/articles
# 保留时间
retention_days: 365
# 备份内容
includes:
- content
- media
- stats
命令行操作
手动发布
# 发布单篇文章
openclaw wechat publish article.md
# 发布到草稿箱
openclaw wechat publish article.md --mode draft
# 定时发布
openclaw wechat publish article.md --schedule "2024-01-15 08:00"
# 批量发布
openclaw wechat publish ./articles/*.md
查看发布状态
# 查看发布历史
openclaw wechat publish history
# 查看草稿列表
openclaw wechat draft list
# 查看发布队列
openclaw wechat publish queue
取消发布
# 取消定时发布
openclaw wechat publish cancel <article-id>
# 删除草稿
openclaw wechat draft delete <draft-id>
小结
本文详细介绍了 OpenCLAW 公众号内容自动发布的配置:
- 发布模式 - 草稿箱、定时、立即发布
- 内容源 - RSS、热点、AI 生成
- 文章格式 - 标题、正文、封面图
- 内容处理 - 敏感词、原创度、摘要
- 定时发布 - 时间表、队列管理
- 统计分析 - 发布统计、效果分析
- 最佳实践 - 质量控制、频率限制
微信公众号系列教程完结!