当前公开契约 · 消息

企业微信发送文件 API

发送文件。先调「上传文件」,把返回的 data 整体作为 content 传入。

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

请求地址

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

请求示例

curl -X POST 'https://api.qingluanbot.com/qingluan/api/message/sendFile' \
  -H 'QL-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "appid": "we_xxxxxxxxxxxxxxx",
  "conversationId": 1000000000000001,
  "content": {
    "id": "<sample-media-id>",
    "name": "示例名称",
    "url": "",
    "size": 12216,
    "aesKey": "00000000000000000000000000000000",
    "md5": "00000000000000000000000000000000"
  }
}'

请求参数

字段类型要求说明
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": {
      "id": "",
      "name": "",
      "url": "",
      "size": 0,
      "md5": ""
    }
  },
  "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 响应,可在开发者控制台完成配置与验证。

打开开发者控制台