I have successfully tested my agent intents in the Dialogflow console where my fulfillment webhook gives responses such as:
{
speech: 'You have 4 items, aaaa, bbbb, cccc, dddd ',
displayText: 'You have 4 items, aaaa, bbbb, cccc, dddd ',
data: {},
contextOut: [],
source: 'xxx:'
}
Now I have set Dialogflow V2 API (v2beta1, I think).
I get a response:
"Webhook call failed. Error: Failed to parse webhook JSON response: Cannot find field: speech in message google.cloud.dialogflow.v2beta1.WebhookResponse".
What JSON response structure/format do I need to use? The documentation on this is not at all clear. Can someone point me to the correct page - or describe it here.
If I do a search for "dialogflow v2beta1 fulfillment json response format", one entry seems to be promising: Dialog Flow WebhookResponse
But I cannot seem to find any reference to the field named "speech" (as per the error message).
Hi So I was facing a similar problem while trying to setup a webhook for my dialogueflow v2 beta . It took me hours of google search to understand the error. The error means that the field you have sent donot match the possible Message Fields you can pass inside fullfillment messages.
This is my cloud function that I m using for webhook and it works perfectly for v2. Follow the below link for the format of messages that can be part of the fulfillmentMessages array
Message Format for fulfillmentMessages
The Below code works for v1
This works perfectly for v1
Some things have changed for v2, and they're very particular about the format to return to dialogflow because they take it and insert it in the RAW API response json. I ran into this issue and found the template responses in the documentation here very useful.
It would be helpful to look at the reference documentation for this API.
Instead of "speech", you probably are looking for
fulfillmentText
. It also seems like other fields in your response would not match either, so you should refer to the reference docs above to determine how to restructure your payload to match the required API.