Skip to content

Twitter AI Agent is an advanced Next.js application designed to automate and enhance your Twitter interactions using the power of AI. By integrating with the Twitter API and Google Generative AI, this project enables seamless automation of various Twitter activities, including posting tweets, etc

Notifications You must be signed in to change notification settings

emmytwinchimdiebere/TweetAiagent

Repository files navigation

Project Description

Twitter AI Agent

Twitter AI Agent is an advanced Next.js application designed to automate and enhance your Twitter interactions using the power of AI. By integrating with the Twitter API and Google Generative AI, this project enables seamless automation of various Twitter activities, including posting tweets, replying to mentions, analyzing sentiment, monitoring trends, and more. The application leverages cron jobs to schedule these tasks at regular intervals, ensuring consistent and timely engagement with your audience.

Key Features

  • Automated Tweet Posting: Generate and post creative tweets about specific topics, enriched with emojis to express sentiments.
  • Mention Handling: Fetch recent mentions, analyze their sentiment, and reply appropriately to maintain engagement with your followers.
  • Trend Monitoring: Fetch trending topics relevant to technology, AI, DAO, Blockchain, and Crypto, and post tweets using these trends to stay current.
  • Follower Analysis: Analyze follower growth and engagement to understand your audience better and tailor your content strategy.
  • Poll Posting: Post engaging polls at scheduled times to interact with your followers and gather their opinions on various topics.
  • Tweet Searching: Search for tweets based on specific keywords and process them by liking and replying based on sentiment analysis.
  • Tweet Liking and Replying: Automatically like and reply to tweets based on their sentiment, enhancing your interaction with the Twitter community.

Why Use Twitter AI Agent?

Twitter AI Agent is designed for individuals and organizations looking to automate their Twitter presence while maintaining a high level of engagement and relevance. By leveraging AI and automation, you can ensure that your Twitter account remains active, responsive, and aligned with the latest trends without manual intervention. This project is ideal for social media managers, digital marketers, influencers, and anyone looking to optimize their Twitter strategy with minimal effort.

How It Works

  1. Environment Variables: Securely manage API keys and tokens using environment variables stored in a .env.local file.
  2. Cron Jobs: Schedule tasks such as posting tweets, replying to mentions, and monitoring trends at regular intervals using cron jobs.
  3. AI Integration: Utilize Google Generative AI to generate creative tweets, analyze sentiment, and perform other AI-driven tasks.
  4. Twitter API: Interact with Twitter's services to post tweets, fetch mentions, search for tweets, and more.

Getting Started

To get started with Twitter AI Agent, follow the installation and usage instructions provided in the README.md file. Ensure you have the necessary API keys and tokens from your Twitter Developer account and Google API.

Twitter AI Agent is your ultimate tool for automating and enhancing your Twitter presence with the power of AI. Stay engaged, relevant, and responsive with minimal effort, and let AI handle the rest!

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

  1. Clone the repository:

    git clone https://github.com/yourusername/twitter-ai-agent.git
    cd 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 of your project and add the following environment variables:

    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 the placeholder values with your actual API keys and tokens.

Usage

  1. Start the development server:

    Using npm:

    npm run dev

    Using yarn:

    yarn dev

    The application will be available at http://localhost:3000.

  2. Access environment variables:

    In your Next.js components or API routes, you can access the environment variables using process.env. For example:

    const twitterApiKey = process.env.NEXT_PUBLIC_TWITTER_API_KEY;

Project Structure


CDPTOOLKit/
├── public/                 # Static assets
├── src/                    # Source files
│   ├── app/                # Next.js app directory
│   │   ├── api/            # API routes
│   │   └── ...             # Other app-specific files
│   ├── components/         # React components
│   ├── lib/                # Utility functions and libraries
│   └── ...                 # Other source files
├── .env.local              # Environment variables
├── .gitignore              # Git ignore file
├── next.config.js          # Next.js configuration
├── package.json            # Project metadata and dependencies
└── README.md               # Project documentation           # Project documentation

API Integration

Twitter API

The application uses the Twitter API to interact with Twitter's services. Ensure you have the following credentials from your Twitter Developer account:

  • API Key
  • API Secret Key
  • Access Token
  • Access Token Secret

Google API

If your application requires integration with Google services, ensure you have the Google API Key.

Security

  • Environment Variables: Store sensitive information such as API keys and tokens in the .env.local file. This file should be added to [.gitignore]/Desktop/cdptoolkit/.gitignore" to prevent it from being committed to version control.
  • Rate Limiting: Be mindful of Twitter API rate limits to avoid being blocked.

Contributing

Contributions are welcome! Please follow these steps to contribute:

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

License

This project is licensed under the MIT License. See the LICENSE file for more details.

Contact

For any questions or feedback, please contact [email protected].


Thank you for using Twitter AI Agent! We hope it helps you automate your Twitter interactions effectively.

About

Twitter AI Agent is an advanced Next.js application designed to automate and enhance your Twitter interactions using the power of AI. By integrating with the Twitter API and Google Generative AI, this project enables seamless automation of various Twitter activities, including posting tweets, etc

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published