n8nflow.net logo
By n8nflow TeamJuly 10, 202514 min read

AI Content Creation Pipeline with n8n: From Idea to Published Automatically

Build an end-to-end AI content creation pipeline with n8n. Automate research, writing, editing, image generation, and publishing across blogs, social media, and newsletters.

AI Content Creation Pipeline with n8n: From Idea to Published Automatically

AI Content Creation Pipeline with n8n: From Idea to Published

Content creation is the fuel of modern marketing, but it's also one of the most time-consuming activities. With n8n and AI, you can build a pipeline that handles research, drafting, editing, image creation, and publishing — with humans in the loop where it matters.

The AI Content Pipeline Architecture

Idea Sources → Research → Draft → Review → Media → Publish → Distribute
     ↓            ↓         ↓       ↓        ↓       ↓          ↓
  Google Trends  RSS    GPT-4   Human   DALL-E  WordPress   Social
  Competitors    APIs   Claude  Editor   Canva   Webflow     Email
  Keywords       News   Gemini  Team     Stock   CMS API     RSS
  FAQs           Data   Mixtral          Midjourney           Push

Phase 1: Content Ideation and Research

Automated Topic Discovery

// Multi-source topic discovery
const sources = {
  googleTrends: await fetchTrendingTopics('n8n automation'),
  competitorBlogs: await scrapeRSSFeeds(competitorFeeds),
  keywordResearch: await analyzeKeywords(seedKeywords),
  communityQuestions: await fetchFromReddit('r/n8n'),
  internalData: await getFAQAndSupportTopics()
};

// AI merges and scores topics
const topics = await ai.analyze({
  prompt: "Score these content ideas by: search volume, competition, relevance, uniqueness",
  data: sources
});

// Select top topics for the week
const weeklyPlan = topics
  .sort((a, b) => b.score - a.score)
  .slice(0, 7); // 1 topic per day

// Save to content calendar
await saveToContentCalendar(weeklyPlan);

Automated Research Brief

// Generate research brief for a topic
const topic = $input.item.json.topic;

// 1. Search for existing content
const searchResults = await searchWeb(topic);
const competitorArticles = await fetchCompetitorContent(topic);

// 2. Extract key statistics and quotes
const keyStats = await ai.extract({
  articles: searchResults,
  extract: 'statistics, quotes, data points, case studies'
});

// 3. Generate research brief
const brief = await ai.generate({
  prompt: `Create a research brief for an article about "${topic}"

Include:
- Target keywords (primary, secondary, long-tail)
- Search intent (informational, commercial, transactional)
- Content angle (what's missing from existing articles)
- Key points to cover
- Statistics and data to include
- Suggested title variations
- Target word count
- Competitor content gaps to exploit`,
  context: { searchResults, competitorArticles, keyStats }
});

return brief;

Phase 2: AI-Assisted Writing

First Draft Generation

// Generate first draft with AI
const brief = $input.item.json.brief;

const draft = await ai.generate({
  model: 'claude-3.5-sonnet', // Or GPT-4o
  system: `You are an expert content writer specializing in workflow automation and n8n.
Write in a clear, educational style with practical examples.
Use markdown formatting for headings, code blocks, and lists.`,
  
  prompt: `Write a comprehensive article based on this brief:

Title: ${brief.title}
Keywords: ${brief.keywords.join(', ')}
Target Length: ${brief.targetLength} words

Outline:
${brief.outline.map((section, i) => `${i+1}. ${section}`).join('\n')}

Include:
- ${brief.keyPoints.length} key points: ${brief.keyPoints.join('; ')}
- Practical code examples where relevant
- Internal links to related content
- Clear section headings and subheadings`,
  
  temperature: 0.7,
  max_tokens: brief.targetLength * 1.5
});

// Save draft
await saveDraft({
  title: brief.title,
  content: draft,
  keywords: brief.keywords,
  status: 'draft',
  created: new Date().toISOString()
});

SEO Optimization

// Optimize draft for SEO
const draft = $input.item.json;

const seoCheck = await ai.analyze({
  prompt: `Analyze this article for SEO and suggest improvements:

Current title: "${draft.title}"
Current meta description: "${draft.metaDescription}"

Check and suggest fixes for:
1. Title optimization (should include primary keyword, 50-60 chars)
2. Meta description (should include primary keyword, 150-160 chars)
3. Heading structure (H1, H2, H3 hierarchy)
4. Keyword density (primary keyword in first 100 words)
5. Internal linking opportunities
6. Image alt text suggestions
7. Readability improvements`,
  
  article: draft.content
});

return {
  ...draft,
  seo_suggestions: seoCheck.suggestions,
  optimized_title: seoCheck.title,
  optimized_description: seoCheck.description
};

Phase 3: Human Review Pipeline

Smart Review Routing

// Route draft to appropriate reviewer
const draft = $input.item.json;

// Determine review level
const needsDeepReview = 
  draft.seo_suggestions.length > 5 ||
  draft.wordCount > 2000 ||
  draft.category === 'technical';

// Assign reviewer
const reviewer = needsDeepReview
  ? await getSeniorEditor()
  : await getAvailableEditor();

