Aramis Delgado
Aramis Delgado

Reputation: 45

Botman not listening to Dialogflow action

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:

that's the only console error I get

This is my intent's action name

This is the way I'm calling the middleware

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

Answers (2)

Rohan Khude
Rohan Khude

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

Jayreis
Jayreis

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

Related Questions