ChristopherD
ChristopherD

Reputation: 43

Slotfilling entities does not come through to fullfilment

I got a weird problem with dialogflow / node.js backend.

Within Dialogflow I have two entities "color" and "order_amount". I set the entities to required within the intent. But only one of the required entities is send back to my backend and the other is undefined. Though both are received within dialogflow.

app.intent('Default Welcome Intent - yes', (conv, {product_color}, {order_amount}) => {

    console.log({product_color});
    console.log({order_amount});
    conv.ask(`Top. In welke maat?`);

});

So for example, when this intent runs the slotfilling is being done in dialogflow. But I only the first entity is defined e.g {color} and {order_amount} is undefined. When I switch {product_color} and {order_amount} as the below example. Then product_color is undefined.

app.intent('Default Welcome Intent - yes', (conv, {order_amount}, {product_color})

Anyone knows whats going on?

Upvotes: 1

Views: 58

Answers (2)

Prisoner
Prisoner

Reputation: 50701

The issue is that you're mangling your JavaScript. The second function parameter contains an object with all the Intent parameters. The {name1} syntax in JavaScript maps object attribute names to a variable. So you could rewrite the line as

app.intent('Default Welcome Intent - yes', (conv, {product_color,order_amount})

Upvotes: 1

Related Questions