Set user input as intent after button click

Hi, Need help to set the user input as an intent, after a special utter.

in my stories I have something like:

## story1
 * bonjour
      - utter_bonjour
 * confirmer
      - utter_etape1
 * ideasmine
      - action_SendIntentProblemeSite
      - action_SendIntent_B_S

I know that after utter_etape1 the user will give me his ideasmine but I realy don’t know what this will be like. (can’t extract entity, and don’t have examples to set at first) the intent ideasmine is realy random sentences.

So I want to do something after utter_etape1 that allows the user to tape his message and click on button “ok” and in this button ok I will set like a payload to the intent ideasmine. the next action after intent ideasmine is to extract the user input and set it as slot to re use it later (you said previously [slot ideasmine] …).

Or is there any way to tell the bot to listen to the next user input after utter_etape1 and set it directly as ideasmine intent.

Can any one help please?

hey @chemseddine you can read this doc… https://rasa.com/docs/core/api/interpreter/#buttons-and-other-structured-input

you can do in this way too…

story1

  • bonjour
    • utter_bonjour
  • confirmer
    • utter_etape1 buttons:
    • title: “button1” payload: “intent ideasmine random sentence”
    • title: “button2” payload: “other random intent sentencd”
  • ideasmine
    • action_SendIntentProblemeSite
    • action_SendIntent_B

Thank you for your answer, actualy i tried that. But this is not what I want, here is an example:

 bot: write your ideas now, and then click on the button.
 user: random ideas that comes to my mind (I want to take this sentence and set it as a slot called 
 ideasmine, and i want my bot to recognize it as an intent "ideasmine" to follow the story)
 bot: ok your idea is : random ideas that comes to my mind. 

If i do like you said, I’ll use a button with payload: “/ideasmine” but in this case the bot will just understand that this was intent ideasmine but will not asnwer with ok your idea is : random ideas that comes to my mind

 class action_SendIntentProblemeSite(Action):
    def name(self):
    return 'action_SendIntentProblemeSite'
def run(self, dispatcher, tracker, domain):
    message = tracker.latest_message
    #print(message)
    return [SlotSet('intent_probleme_site', message)]

class action_SendIntent_B_S(Action):
def name(self):
    return 'action_SendIntent_B_S'
def run(self, dispatcher, tracker, domain):		
    loc = tracker.get_slot('intent_probleme_site')
    response = """ ok your idea is : {}. """.format(loc['text'])				
    dispatcher.utter_message(response)

hey @chemseddine you use unfeaturized slot

Slot Types

I’ve updated my message to show my actions. I actually want the bot to recognize the user input as intent ideasmine in order to follow the story and not ignore it

so you can define unfeaturized slot in your domain.yml file

If you don’t have any example for your intent, rasa will not be able to recognize it. The only idea that comes to my mind is to add a pop up in your chat with a text field and then when the user press the “Ok” bouton in the pop up, you send the payload.

Slack has a pop up, it’s called dialogs : Interacting with users through dialogs | Slack

I’ll try it, not sure if I explained well my problem. My problem is that the bot don’t have any way to predict that :

 user: random ideas that comes to my mind

is an ideasmine intent, the bot will not know because I don’t know how what this intent will have as input; so I just have an intent called ideasmine but with random things.

Actualy my problem is exactly as @huberrom said. I thought I could use a button and after the user click on it I save the input as slot ideasmine and payload: \ideasmine

You can use a button, but it’ll be the chat job to add the text as the payload, not rasa

and this is done by what you told me? for slack for example I have to use dialogs?

is it easy to do? I’am new to this.

Any examples?

Well using slack you’ll have to use a dialog yes, it’s “easy” to implement but not sure how to do it with Rasa.

I didn’t try the rasa integration with Slack, but I pretty sure it’s not handling dialogs yet.

To my opinion you need to :

I don’t have an example for you sorry, I think it’s going to need a little bit of work to implement it.

Maybe someone has a better solution.

Thank you for the answer. I’ll try to found a way to do it. My stupid solution was to tell the user to begin his message by ideasmine: and then in my intent indeasmine i added ideasmine:

But it’s not good to tell the user to begin his sentence with: …

any way thank you for your answers, thank you also @JiteshGaikwad

Yeah when I started using chatbot, I had the same idea but it’s not the good way to do it

Welcome @chemseddine and thanks to you too @huberrom :wink: