whats-gpt-firebase
v1.0.0
Published
This is Simple Node JS app to connect OpenAI GPT with Whatsapp and realtime database
Downloads
3
Readme
Whats-GPT-Firebase
Table of Contents
Installation
- Clone the repository to your local machine:
git clone https://github.com/enghamzasalem/whats-gpt-firebase.git
- Navigate to the project directory:
cd whats-gpt-firebase
- Install the dependencies:
npm install
- Set up Firebase:
- Create a new Firebase project in the Firebase Console. Replace the Firebase configuration values in the .env file with your project's configuration values. Refer to the Firebase documentation for more information on obtaining your project's configuration. Make sure your Firebase project has the Realtime Database enabled.
- Set up OpenAI:
- Obtain an API key from OpenAI. Replace the placeholder OPEN_AI_KEY in the code with your actual OpenAI API key.
Usage
To run the application, use the following command:
node index.js
Once the application is running, you can access it through a web browser or use the provided endpoints http://localhost:3500.
To authenticate with WhatsApp, open your browser and navigate to http://localhost:3500/authenticate/{phoneNumber}/{prompt}
Replace {phoneNumber} with your WhatsApp phone number (including the country code) and {prompt} with the initial message you want to send to the chatbot.
A QR code will be generated, which you need to scan using the WhatsApp app on your phone. Once scanned, you will be authenticated with WhatsApp and ready to start interacting with the chatbot.
You can also use the /submit endpoint with a POST request to authenticate. Pass the phone number and prompt in the request body. The chat history will be stored in Firebase Realtime Database under the /links/test/{chatId} path.
Contributing
Contributions to Whats-GPT-Firebase are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.
License
This project is licensed under the MIT License.
License Attribution: Developer Relations: Hamza Salem