简体   繁体   中英

How to handle multiple agents in Dialogflow API V2?

I am using NodeJS SDK for accessing Dialogflow(V2) agent.I have multiple agents for multiple categories of business, one agent for one business.

Currently I am using single aget for my Nodejs application and I am using the nodeje SDK of V2 which requires to set an environment variable of the GOOGLE_APPLICATION_CREDENTIALS (I mentioned private key json file path) for Authentication.

How can I implement the above functionality for multiple agents in my Nodejs application. can you please help me how to resolve this issue?

How to access listIntents method for multiple agents?

Thanks.

If you want to use multiple agents, instead of using environment variables, the best alternative is to use keyFileName property when creating the client.

const sessionClient = new dialogflow.SessionsClient({
    keyFilename: '/path/to/google.json'
});
const sessionPath = sessionClient.sessionPath(projectId, sessionId);

Dialogflow easy way for authorization

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM