# 1. Preamble

In the public platform website, for Official Account provides a day of group permissions, for Service Account provides a month (self-contained month) 4 group permissions.For some service number operators with development capabilities, more flexible grouping capabilities can be achieved through an advanced grouping interface.

Please note:

  1. For authentication Official Account, the group interface can be successfully called once a day, and the group can choose to send to all users or a label.
  2. For authentication Service Account, there is a limit on the number of daily calls a developer can use the advanced group interface;And the user can only receive 4 messages per month, whether on a public platform website or using an interface for group messaging, the user can receive only 4 group messages per monthly, and more than 4 messages will fail to send to the user.
  3. Developers can use the preview interface to validate message styles and typography, and send an edited message to a specified user to verify the effect.
  4. During the group sending process, WeChat background will automatically check the original text message, please set the relevant parameters in advance (send_ignore, etc.).
  5. Developers can actively set up clientmsgid to avoid repeated push.
  6. The group messaging interface limits requests to 60 times per minute, and requests that exceed the limit are rejected.
  7. Text message body supports inserting their own account and other Service Account has been mass article links.
  8. For the account that has opened the API group protection, the group of all users need to wait for the administrator to confirm, such as the administrator refused or did not confirm within 30 minutes, the group failed. Users can turn off the API group protection function in "Settings - Security Center - Risk Operation Protection."

The process of grouping up graphic messages is as follows:

  1. First of all, the picture needed in the text message in advance, using the picture interface in the upload text message, upload successfully and get the picture.
  2. Upload text message material, need to use pictures, please use the previous step to get the picture URL.
  3. Using a group of user tags, or a group of OpenID lists, the text message is sent out in a group, and WeChat will perform original verification and return the results of the group operation.
  4. During the above process, you can also preview a text message, query the status of a group message, or delete a grouped message if you need to.

The process of grouping up pictures, text, and other message types is as follows:

  1. If you are sending text messages to a group, you can do it directly according to the interface instructions below.
  2. If it is a group of pictures, videos and other messages, you need to prepare the media_id in advance through the material management interface.

Note on setting is_to_all to true when sending a group to enter the list of historical messages on the Service Account guest:

  1. Setting is_to_all to true and a successful batch will make the batch into the history message list.
  2. In order to prevent exceptions, the authentication Service Account can only be set to is_to_all to true and successfully sent once a day, or sent once on the official website of the public platform.To avoid 2 group messages entering the historical message list in a single day.
  3. Similarly, Service Account in a month, the number of successful mass posts set is_to_all to true, plus the number of mass posts on the official website of the public platform, can only be 4 times.
  4. Service Account If you set is_to_all to false, you can send multiple messages, but each user will only receive a maximum of 4 messages in a month, and these messages will not enter the history list.

Other note:

  1. Developers should note that wherever media_id is used in this interface, you can now use media_id, a permanent asset in asset management. Note, however, that links sent using the same feeds are the same, which means that deleting a single feed causes the entire link to fail.
  2. For mpnews in the group and preview interface, use the media_id obtained through the draft box / new draft interface.

# 2. Interface Directory

Interface Name English name Request Path
Upload Graphic Message Material uploadnewsmsg /cgi-bin/media/uploadnews
Upload Graphic Message Picture uploadImage /cgi-bin/media/uploadimg
Query the status of group message delivery massmsgget /cgi-bin/message/mass/get
Get Group Traffic Speed getSpeed /cgi-bin/message/mass/speed/get
Preview message preview /cgi-bin/message/mass/preview
Delete group messages deleteMassMsg /cgi-bin/message/mass/delete
Group messages based on hashtags sendAll /cgi-bin/message/mass/sendall
Set up a group speed setSpeed /cgi-bin/message/mass/speed/set

# 3 Additional Notes

# 3.1 Original validation will be performed before the text message is grouped

# 1) The group messaging interface adds original validation processes

When a developer calls the grouping interface for the grouping of graphic messages, WeChat compares the articles that the developer prepared to group with those in the public platform original library. The results are divided into the following:

  1. If you are currently preparing to post a group post, you can post a post in a group if you fail to find an article in the original library.

  2. If you are currently preparing a group post and have hit an article in the original library, then:

    • 2.1 If the original author allows the article to be reproduced, you can post it in groups. When a group post is automatically replaced with the original style, the article is automatically endorsed as a reprint and the source is displayed. If you want to modify the original content or style, or do not show the reprint source when the group, you can contact the original author and obtain authorization for the group.
    • 2.2 If the original author prohibits the reproduction of the article, it cannot be grouped.If you want to reprint this article, you can contact the original Service Account author and obtain authorization to send it.

# 2) Add the send_ignore_reprint parameter to the group interface

The group messaging interface adds a new send_ignore_reprint parameter (default 0). Developers can set the send_ignore-reprint parameter of the group messagING interface to specify whether to continue the group when the article is determined to be republished.

  1. When the send_ignore_reprint parameter is set to 1, if the article is determined to be reproduced, and the original text is allowed to be reproduced, the group operation will continue.

  2. When the send_ignore_reprint parameter is set to 0, if the article is determined to be reproduced, the group operation will stop.

# 3.2 Use the clientmsgid parameter to avoid repeated push

The clientmsgid parameter is added to the group interface, and the developer can actively set the clientmsgid parameter when calling the group interface to avoid repeated push.

When sending a group, WeChat background will check the group records within 24 hours,If a message already exists on the clientmsgid, this message request is rejected, returning the existing message msgid, and the developer can call the "query message sending status" interface to see the status of the message.

Add an error code

Error code Error message
45065 A group record already exists for the same clientmsgid, returns the msgid with the existing group task in the data
45066 The same clientmsgid retry too fast, please retry at 1 minute intervals
45067 Clientmsgid Length Exceeds Limit

Interface example and parameter description

{
    "filter":{
       "is_to_all":false,
       "tag_id":2
    },
    "mpnews":{
       "media_id":"123dsdajkasd231jhksad"
    },
    "msgtype":"mpnews",
    "send_ignore_reprint":0,
 	"clientmsgid":"send_tag_2" 
}

Parameter explaination

parameter Do I have to? Introductions
clientmsgid no Developer side group msgid, the length limit of 32 bytes, if not filled in, the background default to group range and group content summary value as clientmsgid

Return instructions

Example of return in case of clientmsgid conflict:

{
    "errcode":45065,
    "errmsg":"clientmsgid exist",
    "msg_id":123456 
}

# 4. Event Push Group Results

  • Since a group task may not be completed until a certain time after it has been submitted,Thus, when the queue interface is called, it only gives a hint of whether the queue task has been successfully submitted, and if the queue job has been submitted successfully, the event is pushed to the developer URL (callback URL) that the developer filled out on the public platform at the end of the queue.
  • It should be noted that since the complete completion of the cluster task takes a long time, the cluster results will be pushed when the cluster tasks are about to be completed, and the pushed number data will be somewhat inaccurate from the actual situation
  • The XML structure of the push is as follows (when sent successfully):
