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

Function updateIntent

dialogflow-cx/update-intent.js:31–53  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

29 // const displayName = 'your-display-name';
30
31 async function updateIntent() {
32 const agentPath = intentClient.projectPath(projectId);
33 const intentPath = `${agentPath}/locations/${location}/agents/${agentId}/intents/${intentId}`;
34
35 //Gets the intent from intentPath
36 const intent = await intentClient.getIntent({name: intentPath});
37 intent[0].displayName = displayName;
38
39 //Specifies what is being updated
40 const updateMask = {
41 paths: ['display_name'],
42 };
43
44 const updateIntentRequest = {
45 intent: intent[0],
46 updateMask,
47 languageCode: 'en',
48 };
49
50 //Send the request for update the intent.
51 const result = await intentClient.updateIntent(updateIntentRequest);
52 console.log(result);
53 }
54
55 updateIntent();
56

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected