Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

WeChat → Notion AIO (Bilingual)

Languages / 语言切换: English | 中文


WeChat → Notion | Competitions & Events Ingestion (AIO)

Aggregate WeChat Official Accounts / websites into Notion:

  • Auto-fetch (plug in WeWe RSS if you like)
  • Rule-based scoring (competitions / events / negative blocks)
  • Write to Events database & generate a daily brief (Daily Briefs)
  • Runs twice every day at 14:30 / 19:30 (UTC+8) via GitHub Actions

Fits the all-in-one page: Sources / Events / Rules (inline databases) + Daily Briefs (child page).


✨ Features

  • Rule scoring: supports TRIGGERS_COMP / TRIGGERS_EVENT / NEGATIVE / MIN_SCORE …
  • De-dup: same Link won’t be created twice
  • Daily brief: 📅 YYYY-MM-DD Competition/Event Brief
  • Reliability: retry with exponential backoff; fallback parsing when RSS fails
  • Optional WeWe refresh: wewerss-refresh.yml triggers ?update=true

🧱 Notion Schema

Sources

  • Name(title) / FeedURL(url) / Enabled(checkbox)

Events

  • Name(title) / Type(select: Competition, Event) / Source(rich_text)
  • Published(date) / Deadline(date) / Score(number)
  • Link(url) / Summary(rich_text)

Rules

  • Name(title) / Key(select: TRIGGERS_COMP, TRIGGERS_EVENT, NEGATIVE, PRIZE, ORG_AUTH, ONLINE, AUDIENCE, MIN_SCORE)
  • Pattern(rich_text) / Weight(number) / HardBlock(checkbox) / Enabled(checkbox)

Daily Briefs

  • A parent page for generated briefs

All four objects must be shared to your Integration (Can edit).


🔐 Required GitHub Secrets

  • NOTION_TOKEN – Notion internal integration token (secret_…)
  • NOTION_SOURCES_DB – Sources database ID
  • NOTION_DB_ID – Events database ID
  • NOTION_RULES_DB – Rules database ID
  • NOTION_DAILY_PARENT – Daily Briefs parent page ID

(Optional Repo Variables) TZ=Asia/Shanghai
(Optional for WeWe refresh) WEWE_BASE, WEWE_FEED_IDS


🗂 Project Layout

.
├─ src/
│  ├─ pipeline.py        # Read Sources → score → write Events → build brief
│  ├─ fetch.py           # RSS/Atom first; fallback to HTML parsing
│  ├─ rules.py           # Rule compilation & scoring
│  ├─ notion_util.py     # Notion API wrapper + retries
│  └─ config.py          # Env loader
├─ requirements.txt
└─ .github/workflows/
   ├─ notion-pipeline.yml       # Main pipeline (14:30 / 19:30 UTC+8)
   └─ wewerss-refresh.yml       # Optional: trigger WeWe `?update=true`

🚀 Quick Start

  1. Notion: create/verify the four objects (Sources/Events/Rules/Daily Briefs), then Share them to your Integration (Can edit).
  2. Sources: add a test row
    • Name=Sample, FeedURL=(RSS/Atom or web page), Enabled=✅
    • Prefer an .atom generated by WeWe RSS; you may append title_include / title_exclude filters to the URL.
  3. GitHub Secrets: fill in the 5 required items above.
  4. First run
    • Actions → notion-pipeline (UTC+8 14:30 / 19:30)Run workflow
    • (Optional) wewerss-refreshRun workflow (needs WEWE_BASE)

After it finishes, you should see new items in Events, and a new brief page under Daily Briefs.


⏱ Scheduling (Cron)

  • notion-pipeline.yml:
    • 30 6 * * *14:30 UTC+8
    • 30 11 * * *19:30 UTC+8
  • GitHub pauses cron if the repo is inactive for 60 days; any push or manual run will resume it.
  • For a third time (e.g., 23:59 +8):
    • Enable wewerss-refresh.yml (set WEWE_BASE) to trigger WeWe at 15:59 UTC; or
    • Widen WeWe’s CRON_EXPRESSION (may over-trigger; use with care).

🩺 Troubleshooting

  • No data inserted:
    • Is the source Enabled and the FeedURL accessible?
    • Is MIN_SCORE too high? (try 2–3)
    • Does the Integration have Can edit permissions?
  • Duplicates/noisy: raise NEGATIVE weights and set HardBlock=✅; increase MIN_SCORE; or use title_include/exclude in the feed URL.
  • WeWe not updating: confirm CRON_EXPRESSION is applied (Redeploy), and try …/feeds/all.atom?update=true.

📝 Run locally (optional)

python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt

export NOTION_TOKEN=secret_xxx
export NOTION_SOURCES_DB=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
export NOTION_DB_ID=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
export NOTION_RULES_DB=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
export NOTION_DAILY_PARENT=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

python -m src.pipeline

🔒 Security

  • Never commit tokens/IDs; put them in GitHub Secrets only.
  • To revoke: remove the Integration from Notion Connections or reset the token.

WeChat → Notion|竞赛 & 活动一体化采集(AIO)

