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