// Send for review with context
await sendReviewRequest({
  to: reviewer,
  title: draft.title,
  content: draft.content,
  seo_suggestions: draft.seo_suggestions,
  due_in: needsDeepReview ? 48 : 24, // hours
  action: {
    approve: { next: 'publish' },
    revise: { next: 'rewrite', notes: 'required' },
    reject: { next: 'archive' }
  }
});

Phase 4: Media Generation

AI Image Creation

// Generate featured image and inline graphics
const article = $input.item.json;

// Generate featured image
const featuredImage = await dalle.generate({
  prompt: `Professional blog header image for an article about: ${article.title}
Style: Clean, modern tech aesthetic, blue/green color scheme
Aspect ratio: 16:9 (1200x630)
No text in the image`,
  size: '1792x1024',
  quality: 'hd'
});

// Generate diagram if article includes technical concepts
if (article.hasArchitectureDiagram) {
  const diagram = await generateArchitectureDiagram(article.keyConcepts);
}

return {
  ...article,
  images: {
    featured: featuredImage.url,
    diagram: diagram?.url,
    alt_text: ai.generateAltText(featuredImage, article.title)
  }
};

Phase 5: Publishing and Distribution

Multi-Platform Publishing

// Publish to all platforms
const article = $input.item.json;

const publishTargets = {
  wordpress: async () => {
    return await wordpress.createPost({
      title: article.title,
      content: article.content_html,
      status: 'publish',
      categories: article.categories,
      tags: article.tags,
      featured_media: article.featured_image_id,
      meta: {
        _yoast_wpseo_title: article.seo_title,
        _yoast_wpseo_metadesc: article.seo_description
      }
    });
  },
  
  ghost: async () => {
    return await ghost.createPost({
      title: article.title,
      html: article.content_html,
      status: 'published',
      tags: article.tags,
      feature_image: article.featured_image_url,
      meta_title: article.seo_title,
      meta_description: article.seo_description
    });
  },
  
  webflow: async () => {
    return await webflow.createItem('blog-posts', {
      name: article.title,
      slug: article.slug,
      'post-body': article.content_html,
      'featured-image': article.featured_image_url,
      'seo-title': article.seo_title,
      'seo-description': article.seo_description
    });
  }
};

// Publish to configured platforms
const results = {};
for (const [platform, publishFn] of Object.entries(publishTargets)) {
  try {
    results[platform] = await publishFn();
  } catch (error) {
    console.error(`Failed to publish to ${platform}:`, error);
    results[platform] = { error: error.message };
  }
}

Social Distribution

// Distribute across social channels
const article = $input.item.json;

// Generate platform-specific posts
const socialPosts = {
  twitter: await ai.generate({
    prompt: `Create a 5-tweet thread promoting this article. Include key insights and a call to action. Article: ${article.title}. URL: ${article.url}`
  }),
  linkedin: await ai.generate({
    prompt: `Write a LinkedIn post promoting this article. Professional tone, share personal insight, include 3 key takeaways. Article: ${article.title}. URL: ${article.url}`
  })
};

// Schedule posts
await buffer.createPost({
  text: socialPosts.twitter[0],
  url: article.url,
  scheduled_at: article.publish_time // Immediate
});

await buffer.createPost({
  text: socialPosts.linkedin,
  url: article.url,
  scheduled_at: tomorrowAt(9) // Tomorrow 9 AM
});

Measuring Success

// Track content performance
const article = $input.item.json;

const metrics = {
  publishing: {
    time_to_publish: article.published_at - article.created_at,
    human_review_time: article.review_completed_at - article.review_started_at,
    ai_generation_time: article.draft_completed_at - article.generation_started_at
  },
  engagement: {
    pageviews: await analytics.getPageviews(article.slug, '7d'),
    avg_time_on_page: await analytics.getAvgTime(article.slug),
    bounce_rate: await analytics.getBounceRate(article.slug),
    social_shares: await countSocialShares(article.url),
    backlinks: await countBacklinks(article.url, '30d')
  },
  seo: {
    keyword_rankings: await getKeywordRankings(article.keywords),
    organic_traffic: await analytics.getOrganicTraffic(article.slug, '30d'),
    click_through_rate: await getGSCCTR(article.slug, '30d')
  }
};

// Alert on top performers
if (metrics.engagement.pageviews > 5000) {
  await notifyTeam(`🔥 "${article.title}" hit 5K+ views!`);
}

Complete Pipeline Cost

ComponentToolCost/Month
Topic researchCustom + GPT-4o-mini~$2
Draft generationClaude 3.5 Sonnet~$15 (30 posts)
SEO optimizationGPT-4o-mini~$1
Image generationDALL-E 3~$8 (30 images)
PublishingWordPress/Webflow APIFree
Social distributionBuffer APIFree (n8n integration)
AnalyticsGoogle Analytics APIFree
Total~$26/month for 30 posts

Compare to hiring a content writer: $2,000-5,000/month for equivalent output.

Browse our Content Creation workflow templates and AI automation solutions for pre-built content pipelines.

Share this article

Help others discover n8n automation tips and tricks

Related Articles