问题:我们正常使用了文档中,客服菜单的功能,但是为什么微信服务器返回xml代码中没有正确返回“MsgId:消息ID bizmsgmenuid:点击的菜单ID”?目前使用的是已认证的服务号
文档:https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Service_Center_messages.htmlhttps://developers.weixin.qq.com/doc/offiaccount/Getting_Started/Global_Return_Code.html
def send_menu_message(openid, menu_data):
access_token = get_access_token()
if not access_token:
return False
url = f"https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token={access_token}"
payload = {
"touser": openid,
"msgtype": "msgmenu",
"msgmenu": menu_data
}
response = requests.post(url, data=json.dumps(payload, ensure_ascii=False).encode('utf-8'), headers={'Content-Type': 'application/json; charset=UTF-8'})
if response.status_code == 200:
return True
else:
return False
b'<xml><ToUserName><![CDATA[osDUQ60EsybEQNCQwOQ2fOmqK8so]]></ToUserName><FromUserName><![CDATA[gh_3f7badc0771f]]></FromUserName><CreateTime><![CDATA[1735382317]]></CreateTime><MsgType><![CDATA[text]]></MsgType><Content><![CDATA[\xe6\x84\x9f\xe8\xb0\xa2\xe6\x82\xa8\xe7\x9a\x84\xe8\xaf\x84\xe4\xbb\xb7]]></Content></xml>'