How to Go Viral on TikTok and LinkedIn Using AI Prompts
Most creators think going viral is about luck or posting constantly. I've found it's about systematic prompt engineering—using specific AI instructions to generate content that algorithms love. Last month, a single prompt structure I built in Claude generated a LinkedIn carousel that got over 500,000 impressions. Here’s how to move beyond generic "write a post" prompts and build a repeatable system.
The Anatomy of a Viral Hook: Prompt Engineering for the First 3 Seconds
The algorithm decides your post's fate in the first 3 seconds. Your AI prompts for viral content must engineer this hook, not just the whole post. Generic prompts like "write a catchy intro" fail because they lack platform-specific context.
For TikTok and Reels, the hook must trigger a "scroll-stopping" emotional or intellectual response. I use a multi-variable prompt in a custom n8n workflow that pulls current trending audio IDs and formats the request for Claude's API. Here’s the core structure:
{
"platform": "TikTok",
"content_type": "hook",
"target_emotion": "curiosity",
"topic": "AI automation for freelancers",
"constraints": "Under 5 words. Must pose a question or state an impossible fact. Reference trending audio context ID: {{$json.trending_audio_id}}"
}
This prompt is part of a larger automation that checks trending sounds via the TikTok API, then feeds that context to Claude. The output is never just text; it's a structured JSON with the hook, suggested visual cue (e.g., "on-screen text: 'I automated my job'"), and the first line of the script. For LinkedIn, the hook is different—it's often a bold, contrarian statement or a specific number. My prompt explicitly demands this: "format: '[NUMBER] [CONTROVERSIAL_VERB] about [TOPIC]. Most people get this wrong.'"
This precision turns the AI from a general writer into a platform-specific hook generator. For a deeper dive into building these automations, see my guide on 50 n8n Workflow Templates to Automate Your Agency in 2024.
From Generic to Platform-Specific: Structuring Prompts for TikTok vs. LinkedIn
TikTok and LinkedIn have opposing content DNA. Using the same AI prompts for viral content for both is the fastest way to get mediocre results. TikTok thrives on raw, authentic, fast-paced narrative. LinkedIn rewards polished, insight-packed, value-forward structure.
For TikTok/Reels, I structure prompts to force a problem-solution-agitation story arc within 45 seconds. The prompt specifies timing:
You are a top TikTok creator. Draft a 45-second script on [TOPIC].
- 0-3 sec: Hook (use the hook: {{$input.hook}})
- 3-10 sec: Agitate the problem (show frustration)
- 10-30 sec: Show the solution (visually, with quick cuts)
- 30-45 sec: Call to action (simple, directed to comments)
Format as JSON with `seconds`, `visual_cue`, `spoken_text`.
For LinkedIn, the prompt demands a knowledge-dense framework. Carousels perform best, so the prompt structures content for 10 slides:
Act as a LinkedIn growth strategist. Create a carousel on [TOPIC] titled "{{$input.hook}}".
- Slide 1: Title & hook.
- Slide 2-4: The common mistake/failed approach.
- Slide 5-7: The proven framework/strategy (use diagrams, e.g., "Diagram: 3-Step System").
- Slide 8-9: Concrete example with numbers.
- Slide 10: Question to prompt comments.
Output: An array. Each object contains `slide_number`, `headline` (under 10 words), `body_text` (under 40 words), and `visual_description`.
I run these in n8n with a Google Slides or Canva API integration to auto-generate the visual assets. The key is treating the AI as a content architect, not a writer. You give it the blueprint; it fills in the details with platform-aligned precision.
Building a Content Assembly Line: Automating Post Creation with n8n
Manually copying prompts into ChatGPT is slow and inconsistent. My viral posts come from an n8n workflow that acts as a content assembly line. It chains specific prompts, fetches real-time data, and formats the output for publishing.
- Trigger: Manual or schedule (I run it every Monday).
- Supabase Node: Fetches a content topic from my curated ideas database.
- Claude API Node: Runs the structured LinkedIn carousel prompt (from the previous section).
- Code Node: Formats the output into a clean JSON for Canva.
- Canva API Node: Uses the JSON to populate a template and generate the carousel images.
- Resend Node: Emails the packaged assets (copy + images) to me for final review.
The Claude API call in step 3 is where the magic happens. The configuration in n8n includes the exact system prompt and temperature setting (I use 0.7 for balanced creativity). This workflow turns a one-line topic ("time management for creators") into a nearly finished post in under 2 minutes.
The real power is scaling this. I have separate, parallel workflows for TikTok scripts, YouTube shorts descriptions, and Twitter threads. They all pull from the same topic database in Supabase but use their own tailored prompt chains. This is the system behind the 50 Social Media Growth Workflows for Agencies ($29) product—it’s these exact, exportable n8n workflows.
If you're tired of brainstorming from scratch, I've packaged 100 of these battle-tested prompt structures into Viral Content Prompts: 100 AI Prompts for Social Growth ($19). It includes the exact prompt JSON for hooks, carousels, scripts, and more, ready to plug into your own AI tools. Get it here.
The System: Automating Your Viral Content Pipeline
Manually creating and posting content is a bottleneck. I use n8n workflows to automate the entire pipeline from prompt to published post. Here's a real setup: a workflow triggered by a Google Sheets row (where I batch-write prompt ideas) that calls the Claude API, formats the output, and auto-posts to LinkedIn via their API or to a scheduling tool like Buffer.
The key is structuring your prompt output for automation. When you design a prompt, force it to return structured JSON. This lets n8n parse it cleanly. For example, a viral hook prompt shouldn't just return text; it should return {"hook": "The text", "hashtags": ["#AI", "#Growth"]}. My agency workflow templates include a node that does exactly this, saving 10+ hours a week on content formatting.
// Example n8n Function Node to structure a raw AI response
const items = $input.all();
for (const item of items) { const rawText = item.json.rawClaudeResponse; // Simple parsing logic for a known structure const hookMatch = rawText.match(/Hook:\s*(.+?)\n/); const hashtagMatch = rawText.match(/Hashtags:\s*(.+)/);
newItems.push({ json: { viralHook: hookMatch ? hookMatch[1].trim() : '', hashtags: hashtagMatch ? hashtagMatch[1].trim().split(' ') : [], platform: 'linkedin', readyForPost: true } }); }
return newItems; ```
Tracking What Actually Works
Going viral isn't magic; it's data. I plug my social APIs into a Supabase database to track performance. A simple table logs each post's id, platform, impressions, engagement_rate, and the prompt_id used to create it. This is how you move from guessing to knowing which prompt structures drive real shares.
I calculate a simple Viral Score for each post: (shares * 2) + comments + likes. I then join this data back against my prompts table. After 50 posts, you'll see clear patterns—maybe listicle hooks work 3x better on LinkedIn, while controversy prompts kill it on TikTok. This feedback loop is where the real optimization happens. I spend maybe $5/month on Supabase for this.
-- In Supabase, I run this to find my top-performing prompt types
SELECT
prompt_template_name,
AVG(viral_score) as avg_score,
COUNT(*) as posts_count
FROM
social_posts
WHERE
created_at > NOW() - INTERVAL '30 days'
GROUP BY
prompt_template_name
HAVING
COUNT(*) > 4
ORDER BY
avg_score DESC;
Scaling and Outsourcing the Creative Layer
Once the system runs, you hit a human bottleneck: making the actual videos or graphics. For TikTok and Reels, I don't appear on camera. I use HeyGen or D-ID for AI avatars delivering the script, or CapCut templates with stock footage from Pexels. The AI-generated script from Claude is fed into the video tool via API or a simple CSV upload. Cost per video? About $1-$4.
For LinkedIn carousels, Canva API is your friend. I built an n8n workflow that takes a viral tip list from Claude, formats it into a JSON array, and uses the Canva API to populate a template, generating a downloadable PDF. This turns a 30-minute design task into a 2-minute automated process. The 50 Social Media Growth Workflows product includes this exact Canva automation template.
The Business Model: From Content to Clients
This system isn't just for personal branding. It's a service. I offer "Viral LinkedIn Ghostwriting" for founders at $500/month for 8 posts. My cost? The $19 prompt pack, $29 for the automation workflows, and about 2 hours a month for oversight. The rest is automated. The positioning is easy: "I use proprietary AI systems to guarantee a 20%+ average engagement rate."
For bigger agencies, the play is white-labeling. You can resell these automated content pipelines. Use the Next.js AI Boilerplate to spin up a client portal where they submit topics and get scheduled posts. Charge $299/month per client. The tech stack is Vercel for hosting, Supabase for data, and n8n cloud ($20/month) running the workflows. The margin is insane.
Wrapping Up
Going viral consistently means treating content like a software pipeline: ideate with prompts, automate creation, track performance, and iterate based on data. The tools exist and are affordable; it's about stitching them together into a system that runs without your constant attention.
This approach lets you scale your own presence or productize it as a high-margin service. The hard work is already done in designing the prompts and building the automations—you just need to execute the playbook.
Ready to stop guessing and start scaling? Get the exact prompts and systems I use daily.
Viral Content Prompts: 100 AI Prompts for Social Growth ($19) gives you the proven prompt formulas for hooks, stories, and frameworks that drive shares. Pair it with the 50 Social Media Growth Workflows ($29) to automate the entire process from idea to scheduled post.
Stop creating content manually. Systemize your virality.
Walid Abed
Building AI-operated businesses from Beirut. Creator of Opsonaut.
Recommended
Ready to automate?
Browse workflow templates, prompt packs, and AI kits.
Get weekly automation tips
Join 1,000+ developers and solopreneurs. No spam.
Related Articles
50 AI Prompts Every Business Needs in 2026
50 copy-paste AI prompts that handle marketing, sales, support, and operations — tested across ChatGPT, Claude, and Gemini.
The Developer's Guide to n8n Workflow Templates
Everything about n8n workflow templates — from importing your first template to building and selling your own.
How to Automate Your Entire Business for Under $120/Month
A real cost breakdown: automate sales, support, content, and analytics using free and low-cost tools for under $120/month.