dialogflow / dialogflow-nodejs-client

Node.js SDK for Dialogflow
Apache License 2.0
659 stars 287 forks source link

problem with request paths for contexts in dialogflow v2 #118

Closed agnescameron closed 4 years ago

agnescameron commented 4 years ago

Hi there --

I'm having some issues with contextClient.createContext and contextClient.ListContexts methods. As per the documentation, I'm setting the request path as 'projects/{projectId}/agent/sessions/{sessionId}', but I get back the error Resource name '' does not match 'projects/*/locations/*/agent/environments/*/users/*/sessions/*'. .

I know that projectId and sessionId are correct, as sessionClient.detectIntent works as expected.

Would you be able to clarify what should be going in the context request string? Thanks!

agnescameron commented 4 years ago

Resolved: when creating a new context, the 'name' given is actually the contextPath, which needs to be set in the same way as the session path, as in the API sample docs here https://github.com/googleapis/nodejs-dialogflow/blob/master/samples/resource.js#L902.