Appearance
可订阅事件列表
返回可订阅的事件类型(message.received / friend.added / friend.deleted / contact.modified / instance.online / instance.offline)。
请求参数
无请求参数。
请求示例
http
POST {BASE_URL}/wx-api/webhook/event-types
Authorization: Bearer <你的 App Token>
Content-Type: application/json
{}bash
curl -X POST '{BASE_URL}/wx-api/webhook/event-types' \
-H 'Authorization: Bearer <你的 App Token>' \
-H 'Content-Type: application/json' \
--data-raw '{}'python
import requests
url = "{BASE_URL}/wx-api/webhook/event-types"
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/event-types";
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/event-types';
$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": {
"items": [
{
"name": "message.received",
"category": "",
"description": ""
},
{
"name": "friend.added",
"category": "",
"description": ""
},
{
"name": "friend.deleted",
"category": "",
"description": ""
},
{
"name": "contact.modified",
"category": "",
"description": ""
},
{
"name": "instance.online",
"category": "",
"description": ""
},
{
"name": "instance.offline",
"category": "",
"description": ""
}
]
},
"message": "ok"
}