简体   繁体   English

Laravel Botman:无法获得Facebook Messenger用户

[英]Laravel Botman: Can't get Facebook Messenger User

I am using Botman Studio . 我正在使用Botman Studio I am facing an unexpected error while using Botman $bot->getUser() API. 使用Botman $ bot-> getUser() API时遇到意外错误。 I have added welcome screen and get started payload. 我添加了欢迎屏幕并开始使用有效负载。 It works fine.When user clicks Get_started, i want to store user's information. 它工作正常。当用户单击Get_started时,我想存储用户的信息。 But Laravel Log says: 但是Laravel Log说:

local.ERROR: Error sending payload: (#100) Insufficient permission to access user profile. local.ERROR:发送有效载荷时出错:(#100)访问用户配置文件的权限不足。 {"exception":"[object] (BotMan\\Drivers\\Facebook\\Exceptions\\FacebookException(code: 0): Error sending payload: (#100) Insufficient permission to access user profile. at /..../vendor/botman/driver-facebook/src/FacebookDriver.php:501) {“ exception”:“ [对象](BotMan \\ Drivers \\ Facebook \\ Exceptions \\ FacebookException(代码:0):发送有效载荷时出错:(#100)在/..../vendor/botman中访问用户配置文件的权限不足。 /driver-facebook/src/FacebookDriver.php:501)

Please help. 请帮忙。 I am new to Botman. 我是博特曼的新手。 TIA. TIA。

File: App\\Http\\Controllers\\BotmanController.php 文件:App \\ Http \\ Controllers \\ BotmanController.php

 public function handle()
{
    $botman = app('botman');
    $botman->hears('GET_STARTED', function (BotMan $bot) {
        $bot_user = $bot->getUser();
        Log::info(\GuzzleHttp\json_encode($bot_user));
        $bot->reply("Hello! $bot_user->getFirstName()");
    });

    $botman->listen();
}

I have also tried Botman $bot->getDriver() . 我也尝试过Botman $ bot-> getDriver() But it returns null, though Botman $bot->getDriver()->getName() returns Facebook . 但是它返回null,尽管Botman $ bot-> getDriver()-> getName()返回Facebook
Laravel Version: 5.6 Laravel版本:5.6
Botman Version: 2.0 Botman版本:2.0

Please test the same functionality using your developer account. 请使用您的开发者帐户测试相同的功能。 Facebook needs to approve permissions to access user information if your bot is in production or is public (Can be accessed by everyone). 如果您的机器人在生产中或是公开的,则Facebook需要批准访问用户信息的权限(每个人都可以访问)。 If it works with your facebook account (I am assuming you are the admin of both the facebook page and the developer app where the bot is connected.), Then you need to go to the messenger tab on the facebook developers page and scroll down to App Review for Messenger and make all the available permission requests submissions. 如果它与您的Facebook帐户一起使用(我假设您同时是Facebook页面和与机器人连接的开发人员应用程序的管理员。),那么您需要转到Facebook开发人员页面上的Messenger标签,然后向下滚动至Messenger的App Review,并提交所有可用的权限请求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM