Skip to content
POST{BASE_URL}/wx-api/webhook/get
只读回调配置JSON · Bearer App Token

查询当前回调配置

返回当前应用的回调配置(未设置则 webhook 为 null)。

说明与注意

  • secret 只在首次创建时返回一次,查询不会返回明文;更新已有配置不返回也不改 secret
  • 密钥丢失时,先删除回调配置,再重新设置获取新 secret,并同步更新验签密钥;也可联系对接人。

请求参数

无请求参数。

请求示例

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

{}
bash
curl -X POST '{BASE_URL}/wx-api/webhook/get' \
  -H 'Authorization: Bearer <你的 App Token>' \
  -H 'Content-Type: application/json' \
  --data-raw '{}'
python
import requests

url = "{BASE_URL}/wx-api/webhook/get"
headers = {"Authorization": "Bearer <你的 App Token>", "Content-Type": "application/json"}
body = """{}"""

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/webhook/get";
String body = "{}";

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/webhook/get';
$body = <<<'JSON'
{}
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": {
    "webhook": {
      "id": "whk_…",
      "name": "OpenAPI 回调",
      "url": "https://your.domain/hook",
      "events": [
        "message.received",
        "friend.added",
        "friend.deleted",
        "contact.modified",
        "instance.online",
        "instance.offline"
      ],
      "status": "active",
      "signingEnabled": true
    }
  },
  "message": "ok"
}

下一步