0

I'm implementing an app in "Dialog Flow"

I'm sending request to app like this

$text = "Something";

$data = array(
         "source" =>  $text,
         "speech" =>  $text,
         "displayText" =>$text,
         "contextOut" => array()
     );
header('Content-Type: application/json');
echo json_encode($data);

The text displayed in app. but mic is open I want turn off the mic .

I tried expectUserResponse but not working

array(
         "expectUserResponse" => false,
         "source" =>  $text,
         "speech" =>  $text,
         "displayText" =>$text,
         "contextOut" => array()
     )

Please help.

Gowri
  • 1,832
  • 3
  • 29
  • 53

1 Answers1

1

The expectUserResponse parameter is not part of the Dialogflow response JSON. Instead, it is part of the Actions on Google specific part of the response. If you're using Dialogflow v1, this will be in the data.google object. If you're using Dialogflow v2, this will be in the payload.google object.

So if you're using Dialogflow v1, your code might look something like this:

array(
  "speech" =>  $text,
  "displayText" =>$text,
  "contextOut" => array(),
  "data" => array(
    "google" => array(
      "expectUserResponse": false
    )
  )
)

while v2 might look like

array(
  "speech" =>  $text,
  "displayText" =>$text,
  "contextOut" => array(),
  "payload" => array(
    "google" => array(
      "expectUserResponse": false
    )
  )
)
Prisoner
  • 49,922
  • 7
  • 53
  • 105
  • I modified little bit. It's worked. `"data"=> array("google" => array("expect_user_response" => false ))` – Gowri Apr 20 '18 at 04:54
  • Using underscores may stop working next month, since it is part of the AoG v1 API which is deprecated. Support ends for it in May. (This is unrelated to the Dialogflow v1 API which is still supported, but no longer receiving updates for new features.) – Prisoner Apr 20 '18 at 10:37