actions-on-google / actions-on-google-nodejs

Node.js client library for Actions on Google
https://actions-on-google.github.io/actions-on-google-nodejs
Apache License 2.0
900 stars 194 forks source link

Issue in getting response from Dialogflow #384

Open ghost opened 4 years ago

ghost commented 4 years ago

This is the URL( https://dialogflow.googleapis.com/v2/{parent=projects/}/agent) in my case( https://dialogflow.googleapis.com/v2/{parent=projects/chatagent-yrwptu}/agent) which I want to access from the POSTMAN tool to check its response whether it is working or not. But every time it is giving me an error

The requested URL /v2/%7Bparent=projects/chatagent-yrwptu%7D/agent was not found on this server. That’s all we know. I seriously don't know what to do What I wanted to get the response from the dialogflow and saves into my salesforce org.

Fleker commented 4 years ago

When you see {parents=projects/chatagent-yrwptu} it does not mean literally parents=. It's meant to signify that the URL path for the v2 API is agent, but it needs to be prepended by a parent so that the API knows which project specifically to use.

So you should be using the URL https://dialogflow.googleapis.com/v2/projects/chatagent-yrwptu/agent

ghost commented 4 years ago

Yes I was using this URL from Salesforce org but it was not giving me any response, so what should I do to get the response in my salesforcr org

ghost commented 4 years ago

I have tried this code but I was confused in this curl query Http http = new Http(); HttpRequest request = new HttpRequest(); request.setHeader() request.setEndpoint('curl\-H "Authorization: Bearer 2041141a7ad34f45ae12654480ac0c98"\"https://dialogflow.googleapis.com/v2/{parent=projects/chatagent-yrwptu}/agent/query?v=20150910&contexts=shop&lang=en&query=apple&sessionId=12345&timezone=America/New_York"'); request.setMethod('Get'); HttpResponse response = http.send(request); String body = response.get(body); System.debug(body);

Fleker commented 4 years ago

Your cURL command has the same issue where you're passing parent=. If you use the standard URL you will get a different answer. However, I also am not seeing any documentation for the approach you're taking in the request.

ghost commented 4 years ago

Thanku @Fleker for your quick response on this issue