Open JpEncausse opened 3 years ago
Do you want to use the library then, or would you just prefer sending JSON back directly?
If you want the library, you can use something similar to the session-entities-plugin and use the serialize
method:
const responseBody = this.conv.serialize() as ResponseBody
const convBody = this.conv.body as GoogleCloudDialogflowV2WebhookRequest
responseBody.sessionEntityTypes = this.entities.map(entity => {
entity.name = `${convBody.session}/entityTypes/${entity.name}`
return entity
})
this.conv.json(responseBody)
The documentation describe a middleware that will register functions on a given intent.
I'm using Node-RED with a fullfilment end-point. I can't and don't want to build a middleware because I want to manage the response flow. I only need a wrapper on the API to retrieve a valid JSON.
Is there a way to use the
conv
object in order to retrieve a valid JSON response ? Something like in the playground