Is there any way to create a menu based chatbot for whatsapp using RASA

Hii @SamS, I need to create a chatbot for whatsapp using menu based approach i.e. User should only interact with the bot using numbers. Ex:

Bot:

For information regarding product select one of the following options:

  1. XYZ
  2. qwer
  3. some_option

User: 1

BOT: For XYZ product select from following options:

  1. Option1
  2. OPtion2
  3. Option3

User: 2

what is the best possible way to achieve this type of usecase using RASA? Thanks in advance.

Hey @ojas, I think your use case could be covered nicely by using buttons. If you don’t want the user to press buttons and really have them write only numbers, then that could be done too (in that case, you’ll have to create a custom action for this). Let me know if you have more specific questions.

1 Like

@SamS thanks for the reply!

Since i need to create this bot for whatsapp, so buttons can’t be used. I have multiple user stories that i have to implement on whatsapp. Since user interaction can will only be done through numbers i.e. 1,2,… . So how can intent parsing be done and implemented.

I think you’ll want to group all those numerical user messages under 1 intent; possibly extracting the number itself as an entity, and then from within your custom action conditioning on the value of the extracted entity.

2 Likes

@SamS you mean something like this:

intent: number_input

Yeah, for example :slightly_smiling_face:

Hello @ojas Can you help me, how did you solve that problem

Hey @NikoAP77 I have been working on same. I am using a different approach to solve this. As of now i have not defined any numbered intent in my nlu.

I have introduced a flask layer between whatsapp and my rasa server.

In my flask, i have basically mapped my actual intents to the numbers. Something like this:

Intent = {‘1’ : {‘option’ : ‘option1’, ‘payload’:‘payload1’}, ‘2’ : {‘option’ : ‘option2’, ‘payload’:‘payload2’}}

So basically my flask layer sends the actual intent( i.e. payload) based on what user inputs as 1 or 2

1 Like

@ojas I am also working on a similar kind of project, Is it working fine for you? Will it work if I start the conversation with the bot instead of passing numeric input?

Hey @ojas could you elaborate on this a bit?

Yes @Nik720, it is working fine for me. It depends on you how you start the conversation and pass the payload accordingly. Since I have already defined all my intents in rasa, I am using flask only for mapping the Number(1,2,3…) correctly to the payload. It’s like:
1: Topic 1
2: Topic 2

So, my flask would handle that on receiving ‘1’ as input what message or payload will it send to rasa. Something like : {sender: user1, message: topic_1}. Here ‘topic_1’ is the intent examples on which i have trained my model.

@Nims007 Please read the above reply!

Hi @ojas I had some questions about the flask layer, would solve a ton of problems for me personally. Is there anyway I can get in touch with you, via discord or anything else? It would be extremely helpful.

@Nims007 ya sure…on linkedin we can.

@ojas may I have your ID?

@Nims007 I have sent you connection request.

btw it’s https://www.linkedin.com/in/ojasagrawal0808/

@ojas I’ve sent you a dm on LinkedIn.

Hello everyone :slightly_smiling_face: Based on the @SamS proposal, I’ve made a small example bot that I hope will help you solve this challenge :raised_hands: Let me know if it was useful to you. Link to the repository.

2 Likes

Hello Derguene

I’ve checked your project on Rasa Whatsapp bot. One thing, I didnt understand is when you type Hello!, it replied with a numbered chat and later you selected 1 and it replied about PyTorch. But it also works without saying Hello!, you can directly enter the number.

How can I get into a continuous response till that branch is closed. For example, I said Hello and I chose option1, later under that few more options will be displayed. And I’ll select that…this leads to a branch…

Hello @NGarakapati,

You’re right, it also works when you put a number directly without going through Hello. On the other hand, it would be random since the user is not supposed to know the options available at the start of the conversation. The greeting message thus makes it possible to display the supported menu.

Ow, interesting. Do you mean taking into account submenus and where an option will depend on the submenu in question !? :thinking: I have implemented single-level management. For example, if you select PyTorch (option 1), it displays a sub-menu with the version choice. From there, you can make your choice (always with numbers) and it directs you to the corresponding branch.