Appearance
发送文本
发送文本消息。首次联调建议把 wcId 设为 filehelper,手机微信能直接看到结果。
接口地址: POST /sendText
前置条件
- 微信实例已登录,并已获得可用
wId。 - 发送目标是好友、文件传输助手或当前微信所在群聊。
- 同一
wId建议进入队列,避免并发直发。
请求参数
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| wId | 是 | string | 登录实例标识 |
| wcId | 是 | string | 接收方微信 ID、filehelper 或群 ID,如 24187765053@chatroom |
| content | 是 | string | 文本消息内容 |
响应参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| code | string | 1000 成功,1001 失败 |
| message | string | 反馈信息 |
| data.type | int | 消息类型 |
| data.msgId | long | 消息 ID |
| data.newMsgId | long | 新消息 ID |
| data.createTime | long | 发送时间戳(秒) |
| data.wcId | string | 接收方 ID |
请求示例
json
{
"wId": "0000016e-63eb-f319-0001-ed01076abf1f",
"wcId": "filehelper",
"content": "Hello from Eyun"
}成功响应
json
{
"code": "1000",
"message": "处理成功",
"data": {
"type": 1,
"msgId": 2562652205,
"newMsgId": 4482117376572170921,
"createTime": 1641457769,
"wcId": "filehelper"
}
}错误响应
json
{
"code": "1001",
"message": "失败",
"data": null
}使用建议
- 首次接入先发到
filehelper,确认wId、签名和网络正常。 - 文本适合通知、客服回复和简单指令;图片、文件、链接请用对应接口。
- 高频发送时按
wId做队列和限速。
验证与排查
| 场景 | 处理方式 |
|---|---|
| 首次联调 | 发到 filehelper,手机微信能看到消息即链路正常 |
| 返回成功但目标没收到 | 检查 wId 是否在线,目标 wcId 是否正确 |
| 返回失败 | 参考 发送接口通用错误码 |
| 高频发送 | 参考 API 使用规范 配置队列和限速 |