把微信公众号 / 网站等信息源汇总到 Notion

  • 自动抓取(可接入 WeWe RSS
  • 规则打分(竞赛 / 活动 / 负向屏蔽)
  • 写入 Events 数据库 & 生成每日简报(Daily Briefs
  • 每天 UTC+8 的 14:30 / 19:30 自动运行(GitHub Actions)

适配一体化页面:Sources / Events / Rules(内联数据库)+ Daily Briefs(子页面)。


✨ 特性

  • 按规则打分:支持 TRIGGERS_COMP / TRIGGERS_EVENT / NEGATIVE / MIN_SCORE …
  • 去重写入:同一 Link 不重复创建
  • 自动简报📅 YYYY-MM-DD 竞赛/活动简报
  • 稳定性:Notion API 指数退避重试;RSS 失败回落网页解析
  • 可选 WeWe 刷新:配合 wewerss-refresh.yml 定时触发 ?update=true

🧱 Notion 数据库结构

Sources

  • Name(title) / FeedURL(url) / Enabled(checkbox)

Events

  • Name(title) / Type(select:含 竞赛、活动) / Source(rich_text)
  • Published(date) / Deadline(date) / Score(number)
  • Link(url) / Summary(rich_text)

Rules

  • Name(title) / Key(select:TRIGGERS_COMP, TRIGGERS_EVENT, NEGATIVE, PRIZE, ORG_AUTH, ONLINE, AUDIENCE, MIN_SCORE)
  • Pattern(rich_text) / Weight(number) / HardBlock(checkbox) / Enabled(checkbox)

Daily Briefs

  • 子页面,作为简报父页面

以上四个对象需 Share → Add connections → 你的 Integration(Can edit)


🔐 必填 GitHub Secrets

  • NOTION_TOKEN – Notion 内部集成 token(secret_…
  • NOTION_SOURCES_DB – Sources 数据库 ID
  • NOTION_DB_ID – Events 数据库 ID
  • NOTION_RULES_DB – Rules 数据库 ID
  • NOTION_DAILY_PARENT – Daily Briefs 父页面 ID

(可选 Repo Variables) TZ=Asia/Shanghai
(可选,用于刷新 WeWe) WEWE_BASEWEWE_FEED_IDS


🗂 目录结构

.
├─ src/
│  ├─ pipeline.py        # 读取 Sources → 评分 → 写入 Events → 生成简报
│  ├─ fetch.py           # RSS/Atom 优先;失败回落页面解析
│  ├─ rules.py           # 规则编译与打分
│  ├─ notion_util.py     # Notion API 封装 + 重试
│  └─ config.py          # 读取环境变量
├─ requirements.txt
└─ .github/workflows/
   ├─ notion-pipeline.yml       # 主流程(14:30 / 19:30 UTC+8)
   └─ wewerss-refresh.yml       # 可选:触发 WeWe `?update=true`

🚀 快速开始

  1. Notion:创建/确认四个对象(Sources/Events/Rules/Daily Briefs),字段如上;Share 给 Integration(Can edit)。
  2. Sources:新增一行测试源
    • Name=示例FeedURL=(RSS/Atom 链接或网页)Enabled=✅
    • 推荐使用 WeWe RSS 生成的 .atom;可在 URL 上追加 title_include / title_exclude 过滤。
  3. GitHub Secrets:填好上面的 5 个必填项。
  4. 首次手动运行
    • Actions → notion-pipeline (UTC+8 14:30 / 19:30)Run workflow
    • (可选)wewerss-refreshRun workflow(需先设置 WEWE_BASE

运行完成后,在 Events 可见新增条目,在 Daily Briefs 下可见当天简报。


⏱ 定时(Cron)

  • notion-pipeline.yml
    • 30 6 * * *14:30 UTC+8
    • 30 11 * * *19:30 UTC+8
  • GitHub 定时在仓库 60 天无活动时会暂停;任意 push 或手动 Run 恢复。
  • 需要第三个时间点(如 23:59 +8):
    • 打开 wewerss-refresh.yml(设置 WEWE_BASE),在 15:59 UTC 触发 WeWe 刷新;或
    • 将 WeWe 的 CRON_EXPRESSION 配成更宽表达式(会多刷,谨慎)。

🩺 故障排查

  • 无数据入库
    • Sources 是否勾 Enabled;FeedURL 是否可打开返回 XML
    • RulesMIN_SCORE 是否过高(先设 2–3 测试)
    • Integration 是否有 Can edit 权限
  • 重复/噪音多:提升 NEGATIVE 权重并设 HardBlock=✅;提高 MIN_SCORE;或在 feed URL 加 title_include/exclude
  • WeWe 不更新:确认 Zeabur 的 CRON_EXPRESSION 已生效并 Redeploy;访问 …/feeds/all.atom?update=true 测试 200

📝 本地运行(可选)

python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt

export NOTION_TOKEN=secret_xxx
export NOTION_SOURCES_DB=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
export NOTION_DB_ID=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
export NOTION_RULES_DB=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
export NOTION_DAILY_PARENT=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

python -m src.pipeline

🔒 安全

  • 切勿secret_… token / 数据库 ID 放到代码里;只放 GitHub Secrets
  • 撤销权限:在 Notion Connections 移除该 Integration 或在集成页面重置 token。

About

😋优雅的微信公众号订阅方式,基于Notion与WeWeRSS,可采用关键词定时筛选与自动分析。

Topics

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages