0

I'm getting the following error when I'm using Dialogflow CX Webhook

{"error":"unknown field \"redactedText\" in google.cloud.dialogflow.cx.v3.ResponseMessage.Text"}

I'm using the code below to read the Webhook Request

wr := cx.WebhookRequest{}
if err = jsonpb.Unmarshal(r.Body, &wr); err != nil {
    //I have an error return function here, which returns the error above
}

I'm not sure what's causing the redactedText, and I can't find any documentation about it. Any idea what's causing this?

1 Answers1

0

Alecz,

It does look like text is returning an object instead of simply a string. To properly unmarshal the CX proto WebhookResponse, I'd recommend using the protojson (as the jsonpb package has been deprecated), and configuring the UnmarshalOptions like this:

err = protojson.UnmarshalOptions(protojson.UnmarshalOptions{
        AllowPartial:   true,
        DiscardUnknown: true,
    }).Unmarshal(r.Body, &wr)

My assumption is that it has to do with the parameter redaction feature that CX has, but may not yet made it to the documentation.

Please let me know if this helps!

ghchinoy
  • 1,523
  • 1
  • 11
  • 15