Skip to content

g0drlc/Eliza-Twitter-AI-Agent

Repository files navigation

🚀 Twitter AI Agent

Twitter AI Agent is a cutting-edge Next.js application designed to automate and enhance your Twitter interactions using the power of AI. By seamlessly integrating the Twitter API with Google Generative AI, this app enables powerful automation for tweeting, replying, sentiment analysis, trend monitoring, and more. With cron jobs ensuring regular execution, the app ensures you stay connected and engaged with your audience 24/7. 🌟


🌟 Key Features

  • 🐦 Automated Tweet Posting: Generate and post creative tweets enriched with emojis for engagement.
  • 💬 Smart Mention Handling: Analyze and reply to mentions with sentiment-aware responses.
  • 🔥 Trend Monitoring: Stay relevant by posting about trending topics in AI, Blockchain, and Crypto.
  • 📊 Follower Analysis: Track follower growth and engagement to refine your content strategy.
  • 🗳️ Poll Posting: Post interactive polls to gather opinions from your audience.
  • 🔍 Tweet Searching: Search tweets by keywords, like them, and reply based on sentiment analysis.
  • ❤️ Auto Like & Reply: Engage with the Twitter community by liking and replying to relevant tweets.

Why Use Twitter AI Agent?

Twitter AI Agent is perfect for individuals or organizations looking to:

  • Automate their Twitter activity with minimal manual effort.
  • Maintain high engagement and relevance in their niche.
  • Leverage AI to create impactful and timely Twitter interactions.

Whether you're a social media manager, influencer, or a tech-savvy professional, this tool is your ultimate assistant for optimizing Twitter strategies. 🚀


🛠️ How It Works

  1. 🔐 Environment Setup: Manage sensitive API keys and tokens securely with .env.local.
  2. ⏱️ Scheduled Tasks: Automate tweets, replies, and trend monitoring using cron jobs.
  3. 🤖 AI Integration: Generate tweets and analyze sentiment with Google Generative AI.
  4. 🐦 Twitter API: Post tweets, fetch mentions, and monitor trends directly through the Twitter API.

🚀 Getting Started

Prerequisites

  • ✅ Node.js (v14.x or later)
  • ✅ npm (v6.x or later) or yarn (v1.x or later)
  • ✅ Twitter Developer Account with API keys and tokens

Installation Steps

  1. Clone the Repository:

    git clone https://github.com/g0drlc/Eliza-Twitter-AI-Agent.git
    cd Eliza-Twitter-AI-Agent
  2. Install Dependencies:
    Using npm:

    npm install

    Using yarn:

    yarn install
  3. Set Up Environment Variables:
    Create a .env.local file in the root directory and add:

    NEXT_PUBLIC_GOOGLE_API_KEY=your-google-api-key
    NEXT_PUBLIC_TWITTER_API_KEY=your-twitter-api-key
    NEXT_PUBLIC_TWITTER_API_SECRET=your-twitter-api-secret
    NEXT_PUBLIC_TWITTER_ACCESS_TOKEN=your-twitter-access-token
    NEXT_PUBLIC_TWITTER_ACCESS_TOKEN_SECRET=your-twitter-access-token-secret

    Replace placeholders with your actual keys and tokens.

  4. Run the Development Server:
    Using npm:

    npm run dev

    Using yarn:

    yarn dev

    The app will be accessible at http://localhost:3000.


📂 Project Structure

twitter-ai-agent/
├── public/                 # Static assets
├── src/                    # Source files
│   ├── app/                # Next.js app directory
│   ├── components/         # Reusable React components
│   ├── lib/                # Utility functions and libraries
│   └── ...                 # Other source files
├── .env.local              # Environment variables
├── package.json            # Project dependencies
└── README.md               # Project documentation

🔗 API Integrations

  • Twitter API: Post tweets, fetch mentions, and monitor trends effortlessly.
  • Google Generative AI: Generate engaging content and perform sentiment analysis.

🔒 Security Best Practices

  • Store all API keys and tokens in the .env.local file and add it to .gitignore.
  • Monitor API usage to avoid exceeding Twitter’s rate limits.

🛡️ Testing and Deployment

  • 🧪 Testing: Conduct local testing to ensure smooth operation.
  • 🚀 Deployment: Use platforms like Vercel or Fleek for hosting.

🤝 Contributing

We welcome contributions! To contribute:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature-branch).
  3. Commit your changes (git commit -m "Add feature").
  4. Push to your branch (git push origin feature-branch).
  5. Submit a pull request for review.

📧 Contact

For questions or feedback, feel free to reach out on Telegram: @g0drlc.