1

I'm trying to set parameters inside my EventInput object, in order to send it inside my QueryInput and detect the Intent. I'm using DialogFlow V2Beta1 API for Java version com.google.cloud:google-cloud-dialogflow:0.85.0-alpha. I'm aware of the json expected format based on
Custom Events documentation, but all method available didn't work for me. Related question for other languages didn't awnser it either: set parameters in EventInput in Dialogflow V2 API. I'm losing something about protobuf pattern? My parameters are the following: enter image description here

I've already tried the below code, but it doesn't work, the response from server always asks "What is the location_user?", meaning that the parameter is missing. On DialogFlow V2 happens the same issue.

queryInput = QueryInput.newBuilder()
                        .setEvent(
                                EventInput.newBuilder()
                                        .setName("REVISION")
                                        .setParameters(
                                                Struct.newBuilder()
                                                        .putFields("location_user",
                                                                Value.newBuilder()
                                                                        .setStringValue("Campinas")
                                                                        .build())
                                                        .build()
                                        )
                                        .setLanguageCode(config.getLanguage()
                                        )
                        )
                        .build();

output json:

name: "REVISION"
parameters {
  fields {
    key: "location_user"
    value {
      string_value: "Campinas"
    }
  }
}
language_code: "pt-BR"

1 Answers1

3

Your code seems to be correct. The problem is in your Intent configuration.

from dialogflow docs:

To reference an event parameter in the parameter table or a response, use the following format: #event-name.parameter-name.

In your example: put #REVISION.location_user in Value column in Parameters table.

I've checked your code and it works, please find my Intent configuration below

sample intent

  • Thanks for your help, but IMHO that's not the problem. When I try to detect my Intent, the response from server always asks "What is the location_user?", meaning that the parameter is missing. – Raphael Adamski Apr 05 '19 at 11:25
  • As in edited answer - I've checked your code and it works. I've attached screenshot of sample Intent configuration I've used. – MortFollower Apr 05 '19 at 11:50
  • How to pass parameter without an event? @MortFollower – Subin Babu Jun 14 '19 at 13:09
  • 1
    @SubinBabu I think this is separate topic. More details about your case would be needed. Nevertheless, if you use IntentAPI you can just create new parameter in context when you call Dialogflow. – MortFollower Jun 25 '19 at 06:22