【问题标题】:Domains are not being added, Whitelist domains facebook messenger extension未添加域,将域列入白名单 facebook messenger 扩展
【发布时间】: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


【解决方案1】:

问题是我使用的是应用访问令牌而不是页面访问令牌,我不知道有什么区别。

【讨论】:

    【解决方案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);
    });
    

    【讨论】:

    • 我在做同样的事情,但我有一个字符串数组,其中包含所有要列入白名单的域,并且想要将一个数组分配给 whitelisted_domains 而不是仅仅提供字符串,我该怎么做?
    【解决方案3】:

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

    请求应该返回:

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

    【讨论】:

    • 嘿@Micheal Vu,mydomainw..com 不正确我的意思是mydomainw.com 但无论如何,所有这些域都不是我的,它们在那里是为了说明我在做什么。我不想给出我想要列入白名单的真实域。我还添加了更多信息,因为自上次以来我一直在尝试不同的方法(图形 api 工具),但还没有任何效果。你需要我的真实域名来试试吗?
    猜你喜欢
    • 2018-12-24
    • 2018-02-01
    • 1970-01-01
    • 2020-08-29
    • 1970-01-01
    • 1970-01-01
    • 2017-10-27
    • 2015-08-04
    • 1970-01-01
    相关资源
    最近更新 更多