of course it's possible...
You need to choose a communication system with your server(s)... it can be :
- direct access to DB (security risk, not a good idea)
- webservice (REST)
- sockets
-...
and then when a user press send, you send to the server, and on a timer you read on the server since last read
And that's it, you have a chat system...
Of course, scalability needs to be considered from the start and the devil WILL be in the details...
As for a chatbot, of course it's possible too... it is very basic logic that you can implement easily. Now, don't take MY word for it as I have never implemented such a system myself, but I remember a conversation I had with Fabrice a few years back on the subject and suddenly the whole thing came to life in my mind like it was nothing...