Search code examples
pythondialogflow-esapi-ai

Why do I not get the response as RAW API RESPONSE specified by Dialogflow?


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?


Solution

  • 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')