当前公开契约 · 消息

企业微信发送小程序卡片 API

发送小程序卡片。需要小程序 username(gh_ 开头)、appId、path 与封面图。 :::tip 🔗 调用关系 准备小程序信息,并先上传封面图以取得 coverFileId、coverAesKey 等字段。 ::: :::note 🧩 字段命名:设备标识使用 appid,小程序标识使用 appId,两者区分大小写。 ::: :::check ✅ 成功判定:HTTP 200 且响应体 code = 0。业务失败请查看 message 与 detail。 :::

进入控制台试用 查看完整契约
POST实例字段:appid更新:2026-10-11

请求地址

POST https://api.qingluanbot.com/qingluan/api/message/sendMiniProgram

请求示例

curl -X POST 'https://api.qingluanbot.com/qingluan/api/message/sendMiniProgram' \
  -H 'QL-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "appid": "we_xxxxxxxxxxxxxxx",
  "conversationId": 1000000000000001,
  "content": {
    "title": "示例名称",
    "miniProgramDetails": {
      "username": "gh_example@app",
      "appId": "wx0000000000000000",
      "path": "pages/index/index",
      "coverUrl": "https://example.com/sample",
      "title": "示例名称",
      "appName": "示例名称",
      "fallbackUrl": "https://example.com/sample",
      "coverFileId": "<media-file-id>",
      "coverMd5": "00000000000000000000000000000000",
      "coverAesKey": "00000000000000000000000000000000",
      "coverSize": 57102,
      "coverWidth": 1000000000000001,
      "coverHeight": 400
    }
  }
}'

请求参数

字段类型要求说明
appidstring必填青鸾实例 ID,形如 we_xxxxxxxxxxxxxxx。在开发者控制台「实例与回调」扫码上号后获得。
conversationIdinteger必填会话 ID。群聊传群号,私聊传对方 uin。注意它超出 JavaScript 安全整数范围,JS 侧需按大整数处理,不要经过 Number()。
contentobject必填消息/动态正文。纯文本类接口传字符串;媒体类传对象(把上传接口返回的 data 整体带上)

响应判断

能力层接口返回包含 code、message、time 与 data 等字段;请以 code=0 判断业务成功。HTTP 200 只表示网关已返回响应,不能替代业务状态判断。

可能的响应状态

HTTP 状态公开契约说明
200原样返回(code = 0 即成功)
403受控接口,需通过控制台配置
404appid 不存在或无权访问

200 响应示例

{
  "code": 0,
  "data": {
    "id": 0,
    "syncKey": 0,
    "messageType": 0,
    "fromUserId": 0,
    "toUserId": 0,
    "roomId": 0,
    "contentType": 0,
    "sendTime": 0,
    "appInfo": "",
    "senderName": "",
    "content": {
      "title": "",
      "miniProgramDetails": {
        "username": "",
        "appId": "",
        "path": "",
        "type": 0,
        "source": 0,
        "coverUrl": "",
        "title": "",
        "appName": "",
        "fallbackUrl": "",
        "appNameDup": "",
        "coverMd5": "",
        "coverSize": 0,
        "reserved19": 0,
        "reserved20": 0,
        "coverWidth": 0,
        "coverHeight": 0,
        "flag": 0
      }
    }
  },
  "detail": "",
  "message": "ok",
  "time": "2026-07-21 07:33:17"
}

接入步骤

  1. 在青鸾开发者控制台创建或查看 API Key。
  2. 在「实例与回调」接入企业微信账号,取得 appid。
  3. 请求头携带 QL-Key,按当前契约提交 JSON 请求。
  4. 读取响应中的 code;仅当 code=0 时按成功流程处理。

把企业微信能力接入你的系统

从 API Key、appid 到首个 code=0 响应,可在开发者控制台完成配置与验证。

打开开发者控制台