탐색으로 건너뛰기

Monitor WeChat official accounts in n8n and alert a Feishu group

To send a Feishu group one digest of new WeChat official-account articles, build an n8n workflow that calls wechat_mp.v2.fetch_account_articles for each verified username on your roster, records each article in a Data Table and posts only articles added since the previous check to a Feishu custom bot. For example, an editorial team follows a dozen official accounts and wants one digest per check. The first run only records a baseline for each account and sends no alert. Run a historical backfill as a separate task.

n8n setup · What to do when WeChat limits a request

Build one run in n8n

  1. Start with Manual Trigger and put one verified username in Edit Fields. Later, read the roster as one item per account. Record each account’s scan outcome so that a failed account can be retried on its own.
  2. Add HTTP Request, POST to https://api.beatapi.io/v1/social-data/call, and select a Header Auth credential with Authorization: Bearer <BEATAPI_API_KEY>. Enter the JSON body below in Expression mode; the first request leaves offset empty.
{{ { action: 'wechat_mp.v2.fetch_account_articles', params: { username: $json.username, offset: '', item_show_type: 0, raw: false } } }}
  1. Before splitting the results into article items, check that the response has status: succeeded, no error and a data.articles array.
    • An empty data.articles array means the request returned no articles.
    • If the call fails or the response shape differs, log the request ID, stop at that account and leave the account’s scan progress unchanged.
    • To page, pass data.next_offset back for the same account and content type. Stop at is_end: 1, a missing or repeated cursor, or the page limit. If the page limit is reached before the previous boundary, mark the account’s coverage incomplete.
  2. In Data Table, create the columns article_key, title, url and delivery_state.
    • Build article_key from data.biz_username and the article’s app_msg_id and idx, and deduplicate each page by article_key. Hold articles with an incomplete key for review.
    • On the first run, write every article as baseline. On later runs, insert only new keys as pending.
    • If you use Upsert, make sure Upsert does not change existing sent rows back to pending.
    • If runs can overlap, run the workflow serially or use a store that enforces a unique article_key.

Check which articles should trigger an alert

What the editorial team seesWhat to recordWhat the group should receive
On Monday, the Product Weekly account already has a setup guide and an FAQRecord both as that account’s baselineNo alert
On Tuesday, Product Weekly publishes release notes and a migration guide in the same dispatchInsert two pending rows. The two rows share app_msg_id and have different idx valuesOne digest with a link to each article
Tuesday’s run is replayed after delivery was confirmedKeep both rows as sentNo duplicate digest
A Community News account with ten existing articles joins the roster on WednesdaySeed its own baseline and continue checking Product Weekly for updatesOnly new articles from accounts with an existing baseline

Keep a separate scan boundary for each account, such as the set of recent article keys from the account’s last complete scan:

  1. Start each run on page one.
  2. Page forward until you reach the page that contains the previous boundary, and process every article on that page.
  3. If you see only a pinned article or a repeat from another page, keep paging until the configured boundary.
  4. If the cursor fails or the page limit runs out before the boundary, keep the old boundary. Articles already found can still be saved; the next scan from page one deduplicates by article_key.

Store “how far each account was scanned” separately from “which articles reached the group”. For example, Tuesday’s two new articles belong to batch MP-002 and the Feishu send times out. On Wednesday, even if the scan finds nothing new, check whether batch MP-002 reached the group before retrying. If Tuesday’s scan also missed the previous boundary for one account, rescan that account on its own.

Send one digest to the Feishu group

  1. Add a custom bot in the target Feishu group’s settings and store the bot’s webhook in protected configuration.
  2. Meet the group’s keyword, signature or IP requirements for the bot. For a signed bot, generate a fresh timestamp and sign for each request as Feishu’s documentation describes.
  3. Add a second HTTP Request that POSTs the JSON message to the webhook. Include the account, article title, link and batch ID, so the digest can be traced back.
{"msg_type":"text","content":{"text":"WeChat digest | Batch MP-001\nExample account | Setup guide update\nhttps://mp.weixin.qq.com/s/example"}}

Before going live, test the digest step:

  1. Send one saved record to a test group.
  2. Change the batch’s pending rows to sent only after Feishu returns code: 0.
  3. Before sending, save the batch ID and the batch’s article keys, so reconciliation and any retry use the same batch.
  4. If delivery times out or saving the status fails, look up the batch ID in the group to confirm delivery before retrying.
  5. Skip delivery when no articles are pending. A batch with unconfirmed delivery still needs reconciliation, even when the latest scan finds no new articles.
  6. After one successful sample and one repeat run, switch to Schedule Trigger, set the workflow timezone and publish the workflow.

To fetch the text of selected articles, continue with the single-article n8n workflow.

Budget for the list pages actually requested per account, plus detail requests and retries, at BeatAPI pricing. Then check three results: a replayed run sends no extra digest, one failed account can be retried on its own, and each digest link opens the matching article.

Schedule Trigger · Data Table · Feishu custom bot