Appearance
邀请群成员(开启群验证)
邀请好友加入已开启邀请确认的群,管理员审批通过后才入群。
接口地址: POST /addChatRoomMemberVerify
说明与注意
- 群没开邀请确认时,40 人以下用添加群成员,40 人以上用邀请群成员(40 人以上)。
请求参数
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
wId | 是 | string | 登录实例标识 |
chatRoomId | 是 | string | 群 ID |
userList | 是 | string | 被邀请好友的微信 ID |
reason | 是 | string | 邀请理由,管理员可见,不得为空 |
请求示例
http
POST {BASE_URL}/addChatRoomMemberVerify
Authorization: Bearer <你的调用凭证>
Content-Type: application/json
{
"wId": "2c7a5bf6-e23d-4fb0-8f03-b90e844b539f",
"chatRoomId": "1806832422@chatroom",
"userList": "wxid_i6sbbjenjuj22",
"reason": "拉个发小入群"
}bash
curl -X POST '{BASE_URL}/addChatRoomMemberVerify' \
-H 'Authorization: Bearer <你的调用凭证>' \
-H 'Content-Type: application/json' \
--data-raw '{
"wId": "2c7a5bf6-e23d-4fb0-8f03-b90e844b539f",
"chatRoomId": "1806832422@chatroom",
"userList": "wxid_i6sbbjenjuj22",
"reason": "拉个发小入群"
}'python
import requests
url = "{BASE_URL}/addChatRoomMemberVerify"
headers = {"Authorization": "Bearer <你的调用凭证>", "Content-Type": "application/json"}
body = """{
"wId": "2c7a5bf6-e23d-4fb0-8f03-b90e844b539f",
"chatRoomId": "1806832422@chatroom",
"userList": "wxid_i6sbbjenjuj22",
"reason": "拉个发小入群"
}"""
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}/addChatRoomMemberVerify";
String body = "{\n" +
" \"wId\": \"2c7a5bf6-e23d-4fb0-8f03-b90e844b539f\",\n" +
" \"chatRoomId\": \"1806832422@chatroom\",\n" +
" \"userList\": \"wxid_i6sbbjenjuj22\",\n" +
" \"reason\": \"拉个发小入群\"\n" +
"}";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder(URI.create(url))
.header("Authorization", "Bearer <你的调用凭证>")
.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}/addChatRoomMemberVerify';
$body = <<<'JSON'
{
"wId": "2c7a5bf6-e23d-4fb0-8f03-b90e844b539f",
"chatRoomId": "1806832422@chatroom",
"userList": "wxid_i6sbbjenjuj22",
"reason": "拉个发小入群"
}
JSON;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer <你的调用凭证>',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;成功响应
json
{
"message": "成功",
"code": "1000",
"data": null
}错误响应
json
{
"message": "失败",
"code": "1001",
"data": null
}响应参数
| 参数名 | 类型 | 说明 |
|---|---|---|
code | string | 1000 成功;其他值都是失败,通常是 1001 |
message | string | 反馈信息 |
data | null | 成功或失败时通常为空 |