Skip to main content

Generate knowledge base articles with GPT & Perplexity AI for Contentful CMS

Workflow preview

Workflow preview
100%
Generate knowledge base articles with GPT & Perplexity AI for Contentful CMS preview
Open on n8n.io

Important notice

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

1. Workflow Overview

Workflow: Auto Knowledge Base Article Generator About the Creators This workflow was created by Varritech Technologies, an innovative agency that leverages AI to engineer...

Best for

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

Tools used

n8n-nodes-base.httprequest, @n8n/n8n-nodes-langchain.agent, @n8n/n8n-nodes-langchain.lmchatopenai, @n8n/n8n-nodes-langchain.toolworkflow, @n8n/n8n-nodes-langchain.chattrigger, n8n-nodes-base.code, n8n-nodes-base.merge, 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 Varritech.

Original n8n.io source

1.1 Workflow description

Title
Generate knowledge base articles with GPT & Perplexity AI for Contentful CMS
Workflow name
Generate knowledge base articles with GPT & Perplexity AI for Contentful CMS

Workflow: Auto Knowledge Base Article Generator

⚑ About the Creators

This workflow was created by Varritech Technologies, an innovative agency that leverages AI to engineer, design, and deliver software development projects 500% faster than traditional agencies. Based in New York City, we specialize in custom software development, web applications, and digital transformation solutions. If you need assistance implementing this workflow or have questions about content management solutions, please reach out to our team.

πŸ—οΈ Architecture Overview

This workflow automates the end-to-end creation of a structured knowledge-base article from a simple chat prompt:

  1. Chat Trigger β†’ Receives user request
  2. AI Drafting Loop β†’ Generates & refines JSON article via AI agents
  3. Perplexity Research Call β†’ Deep-dive content generation
  4. Editorial Loop β†’ Up to 3 AI-driven revisions
  5. Contentful Publish β†’ Pushes final JSON into CMS

πŸ“¦ Node-by-Node Breakdown

flowchart LR
  A[Webhook: Chat Trigger] --> B[AI Writer Agent]
  B --> C[HTTP Request: Perplexity Content]
  C --> D[Function: Format Output & Citations]
  D --> E[Loop Start: Initialize Count]
  E --> F[AI Editor Agent]
  F --> G{action == "rewrite"?}
  G -- yes --> H[Function: Merge Improvements]
  H --> I[Increment Count] --> F
  G -- no --> J[Stop Loop]
  J --> K[HTTP Request: Publish to Contentful]

Webhook: Chat Trigger

Type: HTTP Webhook (POST /webhook/knowledge-article)

Payload:

{ 
	"chatInput": "What topics should I write about?" 
}

Purpose: Kicks off the workflow on that chat prompt.

AI Writer Agent

Inputs: chatInput or existing article JSON

Outputs:

{
  "title": "...",
  "slug": "...",
  "category.id": "...",
  "description": "...",
  "keywords": [...],
  "content": "...",
  "metaTitle": "...",
  "metaDescription": "...",
  "readingTime": 5,
  "difficulty": "intermediate"
}

Purpose: Generates the article skeleton (metadata + initial content).

HTTP Request: Perplexity Content

Method: POST

URL: https://api.perplexity.ai/research

Body:

{
  "model": "sonar-deep-research",
  "query": "{{ $json.title }}",
  "length": 1000
}

Purpose: Retrieves a long-form, deeply researched draft for the article body.

Function: Format Output & Citations

Logic:

  • Parse raw Perplexity response
  • Extract source URIs
  • Append them under a sources markdown list

Editorial Loop

  1. Initialize Counter to 0
  2. AI Editor Agent
    • Reads draft JSON
    • Returns either:
      • action: "rewrite" + improvements: [...]
      • or action: "submit"
  3. Merge Improvements (if rewriting)
    • Applies suggested updates to JSON fields
  4. Limit Check
    • Stops after 3 iterations or on "submit"

HTTP Request: Publish to Contentful

Method: PUT

URL: https://cdn.contentful.com/spaces/{space}/environments/master/entries/{entryId}

Headers:

  • Authorization: Bearer <token>
  • Content-Type: application/vnd.contentful.management.v1+json

Body: Maps JSON β†’ Contentful entry fields

Outcome: Publishes the finalized article live.

πŸ” Design Rationale & Best Practices

Separation of Concerns

Writer vs. Editor agents isolate creative drafting from quality review.

Idempotent Loop

Counter + action flags prevent infinite retries.

Extensibility

Swap in different research APIs or CMS targets with minimal changes.

Structured JSON

Ensures predictable input/output for each node.

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 - Create Perplexity Content

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

Block 2 - AI Writer Agent

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 1.7

Block 3 - AI Editor Agent

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 1.7

Block 4 - OpenAI Chat Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenAi - lmChatOpenAi
Config choices
Version 1.2

Block 5 - OpenAI Chat Model1

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenAi - lmChatOpenAi
Config choices
Version 1.2

Block 6 - Accept and Publish

Type / Role
@n8n/n8n-nodes-langchain.toolWorkflow - toolWorkflow
Config choices
Version 2

Block 7 - When chat message received

Type / Role
@n8n/n8n-nodes-langchain.chatTrigger - chatTrigger
Config choices
Version 1.1

Block 8 - JSON.parse1

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

Block 9 - Merge

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 3

Block 10 - Format

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

Block 11 - JSON.parse

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

Block 12 - Format Perplexity Output & Add Citations

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

Block 13 - Initialize Count

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

Block 14 - Increment Count

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

Block 15 - Check Limit

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

Block 16 - Stop Here

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

Block 17 - Execute Workflow

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

Block 18 - JSON.parse3

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

Block 19 - should submit

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 20 - Sticky Note

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

Block 21 - Sticky Note1

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

Block 22 - Sticky Note2

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

Block 23 - Sticky Note3

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

Block 24 - Sticky Note4

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

Showing the first 24 of 25 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow Generate knowledge base articles with GPT & Perplexity AI for Contentful CMS
Complexity advanced
Nodes 25
Categories Content Creation, Multimodal AI
Author Varritech
Published 13 May 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/4012/4012.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 Generate knowledge base articles with GPT & Perplexity AI for Contentful CMS do?

Workflow: Auto Knowledge Base Article Generator About the Creators This workflow was created by Varritech Technologies, an innovative agency that leverages AI to engineer...

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.