DialogFlow V2 API - Webhook response was empty - php

My webhook is not getting invoked from Dialogflow and always returning an error
Webhook call failed. Error: Webhook response was empty.
When I use CURL/POST MAN with the dialogflow request the response I get is according to the documentation.
{
"fulfillmentMessages": [
{
"text": {
"text": [
"Hi, how can I help?"
],
}
}
],
"fulfillmentText": "Hi, how can I help?",
"outputContexts": [],
}

Check to make sure the URL you have set for fulfillment is the same one you're using in your tests and that it responds correctly to POST messages that are formatted with the webhook request JSON.
Check your server logs to see if there is an error being generated when your webhook is called.

Related

Zendesk API: Receiving 422 response with "Email: cannot be blank"

when using postman, everything works fine as per screenshot below:
Once guzzle client is used, for the same payload (visible in screenshot below), there is this error message "email cannot be blank":
In the documentation, I don't see anything regarding email needed and if it is, then why am I able to create from postman in the first place?
What has been done so far:
Including "email" into the payload as a part of "request" key,
Including inside "comment"
Add it outside of "request" key in the payload
None of them worked.
The full error message is:
"{
"error":"RecordInvalid",
"description":"Record validation errors",
"details":{
"email":[
{
"description":"Email: cannot be blank",
"error":"BlankValue"
}
]
}
}"
Does anyone has an idea what could be the solution?
EDIT:
When I try directly using postman it works and I don't have email in the request at all.
EDIT #2:

Client error: bad request. Error 400. NoCaptcha Laravel Anhskohbo

I connect the re-captcha to the site, which is built on Laravel. And when you click on "I am not a robot", and then on "registration", this error appears.
In the past, I connected the re-captcha on the framework yii2. I had no such problems with exceptions. Now I Installed captcha - Anhskohbo NoCaptcha.
The error itself looks like a notification:
Client error: POST https://www.google.com/recaptcha/api/siteverify resulted in a 400 Bad Request response:
{
"success": false,
"error-codes": [
"bad-request"
]
}
According to the Google reCAPTCHA documentation, this error is given when the request is malformed. Can you check what values are being passed to the /siteverify endpoint? The first thing that comes to mind is that the Content-Type: header for the request to Google's endpoint should be application/x-www-form-urlencoded as per this response - this is also true in my experience.

DialogFlow (API.AI) REST with php

I work on DialogFlow recently and I need to send a POST to my own web services.
It's a Rest services work with Symfony et PHP.
So I tried something and it didn't work.
In the tutorial it worked with Google Cloud, but I don't want to work with it.
I changed the URL of Webhook with my own. I didn't change anything else in DialogFlow because it was good with google. There it is :
/**
* #Rest\View()
* #Rest\Post("/testDialogBot")
*/
public function testDialogBotAction( Request $request )
{
$re = "Test reponse";
$response = new Response(json_encode( array( "speech" => $re, "displayText" => $re )));
$response->headers->set('Content-Type', 'application/json');
return $response;
}
The JSON of DialogFlow return :
"status": {
"code": 206,
"errorType": "partial_content",
"errorDetails": "Webhook call failed. Error: Request timeout."
},
I'm sure it can work, I do something bad probably.
Thank's for help.
According to the official docs the response "should" have the following fields: speech, displayText, data, contextOut adn source. You are only sending speech and displayText. Maybe adding the others will do the trick.
Also, the limits stated on the docs for the response are:
Timeout for service response – 5 seconds. Data received in the
response from the service – up to 64K.
Check if your server can send the response within those parameters
Ok that's fine, you don't need every parameters. My URL was wrong and It seems that DialogFlow doesn't accept https but only http.

Wrong response from the webhook: 400 Bad Request

I'm recently tried to use webhook to get update from telegram. my program work correctly whit getUpdates().
but when i set webhook i got
"Wrong response from the webhook: 400 Bad Request"
error when try to check status of webhook by getWebhookInfo method.
here is my code:
$telegram->commandsHandler(true)
when is used below code in getUpdates mod every thing was fine.
$telegram->commandsHandler(false)
And is should say i use https and my ssl is ok.
This is answer of getWebhookInfo to me.
{
"ok": true,
"result": {
"url": "https://telbit.ir/api/bot/<token>",
"has_custom_certificate": false,
"pending_update_count": 13,
"last_error_date": 1476344420,
"last_error_message": "Wrong response from the webhook: 400 Bad Request"
}
}
I found my answer
every things was ok. the error happens because of my framework.

Error trying to create webhook

I tried to create a webhook for a task in Asana but the only response I'm getting is this:
{
"errors": [
{
"message": "Could not complete activation handshake with target URL. Please ensure that the receiving server is accepting connections and supports SSL",
"help": "For more information on API status codes and how to handle them, read the docs on errors: https://asana.com/developers/documentation/getting-started/errors"
}
]
}
(Status: 400 Bad Request)
I am sending a POST Request via Postman to https://app.asana.com/api/1.0/webhooks with following content:
{
"data":
{
"resource": 123456789012345,
"target": "https://example.com/asana.php"
}
}
The asana.php looks something like this:
$headers = getallheaders();
$secret_token = $headers['X-Hook-Secret'];
header('X-Hook-Secret: ' . $secret_token);
What am I doing wrong? Am I missing something?
According to the Asana API Reference (https://asana.com/developers/api-reference/webhooks),
The target must respond with a 200 OK and a matching X-Hook-Secret header to confirm that this webhook subscription is indeed expected.
When you send the header, do you know what response code is being sent? Perhaps you might want to have a look at the $http_response_code argument in http://php.net/manual/en/function.header.php

Categories