Appearance
转发链接消息
把收到的链接卡片原样转发给好友或群聊,保留原卡片的样式。自己拼一张新卡片用发送链接。
接口地址: POST /forwardUrl
说明与注意
content用链接消息回调里的 XML 原文。
请求参数
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| wId | 是 | string | 登录实例标识 |
| wcId | 是 | string | 接收方微信 ID 或群 ID |
| content | 是 | string | 链接消息 XML 内容 |
请求示例
http
POST {BASE_URL}/forwardUrl
Authorization: Bearer <你的调用凭证>
Content-Type: application/json
{
"wId": "0000016f-a805-4715-0001-848f9a297a40",
"wcId": "jack_623555049",
"content": "<?xml version=\"1.0\"?>\n<msg>\n\t<appmsg appid=\"\" sdkver=\"0\">\n\t\t<title>理想汽车正式登陆纳斯达克!</title>\n\t\t<des>7月30日,理想汽车正式在美国纳斯达克证券市场正式挂牌上市,股票代码为“LI”,发行价格为每股11.5美元。</des>\n\t\t<action />\n\t\t<type>5</type>\n\t\t<showtype>0</showtype>\n\t\t<soundtype>0</soundtype>\n\t\t<mediatagname />\n\t\t<messageext />\n\t\t<messageaction />\n\t\t<content />\n\t\t<contentattr>0</contentattr>\n\t\t<url>http://mp.weixin.qq.com/s?__biz=MzU0Mjk1MDk4MA==&mid=2247489268&idx=1&sn=b9df468408299b16ea55b804f8eaac6f&chksm=fb1385dfcc640cc90de251b2d641739fe91278c6d6c3a94239cadfe0f5f1146bdf283d7b73a6&mpshare=1&scene=2&srcid=0730zRNXTUJqhf7Fztpamu6n&sharer_sharetime=1596158677187&sharer_shareid=b5d32fcdbf6f6bd1700daee19cead97b#rd</url>\n\t\t<lowurl />\n\t\t<dataurl />\n\t\t<lowdataurl />\n\t\t<songalbumurl />\n\t\t<songlyric />\n\t\t<appattach>\n\t\t\t<totallen>0</totallen>\n\t\t\t<attachid />\n\t\t\t<emoticonmd5></emoticonmd5>\n\t\t\t<fileext />\n\t\t\t<cdnthumburl>30570201000450304e0201000204502c9b9f02032f55f90204a40260b402045f2379650429777875706c6f61645f777869645f796c7874666c636730703862323237395f313539363136303335370204010400030201000400</cdnthumburl>\n\t\t\t<cdnthumbmd5>51f22eeff56ff76a7cab2bf177ef6c1a</cdnthumbmd5>\n\t\t\t<cdnthumblength>25332</cdnthumblength>\n\t\t\t<cdnthumbwidth>150</cdnthumbwidth>\n\t\t\t<cdnthumbheight>150</cdnthumbheight>\n\t\t\t<cdnthumbaeskey>99e7fd1d7d33dba159edfa52607645c3</cdnthumbaeskey>\n\t\t\t<aeskey>99e7fd1d7d33dba159edfa52607645c3</aeskey>\n\t\t\t<encryver>0</encryver>\n\t\t\t<filekey>wxid_ylxtflcg0p8b2279_1596160357</filekey>\n\t\t</appattach>\n\t\t<extinfo />\n\t\t<sourceusername>gh_89701dbd6858</sourceusername>\n\t\t<sourcedisplayname>理想汽车</sourcedisplayname>\n\t\t<thumburl />\n\t\t<md5 />\n\t\t<statextstr />\n\t\t<directshare>0</directshare>\n\t\t<mmreadershare>\n\t\t\t<itemshowtype>0</itemshowtype>\n\t\t\t<nativepage>0</nativepage>\n\t\t\t<pubtime>0</pubtime>\n\t\t\t<duration>0</duration>\n\t\t\t<width>0</width>\n\t\t\t<height>0</height>\n\t\t\t<vid />\n\t\t\t<funcflag>0</funcflag>\n\t\t\t<ispaysubscribe>0</ispaysubscribe>\n\t\t</mmreadershare>\n\t</appmsg>\n\t<fromusername>wxid_i6qsbbjenjuj22</fromusername>\n\t<scene>0</scene>\n\t<appinfo>\n\t\t<version>1</version>\n\t\t<appname />\n\t</appinfo>\n\t<commenturl />\n</msg>\n"
}bash
curl -X POST '{BASE_URL}/forwardUrl' \
-H 'Authorization: Bearer <你的调用凭证>' \
-H 'Content-Type: application/json' \
--data-raw '{
"wId": "0000016f-a805-4715-0001-848f9a297a40",
"wcId": "jack_623555049",
"content": "<?xml version=\"1.0\"?>\n<msg>\n\t<appmsg appid=\"\" sdkver=\"0\">\n\t\t<title>理想汽车正式登陆纳斯达克!</title>\n\t\t<des>7月30日,理想汽车正式在美国纳斯达克证券市场正式挂牌上市,股票代码为“LI”,发行价格为每股11.5美元。</des>\n\t\t<action />\n\t\t<type>5</type>\n\t\t<showtype>0</showtype>\n\t\t<soundtype>0</soundtype>\n\t\t<mediatagname />\n\t\t<messageext />\n\t\t<messageaction />\n\t\t<content />\n\t\t<contentattr>0</contentattr>\n\t\t<url>http://mp.weixin.qq.com/s?__biz=MzU0Mjk1MDk4MA==&mid=2247489268&idx=1&sn=b9df468408299b16ea55b804f8eaac6f&chksm=fb1385dfcc640cc90de251b2d641739fe91278c6d6c3a94239cadfe0f5f1146bdf283d7b73a6&mpshare=1&scene=2&srcid=0730zRNXTUJqhf7Fztpamu6n&sharer_sharetime=1596158677187&sharer_shareid=b5d32fcdbf6f6bd1700daee19cead97b#rd</url>\n\t\t<lowurl />\n\t\t<dataurl />\n\t\t<lowdataurl />\n\t\t<songalbumurl />\n\t\t<songlyric />\n\t\t<appattach>\n\t\t\t<totallen>0</totallen>\n\t\t\t<attachid />\n\t\t\t<emoticonmd5></emoticonmd5>\n\t\t\t<fileext />\n\t\t\t<cdnthumburl>30570201000450304e0201000204502c9b9f02032f55f90204a40260b402045f2379650429777875706c6f61645f777869645f796c7874666c636730703862323237395f313539363136303335370204010400030201000400</cdnthumburl>\n\t\t\t<cdnthumbmd5>51f22eeff56ff76a7cab2bf177ef6c1a</cdnthumbmd5>\n\t\t\t<cdnthumblength>25332</cdnthumblength>\n\t\t\t<cdnthumbwidth>150</cdnthumbwidth>\n\t\t\t<cdnthumbheight>150</cdnthumbheight>\n\t\t\t<cdnthumbaeskey>99e7fd1d7d33dba159edfa52607645c3</cdnthumbaeskey>\n\t\t\t<aeskey>99e7fd1d7d33dba159edfa52607645c3</aeskey>\n\t\t\t<encryver>0</encryver>\n\t\t\t<filekey>wxid_ylxtflcg0p8b2279_1596160357</filekey>\n\t\t</appattach>\n\t\t<extinfo />\n\t\t<sourceusername>gh_89701dbd6858</sourceusername>\n\t\t<sourcedisplayname>理想汽车</sourcedisplayname>\n\t\t<thumburl />\n\t\t<md5 />\n\t\t<statextstr />\n\t\t<directshare>0</directshare>\n\t\t<mmreadershare>\n\t\t\t<itemshowtype>0</itemshowtype>\n\t\t\t<nativepage>0</nativepage>\n\t\t\t<pubtime>0</pubtime>\n\t\t\t<duration>0</duration>\n\t\t\t<width>0</width>\n\t\t\t<height>0</height>\n\t\t\t<vid />\n\t\t\t<funcflag>0</funcflag>\n\t\t\t<ispaysubscribe>0</ispaysubscribe>\n\t\t</mmreadershare>\n\t</appmsg>\n\t<fromusername>wxid_i6qsbbjenjuj22</fromusername>\n\t<scene>0</scene>\n\t<appinfo>\n\t\t<version>1</version>\n\t\t<appname />\n\t</appinfo>\n\t<commenturl />\n</msg>\n"
}'python
import requests
url = "{BASE_URL}/forwardUrl"
headers = {"Authorization": "Bearer <你的调用凭证>", "Content-Type": "application/json"}
body = r"""{
"wId": "0000016f-a805-4715-0001-848f9a297a40",
"wcId": "jack_623555049",
"content": "<?xml version=\"1.0\"?>\n<msg>\n\t<appmsg appid=\"\" sdkver=\"0\">\n\t\t<title>理想汽车正式登陆纳斯达克!</title>\n\t\t<des>7月30日,理想汽车正式在美国纳斯达克证券市场正式挂牌上市,股票代码为“LI”,发行价格为每股11.5美元。</des>\n\t\t<action />\n\t\t<type>5</type>\n\t\t<showtype>0</showtype>\n\t\t<soundtype>0</soundtype>\n\t\t<mediatagname />\n\t\t<messageext />\n\t\t<messageaction />\n\t\t<content />\n\t\t<contentattr>0</contentattr>\n\t\t<url>http://mp.weixin.qq.com/s?__biz=MzU0Mjk1MDk4MA==&mid=2247489268&idx=1&sn=b9df468408299b16ea55b804f8eaac6f&chksm=fb1385dfcc640cc90de251b2d641739fe91278c6d6c3a94239cadfe0f5f1146bdf283d7b73a6&mpshare=1&scene=2&srcid=0730zRNXTUJqhf7Fztpamu6n&sharer_sharetime=1596158677187&sharer_shareid=b5d32fcdbf6f6bd1700daee19cead97b#rd</url>\n\t\t<lowurl />\n\t\t<dataurl />\n\t\t<lowdataurl />\n\t\t<songalbumurl />\n\t\t<songlyric />\n\t\t<appattach>\n\t\t\t<totallen>0</totallen>\n\t\t\t<attachid />\n\t\t\t<emoticonmd5></emoticonmd5>\n\t\t\t<fileext />\n\t\t\t<cdnthumburl>30570201000450304e0201000204502c9b9f02032f55f90204a40260b402045f2379650429777875706c6f61645f777869645f796c7874666c636730703862323237395f313539363136303335370204010400030201000400</cdnthumburl>\n\t\t\t<cdnthumbmd5>51f22eeff56ff76a7cab2bf177ef6c1a</cdnthumbmd5>\n\t\t\t<cdnthumblength>25332</cdnthumblength>\n\t\t\t<cdnthumbwidth>150</cdnthumbwidth>\n\t\t\t<cdnthumbheight>150</cdnthumbheight>\n\t\t\t<cdnthumbaeskey>99e7fd1d7d33dba159edfa52607645c3</cdnthumbaeskey>\n\t\t\t<aeskey>99e7fd1d7d33dba159edfa52607645c3</aeskey>\n\t\t\t<encryver>0</encryver>\n\t\t\t<filekey>wxid_ylxtflcg0p8b2279_1596160357</filekey>\n\t\t</appattach>\n\t\t<extinfo />\n\t\t<sourceusername>gh_89701dbd6858</sourceusername>\n\t\t<sourcedisplayname>理想汽车</sourcedisplayname>\n\t\t<thumburl />\n\t\t<md5 />\n\t\t<statextstr />\n\t\t<directshare>0</directshare>\n\t\t<mmreadershare>\n\t\t\t<itemshowtype>0</itemshowtype>\n\t\t\t<nativepage>0</nativepage>\n\t\t\t<pubtime>0</pubtime>\n\t\t\t<duration>0</duration>\n\t\t\t<width>0</width>\n\t\t\t<height>0</height>\n\t\t\t<vid />\n\t\t\t<funcflag>0</funcflag>\n\t\t\t<ispaysubscribe>0</ispaysubscribe>\n\t\t</mmreadershare>\n\t</appmsg>\n\t<fromusername>wxid_i6qsbbjenjuj22</fromusername>\n\t<scene>0</scene>\n\t<appinfo>\n\t\t<version>1</version>\n\t\t<appname />\n\t</appinfo>\n\t<commenturl />\n</msg>\n"
}"""
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}/forwardUrl";
String body = "{\n" +
" \"wId\": \"0000016f-a805-4715-0001-848f9a297a40\",\n" +
" \"wcId\": \"jack_623555049\",\n" +
" \"content\": \"<?xml version=\\\"1.0\\\"?>\\n<msg>\\n\\t<appmsg appid=\\\"\\\" sdkver=\\\"0\\\">\\n\\t\\t<title>理想汽车正式登陆纳斯达克!</title>\\n\\t\\t<des>7月30日,理想汽车正式在美国纳斯达克证券市场正式挂牌上市,股票代码为“LI”,发行价格为每股11.5美元。</des>\\n\\t\\t<action />\\n\\t\\t<type>5</type>\\n\\t\\t<showtype>0</showtype>\\n\\t\\t<soundtype>0</soundtype>\\n\\t\\t<mediatagname />\\n\\t\\t<messageext />\\n\\t\\t<messageaction />\\n\\t\\t<content />\\n\\t\\t<contentattr>0</contentattr>\\n\\t\\t<url>http://mp.weixin.qq.com/s?__biz=MzU0Mjk1MDk4MA==&mid=2247489268&idx=1&sn=b9df468408299b16ea55b804f8eaac6f&chksm=fb1385dfcc640cc90de251b2d641739fe91278c6d6c3a94239cadfe0f5f1146bdf283d7b73a6&mpshare=1&scene=2&srcid=0730zRNXTUJqhf7Fztpamu6n&sharer_sharetime=1596158677187&sharer_shareid=b5d32fcdbf6f6bd1700daee19cead97b#rd</url>\\n\\t\\t<lowurl />\\n\\t\\t<dataurl />\\n\\t\\t<lowdataurl />\\n\\t\\t<songalbumurl />\\n\\t\\t<songlyric />\\n\\t\\t<appattach>\\n\\t\\t\\t<totallen>0</totallen>\\n\\t\\t\\t<attachid />\\n\\t\\t\\t<emoticonmd5></emoticonmd5>\\n\\t\\t\\t<fileext />\\n\\t\\t\\t<cdnthumburl>30570201000450304e0201000204502c9b9f02032f55f90204a40260b402045f2379650429777875706c6f61645f777869645f796c7874666c636730703862323237395f313539363136303335370204010400030201000400</cdnthumburl>\\n\\t\\t\\t<cdnthumbmd5>51f22eeff56ff76a7cab2bf177ef6c1a</cdnthumbmd5>\\n\\t\\t\\t<cdnthumblength>25332</cdnthumblength>\\n\\t\\t\\t<cdnthumbwidth>150</cdnthumbwidth>\\n\\t\\t\\t<cdnthumbheight>150</cdnthumbheight>\\n\\t\\t\\t<cdnthumbaeskey>99e7fd1d7d33dba159edfa52607645c3</cdnthumbaeskey>\\n\\t\\t\\t<aeskey>99e7fd1d7d33dba159edfa52607645c3</aeskey>\\n\\t\\t\\t<encryver>0</encryver>\\n\\t\\t\\t<filekey>wxid_ylxtflcg0p8b2279_1596160357</filekey>\\n\\t\\t</appattach>\\n\\t\\t<extinfo />\\n\\t\\t<sourceusername>gh_89701dbd6858</sourceusername>\\n\\t\\t<sourcedisplayname>理想汽车</sourcedisplayname>\\n\\t\\t<thumburl />\\n\\t\\t<md5 />\\n\\t\\t<statextstr />\\n\\t\\t<directshare>0</directshare>\\n\\t\\t<mmreadershare>\\n\\t\\t\\t<itemshowtype>0</itemshowtype>\\n\\t\\t\\t<nativepage>0</nativepage>\\n\\t\\t\\t<pubtime>0</pubtime>\\n\\t\\t\\t<duration>0</duration>\\n\\t\\t\\t<width>0</width>\\n\\t\\t\\t<height>0</height>\\n\\t\\t\\t<vid />\\n\\t\\t\\t<funcflag>0</funcflag>\\n\\t\\t\\t<ispaysubscribe>0</ispaysubscribe>\\n\\t\\t</mmreadershare>\\n\\t</appmsg>\\n\\t<fromusername>wxid_i6qsbbjenjuj22</fromusername>\\n\\t<scene>0</scene>\\n\\t<appinfo>\\n\\t\\t<version>1</version>\\n\\t\\t<appname />\\n\\t</appinfo>\\n\\t<commenturl />\\n</msg>\\n\"\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}/forwardUrl';
$body = <<<'JSON'
{
"wId": "0000016f-a805-4715-0001-848f9a297a40",
"wcId": "jack_623555049",
"content": "<?xml version=\"1.0\"?>\n<msg>\n\t<appmsg appid=\"\" sdkver=\"0\">\n\t\t<title>理想汽车正式登陆纳斯达克!</title>\n\t\t<des>7月30日,理想汽车正式在美国纳斯达克证券市场正式挂牌上市,股票代码为“LI”,发行价格为每股11.5美元。</des>\n\t\t<action />\n\t\t<type>5</type>\n\t\t<showtype>0</showtype>\n\t\t<soundtype>0</soundtype>\n\t\t<mediatagname />\n\t\t<messageext />\n\t\t<messageaction />\n\t\t<content />\n\t\t<contentattr>0</contentattr>\n\t\t<url>http://mp.weixin.qq.com/s?__biz=MzU0Mjk1MDk4MA==&mid=2247489268&idx=1&sn=b9df468408299b16ea55b804f8eaac6f&chksm=fb1385dfcc640cc90de251b2d641739fe91278c6d6c3a94239cadfe0f5f1146bdf283d7b73a6&mpshare=1&scene=2&srcid=0730zRNXTUJqhf7Fztpamu6n&sharer_sharetime=1596158677187&sharer_shareid=b5d32fcdbf6f6bd1700daee19cead97b#rd</url>\n\t\t<lowurl />\n\t\t<dataurl />\n\t\t<lowdataurl />\n\t\t<songalbumurl />\n\t\t<songlyric />\n\t\t<appattach>\n\t\t\t<totallen>0</totallen>\n\t\t\t<attachid />\n\t\t\t<emoticonmd5></emoticonmd5>\n\t\t\t<fileext />\n\t\t\t<cdnthumburl>30570201000450304e0201000204502c9b9f02032f55f90204a40260b402045f2379650429777875706c6f61645f777869645f796c7874666c636730703862323237395f313539363136303335370204010400030201000400</cdnthumburl>\n\t\t\t<cdnthumbmd5>51f22eeff56ff76a7cab2bf177ef6c1a</cdnthumbmd5>\n\t\t\t<cdnthumblength>25332</cdnthumblength>\n\t\t\t<cdnthumbwidth>150</cdnthumbwidth>\n\t\t\t<cdnthumbheight>150</cdnthumbheight>\n\t\t\t<cdnthumbaeskey>99e7fd1d7d33dba159edfa52607645c3</cdnthumbaeskey>\n\t\t\t<aeskey>99e7fd1d7d33dba159edfa52607645c3</aeskey>\n\t\t\t<encryver>0</encryver>\n\t\t\t<filekey>wxid_ylxtflcg0p8b2279_1596160357</filekey>\n\t\t</appattach>\n\t\t<extinfo />\n\t\t<sourceusername>gh_89701dbd6858</sourceusername>\n\t\t<sourcedisplayname>理想汽车</sourcedisplayname>\n\t\t<thumburl />\n\t\t<md5 />\n\t\t<statextstr />\n\t\t<directshare>0</directshare>\n\t\t<mmreadershare>\n\t\t\t<itemshowtype>0</itemshowtype>\n\t\t\t<nativepage>0</nativepage>\n\t\t\t<pubtime>0</pubtime>\n\t\t\t<duration>0</duration>\n\t\t\t<width>0</width>\n\t\t\t<height>0</height>\n\t\t\t<vid />\n\t\t\t<funcflag>0</funcflag>\n\t\t\t<ispaysubscribe>0</ispaysubscribe>\n\t\t</mmreadershare>\n\t</appmsg>\n\t<fromusername>wxid_i6qsbbjenjuj22</fromusername>\n\t<scene>0</scene>\n\t<appinfo>\n\t\t<version>1</version>\n\t\t<appname />\n\t</appinfo>\n\t<commenturl />\n</msg>\n"
}
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": 6,
"msgId": 697760535,
"newMsgId": 6957007917217750754,
"createTime": 1641457929,
"wcId": "jack_623555049"
}
}错误响应
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 |