Skip to content

(Could not construct ApplicationDefaultCredentials) for PHP dialogflow #5

Description

@carlosricardocm

Hi,

If anyone is having this error:

(Could not construct ApplicationDefaultCredentials)

Could be solved adding the following (in botman.php)

putenv("GOOGLE_APPLICATION_CREDENTIALS=path_to_json_credential_file");
putenv("GOOGLE_CLOUD_PROJECT=name_proyect");

The rest is as in the guide:

$dialogflow = \BotMan\Middleware\DialogFlow\V2\DialogFlow::create('es');

$botman->middleware->received($dialogflow);

$botman->hears('input.(.*)', function ($bot) {
    $extras = $bot->getMessage()->getExtras();
    $bot->reply($extras['apiReply']);
})->middleware($dialogflow);

In the previous code 'input.(.*)' is the action prefix used in your dialogsflow's Intent; for example, I have an Intent called scheduleappointment and inside the appointment i have an action called input.scheduleappointment that return date, time and appointment name.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions