Google actions builder – how to read from webhook request and avoid empty response

When I call webhook using PHP, I get this message while testing. Sorry, I didn’t get any response Attached my webhook request json and and php code

if($method == 'POST')
 $requestBody = file_get_contents('php://input');
 $json = json_decode($requestBody, true, 512, JSON_BIGINT_AS_STRING);
 $response = array ('prompt' => array ('firstSimple' => array ( 'speech' => $customer_name, 'text' => 
 echo json_encode( $response );

also webhook response json while testing

"responseJson": {
"prompt": {
  "firstSimple": {}

enter image description here

Webhook request json

enter image description here


Although it shows up in the test console, the “requestJson” attribute isn’t part of the body that is sent to you. The body will just include the object underneath that attribute.

So the line to get $customerName should probably be more like


The specific reason you’re getting the error about not getting a response is because there aren’t any attributes set in the “simpleResponse” attribute of the response. I’m assuming that is because $customer_name ends up not getting set, so either php or the Assistant are removing null attribute values.