2

In our Dialogflow agent, We have an intent set up with an event called "updateParams" associated with the intent. The intent has a parameter called "ExampleEntity" that I would like to update using c# by invoking the event using the Detect Intent API. We are using this version of the sdk Google.Cloud.Dialogflow.V2" Version="1.0.0-beta02"

            queryInput.Event = new EventInput
            {
                Name = "updateParams",

                Parameters = new Struct
                {                        
                    Fields = {{ "ExampleEntity",Value.ForString("Bla")}} 
                },
                LanguageCode = languageCode
            };

An example of the response can be seen here. As you can see the "ExampleEntity" parameter isn't being updated as per the request: enter image description here

Any tips on where we're going wrong? We're fairly new to Dialogflow so it is probably something simple.

mjroodt
  • 3,223
  • 5
  • 22
  • 35
  • How are you returning the response to Dialogflow in your agent? If you're using the default Json.NET conversion from the WebhookResponse to JSON, that would explain it. (You need to use the Protobuf JSON conversion.) – Jon Skeet Mar 07 '19 at 20:20
  • In this project we are implementing a .net core project using df as the natural language processor. Phrases come through to an endpoint that project, and we use the df detectIntent API to work out the intent, we then use the Fulfillment text(s) to decide what response should be sent to the user. In some circumstances, we might want to programatically fill some empty parameters on the intent if we can get those without prompting the user, so we do a second call to detectIntent to pass the custom event with the parameters filled, using the above call which is where we are having the issue. – mjroodt Mar 07 '19 at 23:56
  • So to be clear, you're not using a web hook at all, just calling DetectIntent entirely separately? (Most of the problems using Dialogflow from C# are in terms of JSON encoding/decoding for web hooks.) – Jon Skeet Mar 08 '19 at 06:45
  • 1
    That's right. Our dialogflow agent does not use the webhook functionality at all. Instead we use it to manage all of our intents, entities, small talk etc, and we use it to guide the flow of the conversation, but all controlled via a separate .net core project which is based on bot-framework/. Responses back to the user are done using that component, not dialogflow. This is working well when allowing dialogflow to prompt for filling empty required parameters, we just have this issue trying to 'pre-populate' parameters on the detected intent, without user interaction. Hope that makes sense. – mjroodt Mar 08 '19 at 08:00
  • Hmm... I'll have to have a look at that later. (I'm on vacation today, and about to go out.) The C# code looks okay to me... – Jon Skeet Mar 08 '19 at 09:00

1 Answers1

3

Your code looks okay.
However, in your intent, you need to provide default value of the entity ExampleEntity.

Give it as : #event_name.entity_name
Your event is updateParams and entity name is ExampleEntity, so in this case default value will be #updateParams.ExampleEntity

This way, when your intent is invoked through the event with the values passed, ExampleEntity will know from where to pick up the default value.

You can check out this answer for details as well.

Hope it helps.

sid8491
  • 6,622
  • 6
  • 38
  • 64
  • Yes this worked for us! In our example we had to use #updateParams.ExampleEntity in our default value. – mjroodt Mar 08 '19 at 11:26