Search code examples
dialogflow-cx

How to match parameter to TWO entities simultaneously?


My bot asks: 'how do you (i.e. customer) want to pay for this product?'

Customer says: 'part in cash and the difference in 48x'

What the customer is saying above is that he wants to pay in cash and use financing. And that financing should consider 48 installments.

Entities:

  1. paymentType: {cash, financed} ; Financed includes 48x as a synonym

  2. numInstallments: {12x, 24x, 36x, 48x} ; 48x is the number of installments desired

Using the GUI only, how to do this: IF user says '48x' THEN simultaneously add 'financed' to the paymentType list AND set numInstallments equal to '48x' ?

Apparently the GUI doesn't allow me to do that unless I'm doing something wrong (see below the screen which allows a parameter to be mapped to an entity and notice that this dropdown apparently allows selection of a single entity and not two, which is what I need).

How to solve this problem in an easy way through the GUI?

enter image description here


Solution

  • I don't know if what you have in mind is actually feasible in this case.

    What you could do is keep the intent and entities as-is and then create several conditions in the page where you fill this parameters or another page (i think this is preferred). In that page you can put different routes where your conditions are true that modify your parameters as you wish.

    For example, after asking the user how they'd like to pay, you can have a route going to a "Set parameters" page which has several routes:

    1. First route has a condition $session.params.numeroDeParcelas != null (you know the user has asked a specific number of installments, so handle the case by setting the parameters you need in this route (under parameters in the route write paymentType : "financed")
    2. Second route has another condition, for example $session.params.numeroDeParcelas = null (you know the user hasn't asked for financing, so set the same parameter as before to "cash")

    and so on, until you've exhausted your user cases (all payment methods, possibly all types of financing). Pay attention: the routes are always evaluated in order so make sure to keep this in mind while writing/ordering them: be specific to avoid fulfilling the wrong one by mistake (e.g. by creating compound conditions, chaining parameter checks as in $session.params.numeroDeParcelas = null AND $session.params. numInstallments = "36x"