Skip to content

发送链接

向好友或群聊发送链接卡片消息。

接口地址: POST /sendUrl

前置条件

  • 微信实例已登录,并已获得可用的 wId
  • 接收方 wcId 可以是好友微信 ID,也可以是群 ID。
  • url 需要是接收方微信客户端可访问的公网链接。
  • thumbUrl 建议使用稳定公网图片,格式为 JPG 或 PNG,大小控制在 50KB 以内。

请求参数

参数名必选类型说明
wIdstring登录实例标识
wcIdstring接收方微信 ID 或群 ID
titlestring链接标题
urlstring跳转链接
descriptionstring链接描述
thumbUrlstring卡片缩略图 URL,JPG/PNG 格式,50KB 以内

响应参数

参数名类型说明
codestring1000 成功,1001 失败
messagestring反馈信息
data.typeint类型
data.msgIdlong消息 ID
data.newMsgIdlong新消息 ID
data.createTimelong发送时间戳(秒)
data.wcIdstring接收方 ID

请求示例

json
{
 "wId": "0000016f-63d2-ea61-000e-a659a75ea445",
 "wcId": "jack_623555049",
 "title": "Eyun 接入指南",
 "url": "https://timgsa.182.40.194.50/timg?image&quality=80&size=b9999_10000&sec=1577945612638&di=81a0281095a337037abf85f29929b55f&imgtype=0&src=http%3A%2F%2Fimage5.92bizhi.com%2Funclassified_unclassified--122_26-1600x1200.jpg",
 "description": "快速了解登录、消息发送和回调配置流程",
 "thumbUrl": "https://timgsa.182.40.194.50/timg?image&quality=80&size=b9999_10000&sec=1577945612638&di=81a0281095a337037abf85f29929b55f&imgtype=0&src=http%3A%2F%2Fimage5.92bizhi.com%2Funclassified_unclassified--122_26-1600x1200.jpg"
}

成功响应

json
{
 "code": "1000",
 "message": "发送链接成功",
 "data": {
 "type": null,
 "msgId": 697760503,
 "newMsgId": 181228940242588250,
 "createTime": 1641457185,
 "wcId": "wxid_amdhbnjfj3d"
 }
}

错误响应

json
{
 "message": "失败",
 "code": "1001",
 "data": null
}

使用建议

  • 链接卡片适合营销页、活动页和文章分享;纯文本 URL 建议使用发送文本消息接口。
  • 建议业务侧在发送前校验 urlthumbUrl 是否可访问,避免微信端展示空白卡片。
  • 发送成功后保存 msgIdnewMsgIdcreateTime,便于追踪发送结果或执行撤回。