Templates / N8N automated Twitter reply bot workflow

N8N automated Twitter reply bot workflow

Unknown

by Max · 2,030 views · created 2025-09-09 · Lead Nurturing, AI Chatbot

Unknown. This template uses community nodes we can't verify statically. Uses community nodes that can't be verified statically (unverified community packages are off by default in 3.0). Static check, last run 2026-10-19.

Community nodes

These come from third-party npm packages. In n8n 3.0 unverified community packages are off by default (N8N_UNVERIFIED_PACKAGES_ENABLED=false).

Nodes used (19)

MongoDBBasic LLM ChainOpenRouter Chat ModelStructured Output ParserX (Formerly Twitter)Telegram

What it does

N8N Automated Twitter Reply Bot Workflow ============================================ For latest version, check: dziura.online/automation Latest documentation can be find here You must have Apify community node installed before pasting the JSON to your workflow. Overview ------------ This n8n workflow creates an intelligent Twitter/X reply bot that automatically scrapes tweets based on keywords or communities, analyzes them using AI, generates contextually appropriate replies, and posts them while avoiding duplicates. The bot operates on a schedule with intelligent timing and retry mechanisms. Key Features ---------------- Automated tweet scraping from Twitter/X using Apify actors AI-powered reply generation using LLM (Large Language Model) Duplicate prevention via MongoDB storage Smart scheduling with timezone awareness and natural posting patterns Retry mechanism with failure tracking Telegram notifications for status updates Manual trigger option via Telegram command Required Credentials & Setup -------------------------------- 1\. Telegram Bot Create a bot via @BotFather on Telegram Get your Telegram chat ID to receive status messages Credential needed: Telegram account (Bot token) 2\. MongoDB Database Set up a MongoDB database to store replied tweets and prevent duplicates Create a collection (default name: collection\name) Credential needed: MongoDB account (Connection string) Tutorial: MongoDB Connection Guide 3\. Apify Account Sign up at Apify.com Primary actors used: Search Actor: api-ninja/x-twitter-advanced-search - For keyword-based tweet scraping (ID: 0oVSlMlAX47R2EyoP) Community Actor: api-ninja/x-twitter-community-search-post-scraper - For community-based tweet scraping (ID: upbwCMnBATzmzcaNu) Credential needed: Apify account (API token) 4\. OpenRouter (LLM Provider) Sign up at OpenRouter.ai Used for AI-powered tweet analysis and reply generation Model used: x-ai/grok-3 (configurable) Credential needed: OpenRouter account (API key) 5\. Twitter/X API Set up developer account at developer.x.com Note: Free tier limited to ~17 posts per day Credential needed: X account (OAuth2 credentials) Workflow Components ----------------------- Trigger Nodes 1\. Schedule Trigger Purpose: Runs automatically every 20 minutes Smart timing: Only active between 7 AM - 11:59 PM (configurable timezone) Randomization: Built-in probability control (~28% execution chance) to mimic natural posting patterns 2\. Manual Trigger Purpose: Manual execution for testing 3\. Telegram Trigger Purpose: Manual execution via /reply command in Telegram Usage: Send /reply to your bot to trigger the workflow manually Data Processing Flow 1\. MongoDB Query (Find documents) Purpose: Retrieves previously replied tweet IDs to avoid duplicates Collection: collection\name (configure to match your setup) Projection: Only fetches tweet\id field for efficiency 2\. Data Aggregation (Aggregate1) Purpose: Consolidates tweet IDs into a single array for filtering 3\. Keyword/Community Selection (Keyword/Community List) Purpose: Defines search terms and communities Configuration: Edit the JSON to include your keywords and Twitter community IDs Format:{ "keyword\community\list": \ "SaaS", "Entrepreneur", "1488663855127535616" // Community ID (19-digit number) \, "failure": 0 } 4\. Random Selection (Randomized community, keyword) Purpose: Randomly selects one item from the list to ensure variety 5\. Routing Logic (If4) Purpose: Determines whether to use Community search or Keyword search Logic: Uses regex to detect 19-digit community IDs vs keywords Tweet Scraping (Apify Actors) Community Search Actor Actor: api-ninja/x-twitter-community-search-post-scraper Purpose: Scrapes tweets from specific Twitter communities Configuration:{ "communityIds": \"COMMUNITY\ID"\, "numberOfTweets": 40 } Search Actor Actor: api-ninja/x-twitter-advanced-search Purpose: Scrapes tweets based on keywords Configuration:{ "contentLanguage": "en", "engagementMinLikes": 10, "engagementMinReplies":

View the original on n8n.io → Check your own copy

Get the weekly “what broke” email

New templates, newly broken ones, and n8n release changes. One short email a week.

Form not loading? Subscribe here.