> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.beatapi.io/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.beatapi.io/_mcp/server.

# How do I turn a WeChat article into a reviewable text record in n8n?

> Configure one HTTP Request and a validating Code node, preserve item pairing and avoid silently substituting summaries or retrying paid queries.

To turn one selected WeChat article into a reviewable text record in n8n, connect **Manual Trigger → HTTP Request → Code**. The HTTP Request node calls `wechat_mp.v2.fetch_article_detail_h5` with the article's original URL, and the Code node validates the response and returns the text, title, account and request ID for review or storage. If this is your first BeatAPI workflow, start with [n8n credential setup](/integrations/n8n). If the response contains only a summary, check [how to identify the article text](/faq/wechat-article-full-text).

For example, to verify who a peer announcement applies to, check the returned title and account, then have a reviewer find the relevant passage in the returned text. For a daily workflow, verify one article before adding a schedule.

## Connect one bounded processing step first

Build the workflow with one verified article URL first: **Manual Trigger → Article input → HTTP Request → Code**. Keep the BeatAPI key in n8n credentials, and record the request start time separately from the article's publication time. To debug the Code node's projection, reuse a successful saved execution or synthetic Code inputs instead of rerunning the paid HTTP Request node.

The Code node's output keeps the article URL, the requested URL, the request ID, the account and the returned text. Each output item links to its own input item: if the second article's response has no link, the Code node does not fall back to the first article's URL. The output is reviewable material; storage, full-page archiving and research conclusions are separate steps.

## Decide whether a returned article can move forward

| Result                                                | What to do                                                                                                         |
| ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
| Business success, nonempty text and a valid source    | Continue reviewing the returned material; the reading scope stays limited to the returned text                     |
| Title or summary but no body text                     | Stop the item; do not substitute the summary for the body                                                          |
| Trimmed body text exactly matches the summary         | Stop for manual review. A short article can legitimately match its summary, so a match does not prove an API fault |
| Mixed input provenance or an unresolvable linked item | Repair the item pairing and node names before writing to article records                                           |
| Body retrieval succeeded but storage failed           | Keep the successful output and retry the storage step from the saved output before retrieving the article again    |

The current free contract describes `content_text` as the body text and `desc` as the summary. The contract does not certify that every image, attachment or page section is covered. The Code node's output therefore records `reading_scope=returned_plain_text_only` and `full_page_coverage_verified=false`. Nonempty text or a successful workflow run does not turn these two values into a whole-page verification claim.

## Check the material before storage or analysis

Before storage or analysis, spot-check the returned body, title, account, source and publication time; keep a missing publication time as missing. Ask the downstream AI model for short supporting quotations, and keep source claims apart from the model's inferences. Record unavailable media and unanswered questions instead of filling the gaps.

After one item works, test two distinct inputs, their pairing and repeated processing. Verify the destination, the article identity, create/update behavior and recovery from uncertain writes as separate checks. The single-article HTTP workflow does not include scheduled discovery, history pagination or an MCP Agent connection.

Steps 1–6 below give the exact node setup and pasteable Code. The Code node only validates and projects data; the Code node sends no requests and writes to no external system.

For example, you pass in two articles. Article A has validated body text, but A's storage step fails. Article B returns only a summary. Resume A from A's saved result, and leave B pending until B has body text to read. Match each output item to its input by input URL and request ID, so each item stays traceable even when items arrive in a different order.

## 1. Inspect the action and price

Inspect `data:wechat_mp.v2.fetch_article_detail_h5` for free with the request below. The workflow reads one supplied URL; the workflow does not discover every newly published article.

```bash
curl -sS https://api.beatapi.io/v1/capabilities/inspect \
  -H 'Content-Type: application/json' \
  -d '{"reference":"data:wechat_mp.v2.fetch_article_detail_h5"}'
```

The cURL request below and the HTTP Request node send the same request. Choose one of the two routes; running both pays twice for the same article.

```bash
curl -sS https://api.beatapi.io/v1/social-data/call \
  -H "Authorization: Bearer $BEATAPI_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"action":"wechat_mp.v2.fetch_article_detail_h5","params":{"url":"<article_url>"}}'
```

## 2. Supply input and credentials

1. Start with **Manual Trigger → Edit Fields → HTTP Request → Code**.
2. Rename the Edit Fields node to exactly `Article input`.
3. In `Article input`, set `article_url` to the verified mp.weixin.qq.com/s/… link and `request_started_at` to the expression `{{ $now.toISO() }}`. `request_started_at` is the request start time, not the publication time or the response completion time.
4. Store the BeatAPI key in a Header Auth credential, with `Authorization` as the header name and `Bearer` plus the key as the value. Do not store the key in article fields or output records.

## 3. Configure HTTP Request

| Setting                             | Value                                            |
| ----------------------------------- | ------------------------------------------------ |
| Method                              | POST                                             |
| URL                                 | `https://api.beatapi.io/v1/social-data/call`     |
| Authentication                      | Generic Credential Type, Header Auth             |
| Send Body                           | Enabled, JSON                                    |
| Response Format                     | JSON                                             |
| Include Response Headers and Status | Off; the code expects the response body directly |
| Pagination / Retry On Fail          | Off for this bounded example                     |

Set the JSON body to an object expression:

```javascript
{{ { action: 'wechat_mp.v2.fetch_article_detail_h5', params: { url: $json.article_url } } }}
```

The JSON body is an n8n expression, not a standalone JavaScript program: select Expression mode in the field editor. See the [official HTTP Request reference](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.httprequest/).

## 4. Validate and project in Code

Set the Code node to JavaScript and **Run Once for All Items**. The Code below only transforms data: the Code sends no requests and does not follow instructions in the article text. `pairedItem` keeps each output item linked to its input item. `$('Article input').itemMatching(index)` returns the source URL linked to each response, not the first row's URL, so keep the node name `Article input` exactly as written. [Official linked-item reference](https://docs.n8n.io/code/cookbook/builtin/itemmatching/).

```javascript
function articleUrl(value) {
  if (typeof value !== 'string') throw new Error('Article URL must be a string');
  const match = value.match(/^https?:\/\/mp\.weixin\.qq\.com(\/s(?:\/[^?#\s]+)?)(?:\?([^#\s]*))?(?:#[^\s]*)?$/);
  if (!match) throw new Error('Expected a WeChat article URL');
  if (match[1] === '/s') {
    const query = (match[2] ?? '').split('&');
    if (!['__biz', 'mid', 'idx'].every(key => query.some(pair => pair.startsWith(key + '=') && pair.length > key.length + 1))) {
      throw new Error('Long article URL needs __biz, mid and idx');
    }
  }
  return value;
}
return $input.all().map((item, index) => {
  const response = item.json;
  if (response.status !== 'succeeded' || response.error != null || response.action !== 'wechat_mp.v2.fetch_article_detail_h5') {
    throw new Error('Expected a successful article-detail response');
  }
  if (typeof response.request_id !== 'string' || !response.request_id.trim()) throw new Error('Missing request_id');
  const input = $('Article input').itemMatching(index).json;
  const requestedUrl = articleUrl(input.article_url);
  if (typeof input.request_started_at !== 'string' || !/(Z|[+-]\d{2}:\d{2})$/.test(input.request_started_at) || !Number.isFinite(Date.parse(input.request_started_at))) {
    throw new Error('request_started_at needs a timezone-aware timestamp');
  }
  const article = response.data?.content;
  if (typeof article?.content_text !== 'string' || !article.content_text.trim() || ['[redacted]', '[redacted-depth]'].includes(article.content_text.trim())) {
    throw new Error('Missing body: do not substitute the summary');
  }
  if (typeof article.desc === 'string' && article.content_text.trim() === article.desc.trim()) {
    throw new Error('Returned text equals summary: review before using as article body');
  }
  const fallback = article.link === undefined || article.link === null || article.link === '';
  const url = articleUrl(fallback ? requestedUrl : article.link);
  let published = null;
  if (article.create_timestamp !== undefined && article.create_timestamp !== null) {
    if (typeof article.create_timestamp !== 'number' || !Number.isFinite(article.create_timestamp)) throw new Error('Invalid publication timestamp');
    const date = new Date(article.create_timestamp * 1000);
    if (!Number.isFinite(date.getTime())) throw new Error('Invalid publication timestamp');
    published = date.toISOString();
  }
  return {
    json: {
      article_url: url,
      requested_url: requestedUrl,
      article_url_from: fallback ? 'request' : 'response',
      author_source_url: article.source_url ?? null,
      title: article.title ?? null,
      account_id: article.user_name ?? null,
      text: article.content_text,
      reading_scope: 'returned_plain_text_only',
      full_page_coverage_verified: false,
      published_at_utc: published,
      published_at_raw: article.create_time ?? null,
      request_started_at: input.request_started_at,
      request_id: response.request_id,
    },
    pairedItem: { item: index },
  };
});
```

The field paths follow BeatAPI's raw response. `desc` cannot replace the body text, and `source_url` cannot replace the current article link. Turning on **Include Response Headers and Status** changes the response wrapper, so recheck the field paths before reusing the Code. [Official Code-node reference](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.code/).

## 5. Add persistence and deduplication deliberately

The Code node produces an n8n data item, not permanent storage. Feishu, database and file destinations each need their own permissions. Confirm the destination before connecting automatic writes, and deduplicate by a verified article key, not by title.

If storage fails, retry the storage step with the saved output of the same execution instead of rerunning the paid HTTP Request node. To discover articles on a schedule, use the [account update workflow](/guides/wechat-incremental-articles).

## 6. Verify success and failure cases

Test the Code node with offline fixtures before going live. The fixtures should show five results:

1. Valid text produces one record.
2. Failed and bodyless results are rejected.
3. A response without a link takes the URL from the item's paired, validated input.
4. An invalid source link is rejected.
5. With multiple inputs, each record keeps its own request ID and input-pairing index.

An error must never be reported as “no new articles today.”

One approved article retrieval is one platform call; retries and model analysis are counted separately.

[Save with Feishu CLI](/guides/wechat-to-feishu) · [WeChat question index](/faq/wechat)

## When should you use the n8n MCP Client Tool?

Keep the HTTP Request node for a fixed article lookup. Connect **MCP Client Tool** to **AI Agent** when an agent needs to choose between article lists, article detail and other sources. On n8n versions that support Streamable HTTP, choose the Streamable HTTP transport, enter `https://beatapi.io/mcp` and select **Bearer Auth** with your BeatAPI key. If your MCP Client Tool node only supports an SSE endpoint, use the HTTP workflow above.

Check that the MCP Client Tool lists `capabilities_search`, `capabilities_inspect` and `capabilities_run`. Ask the agent to find the article-detail action, check the action's contract and run the action for one verified URL. Match the agent's execution to the request ID and returned text. For scheduled discovery and storage, see [scheduled WeChat checks](/guides/wechat-n8n-monitor).

[n8n MCP Client Tool](https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.toolmcp/)