个人微信API二次开发:消息撤回两分钟窗口

个人微信API二次开发:消息撤回两分钟窗口 给客户的报价发成 90000。销售立刻调撤回回包失败。日志里没有当时的newMsgId脚本拿着文本内容去撤接口无法定位。个人微信撤回看发送成功时的消息 ID 和经过时间。窗口按客户端实际限制走代码里按约两分钟预留网络延迟。接口说明、参数和返回值都在 API 文档 里。发送当时就要存 IDGeWe API 发文本成功后从data里取出消息 ID 再入库。importtimeimportrequests HEADERS{X-GEWE-TOKEN:YOUR_TOKEN,Content-Type:application/json,}defpost_text(app_id,to_wxid,content):bodyrequests.post(http://api.geweapi.com/gewe/v2/api/message/postText,headersHEADERS,json{appId:app_id,toWxid:to_wxid,content:content},timeout30,).json()ifbody.get(ret)!200:raiseRuntimeError(body)databody.get(data)or{}msg_iddata.get(newMsgId)ordata.get(msgId)return{msg_id:msg_id,sent_at:time.time()}defrevoke(app_id,to_wxid,msg_id,sent_at):iftime.time()-sent_at110:raiseRuntimeError(窗口已过发更正说明不要再调撤回)returnrequests.post(http://api.geweapi.com/gewe/v2/api/message/revokeMsg,headersHEADERS,json{appId:app_id,toWxid:to_wxid,msgId:msg_id},timeout30,).json()群聊toWxid为xxxxchatroom。用另一个appId撤不掉这台设备发出的消息。超时后发「上一份报价作废正确为 9000」。平台地址GeWe API 官网收口报价发错先看 ID 和时钟。测试号发一条立刻撤回会话显示已撤回再给业务开这个按钮。