Automatic YouTube Video Promotion on X - n8n Workflow

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).

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

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.

Overview

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.

How it Works

This automation initiates using a time-based n8n trigger, configured to run every two hours, checking for recently published content.


  1. Detection and Fetching: The Fetch Latest Videos n8n node queries the specified YouTube Channel ID for recent videos (published within the last 20 hours).

  2. Deduplication: The Remove Duplicates n8n node prevents the same video from being posted multiple times by checking against previous workflow executions.

  3. Content Generation: If new content is found, the 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.

  4. Character Enforcement Loop: The 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.

  5. Logging: Once compliant, the content is logged into Google Sheets (GS - Add Tweet) with a 'Post written' status.

  6. Publishing: The content is published to X via the Post to X n8n node.

  7. Final Update: The Google Sheets entry is updated (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.

Installation Guide

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


  1. Import: Copy the provided n8n workflow JSON data and paste it into your n8n instance's workflow editor using the 'Import from JSON' option.

  2. Trigger Setup: Enable the Check Every 2 Hours n8n trigger to automate execution, or keep the When clicking "Test workflow" node for manual testing.

  3. YouTube Credential Setup: Open the 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).

  4. OpenAI Credential Setup: Connect your OpenAI API key to the Generate X Post and Rewrite X Post to 220 Characters n8n nodes.

  5. Google Sheets Setup: Configure the Google Sheets credentials in the GS - Add Tweet and GS - Update Tweet n8n nodes. Specify your desired Spreadsheet Document ID and Sheet Name for logging.

  6. X Credential Setup: Configure the Post to X n8n node with your X (Twitter) OAuth2 credentials.

  7. Optional Notifications: Configure the Discord, Slack, or Gmail n8n nodes if you wish to receive post notifications.

Node Details

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.

Related n8n Workflows

Free

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

n8n Ambassador & Verified Partner

Featured*