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

Function main

dialogflow/update-intent.js:19–44  ·  view source on GitHub ↗
(projectId, intentId, displayName)

Source from the content-addressed store, hash-verified

17process.env.DEBUG = 'dialogflow:debug'; // enables lib debugging statements
18
19async function main(projectId, intentId, displayName) {
20 // [START dialogflow_update_intent_sample]
21 const {IntentsClient} = require('@google-cloud/dialogflow');
22
23 const intentClient = new IntentsClient();
24
25 const agentPath = intentClient.projectAgentPath(projectId);
26 const intentPath = agentPath + '/intents/' + intentId;
27
28 const intent = await intentClient.getIntent({name: intentPath});
29 intent[0].displayName = displayName;
30 const updateMask = {
31 paths: ['display_name'],
32 };
33
34 const updateIntentRequest = {
35 intent: intent[0],
36 updateMask: updateMask,
37 languageCode: 'en',
38 };
39
40 //Send the request for update the intent.
41 const result = await intentClient.updateIntent(updateIntentRequest);
42 console.log(result);
43 // [END dialogflow_update_intent_sample]
44}
45
46process.on('unhandledRejection', err => {
47 console.error(err.message);

Callers 1

update-intent.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected