Social Media Publishing API

The Social Media Publishing API allows users to publish articles to various social media platforms. Currently, it supports sending to the WeChat Official Account platform, with support for other platforms coming soon. This API is designed to help users easily publish multiple articles simultaneously and automatically process images and videos within the article content.


API Protocol

End Point

POST
https://huntwiz.com/v1/social-media-post

params

parametertypedescriptiondefault
platform*
string
The social media platform to publish to. If multiple platforms are configured, enter the ID; otherwise, a random platform will be selected for sending
wechat
articles*
array
Array of articles to be published-
└─ title*
string
Article title-
└─ author
string
Article author-
└─ digest
string
Summary of the image-text message. Only single image-text messages have a summary; for multiple image-text messages, this field is empty. If this field is not filled, the first 54 characters of the content will be used by default.-
└─ content*
string
The specific content of the image-text message, supports markdown, must be less than 20,000 characters, less than 1M, and JS will be removed from this section-
└─ content_source_url
string
The original URL of the image-text message, i.e., the URL after clicking "Read Original"-
└─ thumb_media_id*
string
Thumbnail media ID-
└─ need_open_comment
int
Whether to open comments, 0 for closed (default), 1 for open-
└─ only_fans_can_comment
int
Whether only fans can comment, 0 for everyone can comment (default), 1 for only fans can comment-
upload_assets
boolean
Whether to automatically process and upload images in the content to the media platform (most media platforms do not support external links)
false

Code Example

curl -X POST 'https://huntwiz.com/v1/social-media-post'
--header 'Authorization: Bearer {api_key}'
--header 'Content-Type: application/json'
--data-raw '{
"platform": "wechat",
"articles": [
{
"title": "My First Article",
"content": "<p>Hello, World!</p>",
"thumb_media_id": "mediathumbnailid123"
}
],
"upload_assets": "true"
}'

Note: The articles parameter should contain an array of valid article objects. Each article object should include title, content, and thumb_media_id.

Response Format

The API will return a JSON object containing the publishing result:

{
"status": "success",
"data": {
// Response data from the WeChat API
},
"metadata": {
"usage": {
"credits": 5,
"remark": "api used for /v1/social-media-post"
},
"content": {
"articleCount": 1,
"totalContentLength": 1000
}
}
}

Billing

Billing is based on the number of articles published:

  • Each article consumes 5 credit points
  • Each API call consumes at least 5 credit points, even if only one article is published

Note:

  • Credit points are deducted based on the number of articles, regardless of the length or complexity of the article content.
  • The system will check if the account has sufficient credit points before starting the process. If credit points are insufficient, the API will return an error without executing the publication.
  • You can view the number of credit points consumed for this request in the metadata of the API response.

Error Handling

If an error occurs, the API will return a JSON object containing error details:

{
"status": "error",
"error": {
"code": "invalid_platform",
"message": "Unsupported social media platform"
}
}

Common error codes include:

  • invalid_platform: Unsupported social media platform
  • invalid_credentials: Provided account credentials are invalid
  • insufficient_credits: Account doesn't have enough credit points for this publication
  • wechat_api_error: Error occurred when calling the WeChat API
  • rate_limit_exceeded: API call frequency limit exceeded

Limitations

  • API is limited to 30 requests per minute
  • A maximum of 8 articles can be published per call
  • Maximum content length for each article is 10,000 characters
  • External script injection is not supported for security reasons
  • API will not host images or videos referenced in articles, but will automatically upload them to the target platform

Usage Suggestions

  1. Always validate your article content to ensure it's correctly formatted before sending it to the API.
  2. Ensure all media files (images and videos) are accessible via public URLs so the API can process them.
  3. Using the use_beautifulsoup parameter can handle complex HTML structures more precisely but may increase processing time.
  4. For articles containing a large number of media files, allow sufficient processing time.
  5. Consider using the bulk publishing feature (multiple articles in one API call) to improve efficiency.

If you have any questions or need further assistance, please don't hesitate to contact our technical support team.