chat-sdk-android
chat-sdk-android copied to clipboard
Develop chatbot using ChatSDK
How can a chatbot be developed using this chat SDK? I have a project where I don't need user authentication, but just need the UI of a chat that should populate the chat view according to the user's responses. I have the JSON format chat tree, but I just want to tweak the SDK so that this functionality is achieved. Are there any documentation I can follow from people who have already achieved this? Looking to quickly prototype one Thanks
@KhyatiMehta3 in this case, I don't know if I would use Chat SDK. The SDK has a lot of things you don't need and achieving what you need, would be more complex as a result. You may be better off using something like this: https://github.com/stfalcon-studio/ChatKit
Well I chose chat SDK because it has a lot of options for my application when I want to scale it up. Currently however, I'm only looking to implement a chat bot. Thanks for your reference! I'll take a look at it and get back here! If currently there's a way of making a chat bot using this SDK, I'd really like to implement that..
Hi @KhyatiMehta3 if you are planning to also include messaging features in your app then you could use it. From what you said, I thought you just wanted a chat view where the user could talk to the bot. If you want to get the Chat SDK running with a bot using Firebase it's not too difficult.
First you would need to set up the Chat SDK on your Firebase account. In that process you will setup Firebase functions and upload a script. If you add an extra function to that script like this:
exports.messageListener = functions.database.ref('{rootPath}/threads/{threadId}/messages/{messageId}').onCreate((messageSnapshot, context) => {
let messageValue = messageSnapshot.val();
// Here you can access the message your user sent.
// Process message
// Send reply
});
This is a message listener which will be called whenever a message is added.
You would just process that message and send a reply. To send a reply, you can study the message structure in the Firebase Console. You'll see that a message is composed of JSON. You would need to write appropriate JSON to the thread to reply to your user.
@bensmiley Thanks a lot! @HarshitaSahai can you also take a look at this?