n8n

How to Generate OpenAI Contentful Articles?

Turn a simple chat prompt into a researched, edited, and publish ready article. Ideal for marketing teams that need steady content with consistent quality. The flow drafts, reviews, and sends final copy to a publishing workflow that maps it to your CMS fields.

A chat message starts the process. An AI Writer Agent creates a full article in structured JSON using OpenAI. A Perplexity request adds deep research. A formatter cleans the Perplexity text and adds citations. These pieces are merged and sent to an AI Editor Agent running a higher grade model to score quality. A feedback loop improves the draft but stops after a safe limit to avoid endless edits. If the editor approves, a tool call triggers a publish workflow that converts the content to Rich Text and creates the entry in your CMS.

You will need API keys for OpenAI and Perplexity, and a Contentful token set in the called publish workflow. Adjust category IDs, the quality threshold, and the max review rounds. Expect faster drafts, fewer manual edits, and clean handoff to your CMS. Great for blogs, product pages, and knowledge content.

What are the key features?

  • Chat message trigger collects the topic and starts content creation.
  • AI Writer Agent builds a full JSON article with title, slug, content, category, and keywords.
  • Perplexity deep research via HTTP request adds long form insights and references.
  • Formatter cleans Perplexity output, removes hidden blocks, and injects markdown citations.
  • Merge and JSON parsing ensure all agent outputs become valid structured data.
  • AI Editor Agent reviews quality using a higher tier model and returns a publish decision.
  • Feedback loop with count initialization, increment, and limit check prevents endless revisions.
  • Conditional routing sends approved articles to a publishing workflow or stops for more changes.
  • Publish tool hands off fields for conversion to Rich Text and CMS creation in Contentful.

What are the benefits?

  • Reduce draft time from 4 hours to 20 minutes
  • Automate up to 70% of editing with an AI quality gate
  • Improve accuracy by adding linked citations to sources
  • Handle 5 times more articles per week with the review loop
  • Connect research, writing, and CMS publishing in one flow
  • Eliminate most copy paste errors when sending content to the CMS

How do you set it up?

  1. Import the template into n8n: Create a new workflow in n8n > Click the three dots menu > Select 'Import from File' > Choose the downloaded JSON file.
  2. You'll need accounts with OpenAI, Perplexity and Contentful. See the Tools Required section above for links to create accounts with these services.
  3. In the n8n credentials manager, create an OpenAI credential using your API key from the OpenAI dashboard. Open both OpenAI Chat Model nodes and select this credential.
  4. Get a Perplexity API key from your Perplexity account. Open the Create Perplexity Content HTTP Request node and set the Authorization header to Bearer YOUR_API_KEY or click Create new credential and follow the on screen steps.
  5. Import or create the separate publishing workflow that connects to Contentful. In that workflow, add a Contentful Content Management API credential with your space ID and environment.
  6. Return to this workflow and open the Accept and Publish tool call. Replace the workflowId with your own publishing workflow and confirm the field mappings for title, slug, content, category, and keywords.
  7. Open the AI Editor Agent system message and update the category IDs so they match your CMS taxonomy.
  8. Set the quality threshold in the should submit decision node to your acceptance level. Adjust the max feedback rounds in Initialize Count and Check Limit.
  9. Open the Format Perplexity Output and Add Citations node and confirm the cleanup and citation format meet your style guide.
  10. Run a test by sending a topic through the chat trigger. Watch the execution: writer, research, formatting, editor decision, and final publish. Verify the article appears in Contentful with proper fields.
  11. If you see JSON parse errors, tighten the AI prompts to return strict JSON only. If the loop stops early, raise the limit in Check Limit. If publishing fails, confirm Contentful credentials and content type field names in the publishing workflow.

Tools Required

$24 / mo or $20 / mo billed annually to use n8n in the cloud. However, the local or self-hosted n8n Community Edition is free.

Contentful

Sign up

Free: $0 / mo, 100K API calls / mo

OpenAI

Sign up

Pay-as-you-go: GPT-5 at $1.25 per 1M input tokens and $10 per 1M output tokens

Perplexity

Sign up

Pay-as-you-go API: Sonar $1/M input tokens, $1/M output tokens + per-request fee (e.g., $0.005 at low context)

Credits:
christian@varritech.com

Similar Templates

Join Futurise to access 1,200+ automation templates

Get instant access to ready-made automation workflows for n8n, Make.com, AI agents, and more. Download, customise, and deploy in minutes.