0

I implemented an Fulfillment webhook in PHP. I add the URL in Fulfillment configuration page. But when I’m trying to run my intent with Actions on Google, here is my error:

**MalformedResponse Failed to parse Dialogflow response into AppResponse because of empty speech response.**

View logs:

Webhook call failed. Error: Failed to parse webhook JSON response: null

My php code :

$return_defaults = 
    array(
        "fulfillmentText" => "respons of it",
        "fulfillmentMessages" => array(
            array(
                "text" => array(
                "text reponse"
            ),
        )
    ),
    "payload" => array(
        "google" => array (
            "expectUserResponse" => true,
            "richResponse" => array(
                "items" => array(
                    array(
                        "simpleResponse" => array(
                            "textToSpeech" => "bye bye calamba"
                        ),
                    ),
                ),
            ),
        ),
    ),
);

$ReturnValue = json_encode($return_defaults);
echo $ReturnValue;

Prisoner
  • 49,922
  • 7
  • 53
  • 105
Nearyuk
  • 167
  • 2
  • 12
  • Is that the entire PHP file? Are you sure it is being called? The error suggests that nothing is being returned, but if I run that by hand (after adding the " – Prisoner Jan 29 '19 at 21:56
  • Thanks for the answer, what i did in Dialogflow is : Fulfillment section -> ENABLED Webhook -> add my URL -> Save. Then, in my intent i choose "Enable webhook call for this content". My URL is working and NOT returning error, i'm really confused – Nearyuk Jan 30 '19 at 09:04
  • What *is* your URL returning? Again, is what you posted the entire file? Because it is missing at least one line. – Prisoner Jan 30 '19 at 11:04

0 Answers0