Reputation: 155
How to call detectIntent but with specified Environment (beta feature) using Dialogflow nodejs SDK (nodejs-dialogflow)?
Upvotes: 4
Views: 853
Reputation: 40394
You have to use dialogflow.v2beta1.SessionsClient
& .environmentSessionPath
instead of .sessionPath
to generate the session that is sent on detectIntent
const client = new dialogflow.v2beta1.SessionsClient({});
const sessionPath = client.environmentSessionPath(project, environment, user, session);
// The text query request.
const request = {
session: sessionPath,
queryInput: {
text: {
text: 'hello'
}
}
};
This is the template for session environment path:
projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}
You can read the library code regarding this answer at https://github.com/googleapis/nodejs-dialogflow/blob/master/src/v2beta1/sessions_client.js#L353
More info at: https://dialogflow.com/docs/agents/versions-environments
Upvotes: 6