I'm trying to create a new Entity
on DialogFlow:
const dialogflow = require('dialogflow');
/**
* trains the NLP to recognize language constructs
*/
export function intTraining() {
const ENTITY_DEFINITION_BOOLEAN = {
parent: 'foo',
entityType: {
displayName: 'myBoolean',
kind: 'KIND_MAP',
autoExpansionMode: 'AUTO_EXPANSION_MODE_UNSPECIFIED',
entities: [
{value: 'true', synonyms: [ 'yes', 'yeah', 'sure', 'okay' ]},
{value: 'false', synonyms: [ 'no', 'no thanks', 'never' ]}
],
},
};
// allocate
const entityTypesClient = new dialogflow.EntityTypesClient();
// declare promises
const promises = [];
// allocate entities
prepareEntity(entityTypesClient, promises, ENTITY_DEFINITION_BOOLEAN);
// execute state initialization
Promise.all(promises);
}
/** Buffers an Entity onto the Promise Queue. */
function prepareEntity(entityTypesClient, promises, definition) {
// boolean entity
promises.push(entityTypesClient
.createEntityType(definition)
.then(responses => { })
.catch(err => { console.error('', err) })
);
}
When I execute this code, however, I receive the following error:
Error: Resource name 'foo' does not match 'projects/*/agent'.
I've already used gcloud auth application-default login
to create API access credentials on my machine, with foo
configured as the currently selected project, but this hasn't helped.
What am I doing wrong?