botman / botman/driver-facebook

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

Open
#122 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
71
Forks
72
PR merge metrics
No merged PRs in 30d

Description

- 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"`

Contributor guide

Open the contributing guide

Research direction

Start at driver-facebook/src/FacebookDriver.php line 120 and follow verifyRequest() through the stack trace. Reproduce the Facebook webhook verification request with the provided curl command, then confirm the undefined Response::create() error is resolved and Facebook returns the challenge response.

Written by the indexing model from the issue text.

Assessment

Tech stack
laravel, php
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.