nodejs-dialogflow icon indicating copy to clipboard operation
nodejs-dialogflow copied to clipboard

How to access particular version of an environment in dialogflow from node ?

Open VinayBaviri opened this issue 5 years ago • 4 comments

Hi there,

I started using dialogflow for chat-bot integration in one of my projects and reading official docs helps me alot. I learnt many things and as a part, i can able to access one particular agent environment from node also. But every time when new intents are added, publishing new version to that environment. Changes are reflecting on the go. I also observed that its maintaining all versions.

image

Here i got stopped with how to access particular version of an environment. So that my front-end app will decide which version it need to connect and updates to existing will not effect to users who's on lower version.

Thanks in advance !!

VinayBaviri avatar Oct 04 '21 14:10 VinayBaviri

Hi @vijay-qlogic — thank you for using our service. To interface with the Environment Entity, you need to create an instance of the EnvironmentsClient and call the relevant endpoint for your specific purpose.

Please note:

  const project = 'project-id';

  const parent = `projects/${project}/agent`;

  const environmentsClient = new dialogflow.EnvironmentsClient();

  const [listEnvironment] = await environmentsClient.listEnvironments({
    parent: parent,
    pageSize: 10,
  });

  console.log(listEnvironment);

This snippet, for example, will return a list of environments and their versions.

b-loved-dreamer avatar Oct 11 '21 21:10 b-loved-dreamer

Hi @b-loved-dreamer , thanks for the info. Able to get the list of environments and their versions as mentioned. But i need sessionPath to access one version of an environment of an agent. So that i can send my custom request object from code to access that one version only.

how to get that ?

VinayBaviri avatar Oct 12 '21 06:10 VinayBaviri

Try this:

  const project = 'python-docs-samples-tests';

  const environment = 'TestEnvironmentI'

  const parent = `projects/${project}/agent/environments/${environment}`;

  const environmentsClient = new dialogflow.EnvironmentsClient();

  const [getEnvironment] = await environmentsClient.getEnvironment({
      name: parent
  });

  console.log(getEnvironment);

b-loved-dreamer avatar Oct 20 '21 20:10 b-loved-dreamer

Thank you for filing this issue. We asked provided feedback 5 days or more ago and never heard back from you. We are unable to proceed with this issue until then, so we are closing it. Please feel free to re-open this issue with more information.

b-loved-dreamer avatar Oct 25 '21 22:10 b-loved-dreamer