googleapis / nodejs-dialogflow

This repository is deprecated. All of its content and history has been moved to googleapis/google-cloud-node.

Home Page:https://dialogflow.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

VinayBaviri opened this issue · 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 !!

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.

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 ?

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);

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.