I am working on a project with DialogFlow V2 Api using Nodejs and the following code somehow does not seem to work:
var query = req.body.query;
const request = {
session: sessionPath,
queryInput: {
text: {
text: query,
languageCode: 'en-US',
},
},
queryParams: {
contexts: [
{
"name": "Question-followup",
"parameters": {},
"lifespanCount": 0
}
]
}
};
// Send request and log result
sessionClient
.detectIntent(request)
.then(responses => {
const result = responses[0].queryResult;
console.log(result);
res.json(result);
if (result.intent) {
console.log(` Intent: ${result.intent.displayName}`);
} else {
console.log(` No intent matchede.`);
}
})
.catch(err => {
console.error('ERROR:', err);
});
And the error I recieve is:
ERROR: { Error: 3 INVALID_ARGUMENT: Name 'Question-followup' does not match patterns 'projects/{projectId=}/agent/environments/{environmentId=}/users/{userId=}/sessions/{sessionId=}/contexts/{contextId=},projects/{projectId=}/agent/sessions/{sessionId=}/contexts/{contextId=}'.
Note: I do have "Question-followup" context into an Intent, so it should not be the problem that the context does not exists or something!
Any idea what would this be?