dialogflow / dialogflow-fulfillment-nodejs

Dialogflow agent fulfillment library supporting v1&v2, 8 platforms, and text, card, image, suggestion, custom responses

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to create session entities

newtonmunene99 opened this issue · 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 did you found how to do it?

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.

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.

👍