Appearance
发送链接
给好友或群聊发一张链接卡片。
接口地址: POST /sendUrl
说明与注意
url、thumbUrl都要是公网能直接访问的地址。
请求参数
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| wId | 是 | string | 登录实例标识 |
| wcId | 是 | string | 接收方微信 ID 或群 ID |
| title | 是 | string | 链接标题 |
| url | 是 | string | 跳转链接 |
| description | 是 | string | 链接描述 |
| thumbUrl | 是 | string | 卡片缩略图 URL,JPG/PNG 格式,50KB 以内 |
请求示例
http
POST {BASE_URL}/sendUrl
Authorization: Bearer <你的调用凭证>
Content-Type: application/json
{
"wId": "0000016f-63d2-ea61-000e-a659a75ea445",
"wcId": "jack_623555049",
"title": "Eyun 接入指南",
"url": "https://example.com/articles/eyun-quickstart",
"description": "快速了解登录、消息发送和回调配置流程",
"thumbUrl": "https://example.com/images/eyun-quickstart-cover.jpg"
}bash
curl -X POST '{BASE_URL}/sendUrl' \
-H 'Authorization: Bearer <你的调用凭证>' \
-H 'Content-Type: application/json' \
--data-raw '{
"wId": "0000016f-63d2-ea61-000e-a659a75ea445",
"wcId": "jack_623555049",
"title": "Eyun 接入指南",
"url": "https://example.com/articles/eyun-quickstart",
"description": "快速了解登录、消息发送和回调配置流程",
"thumbUrl": "https://example.com/images/eyun-quickstart-cover.jpg"
}'python
import requests
url = "{BASE_URL}/sendUrl"
headers = {"Authorization": "Bearer <你的调用凭证>", "Content-Type": "application/json"}
body = """{
"wId": "0000016f-63d2-ea61-000e-a659a75ea445",
"wcId": "jack_623555049",
"title": "Eyun 接入指南",
"url": "https://example.com/articles/eyun-quickstart",
"description": "快速了解登录、消息发送和回调配置流程",
"thumbUrl": "https://example.com/images/eyun-quickstart-cover.jpg"
}"""
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}/sendUrl";
String body = "{\n" +
" \"wId\": \"0000016f-63d2-ea61-000e-a659a75ea445\",\n" +
" \"wcId\": \"jack_623555049\",\n" +
" \"title\": \"Eyun 接入指南\",\n" +
" \"url\": \"https://example.com/articles/eyun-quickstart\",\n" +
" \"description\": \"快速了解登录、消息发送和回调配置流程\",\n" +
" \"thumbUrl\": \"https://example.com/images/eyun-quickstart-cover.jpg\"\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}/sendUrl';
$body = <<<'JSON'
{
"wId": "0000016f-63d2-ea61-000e-a659a75ea445",
"wcId": "jack_623555049",
"title": "Eyun 接入指南",
"url": "https://example.com/articles/eyun-quickstart",
"description": "快速了解登录、消息发送和回调配置流程",
"thumbUrl": "https://example.com/images/eyun-quickstart-cover.jpg"
}
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
{
"code": "1000",
"message": "发送链接成功",
"data": {
"type": null,
"msgId": 697760503,
"newMsgId": 181228940242588250,
"createTime": 1641457185,
"wcId": "wxid_amdhbnjfj3d"
}
}错误响应
json
{
"message": "失败",
"code": "1001",
"data": null
}响应参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| code | string | 1000 成功;其他值都是失败,通常是 1001 |
| message | string | 反馈信息 |
| data.type | int | 类型 |
| data.msgId | long | 消息 ID |
| data.newMsgId | long | 新消息 ID |
| data.createTime | long | 发送时间戳(秒) |
| data.wcId | string | 接收方 ID |