Display messages based on user's intent

Hello All,

I have two intents: (1)Sales and (2)Refund
I have created a task [CustomerPurchaseResults] that will look up for the customer’s purchase information into the system and will return the results based on the user intent. For example:

IF Intent = (1)Sales, SHOW:

  • Product Name:
  • Purchase Date:

IF Intent = (2)Refund, SHOW:

  • Product Name:
  • Purchase Date:
  • Within 30 days?:

The goal here is to display to the customers different messages, based on their requests.

Is it possible to do that creating only one task?

Probably I can create two different tasks:

-SearchCustomerSales
-SearchCustomerRefund

However, I want to avoid this because of backend system integration, so I would like to keep only one task.
Thank you in advance.

@henry.correia, Please check if the below configuration could help:

  1. Create one intent with the name ‘SearchCustomer’ in which collect ‘Sales/Refund’ as an optional entity.
  2. Apply transition rules to transition to next nodes depending on the use case.
  3. Create ML utterances at the intent ‘SearchCustomer’ and tag NER as needed so that “Sales/Refund” will be extracted as an entity value.
1 Like

Hello @Subrahmanyam
Than you very much for your fast reply! I really appreciate that :slight_smile:
However, I believe that the scenario you’ve described is not going to work for me because (I am sorry for that) I forgot to mention that I have already asked the user previously if the request is related to Sales or Refund. So, if I create an optional entity it will ask again the customer about ‘Sales/Refund’, and it will be kind of “annoying” to the user.
Based on that, I would like to know if it is possible to get customer intent via script? For example:


If yes, I can create a script “GetCustomerIntent” and apply the transition based on Context or Intent. Do you think the scenario described in the image above make sense?
Thank you very much!

@henry.correia The optional entity would only be prompted to the user when the entity value is not retrieved from the user utterance. So if the utterances already had input “Sales/refund” the the dialog would pick the value and proceed based on transition rules

We’d provide you with a sample configuration to guide soon on how the use case can be achieved using ML training using NER and optional entities.

The configuration you had the dialog at script node (getcustomerintent) might not work because in the context object the intent identified would be “CustomerPurchaseResults”.

Hi @Subrahmanyam,
I see… Thank you very much again. I will wait for the sample :slight_smile: meanwhile I will try some other options on my end. Looking forward to hearing from you soon! Thx

Hi @henry.correia,

Please find the implementation steps:

1- Create a dialog task with name customerPurchasedetails.

2- By default, the userIntent customerPurchaseDetails will be created.

3- Add a new entity node, say categoryEntity with type String.
image1

In the “instance properties” of the entity node, select “Optional entity”.

image2

4- In the connection properties of the entity, click on “Add If”. This would create conditions as per the screenshot. Fill the conditional properties with reference to the below screenshot.

image3

5- Add a message node “Sales message” and a message node “Refund message” respectively for the connections as per the condition.

image4

Now, go to Natural Language Processing >> Training.
4- For the “Intent” customerPurchaseDetails, add the utterance “I would like to talk about option” and save.

5- Double click on “option”, you can observe a drop-down “select entity”.
6- Select “categoryEntity”.

image5

If the user says, “I would like to like to talk about sales” to the bot, then “sales” word in this utterance will be detected as an input to the “categoryEntity”.

This behavior is called as NER tagging. Please refer the following link to understand more on NER tagging.

https://developer.kore.ai/docs/bots/concepts/natural-language-processing-nlp-guide/entity-detection/

And the entity node will be executed without prompting. Since the input will be “sales” which is already captured from the utterance, it will take to the salesMessage node and displays the sales message.

image6

You can replace the message nodes with your further functionality after detecting the category as sales/refund.

Let us know if you need any further clarification.

Regards,
Yoga Ramya.

@yogaramya.mendu It is better to use a LoV entity instead of a string entity.

Strings are greedy and unbound, so if the user is really prompted for that entity then the value will be whatever they type in and that is unlikely to be a single word, which means the transitions will fail.

Also string entities will not extract from the initial utterance unless there is an NER match or an entity pattern. So if NER doesn’t find anything, and it may not depending on the training, then the entity will be prompted because it is optional.

Hi @andy.heydon,

Thank you for the suggestion and clear explanation.

This point would be helpful in designing the use case appropriately without breaking in any case.

Regards,
Yoga Ramya.

Hello @yogaramya.mendu,
Thank you very much for sending the step by step. I have tested it in the scenarios:

  1. Within my existing workflow where I have already intents named: Refund and Sales, so, the suggestion you provided did not work, unfortunately :pensive: I don’t why… I have trained the Bot exactly as you suggested using NER, but still, the message was prompted to the user.

  2. I have created a brand new Bot, and I have reproduced the steps as you suggested, so, it worked perfectly :slight_smile:

Any other suggestion? My main intents are named: Refund | Sales | Installation |

When the user starts the conversation, Bot shows to the user the option:
Hello XXXXXXX! I am the Bot XXXXX !!! How can I help you? Please, type the name of the task you would like to be assisted with:

a) Installation
b) Activation
c) Refund
d) Sales

So, the user will type “Refund”, and the Bot is able to recognize correctly the intent “Refund” already in the beginning of the conversation. Later on, I ask the customer to provide purchase details such as Order ID and E-mail Address, and now comes the catch… I want to display a Refund message to the user, because in the begining user selected “Refund” as an option… Any further help? Thank you very much!

Hi @andy.heydon, thank you for your suggestion. For LoV you mean “List of Values” right? If yes, within my flow, I have changed the entity type from String to List of Items, but still, the message is prompted to the user to select “sales/refund”… Is there also something else that I need to consider? Thanks

Thank you all and looking forward to hearing from you!
H.

@henry.correia If you have multiple intents and want to use some aspect of a previous task in the current dialog then those previous tasks are going to have to set something in context, typically context.session.BotUserSession. That is the only way to pass information from one task on to a later task.

When one dialog is finished then the user utterances used during that task are not available to future tasks and therefore words cannot be extracted from those utterances.

But if you have just a single task (and only invoke this one task in a session) then a List of Values (LoV) should be able extract a word or words from the utterance. That is a very common use case.

@andy.heydon, Thank you once again… understood… yep, I have multiple intents, and I am normally getting info directly from context, most of them from context.session.BotUserSession.
Btw, I will try to make it simple… I will just separate flows, so when the user invokes “Refund” then I will send Refund message, if the user selects “Installation”, then I will send installation message, and so on… Probably should work this way! Thx