ryderdamen / PHP-DialogFlow-Webhooks-Fulfillment-API

An extremely simple API for handling requests and responses for DialogFlow in PHP.
21 stars 15 forks source link

Failed to parse Dialogflow #1

Open dudunegrinhu opened 6 years ago

dudunegrinhu commented 6 years ago

Hi,

So far this is the best PHP Webhook I found but I'm having and error when I do any build response and response after.

If I do $wh->respond_simpleMessage('Say this out loud', 'Display this text on screen');

It works perfect but If I do:

$textToSpeech = "Say this text out loud"; $displayText = "Display this text on screen"; $wh->build_simpleResponse($textToSpeech, $displayText); $wh->respond();

I get the error below: Failed to parse Dialogflow response into AppResponse because of empty speech response

Am I missing something?

dudunegrinhu commented 6 years ago

I was able to make it work by changing the respond function. This is my final $response

$response = array( 'fulfillmentText' => $this->speech, 'payload' => $integrations, 'data' => $integrations, 'displayText' => $this->speech, 'speech' => $this->speech, );

vivekudayan commented 6 years ago

I get "Webhook call failed. Error: Failed to parse webhook JSON response: Cannot find field: speech in message"