Welcome to the Twitter to Telegram Bot repository! This project is designed to monitor a specific Twitter user's tweets and send real-time notifications to a designated Telegram chat. Built with Node.js, this bot leverages the Twitter API and Telegram Bot API to ensure seamless and efficient communication between platforms.
- Real-Time Monitoring: Continuously monitors tweets from a specified Twitter user.
- Telegram Notifications: Sends instant messages to a Telegram chat whenever a new tweet is posted.
- Robust Logging: Utilizes
tslog
for detailed logging and error handling. - Progress Bar: Includes a CLI progress bar to visually represent the waiting period between checks.
- Environment Variables: Securely manages sensitive data using environment variables.
- Error Handling: Comprehensive error handling and logging for easy debugging.
To get started with the Twitter to Telegram Bot, follow these steps:
-
Clone the repository:
git clone https://github.com/yourusername/twitter-to-telegram-bot.git cd twitter-to-telegram-bot
-
Install dependencies:
npm install
-
Create a
.env
file:TWITTER_BEARER_TOKEN=your_twitter_bearer_token TELEGRAM_BOT_TOKEN=your_telegram_bot_token TELEGRAM_CHAT_ID=your_telegram_chat_id USER_TO_MONITOR=twitter_username_to_monitor
-
Run the bot:
npm start
Ensure you have the following environment variables set in your .env
file:
TWITTER_BEARER_TOKEN
: Your Twitter API Bearer Token.TELEGRAM_BOT_TOKEN
: Your Telegram Bot API Token.TELEGRAM_CHAT_ID
: The Telegram chat ID where notifications will be sent.USER_TO_MONITOR
: The Twitter username of the user to monitor.
After configuring the environment variables and starting the bot, it will:
- Initialize connections to the Twitter and Telegram APIs.
- Send a test message to the specified Telegram chat to confirm successful connection.
- Fetch the latest tweets from the specified Twitter user.
- Send notifications to the Telegram chat whenever new tweets are posted.
- Repeat the process at regular intervals, using a CLI progress bar to show waiting times.
We welcome contributions to the Twitter to Telegram Bot project! If you have suggestions for improvements or new features, feel free to open an issue or submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
This project uses the following libraries and APIs:
- dotenv for managing environment variables.
- twitter-api-sdk for interacting with the Twitter API.
- telegraf for Telegram Bot API integration.
- tslog for logging.
- cli-progress for CLI progress bars. Created & Managed by Ricky Bharti