4

I'm trying to send an EventInput using python dialogflow client v2 (https://dialogflow.com/docs/reference/api-v2/rest/v2beta1/projects.agent.sessions/detectIntent#eventinput) but couldn't set parameters.

Setting it to an object like {"result_guid": "49A8608C-4854-4964-81C3-0A75F912B994"} returns an error ValueError: Protocol message Struct has no "result_guid" field.

How can this be solved?

timu
  • 165
  • 1
  • 6

1 Answers1

6

found the solution. parameters needs to be a google.protobuf.Struct so something like below works

from google.protobuf import struct_pb2

parameters = struct_pb2.Struct()
parameters["result_guid"] = "49A8608C-4854-4964-81C3-0A75F912B994"
event_input = dialogflow.types.EventInput(name=event_name, parameters=parameters, language_code=language_code)
timu
  • 165
  • 1
  • 6