Skip to content

Twitter bot using Encore.ts that automatically posts tweets every hour. Leveraging the power of Google's Gemini AI, the bot generates creative, funny, and sarcastic tweets focused on themes like crypto and coding frustrations.

License

Notifications You must be signed in to change notification settings

TalhaAhsanSh/x-bot-encore.ts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gemini Twitter Bot: Automate Your Tweets with Gemini

Gemini Twitter Bot is an automated solution for posting tweets every hour using dynamic content generated by Google Gemini. This project is built with Encore and integrates seamlessly with the Twitter API using Access Token and Access Token Secret for authentication.

Features

  • Automated Tweets: Post tweets at regular intervals without lifting a finger. Gemini generates tweet content based on trending topics and tailored contexts.
  • Encore-Powered Efficiency: Leveraging Encore’s microservices framework to streamline the development and deployment of the bot.
  • Twitter API Integration: Securely interact with the Twitter API using Access Token and Access Secret for authentication.
  • Dynamic Content Generation: Powered by Google Gemini, ensuring every tweet is fresh, funny, and engaging.

Getting Started

Prerequisites

Run Locally

  1. Create Your Encore App:
encore app create my-twitter-bot --example=gemini-twitter-bot

(Change my-twitter-bot to whatever name suits your project.)

  1. Set Your Gemini API Key:
cd my-twitter-bot
encore secret set GeminiAPIKey --type dev,local,pr,prod

When prompted, paste your Gemini API key.

  1. Add Your Twitter API Credentials:
encore secret set TwitterAPIKey --type dev,local,pr,prod
encore secret set TwitterAPISecret --type dev,local,pr,prod
encore secret set TwitterAccessToken --type dev,local,pr,prod
encore secret set TwitterAccessSecret --type dev,local,pr,prod

Set your Twitter API key, secret, access token, and access token secret.

  1. Run Your Bot:
encore run

Encore will build and start your app, and you can track its local performance via http://localhost:4000.

Deploy to the Cloud

Want to make your bot public? Deploying is simple with Encore:

git push

Encore handles the entire deployment, providing a link to your live app where tweets are posted automatically.

System Overview

This bot is a microservices-based application designed with multiple services working in sync:

  • Twitter Service: Handles Twitter API integration, including posting tweets and retrieving user timelines.
  • Gemini Service: Integrates with Google Gemini to generate creative and contextual content.
  • Scheduler Service: Ensures the bot posts tweets at regular intervals.

Main Flow

  1. Tweet Generation: Every hour, the Scheduler Service triggers the Gemini Service to generate a tweet.
  2. Twitter Authentication: The Twitter Service authenticates using Access Token and Access Token Secret to post tweets.
  3. Post Tweets: Tweets generated by the Gemini Service are published on Twitter via the Twitter Service.
  4. Monitor Success: Check the bot's activity and performance via the Encore Dashboard.

About

Twitter bot using Encore.ts that automatically posts tweets every hour. Leveraging the power of Google's Gemini AI, the bot generates creative, funny, and sarcastic tweets focused on themes like crypto and coding frustrations.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published