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

Fails to parse default console messages with custom payload

Open slowtick opened this issue 6 years ago • 3 comments

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?

slowtick avatar Oct 15 '18 15:10 slowtick

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;
});

slowtick avatar Oct 15 '18 15:10 slowtick

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

HannesSan avatar Mar 11 '20 16:03 HannesSan

I am facing the same issue. Has no one solved this yet ?

Sata-Chakra avatar Jun 08 '22 10:06 Sata-Chakra