Google Assistant Dialogflow API V2 webhook ETag error
Asked Answered
E

1

1

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.

Ehrlich answered 8/5, 2018 at 20:55 Comment(4)
What is the JSON serialization with the basic card?Snelling
I meant my own implementation (no basic card property, only fulfillmentMessages) of the response sent back to the webhook. public class GoogleHomeResponse { public string fulfillmentText { get; set; } public List<FulfillmentMessage> fulfillmentMessages { get; set; } }Ehrlich
Right, but it seems like the error is with your webhook response. If you could post what that looks like, it may help debug your issue.Snelling
I am also running into this issue. Submitted a support request at DialogFlow and an issue at github.com/google/google-api-dotnet-client/issues/1234. I am hoping one of the two will respond with some help.Sevier
S
1

According to https://github.com/google/google-api-dotnet-client/issues/1234, use https://www.nuget.org/packages/Google.Cloud.Dialogflow.V2/1.0.0-beta01 instead of https://www.nuget.org/packages/Google.Apis.Dialogflow.v2/.

Realize that the Gooogle.Cloud package is still pre-release so you will have to specify version when installing or click the little "include prerelease" checkbox if you are using the NuGet Package Manager UI in Visual Studio.

I haven't tried it yet myself so your mileage may vary. I will update once I've tried it.

Update: The Google.Cloud library does work as expected.

Sevier answered 14/6, 2018 at 14:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.