QuantumBotCore is a scalable backend solution for chat applications, leveraging Firebase's real-time capabilities and Google Cloud Functions. It provides an efficient way to manage and handle chat messages, ensuring smooth and secure communication between users.
- Node.js (v14 or later)
- Firebase CLI (installed globally)
- Install dependencies:
npm install -g firebase-tools- Set up the Firebase project:
firebase login
firebase init- Select
Functions,Firestore, and any other required services. - Choose an existing Firebase project or create a new one.
- Configure Firestore rules and indexes as needed.
To deploy the Cloud Functions, run:
firebase deploy --only functionsThe primary API provided by QuantumBotCore is addMessage, which can be called using Firebase's client SDK or an HTTP request.
To send a new chat message using an HTTP client like Postman, make a POST request to the following URL:
https://us-central1-YOUR_PROJECT_ID.cloudfunctions.net/addMessage
The request body should be in the following format:
{
"message": {
"text": "Hello, this is the text message",
"userId": "chats123"
}
}Set the Content-Type header to application/json.
The function will add the message to the Firestore database and return a success response.