使用jquery.ajax从Facebook Graph API获得400个不良请求响应
每当单击一个按钮时,我想发送一条消息,但是我会遇到400个不良请求错误。当我在Postman中这样做时,它可以正常工作。
这是我的jquery.ajax代码:
$.ajax({
method: "POST",
url: 'https://graph.facebook.com/v14.0/me/messages?access_token=<MY_ACCESS_TOKEN>',
data: {
"recipient": {
"id": psid
},
"message": {
"text": "hello, world!"
}
},
contentType: "application/json",
success: function (response) {
console.log(response)
}
})
I want to send a message whenever a button is clicked, but I'm getting 400 Bad Request Errors. It works fine when I do it in Postman.
Here's my jQuery.ajax code:
$.ajax({
method: "POST",
url: 'https://graph.facebook.com/v14.0/me/messages?access_token=<MY_ACCESS_TOKEN>',
data: {
"recipient": {
"id": psid
},
"message": {
"text": "hello, world!"
}
},
contentType: "application/json",
success: function (response) {
console.log(response)
}
})
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论