WeChat icon

WeChat

Create drafts and publish articles to WeChat Official Account

Overview

This node integrates with the WeChat Official Account API to create, manage, and publish article drafts. It supports creating drafts in three modes: single article, multi-article batches (3 articles per draft), and HTML array mode which auto-parses HTML content arrays to generate drafts. The node is useful for automating content publishing workflows on WeChat, such as preparing multiple articles for batch publishing or inserting images intelligently into article content.

Use Case Examples

  1. Create a single article draft with a specified title, content, and thumbnail media ID.
  2. Batch create drafts from a JSON array of articles, each containing title, content, and media IDs.
  3. Automatically parse an array of HTML content strings to create multiple drafts, with options to insert images and generate summaries.

Properties

Name Meaning
Batch Processing Mode Determines how articles are processed for draft creation: single article, multi-article batches, or HTML array auto-parsing.
HTML Content Array JSON array of HTML content strings used as input when batch processing mode is HTML array. The system auto-detects and extracts HTML content from input or uses this parameter if input is empty.
Articles Per Batch Number of articles per draft batch in HTML array mode, supporting 1-8 articles per batch.
Thumbnail Media ID JSON Array JSON array of thumbnail media IDs from which the system randomly selects a media ID as the article cover image in HTML array mode.
Default Article Type Default article type (news or image article) used for all articles in HTML array mode.
Default Author Default author name used for all articles in HTML array mode.
Auto Generate Digest Whether to automatically generate a summary from the first 54 characters of the article content in HTML array mode.
Default Enable Comments Whether comments are enabled by default for all articles in HTML array mode.
Default Only Fans Can Comment Whether only fans can comment by default for all articles in HTML array mode (effective only if comments are enabled).
Enable Image Insertion Automatically insert images into article content in HTML array mode.
Image Insertion Mode Method for inserting images into article content in HTML array mode: auto positioning, by paragraph, or manual.
Image Media IDs or URLs Image data to insert into articles in HTML array mode. Supports arrays from 'Get Material List', JSON strings, or comma-separated URLs.
Max Images Per Article Maximum number of images to insert per article in HTML array mode.
Image Selection Strategy Strategy for selecting images to insert in HTML array mode: sequential, random, or balanced distribution.
Articles JSON JSON array of articles for multi-article batch mode, each with fields like article_type, title, content, thumb_media_id, author, digest, content_source_url, need_open_comment, and only_fans_can_comment.
Article Type Type of article to create in single article mode: news or image article.
Title Title of the article (max 64 characters) in single article mode.
Content HTML content of the article (max 20,000 characters) in single article mode.
Thumbnail Media ID Permanent media ID of the thumbnail image for the article in single article mode.
Author Author name of the article in single article mode.
Digest Summary of the article; auto-generated from the first 54 characters if empty in single article mode.
Content Source URL Original article URL for the 'Read More' link in single article mode.
Enable Comments Whether to enable comments for the article in single article mode.
Only Fans Can Comment Whether only fans can comment on the article in single article mode (effective only if comments are enabled).
Enable Image Insertion Automatically insert images into article content in single article mode.
Image Insertion Mode Method for inserting images into article content in single article mode: auto positioning, by paragraph, or manual.
Image Media IDs or URLs Image data to insert into article content in single article mode. Supports arrays from 'Get Material List', JSON strings, or comma-separated URLs.
Max Images Per Article Maximum number of images to insert into the article in single article mode.
Image Selection Strategy Strategy for selecting images to use in single article mode: sequential, random, or balanced distribution.

Output

JSON

  • media_id - The media ID of the created or managed draft.
  • status - Status of the operation (e.g., success or failed).
  • batch_index - Index of the batch when processing multiple batches.
  • article_count - Number of articles in the batch.
  • articles_summary - Summary of articles including titles and authors.
  • error - Error message if the operation failed.
  • publish_id - Publish ID returned after publishing a draft.
  • publish_results - Results of batch publishing including success and failure details.
  • parsing_summary
    • successful_parses - Number of successfully parsed articles from HTML content.
    • parse_errors - Number of parsing errors encountered.
  • image_insertion_info
    • images_inserted - Number of images inserted into article content.
    • insertion_positions - Positions where images were inserted in the content.

Dependencies

  • WeChat Official Account API

Troubleshooting

  • Invalid JSON format errors when parsing article lists or HTML content arrays. Ensure JSON is correctly formatted.
  • Errors related to missing required fields like title, content, or thumb_media_id in articles. Validate input data before execution.
  • Errors due to invalid or empty media ID arrays for thumbnails or image insertion. Verify media IDs are correct and accessible.
  • Publish failures in batch mode may occur due to API rate limits or network issues. Use publish delay settings to mitigate.
  • Image insertion may fail if image data is invalid or content structure is incompatible. Check image data format and content HTML.

Links

Discussion