Twitter AI Agent
π€ AI Twitter Agent - A Node.js app using Google's Gemini AI to post tweets via natural language. Demonstrates AI + Twitter API integration for intelligent social media automation. Built for developers interested in AI and API development.
Ask AI about Twitter AI Agent
Powered by Claude Β· Grounded in docs
I know everything about Twitter AI Agent. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
Twitter Ai Agent with Gemini Integration π€
An intelligent Twitter (X) agent powered by Google's Gemini AI that allows you to post tweets using natural language commands. This project demonstrates the integration of AI with social media APIs to create powerful automation tools.
β¨ Features
- Natural Language Processing: Post tweets using everyday language
- AI-Powered: Leverages Google's Gemini 2.0 Flash model
- Real-time Interaction: Command-line interface for seamless interaction
- Secure: Environment-based configuration for sensitive credentials
- Extensible: Built with a modular architecture for easy expansion
π οΈ Tech Stack
- Backend: Node.js, Express
- AI: Google Gemini 2.0 Flash
- APIs: Twitter API v2
- Protocol: Model Context Protocol (MCP)
- Authentication: OAuth 1.0a
π¦ Prerequisites
- Node.js (v16+)
- npm or yarn
- Twitter Developer Account
- Google Cloud Project with Gemini API enabled
Installation
-
Clone the repository
git clone https://github.com/adarshpheonix2810/Twitter-Ai-Agent.git cd Twitter-Ai-Agent -
Install dependencies
# Install server dependencies cd server npm install # Install client dependencies cd ../client npm install -
Set up environment variables
Create a
.envfile in bothclientandserverdirectories:client/.env
GEMINI_API_KEY=your_gemini_api_key_hereserver/.env
TWITTER_API_KEY=your_twitter_api_key TWITTER_API_SECRET=your_twitter_api_secret TWITTER_ACCESS_TOKEN=your_twitter_access_token TWITTER_ACCESS_TOKEN_SECRET=your_twitter_access_token_secret
πββοΈ Running the Application
-
Start the server
cd server node index.js -
In a new terminal, start the client
cd client node index.js -
Start interacting! Type your message in the command line, for example:
Post a tweet saying "Hello from my new AI Twitter agent! #AI #TwitterBot"
π οΈ Project Structure
twitter-ai-agent/
βββ client/ # Client application
β βββ index.js # Main client file
β βββ package.json # Client dependencies
β βββ .env # Client environment variables
βββ server/ # Server application
β βββ index.js # Main server file
β βββ twittertool.js # Twitter API integration
β βββ package.json # Server dependencies
β βββ .env # Server environment variables
βββ .gitignore # Git ignore file
βββ README.md # This file
π Security Considerations
- Never commit your
.envfiles - Keep your API keys secure
- Use environment variables for all sensitive information
- Consider implementing user authentication for production use
π€ Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
π License
Distributed under the MIT License. See LICENSE for more information.
π§ Contact
Your Name - Adarsh Singh
Project Link: https://github.com/adarshpheonix2810/twitter-ai-agent
π Acknowledgments
π Show your support
Give a βοΈ if this project helped you!
