Skip to content

Call to undefined method Symfony\Component\HttpFoundation\Response::create() when adding webhook in facebook. #122

@NowakAdmin

Description

@NowakAdmin
  • BotMan Version: 2.6.1
  • PHP Version: 8.1
  • Messaging Service(s): Facebook
  • Cache Driver: LaravelCache

Description:

Hi, im geting this error in laravel 9, how to handle it easiest way?

method create not exist, so should i make new class that extends Request with method create ?

I already tried to change all references from use Symfony\Component\HttpFoundation\Response;
to Illuminate\Http\Response (and Request) but this also not work.

curl -X GET "https://mydomain.com/botman?hub.verify_token=MySecretTokenFromDotENV&hub.challenge=CHALLENGE_ACCEPTED&hub.mode=subscribe"

Reponse:

Error: Call to undefined method Symfony\Component\HttpFoundation\Response::create() in file /var/www/nams/botman/driver-facebook/src/FacebookDriver.php on line 120

#0 /var/www/nams/botman/botman/src/Drivers/DriverManager.php(157): BotMan\Drivers\Facebook\FacebookDriver->verifyRequest()
#1 /var/www/nams/botman/botman/src/BotMan.php(542): BotMan\BotMan\Drivers\DriverManager::verifyServices()
#2 /var/www/nams/botman/botman/src/BotMan.php(421): BotMan\BotMan\BotMan->verifyServices()
#3 /var/www/nams/app/Http/Controllers/BotManController.php(40): BotMan\BotMan\BotMan->listen()
#4 /var/www/nams/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): App\Http\Controllers\BotManController->handle()...

Steps To Reproduce:

Install botman on laravel 9 from local repository (path)
change in composer/json dependencies to fit laravel 9
Try to connect to facebook like:

        $config = [
            'user_cache_time' => 720,

            'config' => [
                'conversation_cache_time' => 720 ,
            ],
            // Your driver-specific configuration
            'facebook' => [
                'token' => env('FACEBOOK_TOKEN'),
                'app_secret' => env('FACEBOOK_APP_SECRET'),
                'verification' => env('FACEBOOK_VERIFICATION'),
            ]
        ];
        $botman = app('botman');
        DriverManager::loadDriver(\BotMan\Drivers\Facebook\FacebookDriver::class);
        BotManFactory::create($config, new LaravelCache());
        $botman->listen();

try to get response for facebook by:
curl -X GET "https://mydomain.com/botman?hub.verify_token=MySecretTokenFromDotENV&hub.challenge=CHALLENGE_ACCEPTED&hub.mode=subscribe"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions