【发布时间】:2017-09-19 01:21:31
【问题描述】:
我一直在尝试按照 facebook 给出的说明将我的域列入白名单,但没有任何效果。
我第一次尝试使用 curl,响应是 {result:"success"},但是当我尝试列出列入白名单的域时,我得到 {data:[]}
然后我尝试使用节点请求模块如下:
request.post("https://graph.facebook.com/v2.6/me/messenger_profile?access_token=sfdlksdfu79r9429049824982342348sjdfsf", {
"setting_type": "domain_whitelisting",
"whitelisted_domains": ["https://mydomainw.com", "https://mydomainw.com/profile", "https://sfujyx.com/ofr", "mydomain1.com", "mydomain.com"],
"domain_action_type": "add"}, function (err, res, body) {
console.log("Whitelisting domain");
if (!err) {
console.log(body);
console.log("Showing the list of whitelisted:");
request.get("https://graph.facebook.com/v2.6/me/messenger_profile?fields=whitelisted_domains&access_token=sfdlksdfu79r9429049824982342348sjdfsf", function (err, res, body) {
if (!err) {
console.log(body);
} else {
console.log(err);
}
});
} else {
console.log(err);
}
});
它仍然带来与 curl 相同的结果:
当我使用 Facebook Graph Api Explorer 工具时,出现以下错误:
我真的被困住了,我不知道我应该怎么做,也不知道人们如何将域列入信使扩展的白名单。
我做错了什么?为什么没有添加域?
我的项目在 Google App Engine 上。
【问题讨论】:
-
我认为你使用了错误的 api 路径。它应该是“/me/messenger_profile”。
-
{ "error": { "message": "不支持的post请求。ID为'me'的对象不存在,由于缺少权限而无法加载,或不支持此操作。请阅读developers.facebook.com/docs/graph-api", "type": "GraphMethodException", "code": 100, "fbtrace_id": "BDenwqcm3BD" } } 的 Graph API 文档是我输入 /me/messenger_profile @MichealVu时得到的响应>
-
您收到上述消息是因为您使用了错误的 access_token。您应该尝试获取页面访问令牌。
标签: node.js facebook-messenger whitelist facebook-messenger-bot botkit