简体   繁体   English

无法使用 whatsapp 业务 api 将我传入的 whatsapp 消息标记为已读

[英]can not mark as read my incoming whatsapp message using whatsapp business api

Here's what I've done.这就是我所做的。 I'm using Python programming language.我正在使用 Python 编程语言。

res = requests.put(
    url='https://graph.facebook.com/v13.0/messages/wamid.HBgMOTE4NzgwNDk1ODA0FQIAEhggQkU2OURGQUYyMzdCNDlBRkQ1QUI4RERBNDdENDBBOEIA', 
    header = {
        "Authorization": "Bearer my-auth-token",
        "Content-Type": "application/json"
    }, 
    data=json.dumps({"status": "read"})
)

print(res.json())

Output:输出:

{'error': {'message': 'Unknown path components: /wamid.HBgMOTE4NzgwNDk1ODA0FQIAEhggQkU2OURGQUYyMzdCNDlBRkQ1QUI4RERBNDdENDBBOEIA', 'type': 'OAuthException', 'code': 2500, 'fbtrace_id': 'A6f8nCvHOSXSZcAGmevCGeJ'}}

According to the documentation the url is supposed to look like this:根据文档,网址应该如下所示:

https://graph.facebook.com/v13.0/PHONE_NUMBER_ID/messages

You seem to be missing PHONE_NUMBER_ID in its correct place, and seem to have wamid... which doesn't seem to be needed here.您似乎在正确的位置缺少PHONE_NUMBER_ID ,并且似乎有wamid...这里似乎不需要。 I also notice that your request body is missing the required data:我还注意到您的请求正文缺少所需的数据:

"messaging_product": "whatsapp",
"status": "read",  <- you only seem to have this
"message_id": "MESSAGE_ID"

Also, the docs show a POST request while you seem to be using a PUT request.此外,文档显示 POST 请求,而您似乎正在使用 PUT 请求。 If you solve all these problems it should start working.如果你解决了所有这些问题,它应该开始工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 是否有任何whatsapp API可用于在whatsapp中广播消息并发送给我的联系人? - Is any whatsapp API available to broadcast message & sent to my contacts in whatsapp? 将 OpenAI API 与 WhatsApp Business API 集成用于聊天机器人 - Integrating OpenAI API with WhatsApp Business API for chatbot 使用 Twilio API,Whatsapp 批准的 Twilio 号码,预先批准的模板,无法接收 whatsapp 消息 - Using the Twilio API, Whatsapp approved Twilio number, pre-approved template, unable to receive whatsapp message 为什么我不能让 Selenium 使用 Python 3.8 和 Chrome 在我的 WhatsApp Web 中编写消息? - Why can't I make Selenium write a message in my WhatsApp Web using Python 3.8 and Chrome? 使用 Twilio 和 WhatsApp 处理消息 - Processing a Message Using Twilio and WhatsApp selenium 从 WhatsApp 读取消息超时错误 - selenium read message from WhatsApp timeout error 如何使用 Whatsapp Cloud API 发送短信 - How to send a text message with Whatsapp Cloud API 回复传入的媒体消息| Twilio Whatsapp API | 内部服务器错误 - Reply to Incoming Media Messages | Twilio Whatsapp API | Internal Server Error 使用python在whatsapp中发送自动消息时出错 - Error in texting automated message in whatsapp using python 检测是否使用 Selenium Webdriver 发送 WhatsApp 消息 - Detect if a WhatsApp message is sent using Selenium Webdriver
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM