Skip to main content

Viral video generator: HeyGen to TikTok & Instagram auto-post + any content

Workflow preview

Workflow preview
100%
Viral video generator: HeyGen to TikTok & Instagram auto-post + any content preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

HeyGen AI Video Generation with Social Media Publishing Description This workflow automates the entire process of creating AI generated videos from trending news content and publishing them to soci...

Best for

  • Content Creation automation workflows
  • Multimodal AI automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.scheduletrigger, n8n-nodes-base.perplexity, n8n-nodes-base.openai, n8n-nodes-base.httprequest, n8n-nodes-base.code, n8n-nodes-base.googlesheets, n8n-nodes-base.webhook, n8n-nodes-base.set

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Reddit Dev .

Original n8n.io source

1.1 Workflow description

Title
Viral video generator: HeyGen to TikTok & Instagram auto-post + any content
Workflow name
Viral video generator: HeyGen to TikTok & Instagram auto-post + any content

HeyGen AI Video Generation with Social Media Publishing

Description

This workflow automates the entire process of creating AI-generated videos from trending news content and publishing them to social media platforms (Instagram and TikTok). It runs daily at 6 AM, finds viral-worthy news, generates scripts, creates AI avatar videos using HeyGen, and automatically publishes to multiple social platforms.

How it works

Content Discovery & Script Generation

  1. Schedule Trigger: Runs daily at 6 AM or any time you choose.
  2. Perplexity Search: Finds trending news articles that would make good viral content
  3. Write Video Script: Uses GPT-4.1 to create a 30-second video script with hook, main content, and CTA
  4. Extract URL: Parses the article URL and script data for further processing

Video Creation Pipeline

  1. Get Screenshot: Uses ScreenshotOne API to create an animated scrolling video of the news article
  2. Upload to Cloudinary: Temporarily stores the background video
  3. Write Video Caption: Generates an engaging social media caption (150-200 characters)
  4. Prepare Avatar Data: Combines all data needed for HeyGen video generation
  5. Create Avatar Video: Sends request to HeyGen API to generate AI avatar video with:
    • Talking photo avatar
    • Text-to-speech voice
    • Background video from the news article
    • 720x1280 dimensions (vertical format)

Data Management

  1. Prepare Sheets Data: Formats video metadata
  2. Store to Google Sheets: Saves video_id, caption, timestamp, and status for tracking

Webhook Processing (Asynchronous)

  1. HeyGen Webhook: Receives callback when video generation is complete
  2. Process HeyGen Callback: Extracts video URLs and status from webhook
  3. Get Caption from Sheets: Retrieves the associated caption using video_id
  4. Combine Data: Merges video data with caption

Social Media Publishing

  1. Upload to Blotato: Uploads the completed video to Blotato media service
  2. Extract Blotato URL: Gets the media URL for social posting
  3. Assign Social Media IDs: Sets the account IDs for each platform
  4. INSTAGRAM: Posts video to Instagram with caption
  5. TIKTOK: Posts video to TikTok with caption and appropriate settings

Setup

Prerequisites

  1. API Keys Required:

    • Perplexity API (for news search)
    • OpenAI API (for script and caption generation)
    • ScreenshotOne API (for article screenshots)
    • HeyGen API (for AI video generation)
    • Cloudinary account (for temporary video storage)
    • Blotato API (for social media posting)
    • Google Sheets API (for data tracking)
  2. HeyGen Setup:

    • Create a talking photo avatar and get the talking_photo_id
    • Select a voice and get the voice_id
    • Set up a webhook endpoint in n8n for callbacks
  3. Google Sheets Setup:

    • Create a new Google Sheet
    • Add headers: video_id, caption, timestamp, status
    • Get the sheet ID from the URL
  4. Social Media Setup:

    • Connect Instagram and TikTok accounts to Blotato
    • Get the account IDs for each platform

Configuration Steps

  1. Replace all placeholder values:

    • YOUR_TALKING_PHOTO_ID - HeyGen avatar ID
    • YOUR_VOICE_ID - HeyGen voice ID
    • YOUR_WEBHOOK_URL - Your n8n webhook URL
    • YOUR_GOOGLE_SHEET_ID - Google Sheets document ID
    • YOUR_INSTAGRAM_ACCOUNT_ID - Blotato Instagram account ID
    • YOUR_TIKTOK_ACCOUNT_ID - Blotato TikTok account ID
    • YOUR_CLOUD_NAME - Cloudinary cloud name
    • YOUR_UPLOAD_PRESET - Cloudinary upload preset
  2. Add credentials in n8n:

    • Perplexity API credentials
    • OpenAI API credentials
    • HeyGen API credentials (create custom API credentials with X-Api-Key)
    • Blotato API credentials
    • Google Sheets OAuth2
    • ScreenshotOne API credentials
  3. Configure the webhook:

    • Copy the webhook URL from the "HeyGen Webhook" node
    • Use this URL in the "Create Avatar Video" node's callback_url

Notes

  • The workflow uses a two-part asynchronous process: initial video creation and webhook-based completion
  • Videos are optimized for vertical format (720x1280) for mobile social media
  • The Google Sheet acts as a database to link video IDs with captions
  • All sensitive content (URLs, API keys) should be replaced with your own values
  • Consider content moderation and copyright when selecting news sources
  • Monitor API usage and costs, especially for HeyGen video generation

Customization Options

  • Content Sources: Modify the Perplexity search query to target specific news sources or topics
  • Video Style: Adjust avatar position, scale, and background video settings
  • Voice Settings: Change voice_id, speed, and pitch for different narration styles
  • Publishing Schedule: Modify the Schedule Trigger for different times or frequencies
  • Social Platforms: Add more platforms by duplicating the Blotato posting nodes

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Schedule Daily Trigger

Type / Role
n8n-nodes-base.scheduleTrigger - scheduleTrigger
Config choices
Version 1.2

Block 2 - Perplexity Search

Type / Role
n8n-nodes-base.perplexity - perplexity
Config choices
Version 1

Block 3 - Write Video Script

Type / Role
n8n-nodes-base.openAi - openAi
Config choices
Version 1.1

Block 4 - Get Screenshot

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 5 - Write Video Caption

Type / Role
n8n-nodes-base.openAi - openAi
Config choices
Version 1.1

Block 6 - Extract URL

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 7 - Prepare Avatar Data

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 8 - Create Avatar Video (Optimized)

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 9 - Store to Google Sheets

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.5

Block 10 - Prepare Sheets Data

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 11 - HeyGen Webhook

Type / Role
n8n-nodes-base.webhook - webhook
Config choices
Version 2

Block 12 - Process HeyGen Callback

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 13 - Get Caption from Sheets

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.5

Block 14 - Combine Data

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 15 - Assign Social Media IDs

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 16 - INSTAGRAM

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 17 - TIKTOK

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 18 - Upload to tmpfiles

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 19 - Extract tmpfiles

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 20 - Upload to Blotato

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 21 - Extract Blotato URL

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

3. Summary Table

Workflow Viral video generator: HeyGen to TikTok & Instagram auto-post + any content
Complexity advanced
Nodes 21
Categories Content Creation, Multimodal AI
Author Reddit Dev
Published 17 Jul 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/6084/6084.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Viral video generator: HeyGen to TikTok & Instagram auto-post + any content do?

HeyGen AI Video Generation with Social Media Publishing Description This workflow automates the entire process of creating AI generated videos from trending news content and publishing them to soci...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Content Creation, Multimodal AI use case.