How to ask user for specification?

Hello,

I am writing a custom function to retrieve information from a file. The custom action handles two main scenarios based on the value of the entity:

  • If the user gives an entity name that exists in my database, then i return the information related to that product

  • If the user asks for information about a product but since the product commercial name can correspond to multiple product technical names, i want to list all possibilities and ask the user to choose the correct one then return to custom action to query the database and return the information.

Does anyone know the best way to achieve this ?

Thank you

Hi @souf, I think what you’re describing is a pattern that’s used in the demo bot Sara: there, when the NLU model isn’t confident enough, the user is asked to confirm which one of the most highly ranked intents they meant:

Screenshot 2020-12-16 at 12.02.22

The implementation of that behaviour is in this custom action. I hope that helps :slight_smile:

Hello, Thanks a lot for the response and pointing me towards a custom action with buttons. I was using forms and i have difficulties setting it up.

While looking into the custom action, i noticed that the custom action ‘action_default_ask_affirmation’ was not used anywhere (not in stories, rules or forms). I was wondering how to integrate the custom action in a story and be able to retrieve the answer?

Thanks !

I’m glad this helped :slight_smile:

action_default_ask_affirmation is a special default action, read about it here, that’s why it isn’t anywhere in stories/rules.

When you write your own action, just include it in your stories wherever you want it to be triggered, like any other custom action.

As for retrieving the answers, that’s what the payload of the button is for: when the user clicks a button, it can trigger an intent and send some additional info back to the bot. I suggest you read about buttons here.

1 Like

Instead of triggering an intent, can i use the payload to set a slot ?