dragos
dragos

Reputation: 300

How to create different answers depending on an entity value in Dialogflow

Here is an example of what I am trying to do.

Assume I have an entity called Animal with values Dog, Cat, Fish, Parrot

I would like the bot to answer to:

How long does @Animal live?

How many legs does @Animal have?

Does @Animal fly? etc.

I am trying to create a table of values associated with each of the Animal.

Thank you

Upvotes: 1

Views: 711

Answers (1)

Marcos Casagrande
Marcos Casagrande

Reputation: 40444

The best option here is to create one intent per question you want to answer.

So, given your examples

1) Animal - life expectancy

Training phrases

@ - How long does @Animal:Animal live?
@ - How many years do @Animal:Animal live?
@ - @Animal life expectancy
" - How long do elephants live

Webhook answer

Elephants can live up to 70 years in the wild

2) Animal - Legs

Training phrases

" - How many legs does dogs have?
@ - How many legs does @Animal have?
@ - leg count of @Animal

Webhook answer

Dogs have 4 legs.

3) Animal - Fly

Training phrases

@ - Does @Animal fly?
" - Can cats fly?

Webhook answer

No, cats can't fly.

Entity

enter image description here


Intent

enter image description here

Legend:

 " - example mode
 @ - Template mode

Upvotes: 1

Related Questions