1

我一直试图将我的域名列入白名单,该域名是由facebook给出的指令,但没有任何工作。域名未被添加,白名单域名facebook messenger扩展

我第一次与卷曲尝试,响应{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); 
       } 
      }); 

不过它带来的结果相同卷曲:

Screen shot of the result of the code

当我使用Facebook的图形API资源管理器工具,这里是我得到的错误:

Graph Api tool, to whitelist domain

我很坚持,我不知道我该怎么做还是怎么的人传令扩展正是白名单域名。

我做错了什么?为什么不添加域?

我的项目位于Google App Engine上。

+0

我想你正在使用错误的API路径。它应该是“/ me/messenger_profile”。 –

+0

{ “error”:{ “message”:“不支持的post请求。带有'me'标识的对象不存在,由于缺少权限而无法加载,或者不支持此操作。 https://developers.facebook.com/docs/graph-api”, “类型”: “GraphMethodException”, “代码”:100, “fbtrace_id”: “BDenwqcm3BD” }} 是我得到的回应当我把/ me/messenger_profile @MichealVu – aidonsnous

+1

你得到了上面的消息,因为你使用错误的access_token。你应该尝试获得页面访问令牌。 –

回答

2

问题是我使用应用程序访问令牌而不是页面访问令牌,我不知道区别。

2

您的域名:“https://mydomainw..com”是一个无效域名。

请求应该返回:

{ 
    "error": { 
    "message": "(#100) whitelisted_domains[0] should represent a valid URL", 
    "type": "OAuthException", 
    "code": 100, 
    "fbtrace_id": "Aq3AVaNVJU9" 
    } 
} 
+0

嘿@Micheal Vu,https://mydomainw.com是不正确的我的意思是https://mydomainw.com,但无论如何,所有这些领域都不是我的,他们在那里是为了说明我在做什么。我不想放弃我想要列入白名单的真实域名。我还添加了更多信息,因为自从上次我不断尝试不同的方法(图形api工具),但没有任何工作。你需要我的真实域名来尝试吗? – aidonsnous

2

其实,之前我没有用 “setting_type”。这是我如何注册域名:

var request = require("request"); 

var options = { method: 'POST', 
    url: 'https://graph.facebook.com/v2.6/me/messenger_profile', 
    qs: { access_token: 'my_page_token' }, 
    headers: { 'content-type': 'application/json' }, 
    body: 
    { whitelisted_domains: 
     [ 
     'https://mydomainw.com', 
     'https://ijuugwivbc.localtunnel.me' ] }, 
    json: true }; 

request(options, function (error, response, body) { 
    if (error) throw new Error(error); 

    console.log(body); 
});