Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

266
Views
is there a way to update an entity using nodejs library of dialogflow es?

I have been trying to update a entity in Dialogflow es using the nodejs SDK, but I haven't been able to do it, the API reference does not give enough information so I need help with.

the name of the entity I want add a new value its @Productos

So far this has been de the code I have been trying to implement.

 updateEntity:async (req, res) => {
    try{
      const projectAgentPath = entityClient.projectAgentPath(clientId)   /// (clientId);
      console.log('whats projectAgentPaht',projectAgentPath);
      const request = {
        parent: projectAgentPath,
        
        
        
      }


      const response  = await entityClient.updateEntityType({
        
        entityType: {
          name: '@Productos',
          displayName: "Productos",
          entities: [
            {value: 'Nuevo producto'}
          ]

        },
      
      });
     // const response = entityClient.getEntityType(request)
      /*const [response] = await intentsClient.listIntents(request);*/
      console.log('whats response ', response);
      return res.json(response).status(200)  

    }catch(e){
      console.log('e ', e)
     return res.json({message: 'ocurrio un problema al procesar la solictud'}).status(500);
    }

the code above gives the following error

 projectAgentPaht projects/prod-proinvestec/agent
e  Error: 3 INVALID_ARGUMENT: Resource name '@Productos' does not match 'projects/*/locations/*/agent/entityTypes/*'.
    at Object.callErrorFromStatus (D:\Projects\iqbit\chatbot-server\node_modules\@grpc\grpc-js\build\src\call.js:31:26)
    at Object.onReceiveStatus (D:\Projects\iqbit\chatbot-server\node_modules\@grpc\grpc-js\build\src\client.js:189:52)
    at Object.onReceiveStatus (D:\Projects\iqbit\chatbot-server\node_modules\@grpc\grpc-js\build\src\client-interceptors.js:365:141)
    at Object.onReceiveStatus (D:\Projects\iqbit\chatbot-server\node_modules\@grpc\grpc-js\build\src\client-interceptors.js:328:181)
    at D:\Projects\iqbit\chatbot-server\node_modules\@grpc\grpc-js\build\src\call-stream.js:187:78
    at processTicksAndRejections (node:internal/process/task_queues:78:11) {
  code: 3,
  details: "Resource name '@Productos' does not match 'projects/*/locations/*/agent/entityTypes/*'.",
  metadata: Metadata {
    internalRepr: Map(1) { 'grpc-server-stats-bin' => [Array] },
    options: {}
  },
  note: 'Exception occurred in retry method that was not classified as transient'

I want to add new values to the products entity. I hope someone could help me. Thanks!

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

I just used regex to detect the name of the products instead of adding values to the products entity.

lol

about 4 years ago · Juan Pablo Isaza Report

0

You first need to get the resource name of your specific entityType that you want to update. You may use below cURL command for getting the resource name.

curl -X GET \
-H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
-H "Content-Type: application/json; charset=utf-8" \
"https://dialogflow.googleapis.com/v2/projects/<your-project-id>/agent/entityTypes"

Below is a sample screenshot where to find the resource name on the result of the cURL command. enter image description here

You may now use the updated code below (derived from your posted code) in which we use the resource name on the "name" parameter and we added the "kind" parameter since this is required when using the updateEntityType() function.

const dialogflow = require('@google-cloud/dialogflow');

const entityClient = new dialogflow.EntityTypesClient();

async function main() {
    
    const projectAgentPath = entityClient.projectAgentPath('your-project-id') 
      console.log('whats projectAgentPath',projectAgentPath);
      const request = {
        parent: projectAgentPath,
        
        }


      const response  = await entityClient.updateEntityType({
        
        entityType: {
          name: "projects/<your-project-id>/agent/entityTypes/<entity-type-id>",
          displayName: "Productos",
          kind: 'KIND_MAP',
          entities: [
            {value: 'Nuevo producto'}
          ]

        },
      
      });
     // const response = entityClient.getEntityType(request)
      /*const [response] = await intentsClient.listIntents(request);*/
      console.log('whats response ', response);
  }
  
  process.on('unhandledRejection', err => {
    console.error(err.message);
    process.exitCode = 1;
  });
  main(...process.argv.slice(2));
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!