botman / botman/studio

Incoming messages are empty

Open
#127 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
332
Forks
91
PR merge metrics
No merged PRs in 30d

Description

I am connecting botman to an existing project on laravel 5.8.

I installed botman and driver-web
added configs and botman routes
config/botman/config.php
```
return [
'conversation_cache_time' => 40,
'user_cache_time' => 30,
];
```
config/botman/web.php
```
return [
'web' => [
'matchingData' => [
'driver' => 'web',
]
]
];
```
routes/botman.php

```
use App\Conversations\WorkingConversation;
use App\Conversations\ComplaintsConversation;
use App\Conversations\InstructionConversation;
use App\Conversations\CallServiceConversation;
use App\Conversations\VacationConversation;
use App\Conversations\InvoiceConversation;
use App\Conversations\ContactUpdateConversation;
use App\Conversations\BusinessOfferConversation;
use BotMan\BotMan\BotMan;
use Illuminate\Support\Facades\Log;

$botman = resolve('botman');

$botman->hears('{mess}', function ($bot, $mess) {
/** @var BotMan $bot */
Log::info('$bot mess >'.$mess.'<');
Log::info('$bot message >'.var_export($bot->getMessage(), true).'<');
Log::info('$bot driver >'.var_export($bot->getDriver(), true).'<');
Log::info('$bot matches >'.var_export($bot->getMatches(), true).'<');
$bot->reply('Hi!');
});

$botman->hears('Start', function ($bot) {
Log::info('botman hears start!!1');
$bot->reply('Hello!');
});
```
make a route
```Route::match(['get', 'post'], '/botman', 'BotManController@handle');```

handle function
```
public function handle(Request $request)
{
/** @var BotMan $botman */
$botman = app('botman');
$botman->listen();
}
```
when i visit /botman/?driver=web&userId=111&message=Start the following is written to the log file
```
[2022-07-20 15:53:15] local.INFO: $bot mess ><
[2022-07-20 15:53:15] local.INFO: $bot message >BotMan\BotMan\Messages\Incoming\IncomingMessage::__set_state(array(
'message' => '',
'sender' => '',
'recipient' => '',
'bot_id' => '',
'images' =>
array (
),
'videos' =>
array (
),
'payload' => NULL,
'extras' =>
array (
),
'audio' =>
array (
),
'files' =>
array (
),
'location' => NULL,
'contact' => NULL,
'isFromBot' => false,
))<
[2022-07-20 15:53:15] local.INFO: $bot driver >BotMan\BotMan\Drivers\NullDriver::__set_state(array(
'payload' => NULL,
'event' => NULL,
'http' =>
BotMan\BotMan\Http\Curl::__set_state(array(
'options' =>
array (
),
)),
'config' =>
Illuminate\Support\Collection::__set_state(array(
'items' =>
array (
),
)),
'content' => '',
))<
[2022-07-20 15:53:15] local.INFO: $bot matches >array (
'mess' => '',
0 => '',
)<

```

I do not understand
1. why are the messages empty
2. why the driver is NullDriver

Help me understand what the problem is, any ideas will be useful

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.