I'm trying to return simple text response and display a basic card within Google Assistant app using the following code:
public GoogleCloudDialogflowV2WebhookResponse Search(GoogleCloudDialogflowV2WebhookRequest request)
{
GoogleCloudDialogflowV2WebhookResponse whr = new GoogleCloudDialogflowV2WebhookResponse();
whr.FulfillmentMessages = new List<GoogleCloudDialogflowV2IntentMessage>();
whr.FulfillmentMessages.Add(new GoogleCloudDialogflowV2IntentMessage()
{
Platform = "ACTIONS_ON_GOOGLE",
SimpleResponses = new GoogleCloudDialogflowV2IntentMessageSimpleResponses()
{
SimpleResponses = new List<GoogleCloudDialogflowV2IntentMessageSimpleResponse>()
{
new GoogleCloudDialogflowV2IntentMessageSimpleResponse()
{
DisplayText = "sample text",
Ssml = "<speak>sample text</speak>"
}
}
},
BasicCard = new GoogleCloudDialogflowV2IntentMessageBasicCard()
{
Title = "sample title",
Subtitle = "sample subtitle",
FormattedText = "sample formatted text",
Image = new GoogleCloudDialogflowV2IntentMessageImage()
{
ImageUri = "https://assistant.google.com/static/images/molecule/Molecule-Formation-stop.png",
AccessibilityText = "sample image"
}
}
});
return whr;
}
I getting the following error when webhook endpoint is invoked from the Google Dialogflow interface:
webhookStatus": {
"code": 3,
"message": "Webhook call failed. Error: Failed to parse webhook JSON response: Cannot find field: ETag in message google.cloud.dialogflow.v2beta1.Intent.Message.Image." }
I cannot find any information regarding ETag issue. I'm using standard Google.Apis.Dialogflow.v2 NuGet package and V2 API Dialogflow agent.
If I don't use GoogleCloudDialogflowV2WebhookResponse and use custom class, that when serialized to JSON works fine without basic card.
{ "fulfillmentText": "test from API", "fulfillmentMessages": [ { "platform": "ACTIONS_ON_GOOGLE", "simpleResponses": { "simpleResponses": [ { "displayText": "test", "ssml": "<speak>test</speak>"}],}}],}
I would prefer to use GoogleCloudDialogflowV2WebhookResponse.