Skip to content

设置小程序群待办 ​

将小程序消息设置为群待办,或撤回已设置的小程序群待办。

接口地址: POST /roomAppTodo

请求参数 ​

参数名必选类型说明
wId是string登录实例标识
chatRoomId是string群 ID
newMsgId是int小程序消息 ID,从消息回调中获取
title是string小程序标题,从消息回调中获取
pagePath是string小程序跳转地址,从消息回调中获取
userName是string小程序 ID,从消息回调中获取
sendWcId是string原小程序发送者 ID,从消息回调中获取
sign否int撤回时必传;设置待办成功后返回本字段

请求示例 ​

http
POST {BASE_URL}/roomAppTodo
Authorization: Bearer <你的调用凭证>
Content-Type: application/json

{
  "wId": "2c7a5bf6-e23d-4fb0-8f03-b9ae844b539f",
  "chatRoomId": "25553320410@chatroom",
  "newMsgId": 128659030295046943,
  "title": "寄快递,用圆通",
  "pagePath": "pages/tabBar/index/index.html?sampshare=...",
  "userName": "gh_f9d9fca26a50@app",
  "sendWcId": "wxid_ylxtflc0p8b22"
}
bash
curl -X POST '{BASE_URL}/roomAppTodo' \
  -H 'Authorization: Bearer <你的调用凭证>' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "wId": "2c7a5bf6-e23d-4fb0-8f03-b9ae844b539f",
  "chatRoomId": "25553320410@chatroom",
  "newMsgId": 128659030295046943,
  "title": "寄快递,用圆通",
  "pagePath": "pages/tabBar/index/index.html?sampshare=...",
  "userName": "gh_f9d9fca26a50@app",
  "sendWcId": "wxid_ylxtflc0p8b22"
}'
python
import requests

url = "{BASE_URL}/roomAppTodo"
headers = {"Authorization": "Bearer <你的调用凭证>", "Content-Type": "application/json"}
body = """{
  "wId": "2c7a5bf6-e23d-4fb0-8f03-b9ae844b539f",
  "chatRoomId": "25553320410@chatroom",
  "newMsgId": 128659030295046943,
  "title": "寄快递,用圆通",
  "pagePath": "pages/tabBar/index/index.html?sampshare=...",
  "userName": "gh_f9d9fca26a50@app",
  "sendWcId": "wxid_ylxtflc0p8b22"
}"""

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}/roomAppTodo";
String body = "{\n" +
    "  \"wId\": \"2c7a5bf6-e23d-4fb0-8f03-b9ae844b539f\",\n" +
    "  \"chatRoomId\": \"25553320410@chatroom\",\n" +
    "  \"newMsgId\": 128659030295046943,\n" +
    "  \"title\": \"寄快递,用圆通\",\n" +
    "  \"pagePath\": \"pages/tabBar/index/index.html?sampshare=...\",\n" +
    "  \"userName\": \"gh_f9d9fca26a50@app\",\n" +
    "  \"sendWcId\": \"wxid_ylxtflc0p8b22\"\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}/roomAppTodo';
$body = <<<'JSON'
{
  "wId": "2c7a5bf6-e23d-4fb0-8f03-b9ae844b539f",
  "chatRoomId": "25553320410@chatroom",
  "newMsgId": 128659030295046943,
  "title": "寄快递,用圆通",
  "pagePath": "pages/tabBar/index/index.html?sampshare=...",
  "userName": "gh_f9d9fca26a50@app",
  "sendWcId": "wxid_ylxtflc0p8b22"
}
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
}

响应参数 ​

参数名类型说明
codestring1000 成功;其他值都是失败,通常是 1001
messagestring反馈信息
dataobject/null成功时可能返回撤回所需信息,失败时通常为空
signint撤销密钥,设置待办成功后用于后续撤回