1

I asked this question before, came to a wrong conclusion because Dialogflow V1 client library gives response in the format specified by Dialogflow and Dialogflow V2 client did not so I thought the response format has changed. I used

response.query_result.parameters.fields

to access the parameters sent by the Dialogflow in an object format and not a JSON string. Where did I go wrong or is the response format correct and Google did not update the Dialogflow documentation?

Jeeva Bharathi
  • 99
  • 2
  • 12

1 Answers1

2

I don't have anything set up right now in nodeJS to test this, but translating from my python requests I think that it should be

request.body.queryResult.parameters['fields']

idk if this could also be helpful to you but in python my code looks like this

req = request.get_json(silent=True, force=True)
auth_code = req.get('queryResult').get('parameters').get('number')
Ariel
  • 61
  • 3
  • 1
    I found solution for this long time ago and forgot to post it. There is a python package called protobuf. We can use MessagetoDict(response.query_result.parameters) to directly convert the object to dictionary and access the values using keys. I don't if your code works, I'll test it and post the results. – Jeeva Bharathi May 03 '19 at 06:27