Tips > AI & LLM Integration

Implement Content Moderation Before Publishing AI-Generated Content

Never publish AI-generated content directly without a moderation step.

Never publish AI-generated content without a moderation step, because LLMs can hallucinate, produce inappropriate text, or violate brand guidelines. Run a cheap classification call such as gpt-4o-mini before publishing that returns approval, a list of issues, a confidence score, and an optional suggested edit, then route the result to auto-publish, human review, or rejection based on that verdict.

Why moderate AI-generated content before publishing?

Never publish AI-generated content directly without a moderation step. LLMs can hallucinate, generate inappropriate content, or produce text that violates your brand guidelines. A classification call before publishing catches these issues before they reach your audience.

How do you add a moderation step in n8n?

Real-world example: A workflow generates social media posts from blog articles. Before posting to LinkedIn, the content passes through a moderation check.

Workflow structure:

[Generate Post: GPT-4o] → [Moderate: gpt-4o-mini] → [IF: approved] →── yes ──→ [Post to LinkedIn]
                                                                      └── no ──→ [Send to Human Review Queue]

Moderation prompt (gpt-4o-mini):

Review the following social media post for publication. Check for:

1. Factual claims that cannot be verified from the source material
2. Inappropriate language, tone, or controversial statements
3. Brand guideline violations (no competitor mentions, no political topics)
4. Grammar and spelling errors
5. Links or references that appear fabricated

Source article summary: {{ $json.article_summary }}

Generated post: {{ $json.generated_post }}

Return JSON:
{
  "approved": true | false,
  "issues": ["list of issues found, empty if approved"],
  "confidence": 0.0 to 1.0,
  "suggested_edit": "corrected version if issues are minor, null otherwise"
}

Downstream routing logic:

const moderation = JSON.parse($json.message.content);

if (moderation.approved && moderation.confidence > 0.85) {
  // Auto-publish
  return [{ json: { action: 'publish', post: $json.generated_post } }];
} else if (moderation.suggested_edit && moderation.confidence > 0.7) {
  // Use the corrected version but still flag for review
  return [{ json: { action: 'review', post: moderation.suggested_edit, issues: moderation.issues } }];
} else {
  // Send to human review
  return [{ json: { action: 'reject', post: $json.generated_post, issues: moderation.issues } }];
}

Automated moderation adds seconds to your workflow but prevents costly brand-damaging incidents.

How do you make moderation more robust?

Note: Defense in Depth

Combine LLM-based moderation with rule-based checks (regex for prohibited words, length validation, URL verification). No single layer catches everything.

Related: Use Manual Trigger During Development Instead of Webhook or Schedule · Flatten Deeply Nested API Responses

Showcase builds

19 complete workflows from my own projects, each with its n8n workflow JSON to import. Showcase entries link the file at the end of the article.

See the showcase builds

Keep reading

190 entries grouped by topic, from first workflow to queue mode. Free, no signup.

Browse the encyclopedia

Need it built?

I design, build and run n8n systems for clients. Every engagement starts with a $1,500 diagnostic audit, credited toward the build.

Book an introductory call