Nodejs-dialogflow: Custom event parameters are ignored

Created on 18 Apr 2019  路  3Comments  路  Source: googleapis/nodejs-dialogflow

I am sending a custom welcome event called "demo-welcome" via v2 with version 0.8.2

{
    "session":"projects/XXXXXXXXXXXX/agent/sessions/20055814231515",
    "queryInput": {
        "event": {
            "name":"demo-welcome",
            "parameters": {
                "party":"123456"
            },
            "languageCode":"de"
            }
        }
}

The event fires correctly but unfortunately parameter party cannot be accessed: #demo-welcome.party does not exist.

Any help is appreciated.
Mark.

question dialogflow

All 3 comments

Hi @mwoop the issue is that parameters needs to be formatted as protobuf Struct. I actually put together a little utility module to help with conversions if you're interested

const {struct} = require('pb-util');
const parameters = struct.encode({party: '123456'});

Hi @callmehiphop - that solved my issue. Thanks a lot.

@mwoop awesome, glad to hear it!

Was this page helpful?
0 / 5 - 0 ratings