使用 php 的 Messenger 机器人的错误白名单域

Error white listing domain for messenger bot using php

我在 Messenger 平台上使用 php 尝试将我的应用域列入白名单时收到此错误

{"error":{"message":"(#100) The parameter setting_type is required","type":"OAuthException","code":100,"fbtrace_id":"H4+VMmlq3Ab"}}

这里是 json

$domain_white = '{
"whitelisted_domains":[
"https://aadb-3120.herokuapp.com"
]
}';

`

和我的卷曲

    function curl($input)
    {
        global $accessToken;
        global $input;
       $ch = curl_init('https://graph.facebook.com/v2.6/me/messages?access_token='.$accessToken);
      curl_setopt($ch, CURLOPT_POST, true);
      curl_setopt($ch, CURLOPT_POSTFIELDS, $input);
      curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); 
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
      curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
      curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
      $output = curl_exec($ch);
      curl_close($ch);
      error_log($output); 

    }

你错过了setting_type,这是必需的:

{
  "setting_type": "domain_whitelisting",
  "whitelisted_domains": [
    "https://aadb-3120.herokuapp.com"
  ],
  "domain_action_type": "add"
}