Use this powerful n8n workflow to automatically fetch your latest YouTube video, generate engaging posts using OpenAI, enforce character limits, and publish directly to X (Twitter).
Download this n8n workflow template and start using it instantly.
Content Creators who regularly publish on YouTube and need efficient social media cross-promotion.
Marketing teams looking for robust, automated social syndication solutions.
Users seeking advanced examples of integrating AI models (OpenAI) within a scheduling n8n workflow.
Anyone interested in leveraging powerful n8n templates for hands-free social media management.
This sophisticated automation solves the problem of manual cross-posting content from YouTube to social platforms. By utilizing this specialized n8n workflow, users ensure their newest YouTube video is detected quickly (running every 2 hours via the schedule n8n trigger) and promoted effectively on X (formerly Twitter).
The core value lies in the integration of the OpenAI n8n node, which dynamically generates witty, character-constrained promotional copy based on the video's title and description. The workflow incorporates a crucial verification loop: if the generated text exceeds the platform's character limit (280 characters), it automatically uses the AI again in a dedicated Rewrite X Post to 220 Characters step until the constraints are met. This ensures every post published by this n8n template is optimized and ready for immediate consumption.
This automation initiates using a time-based n8n trigger, configured to run every two hours, checking for recently published content.
Fetch Latest Videos n8n node queries the specified YouTube Channel ID for recent videos (published within the last 20 hours).Remove Duplicates n8n node prevents the same video from being posted multiple times by checking against previous workflow executions.Generate X Post OpenAI n8n node receives the video metadata (title, description, and URL) and drafts a promotional X post, aiming for under 220 characters.Verify character limit constraints n8n node checks the length. If the character count is too high (over 280 characters), the flow routes to the Rewrite X Post to 220 Characters OpenAI n8n node, which forces regeneration. This output loops back to the verification step until the post is compliant.GS - Add Tweet) with a 'Post written' status.Post to X n8n node.GS - Update Tweet) to include the final status ('Posted to X') and the direct link to the published X post. Optional n8n nodes like Slack or Discord can then send notifications.To set up this powerful n8n workflow, follow these steps:
Check Every 2 Hours n8n trigger to automate execution, or keep the When clicking "Test workflow" node for manual testing.Fetch Latest Videos n8n node. Connect your YouTube OAuth2 account and ensure your specific Channel ID is entered in the filters section (as noted in the associated sticky note).Generate X Post and Rewrite X Post to 220 Characters n8n nodes.GS - Add Tweet and GS - Update Tweet n8n nodes. Specify your desired Spreadsheet Document ID and Sheet Name for logging.Post to X n8n node with your X (Twitter) OAuth2 credentials.Discord, Slack, or Gmail n8n nodes if you wish to receive post notifications. Schedule Trigger (Check Every 2 Hours): The primary n8n trigger, designed to poll for new content every two hours.
YouTube (Fetch Latest Videos): This n8n node uses the 'Video' resource and 'Get Latest' operation, filtered by a specific Channel ID, ensuring only very recent uploads are considered.
Remove Duplicates: A critical core logic flow control n8n node. It deduplicates items based on the videoId, preventing accidental repeated posts across multiple workflow runs.
OpenAI (Generate X Post): Utilizes the gpt-4o-mini model to create compelling, witty social media copy based on video metadata. It explicitly forces JSON output for structured data handling.
If (Verify character limit constraints): A flow control n8n node that checks if the generated post length is greater than 280 characters, initiating the rewrite loop if the constraints are violated.
OpenAI (Rewrite X Post to 220 Characters): This specialized OpenAI n8n node only executes if the character count check fails, forcing the AI to condense the content to meet social media platform limits.
Google Sheets (GS - Add Tweet / GS - Update Tweet): These n8n nodes handle logging. GS - Add Tweet appends the initial draft, and GS - Update Tweet updates the row after the successful post, adding the final post URL.
Twitter (Post to X): The final action n8n node that publishes the completed, character-optimized post to X, completing the primary goal of this n8n workflow.
Streamline your content pipeline with this n8n workflow. Automatically monitor Google Drive for new images, optimize them using TinyPNG, and save the compressed files back to the cloud.

Deploy this powerful n8n workflow to automatically generate personalized training certificates with unique IDs and instantly deliver them to recipients using Gmail. Perfect for educational platforms.

Use this reliable n8n workflow to automatically synchronize metadata for tagged n8n templates and workflows directly into a Notion database for centralized management and governance.

Optimize your self-hosted n8n instance performance by automatically deleting old execution history. This essential n8n workflow uses the internal n8n node to manage database size.








































