Hello, I am trying to integrate rasa-bot with my android app. Are there any options on how to implement it.
kindly suggest.
NOTE: I am not looking for any 3rd party paid chat/voice platforms.
thanks in advance
Hello, I am trying to integrate rasa-bot with my android app. Are there any options on how to implement it.
kindly suggest.
NOTE: I am not looking for any 3rd party paid chat/voice platforms.
thanks in advance
You would have to build a UI for it, and then connect it to a server running rasa core/nlu somewhere else. The details of this are up to you. You can take a look at how the webchat UI from mr bot is implemented though as an example
Is there any available source code on the web for chat UI in android that might be easily connected to rasa?[quote=âQuresh_Abrar, post:1, topic:2664, full:trueâ] Hello, I am trying to integrate rasa-bot with my android app. Are there any options on how to implement it.
kindly suggest.
NOTE: I am not looking for any 3rd party paid chat/voice platforms.
thanks in advance [/quote]
@abhishek1 did you find a solution to this?
Hello, there I am Dishant. I have tried to integrate and have created a blog on same please have a look at it and if you have any doubts you can add it in the comment box
âRasa Chatbot + Android Covid app Tutorial: Part 1â by Dishant gandhi https://link.medium.com/7jH3pLzbvab
Hey @Horizon733, You have made nice tutorials on how to integrate rasa chatbot as an Android app, it is really helpful, thank you for your tutorials.
I am not a developer, I am just doing small experiments with these technologies for prototyping purpose. I will be integrating the chatbot in one of my apps and wanted to understand, how I can pass the data of the users(email ID and name) who has logged in to the app to rasa and then call relevant apiâs from rasa to perform the requested operations submitted by the user.
Example :
User : Hi
Bot : Greetings
User : I received damaged order
Bot : Sorry to hear that, Ill help you with it. Are you having trouble with the following order?
#Since the user is logged in already, I want to pass his email ID from rasa to its backend, and perform action of fetching his latest order from my api and display the response received from the api as next message.
Can you help me with this, or guide me to a tutorial which resembles similar implementation?
Thank you in advance
You can automatically and secretly send a payload message from the user on startup with the email and username. For example:
sendMessage(user_id = 1, message = "/give_info{'email': 'user@example.com', 'username': 'User1'}")
In your domain, you should set to autofill the email
and username
slots, since youâre sending entities with the payload, and you want to save them in slots.
Extra:
In Dishantâs application, if I remember correctly, the ID of the user is always 1 (maybe 0?). This is not recommended for production as everyone will have the same ID. Usually, every user should have a unique ID.
I built a modified version of Dishantâs app here. Is it not complete and still has some bugs, like for the buttons aways appearing on the bottom of the screen. But it generates a random ID when the app is opened instead of always being 1.
Even better than randomly generating the User ID, you could also set it as being the username, so that the database is more organized and doesnât create a new messenger every time you open the app
Thanks and really glad it helps. To send your data from android to rasa you can add one more key as metadata and then you have to customize your channel file i.e rest.py you can find by clicking here. Also, a beginner tip you should know python and rasa well to start changing channel file as per your need
great work @ChrisRahme I can help you out in android app you build feel free to contact me for that.
I think that force entity extraction doesnât work everytime. I donât know why so I suggest to send extras as metadata because it is easy to fetch and can send whatever we want to
Thanks @Horizon733! I built the application for my Final Project and I only had a few days. So I donât think I will develop it further - for now at least.
As for the force entity extraction, I didnât know it stopped working! Thatâs weird, it is a very useful feature.
have you tested it recently, the force entity extraction?
No I havenât
Thank you So much @ChrisRahme for the help and the modified version for improved operations. I will give it a try and will share the updates. My apologies for the late response.
Hi @Horizon733 , I tried sending the userâs email ID as Chris suggested, but I think I am doing it wrong.
I did the following thing:
private val email_id = "abcd@xyz.com"
In the main app it will be fetched from a the profile data.
fun sendMessage(message: String="/action_receive_email_id{'email_id':'"+email_id+"'}"){
var userMessage = MessageClass()
if(message.isEmpty()){
Toast.makeText(this,"Please type your message",Toast.LENGTH_SHORT).show()
}
else{
userMessage = MessageClass(message,USER)
messageList.add(userMessage)
adapter.notifyDataSetChanged()
}
I have made an action which stores the email ID in email_id
slot , when an email ID is entered in rasa shell.
class ActionHelloWorld(Action):
def name(self) -> Text:
return "action_receive_email_id"
def run(self, dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
text = tracker.latest_message['text']
dispatcher.utter_message(text=f"I'll remember your emial ID {text}")
return [SlotSet("email_id", text)]
Can you help me to send private val email_id = "abcd@xyz.com"
this email ID to rasa from your app(tutorial) without displaying it in the chat, and setting it as a slot(email_id
) value
Thank you
Best 2 ways to do it is as followsđ€:
{
"metadata": {
"email": "email@exmaple.com"
}
}
Thank you so much @Horizon733 for the solution, I would go with option 1.
At the Android end, can I define sender_id as email_id in the retrofit = Retrofit.Builder().baseUrl.....
section?
no not there but in the UserMessage class, do you remember sender variable there you have to add it
I am sorry I forgot to mention that I had referred to YouTube tutorial( Connecting Rasa Chatbot with App 5 parts), So in that tutorial I think different method is used. I just checked the Covid Chatbot tutorial, and it has the UserMessage class. Ill go through that tutorial and try adding the email to sender variable.
Hey @Horizon733, Thank you so much for the guidance. Quick Update, I used the covidApp tutorial and now I am able to pass my desired value as sender_id. Now I am working on setting sender_id as a slot, hoping to find a documentation or a tutorial
yes, building a good one for the community with new tools and something else, canât reveal right nowđ