Smartest way to make conditonal logic

Hello,

I’m making an assistance which can cover a FAQ. Here I would like to make a message saying something like “if there’s anything else you need dont be afraid to ask” after the bot has made the Utter action. The thing is it should only be the first intent.

But I cant seem to wrap my head around how i would create an action which can do this. Does anyone have an idea how to approach this problem?

Thanks in advance

Hi @Blaabjerg96! I’m not sure if I understand your question correctly. do you want to do something like this?

- story: faq
  steps:
  - intent: ask_faq
  - action: utter_faq
  - action: utter_dont_be_afraid_to_ask

If this is not what you want, you might want to look into custom actions and follow up events?

I looked into events, but cant seem to find a event that refers to the first intent.

Am I missing something?

Hi! I think I don’t understand what you are trying to do - what do you mean by “it should only be the first intent” and refering to the first intent?

Thanks for the quick reply,

So the idea was that the user might ask more than one question. But the Utter_dont_be_afraid_to_ask should come only after the first time, the bot answers the users message.

I hope that cleared it up

I think now I understand what you’re trying to do, thanks for clearing it up!

I can imagine that you can

  • create a slot with an initial slot value e.g. 0
  • create a custom action for the utter_faq that fetches the slot value by tracker.get_slot(slot_name) and dispatch the reply to the faq
  • if the slot value is still 0 you can issue a dispatcher.utter_message(text = "don't be afraid to ask")
  • update the slot by return [SlotSet("slot1", "value")] for other than 0

That should work, but there are probably also other ways to do it. I hope I didn’t miss anything!

But if i have more than one intent which share the that action, i would run into a problem right? Have i build my FAQ bot incorrectly if i make an intent for each question type?