X-Bot is a Twitter automation bot that posts promotional tweets using data stored in Firebase, generates text with AI via Groq Cloud, and sends notifications via SMS with the Twilio API.
- Retrieves the current index for the post.
- Fetches product information from Firebase.
- Generates promotional text using Groq Cloud.
- Posts the text on Twitter.
- Updates Firebase with the post status.
- Sends SMS notifications via Twilio.
- Python 3.8+
- Firebase account
- Twilio account
- Groq Cloud account
- Twitter Developer account
- Clone the repository:
git clone https://github.com/devgabrielsborges/X-Bot.git cd X-Bot
- Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # For Linux/MacOS venv\Scripts\activate # For Windows
- Install the dependencies:
pip install -r requirements.txt
- Create a
.env
file in the root directory with the following variables:x_apikey=YOUR_TWITTER_API_KEY x_apisecret=YOUR_TWITTER_API_SECRET x_token=YOUR_TWITTER_ACCESS_TOKEN x_tokensecret=YOUR_TWITTER_ACCESS_TOKEN_SECRET x_bearertoken=YOUR_TWITTER_BEARER_TOKEN twilio_sid=YOUR_TWILIO_SID twilio_token=YOUR_TWILIO_AUTH_TOKEN number_from=YOUR_TWILIO_PHONE_NUMBER number_to=YOUR_PHONE_NUMBER firebase_api_key=YOUR_FIREBASE_API_KEY firebase_db_url=YOUR_FIREBASE_DB_URL
- Ensure the initial index is correctly set in Firebase under
actual_index
. - Run the main script:
python main.py
classes.py
: Contains all auxiliary classes and methods used by the main script.FirebaseAPI
: Class for Firebase operations.TwilioAPI
: Class for Twilio API operations.GroqCloud
: Class for Groq Cloud operations.Product
: Class representing the product and its information.
main.py
: Main script that runs the complete automation.
firebase-admin
: For interacting with Firebase.pytz
: For timezone manipulation.requests
: For HTTP requests.tweepy
: For interacting with the Twitter API.python-dotenv
: For loading environment variables from a.env
file.twilio
: For sending SMS via Twilio.langchain_core
andlangchain_groq
: For integration with Groq Cloud.
This project is licensed under the MIT License. See the LICENSE file for details.
- Fork the project.
- Create a new branch (
git checkout -b feature/new-feature
). - Commit your changes (
git commit -am 'Add new feature'
). - Push to the branch (
git push origin feature/new-feature
). - Create a new Pull Request.
For questions or issues, please open an issue in this repository.