AI-Powered X Thread Generator with Telegram Approval Loop - n8n Workflow

Use this advanced n8n workflow to generate, refine, and publish viral X (Twitter) threads using voice or text input via Telegram, powered by GPT. Features an approval loop.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Content Creators and Social Media Managers needing rapid, high-quality content generation for X (Twitter).

  • Users who prefer managing their publishing queue and iterative content drafting directly within a messaging app like Telegram.

  • n8n experts looking for robust n8n templates demonstrating conversational AI agents (Langchain) and custom JSON parsing.

  • Teams seeking advanced n8n workflow automation that integrates generative AI with a human review process.

Overview

This sophisticated n8n workflow revolutionizes social media content creation by integrating the conversational flexibility of Telegram messaging with the powerful capabilities of GPT. It solves the pain point of time-consuming manual drafting and constant context switching. Users can initiate a post idea simply by sending a text or a voice note, and the AI drafts an optimized, 5-part X thread.

The central innovation is the iterative approval loop, managed by the Langchain memory n8n node, allowing users to request tone, style, or length revisions until the content is perfect. Only upon receiving explicit approval keywords (e.g., 'ok' or 'approved') does the n8n workflow automatically trigger the publishing sequence via the Blotato API, followed by status monitoring and a final confirmation message. This advanced n8n workflow showcases best practices for building interactive, mission-critical AI automation.

How it Works

This high-density n8n automation starts with a Telegram n8n trigger:


  1. Input Capture: The Start: Telegram Message n8n trigger activates upon receiving a message. The flow immediately checks if the input is a voice note. If so, it downloads the file and uses the OpenAI Speech to Text n8n node (Whisper) to transcribe the audio into usable text input.

  2. AI Generation & Refinement: The transcribed or original text is routed to the AI: Draft & Revise Post Langchain Agent n8n node, which uses the OpenAI Chat Model (with powerful system instructions) and the Window Buffer Memory n8n node. This memory is key, allowing the AI to recall previous messages and revisions, enabling an ongoing conversation.

  3. Approval Request: The AI agent proposes a 5-tweet thread and asks for feedback. If no approval is detected, the Check if Approved n8n node directs the flow to the Post Suggestion Or Ask For Approval Telegram n8n node, sending the draft back to the user.

  4. Content Extraction: Once the user approves (e.g., sends 'ok'), the AI returns a strict JSON payload. The Check if Approved n8n node detects this format and passes the data to the custom Approval: Extract Final Post Text Code n8n node, which parses the JSON and extracts the five individual tweet texts.

  5. Publishing & Monitoring: The extracted tweets are published as a thread using the Create post with Blotato n8n node. A Wait n8n node introduces a short delay before the workflow begins polling the post status via the Check post status Blotato n8n node.

  6. Confirmation: A final set of If n8n nodes (Published? and In Progress?) determines if the post is live. If published, the Send a confirmation message Telegram n8n node sends the user the public link, concluding the n8n workflow execution.

Installation Guide

To set up this powerful n8n workflow template, follow these steps:


  1. Import: Copy the provided JSON and import it directly into your n8n instance.

  2. Telegram Credentials: Set up a Telegram API credential, linking the bot token created via @BotFather. This is required for the Start: Telegram Message n8n trigger and all Telegram output nodes.

  3. OpenAI Credentials: Create or select an existing OpenAI API credential. This is required for the Speech to Text (Whisper) and the OpenAI Chat Model (GPT) nodes.

  4. Blotato Credentials: Set up a Blotato API credential to enable automatic publishing to your connected X (Twitter) account.

  5. Configure: In the Create post with Blotato n8n node, ensure the correct platform and Account ID for your X profile are selected.

  6. Customize AI: Review the extensive system prompt in the AI: Draft & Revise Post n8n node to tailor the tone, style, and hashtag rules to match your brand's voice.

  7. Activate: Save and activate the n8n workflow. It is now ready to respond to messages sent to your Telegram bot.

Node Details


  • Start: Telegram Message (Telegram Trigger n8n node): The initial entry point. It monitors the specified Telegram bot for incoming messages, whether text or voice notes.

  • Speech to Text (OpenAI n8n node): A dedicated Langchain node utilizing OpenAI's Whisper model to accurately convert uploaded voice notes into readable text for AI processing.

  • AI: Draft & Revise Post (Langchain Agent n8n node): The core intelligence. This n8n node processes user input and context from the memory n8n node to generate and refine complex 5-part X threads, adhering to strict instructions for conversational flow and final JSON output formatting.

  • Window Buffer Memory (Langchain Memory n8n node): Maintains the chat history (context window length of 10) for the user session, identified by the user's Telegram ID, ensuring the AI can handle iterative feedback.

  • Check if Approved (If n8n node): A critical flow control node that checks the AI's output for the presence of the required final JSON structure, signaling that user approval has been granted.

  • Approval: Extract Final Post Text (Code n8n node): A custom JavaScript n8n node designed to safely strip markdown and surrounding text, parse the {"thread": [...]} JSON, and map the five thread elements into distinct variables for subsequent publishing nodes.

  • Create post with Blotato (Blotato n8n node): Handles the external API integration, taking the five separate tweet texts and submitting them as a single, cohesive thread to be published on the X platform.

Related n8n Workflows

Free

Nodes: 12 Nodes
Updated: December 26 2025
View all
Created by

Featured*