dialogflow-fulfillment-nodejs icon indicating copy to clipboard operation
dialogflow-fulfillment-nodejs copied to clipboard

How to create session entities

Open newtonmunene99 opened this issue 4 years ago • 3 comments

When using the API directly you can set sessionEntityTypes to add session entities to the fulfillment. I haven't found a way to do this using dialogflow-fulfillment

newtonmunene99 avatar May 18 '20 11:05 newtonmunene99

@newtonmunene99 did you found how to do it?

TiagoGouvea avatar Jun 11 '20 20:06 TiagoGouvea

No I did not. As this library is no longer maintained, I don't think it will get patched in. I just reverted back to using the api without a wrapper. I started working on an express js wrapper but I'm currently overwhelmed by work and it will take a while before I can finish working on it.

newtonmunene99 avatar Jun 11 '20 20:06 newtonmunene99

Yeah, thing are a little slow here, I see.

I discovered a way to make it work.

    if (agent.requestSource == PLATFORMS.ACTIONS_ON_GOOGLE) {
      const conv = agent.conv();
      // Add Entities
      conv.sessionEntities.add({
        name: 'Opportunity',
        entities: [
          {
            value: 'a',
            synonyms: ['react']
          }
        ]
      });
      conv.sessionEntities.send();
    }

Calling agent.conv() you can get the conv object and it worked like expected.

Anyway, I'm using play with it to see how it works. Thanks, @newtonmunene99 for your quick response.

👍

TiagoGouvea avatar Jun 11 '20 21:06 TiagoGouvea