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

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]
```text
Moderation prompt (gpt-4o-mini):

```text
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"
}
```text
Downstream routing logic:

```javascript
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 } }];
}
```text
> **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.

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

**Related:** [Use Manual Trigger During Development Instead of Webhook or Schedule](../api-cost-optimization/01-use-manual-trigger-during-development-instead-of-webhook-or-schedule.md) | [Flatten Deeply Nested API Responses](../code-node-mastery/01-flatten-deeply-nested-api-responses.md)

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

191 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 a 20-minute call