dialogflow-fulfillment-nodejs
dialogflow-fulfillment-nodejs copied to clipboard
Fails to parse default console messages with custom payload
Dialogflow Console allows to add Custom Payload to Default platform.
Webhook request for such an intent with custom payload in Default platform fails to parse with below exception.
Error: Platform can NOT be empty
at new Payload (/app/node_modules/dialogflow-fulfillment/src/rich-responses/payload-response.js:60:13)
at Object.convertPayloadJson_ [as payload] (/app/node_modules/dialogflow-fulfillment/src/v2-agent.js:439:12)
at consoleMessageList.forEach (/app/node_modules/dialogflow-fulfillment/src/v2-agent.js:374:64)
at Array.forEach (<anonymous>)
at V2Agent.getConsoleMessages_ (/app/node_modules/dialogflow-fulfillment/src/v2-agent.js:369:24)
at V2Agent.processRequest_ (/app/node_modules/dialogflow-fulfillment/src/v2-agent.js:163:41)
at new WebhookClient (/app/node_modules/dialogflow-fulfillment/src/dialogflow-fulfillment.js:238:17)
at APP_
Can we get support for custom payload with Default platform?
Currently worked around by setting platform to 'PLATFORM_UNSPECIFIED' in request before initializing the WebhookClient
if (!request.body.queryResult.fulfillmentMessages)
return;
request.body.queryResult.fulfillmentMessages = request.body.queryResult.fulfillmentMessages.map(m => {
if (!m.platform)
m.platform = 'PLATFORM_UNSPECIFIED';
return m;
});
It is 2020 and the error persists. I have to remove the payload for the webhook call to not send an unhandled promise warning when there is payload
I am facing the same issue. Has no one solved this yet ?