错误从Messenger WebView获取用户ID,即使在白色列表域之后



我列出了白色域,我收到一条消息,显示它成功

{"结果":"成功更新了白名单域"}

但是当我尝试获取用户ID时,我会收到错误消息

未启用错误扩展名 - 可能是在URL上设置的" messenger_extensions",域未列入白色,或者这是Messenger客户端的过时版本

我正在使用PC,所以过时的版本可能不是它,并且我的Messenger扩展程序以这种方式

$get_started_display = "{
'recipient':{
'id': $sender_id
},
'message':{
'attachment':{
  'type':'template',
  'payload':{
    'template_type':'button',
    'text':'Click a button below to continue',
    'buttons':[
      {
        'type':'web_url',
        'title':'Add Leader Profile',
        'url':'https://aadb-3120.herokuapp.com/login.html',
        'webview_height_ratio' : 'full',
        'messenger_extensions': true
      },
      {
        'type':'postback',
        'title':'Review Added Profile',
        'payload':'review'
      },
      {
        'type':'postback',
        'title':'Help',
        'payload':'help'
       },
     ]
   }
  }
 }
}";
please what are my doing wrong?

Messenger Platform社区中的一个管理员只是确认WebViews扩展名不起作用,因此我获得用户ID的唯一方法是将其添加到URL上URL按钮或通过会话变量。

我认为这不是有效的JSON格式。它应该以双引号而不是单引号。您为什么不代替PHP阵列编写并转换为JSON以减少犯错的机会。

例如

$data = [
'recipient' => [
    'id' => $sender_id
],
'message' => [
    'attachment' => [
        'type' => 'template',
        'payload' => [
            'template_type' => 'button',
            'text' => 'Click a button below to continue',
            'buttons' => [
                [
                    'type' => 'web_url',
                    'url' => 'https://google.com',
                    'title' => 'Visit Google',
                    "webview_height_ratio" => "compact"
                ]
            ]
        ]
    ]
]];

$json = json_encode($data);

最新更新