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);
$customer_name=$json["requestJson"]["intent"]["params"]["customer_name"]["resolved"];
$response = array ('prompt' => array ('firstSimple' => array ( 'speech' => $customer_name, 'text' =>
$customer_name)));
echo json_encode( $response );
}
also webhook response json while testing
{
"responseJson": {
"prompt": {
"firstSimple": {}
}
}
}
Webhook request json
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 likeThe 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.