Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incoming messages are empty #127

Open
ka4an4eg opened this issue Jul 20, 2022 · 0 comments
Open

Incoming messages are empty #127

ka4an4eg opened this issue Jul 20, 2022 · 0 comments

Comments

@ka4an4eg
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant