MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/nodejs-docs-samples / listIntents

Function listIntents

dialogflow/list-intents.js:35–67  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

33 const intentsClient = new dialogflow.IntentsClient();
34
35 async function listIntents() {
36 // Construct request
37
38 // The path to identify the agent that owns the intents.
39 const projectAgentPath = intentsClient.projectAgentPath(projectId);
40
41 console.log(projectAgentPath);
42
43 const request = {
44 parent: projectAgentPath,
45 };
46
47 // Send the request for listing intents.
48 const [response] = await intentsClient.listIntents(request);
49 response.forEach(intent => {
50 console.log('====================');
51 console.log(`Intent name: ${intent.name}`);
52 console.log(`Intent display name: ${intent.displayName}`);
53 console.log(`Action: ${intent.action}`);
54 console.log(`Root folowup intent: ${intent.rootFollowupIntentName}`);
55 console.log(`Parent followup intent: ${intent.parentFollowupIntentName}`);
56
57 console.log('Input contexts:');
58 intent.inputContextNames.forEach(inputContextName => {
59 console.log(`\tName: ${inputContextName}`);
60 });
61
62 console.log('Output contexts:');
63 intent.outputContexts.forEach(outputContext => {
64 console.log(`\tName: ${outputContext.name}`);
65 });
66 });
67 }
68
69 listIntents();
70

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected