Я пытаюсь использовать событие followup для вызова намерения из кода webhook.
const event_trigger = {
followupEventInput: {
name: "event_name",
languageCode: "en-US"
}
};
return response.json(event_trigger);
Я получаю эту ошибку в консоли:
Error: Can't set headers after they are sent.
at validateHeader (_http_outgoing.js:491:11)
at ServerResponse.setHeader (_http_outgoing.js:498:3)
at ServerResponse.header (/worker/node_modules/express/lib/response.js:767:10)
at ServerResponse.send (/worker/node_modules/express/lib/response.js:170:12)
at ServerResponse.json (/worker/node_modules/express/lib/response.js:267:15)
at V2Agent.sendJson_ (/srv/node_modules/dialogflow-fulfillment/src/v2-agent.js:226:26)
at V2Agent.sendMessagesResponse_ (/srv/node_modules/dialogflow-fulfillment/src/v2-agent.js:205:10)
at WebhookClient.send_ (/srv/node_modules/dialogflow-fulfillment/src/dialogflow-fulfillment.js:486:19)
at promise.then (/srv/node_modules/dialogflow-fulfillment/src/dialogflow-fulfillment.js:306:38)
at <anonymous>
at process._tickDomainCallback (internal/process/next_tick.js:229:7)
Возвращает лиМетод response.json () не лучший подход?Что бы сработало?