I recently updated from DialogFlowV1
to DialogFlowV2
.
I see that there is no different displayText
& speech
parameters in V2
.
How to send different speech
& displayText
parameters from webhook fulfillment so that I can use those values using DialogFlow
Android client.
From the day I upgraded from V1 to V2, I see that displayText
parameter is returning null in Android's ai.api.sdk
Here is the fulfillment response I am sending from my webhook
{
"fulfillmentText": "My FulfillmentText",
"fulfillmentMessages": [
{
"text": {
"text": [
"Sample response 1",
"Sample response 2"
]
}
}
]
}
What are the changes I have to make in the above response structure ?
You need to pass speech
text in fulfillmentText
and the displayText
in fulfillmentMessages
in v2 api.
{
"fulfillmentText": "This will be speech.",
"fulfillmentMessages": [
{
"text": {
"text": [
"This will be text to be displayed on screen."
]
}
}
]
}
In case you do not pass fulfillmentMessages
from the webhook, then fulfillmentText
will be displayed on screen.
The basic structure of the response is given on this page.
Sample code (python) to send fulfillmentText
:
import json
req = req_you_get_from_webhook_call
res = json.dumps({
'fulfillmentText': 'response from the webhook',
})
return res