Reputation: 45
I am working on a chatbot with Botman. I want to integrate Dialogflow's NLP so I'm calling the middleware and one of it's actions. The problem is that Botman is not hearing it. I just keep getting this error:
This is my intent's action name This is the way I'm calling the middleware I'm using my Client access token. I tried calling the action different names like 'input.automovil', 'automovil', (.*), but it's still failing and I haven't found enough examples.
Upvotes: 0
Views: 632
Reputation: 4883
The documentation is not updated. ApiAi
is renamed as Dialogflow
Replace
use BotMan\BotMan\Middleware\ApiAi;
with
use BotMan\BotMan\Middleware\Dialogflow;
and
$dialogflow = ApiAi::create('your-key')->listenForAction();
with $dialogflow = Dialogflow::create('your-key')->listenForAction();
Upvotes: 1
Reputation: 287
try changing your lines 27 to 33 the the below
$botman->hears('automovil', function (BotMan $bot) {
// The incoming message matched the "my_api_action" on Dialogflow
// Retrieve Dialogflow information:
$extras = $bot->getMessage()->getExtras();
$apiReply = $extras['apiReply'];
$apiAction = $extras['apiAction'];
$apiIntent = $extras['apiIntent'];
$bot->reply($apiReply);
})->middleware($dialogflow);
Upvotes: 0