Skip to content
POST{BASE_URL}/wx-api/api/message/groupSend
写操作实测 2026-09-11消息JSON · Bearer App Token · body appid

群发助手-群发

向一批客户或客户群批量发送消息。

说明与注意

请求参数

参数必填类型说明
appidstring实例 appid,标识操作哪个已登录账号。示例:we_xxxxxxxxxxxxxxx
customerGroupbooleantrue=群发到客户群(receiverList 只能是群 id);false=群发到客户(receiverList 只能是客户 id),二者不能混。示例:true
contentList条件必填array<object>群发内容列表;materialId0(不是素材库内容)时必填。示例:[{"contentType":0,"content":[{"type":3,"text":"[撇嘴]"},{"t…
receiverListarray<int64>接收者 id 列表。示例:[10710637461658379]
materialIdint64素材库 id;不是素材库内容时传 0。示例:117159486110430465
contentList[] 字段
字段类型说明
contentList[].contentTypeint64消息类型码(0 文本/14 图片/23 视频…)
contentList[].contentarray<object>消息内容;文本为数组、媒体为对象
contentList[].content[].typeint64类型编码(具体含义随所在对象:成员/部门、图片/视频、节点类型等,详见对应接口)
contentList[].content[].textstringtype 0/3 的文本内容

请求示例

http
POST {BASE_URL}/wx-api/api/message/groupSend
Authorization: Bearer <你的 App Token>
Content-Type: application/json

{
  "appid": "we_xxxxxxxxxxxxxxx",
  "customerGroup": true,
  "contentList": [
    {
      "contentType": 0,
      "content": [
        {
          "type": 3,
          "text": "[撇嘴]"
        },
        {
          "type": 0,
          "text": "企业"
        }
      ]
    },
    {
      "contentType": 14,
      "content": {
        "id": "<uploadImage fileId>",
        "size": 570260,
        "width": 828,
        "height": 1792,
        "aesKey": "9cf6...",
        "md5": "f6e0..."
      }
    },
    {
      "contentType": 22,
      "content": {
        "id": "*1*<大文件 id>",
        "size": 285357,
        "duration": 2,
        "width": 1280,
        "height": 720,
        "thumbUrl": "https://wework.qpic.cn/...",
        "md5": "9915..."
      }
    },
    {
      "contentType": 20,
      "content": {}
    }
  ],
  "receiverList": [
    10710637461658379
  ],
  "materialId": 117159486110430465
}
bash
curl -X POST '{BASE_URL}/wx-api/api/message/groupSend' \
  -H 'Authorization: Bearer <你的 App Token>' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "appid": "we_xxxxxxxxxxxxxxx",
  "customerGroup": true,
  "contentList": [
    {
      "contentType": 0,
      "content": [
        {
          "type": 3,
          "text": "[撇嘴]"
        },
        {
          "type": 0,
          "text": "企业"
        }
      ]
    },
    {
      "contentType": 14,
      "content": {
        "id": "<uploadImage fileId>",
        "size": 570260,
        "width": 828,
        "height": 1792,
        "aesKey": "9cf6...",
        "md5": "f6e0..."
      }
    },
    {
      "contentType": 22,
      "content": {
        "id": "*1*<大文件 id>",
        "size": 285357,
        "duration": 2,
        "width": 1280,
        "height": 720,
        "thumbUrl": "https://wework.qpic.cn/...",
        "md5": "9915..."
      }
    },
    {
      "contentType": 20,
      "content": {}
    }
  ],
  "receiverList": [
    10710637461658379
  ],
  "materialId": 117159486110430465
}'
python
import requests

url = "{BASE_URL}/wx-api/api/message/groupSend"
headers = {"Authorization": "Bearer <你的 App Token>", "Content-Type": "application/json"}
body = """{
  "appid": "we_xxxxxxxxxxxxxxx",
  "customerGroup": true,
  "contentList": [
    {
      "contentType": 0,
      "content": [
        {
          "type": 3,
          "text": "[撇嘴]"
        },
        {
          "type": 0,
          "text": "企业"
        }
      ]
    },
    {
      "contentType": 14,
      "content": {
        "id": "<uploadImage fileId>",
        "size": 570260,
        "width": 828,
        "height": 1792,
        "aesKey": "9cf6...",
        "md5": "f6e0..."
      }
    },
    {
      "contentType": 22,
      "content": {
        "id": "*1*<大文件 id>",
        "size": 285357,
        "duration": 2,
        "width": 1280,
        "height": 720,
        "thumbUrl": "https://wework.qpic.cn/...",
        "md5": "9915..."
      }
    },
    {
      "contentType": 20,
      "content": {}
    }
  ],
  "receiverList": [
    10710637461658379
  ],
  "materialId": 117159486110430465
}"""

resp = requests.post(url, headers=headers, data=body.encode("utf-8"))
print(resp.text)
java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

String url = "{BASE_URL}/wx-api/api/message/groupSend";
String body = "{\n" +
    "  \"appid\": \"we_xxxxxxxxxxxxxxx\",\n" +
    "  \"customerGroup\": true,\n" +
    "  \"contentList\": [\n" +
    "    {\n" +
    "      \"contentType\": 0,\n" +
    "      \"content\": [\n" +
    "        {\n" +
    "          \"type\": 3,\n" +
    "          \"text\": \"[撇嘴]\"\n" +
    "        },\n" +
    "        {\n" +
    "          \"type\": 0,\n" +
    "          \"text\": \"企业\"\n" +
    "        }\n" +
    "      ]\n" +
    "    },\n" +
    "    {\n" +
    "      \"contentType\": 14,\n" +
    "      \"content\": {\n" +
    "        \"id\": \"<uploadImage fileId>\",\n" +
    "        \"size\": 570260,\n" +
    "        \"width\": 828,\n" +
    "        \"height\": 1792,\n" +
    "        \"aesKey\": \"9cf6...\",\n" +
    "        \"md5\": \"f6e0...\"\n" +
    "      }\n" +
    "    },\n" +
    "    {\n" +
    "      \"contentType\": 22,\n" +
    "      \"content\": {\n" +
    "        \"id\": \"*1*<大文件 id>\",\n" +
    "        \"size\": 285357,\n" +
    "        \"duration\": 2,\n" +
    "        \"width\": 1280,\n" +
    "        \"height\": 720,\n" +
    "        \"thumbUrl\": \"https://wework.qpic.cn/...\",\n" +
    "        \"md5\": \"9915...\"\n" +
    "      }\n" +
    "    },\n" +
    "    {\n" +
    "      \"contentType\": 20,\n" +
    "      \"content\": {}\n" +
    "    }\n" +
    "  ],\n" +
    "  \"receiverList\": [\n" +
    "    10710637461658379\n" +
    "  ],\n" +
    "  \"materialId\": 117159486110430465\n" +
    "}";

HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder(URI.create(url))
    .header("Authorization", "Bearer <你的 App Token>")
    .header("Content-Type", "application/json")
    .POST(HttpRequest.BodyPublishers.ofString(body))
    .build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
php
<?php

$url = '{BASE_URL}/wx-api/api/message/groupSend';
$body = <<<'JSON'
{
  "appid": "we_xxxxxxxxxxxxxxx",
  "customerGroup": true,
  "contentList": [
    {
      "contentType": 0,
      "content": [
        {
          "type": 3,
          "text": "[撇嘴]"
        },
        {
          "type": 0,
          "text": "企业"
        }
      ]
    },
    {
      "contentType": 14,
      "content": {
        "id": "<uploadImage fileId>",
        "size": 570260,
        "width": 828,
        "height": 1792,
        "aesKey": "9cf6...",
        "md5": "f6e0..."
      }
    },
    {
      "contentType": 22,
      "content": {
        "id": "*1*<大文件 id>",
        "size": 285357,
        "duration": 2,
        "width": 1280,
        "height": 720,
        "thumbUrl": "https://wework.qpic.cn/...",
        "md5": "9915..."
      }
    },
    {
      "contentType": 20,
      "content": {}
    }
  ],
  "receiverList": [
    10710637461658379
  ],
  "materialId": 117159486110430465
}
JSON;

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer <你的 App Token>',
    'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;

响应示例

json
{
  "code": 0,
  "data": {
    "msgId": 117252339567559381
  },
  "detail": "",
  "message": "ok",
  "time": "2026-09-11 20:20:00"
}

响应字段

字段类型说明
codeint64统一封套状态码:0=成功,负数=失败
dataobject业务数据
data.msgIdint64下一页起始 msgId
detailstring附加明细,通常为空
messagestring文案:成功为 ok;失败形如 -码|描述
timestring服务端处理时间 YYYY-MM-DD HH:MM:SS

下一步