How would I start the chatbot directly with a slot and an action

The users for my chatbot need to go through a list and select the item they want and as soon as they select that item the chatbot has to initiate the conversation regarding that item. For this I need to directly send the item ID in my relevant slot in the chatbot and initiate the relevant action through just a button and without a previous conversation with the bot. How would I go about doing this?

I am making my application on Android if that would make it easier to answer.

1 Like

Hi @LiteralWizard! Welcome :slight_smile:!

We’d need to learn more about your system to best answer:

  • Will your chatbot live within your Android app? In other words, is it your own front-end for the chat?
  • Will you have a single conversation per user or one conversation per item per user? Can a user change which item they are talking about within your bot?

A few things you can think of:

  • If you control the frontend, when a user click on an item, you can start a conversation by passing the itemID directly as an entity. This could be something like /greet{"itemID": "XYZ"}, and if you have a slot called itemID, it would be automatically filled with it.
  • If you have a different conversation per item per user, you can use a different sender_id per user/item pair. For example, the sender_id could be in the format <userID>_<itemID>. In this case, you’d know the itemID from the tracker.sender_id. You can easily pass it as a slot by overriding the action_session_started.
  • Another option is to override the action_session_started in your action server. This would allow you to fetch from your system what’s the latest item this user clicked on (if you store it somewhere).

Hope that helps! Nicolas

Hello @nbeuchat

My chatbot will be connected to the Android app through a webhook but I will be making the front-end myself. So I can control the front-end to some degree yes. Also one user will only have one conversation with the chatbot and if they decide to change the item the last conversation is forgotten. Even in your solution to this particular scenario, where you said I can say greet{"itemID": "XYZ"} I am still having trouble understanding how to send this intent through a button in my Android application. Ideally what I’m looking for is some way where after pressing a button, the itemID slot gets filled and the chatbot immediately performs a specific action, let’s say for example action_describe_item and initiates the actual chatbot conversation with this action.

Thank you so much for your help. I deeply apologize for my lack of knowledge but I am an absolute beginner at Rasa.

Hi @LiteralWizard! No need to apologizes at all :slight_smile: People are here to help each other!

I’m not sure how you’ll send a message to your bot but I suppose you’ll have some webhook you need to send messages from your frontend to. You can simply send a message with the text /greet{"itemID": "XYZ"} to your webhook as if the user had written this (the same way later messages from the user would be sent to your webhook).

Then, when training your bot, you can have all your stories starting with something like:

* greet{"itemID": "XYZ"}
- utter_greet
- action_describe_item
...

By the way, greet was just an example, you can call it whatever you want like select_item_from_list.

Hope this helps! Happy to discuss this further :slight_smile: We had something very similar but through Facebook Messenger.

Cheers Nicolas

Thank you @nbeuchat!

I will try this as soon as I’m able to and mark your reply as a solution when I’m done. But I do feel like this will help me. Rasa can be very confusing at first.

You’re welcome! Hopefully this will work :slight_smile: