无法标记为使用WhatsApp Business API阅读我传入的WhatsApp消息

发布于 2025-02-13 06:22:58 字数 632 浏览 0 评论 0原文

这是我所做的。我正在使用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())

输出:

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

Here's what I've done. I'm using Python programming language.

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'}}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

雪落纷纷 2025-02-20 06:22:58

根据 documentation url应该看起来像这样:

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

您似乎在正确的位置缺少phone_number_id WAMID ...在这里似乎不需要。我还注意到您的请求主体缺少所需的数据:

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

另外,文档在您似乎使用PUT请求时显示了邮政请求。如果您解决了所有这些问题,则应该开始工作。

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. 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. If you solve all these problems it should start working.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文