1
votes

I have been working lately with Dialogflow to make chatbots to do some simple tasks. For instance with webhooks and youtube api where the user ask to show him a video and then the bot just answers with the youtube video url.

E.G. USER SAYS Show me Neil young harvest moon

AGENT SAYS Here you go : https://www.youtube.com/watch?v=n2MtEsrcTTs

I do this by using a custom Entity I called "YoutubeQuery" I checked "Allow Automated expansion" and unchecked "Define Synonyms" then I just added 2 values "Kavinsky Night Call" and "Indigo Night Tamino"

Entity with example values

In my Intent I just made a couple of training phrases like these:

Training Phrases for my youtube intent

And everything works.

Now my issue is with a new Agent which I called Orders

I want just to get Order Id's from the firestore database, but before getting there I'm running in kind of a huge problem

I defined the order's ID entity just like the one with the youtubeQuery. And I added some example Order ID's , I want them all to Start with OD and have 4digits after example (DX0001,DX0009,DX9999) order id's entity

Afterwards I made the intent Intent of GetOrder

Now unless I give the EXACT order ID's from the traininphrase or the ID examples I defined in the Entity it will always give me a response with an empty parameter OrderID I start my intent by saying "my order" then I get prompted with "What is your ID?

intent start

So when I give an ID that has not been used in the training phrases of the Intent I get an empty value in the parameters like this:

returning empty

But when I give an ID that has been used in the training phrases like for instance the first one DX0808 it does work...

Works

How can I make this work without adding all the possible order id's ranging from DX0001 to DX9999 in the training phrases or the entity. I mean it does work for my youtube query, I can put anything there it does "catch" the value. Any help please?

1
Hi! Can you try this and see if that works for you!Sairaj Sawant
I tried it, but it only works if I put the parameters as NOT required, once I put it as required it doesn't work :/Abdel Kdj
I tried with @sys.any and it seems to work, but I don't know why it doesn't work with custom entities.Abdel Kdj
@sai.raj any idea?Abdel Kdj

1 Answers

0
votes

It looks like the required parameter is the problem here, my suggestion would be to:

  1. Create intent to get the order id in one sentence without reprompt (turn off required on the order id) and id is always present, ex: "my id is DX0402". Include training response where only ID is provided like "DL3932", ex. below:

enter image description here

  1. Set other intent for scenario when customer wants to provide the id but it is missing, for ex. customer says: "my id" and make your bot ask for the id as an response ex. "ok, provide me your id"

If you do it, in case user doesn't provide the id, intent 2 will be triggered and after id is provided you'll trigger intent 1.

Hope this makes sense.