<xml> 
  <ToUserName><![CDATA[gh_4d00ed8d6399]]></ToUserName>  
  <FromUserName><![CDATA[oV5CrjpxgaGXNHIQigzNlgLTnwic]]></FromUserName>  
  <CreateTime>1481013459</CreateTime>  
  <MsgType><![CDATA[event]]></MsgType>  
  <Event><![CDATA[MASSSENDJOBFINISH]]></Event>  
  <MsgID>1000001625</MsgID>  
  <Status><![CDATA[err(30003)]]></Status>  
  <TotalCount>0</TotalCount>  
  <FilterCount>0</FilterCount>  
  <SentCount>0</SentCount>  
  <ErrorCount>0</ErrorCount>  
  <CopyrightCheckResult> 
    <Count>2</Count>  
    <ResultList> 
      <item> 
        <ArticleIdx>1</ArticleIdx>  
        <UserDeclareState>0</UserDeclareState>  
        <AuditState>2</AuditState>  
        <OriginalArticleUrl><![CDATA[Url_1]]></OriginalArticleUrl>  
        <OriginalArticleType>1</OriginalArticleType>  
        <CanReprint>1</CanReprint>  
        <NeedReplaceContent>1</NeedReplaceContent>  
        <NeedShowReprintSource>1</NeedShowReprintSource> 
      </item>  
      <item> 
        <ArticleIdx>2</ArticleIdx>  
        <UserDeclareState>0</UserDeclareState>  
        <AuditState>2</AuditState>  
        <OriginalArticleUrl><![CDATA[Url_2]]></OriginalArticleUrl>  
        <OriginalArticleType>1</OriginalArticleType>  
        <CanReprint>1</CanReprint>  
        <NeedReplaceContent>1</NeedReplaceContent>  
        <NeedShowReprintSource>1</NeedShowReprintSource> 
      </item> 
    </ResultList>  
    <CheckState>2</CheckState> 
  </CopyrightCheckResult> 
  <ArticleUrlResult>
     <Count>1</Count>
     <ResultList>
       <item>
         <ArticleIdx>1</ArticleIdx>
         <ArticleUrl><![CDATA[Url]]></ArticleUrl>
       </item>
     </ResultList>
  </ArticleUrlResult>
</xml>

Parameter explaination

parameter Introductions
ToUserName Service Account of WeChat
FromUserName Service Account The WeChat number for mphelper
CreateTime The timestamp of the time created
MsgType Message type, in this case event
Event Event information, here for MASSSENDJOBFINISH
MsgID Group message ID
Status The result of a group message is "send success" or "send fail" or "err (num)."However, when "send success," it may also cause a small number of users to receive failure due to user rejection of Service Account messages, system errors and other reasons.Err (num) is the specific reason for the failure of the audit. Possible scenarios are as follows: err (10001): suspected advertising, err (20001): suspected politics, Err (20004): suspected of social, err (20002): suspected of pornography, err (20006): suspected of criminal offences, err (20008): suspected of fraud, Err (20013): suspected copyright, err (22000): suspected mutual promotion (mutual promotion), err (21000): suspects other, err (9315): unregulated use of public maps, err (30001): a system error in original validation and the user chooses not to syndicate, Err (30002): Original validation was determined not to group, err (30003): Original verification was determined to be republished and the user chose not to group after being adjudged republished, err (40001): Administrator refused, err (4002): Administrator was unresponsive for 30 minutes, timeout
TotalCount Number of fans under tag_id; Or the number of fans in touser
FilterCount The number of fans ready to send after filtering (filtering refers to specific regions, gender filtering, user settings reject filtering, users receive more than 4 filters), generally FilterCount is about equal to SentCount + ErrorCount
SentCount Number of successful followers sent
ErrorCount Number of followers who failed to send
ResultList Results of individual textual validation
ArticleIdx The serial number of group posts, starting with 1
UserDeclareState The user declares the status of the article. 0 indicates that the user did not declare the original; 1 indicates a user's declaration of originality; 2 means a user's declaration of reproduction
AuditState The state of the system validation. 0 indicates that the original is not yet validated; 1 indicates validation in original; 11 means that the original verification has been approved; Others indicate that the original validation failed.
OriginalArticleUrl Similar original URL
OriginalArticleType Similar to the type of original text. 1 represents the original text; 2 means that historical text is not original; 3 means news category; 4 represents a hack class
CanReprint Is it possible to reproduce it?
NeedReplaceContent Do you need to replace the original text content?
NeedShowReprintSource Do I need to indicate the source of the reproduction?
CheckState The overall validation results. 1-Not convicted of reprint, can be grouped, 2- convicted of reproducing, can be groupsed, 3- convicted of recidivism, cannot be grouped
ArticleUrl The URL of the group post

#