Convert Markdown Content to Contentful Rich Text with AI Formatting
Workflow: Publish to Contentful with Rich Text Formatting
β‘ 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 takes a JSON article payload, splits its markdown content into logical chunks, converts each chunk into Contentful Rich Text JSON via an AI agent, merges the resulting rich text nodes back into a single document, formats the entire entry according to Contentful's field schema, and finally publishes it to Contentful.
Trigger β Executes when called by another workflow
Split by Headings β Breaks markdown into ##-delimited chunks
Markdown β Rich Text β AI agent converts each chunk to Contentful Rich Text JSON
Combine Rich Text Objects β Aggregates all chunk outputs into one document
Format Entry β Wraps metadata and rich-text content into Contentful schema
Publish Entry β HTTP POST to Contentful API
π¦ Node-by-Node Breakdown
flowchart LR A[When Executed by Another Workflow] --> B[Split by Headings] B --> C[Markdown to Contentful format] C --> D[Combine Rich Text Objects] D --> E[Merge1] E --> F[Format1] F --> G[Create newly formatted Contentful Entry]
- When Executed by Another Workflow Type: Execute Workflow Trigger
Input Example: title, slug, category.id, description, keywords, content, metaTitle, metaDescription, readingTime, difficulty
Purpose: Receives the JSON payload from the upstream workflow.
- Split by Headings Type: Code
Logic: Splits input.content into an array of markdown chunks at each second-level heading (##). Emits one item per chunk with index, slug, title, and contentChunk.
- Markdown to Contentful format Type: LangChain Agent (+ OpenAI Chat model)
System Prompt: Defines rules for generating valid Contentful Rich Text JSON (must include nodeType, data:{}, content:[], etc.). Provides examples for paragraphs, headings, lists, links, and images.
User Prompt:
Here is the markdown content to convert:
Purpose: Converts each markdown chunk into an array of rich-text nodes.
- Combine Rich Text Objects Type: Code
Logic: Parses and merges all content arrays returned by the AI agent into one combined content array under a document root.
- Merge1 Type: Merge
Purpose: Joins the original item (with metadata) and the combined rich-text document into a single data stream.
- Format1 Type: Code
Logic: Maps workflow data into the Contentful entry schema by setting each field (title, slug, category link, description, keywords, rich-text content, metaTitle, metaDescription, readingTime, difficulty) under the appropriate locale and structure required by Contentful.
- Create newly formatted Contentful Entry Type: HTTP Request
Method: POST
URL: https://api.contentful.com/spaces
Headers: Authorization: Bearer token for Contentful Management API Content-Type: application/vnd.contentful.management.v1+json X-Contentful-Version: entry version number X-Contentful-Content-Type: content type ID
Body: The formatted fields object produced by the previous node
Purpose: Publishes the new entry with rich-text content to Contentful.
π Design Rationale & Best Practices Chunked Conversion Splitting by headings prevents AI context limits and keeps conversions modular.
Strict Rich Text Schema Enforcing nodeType, data, and content structure avoids validation errors on Contentful.
Two-Phase Merge Separating "combine AI outputs" and "format entry" keeps transformations clear and testable.
Idempotent Publish Uses explicit versioning and content type headers to ensure correct entry creation.
Related Templates
Track Demo Bookings with Google Calendar to Meta Conversions API Integration
Who is this workflow for? If you're using Meta Ads to generate new leads to your sales pipeline, this workflow is for yo...
Build a PDF-Based RAG System with OpenAI, Pinecone and Cohere Reranking
This workflow contains community nodes that are only compatible with the self-hosted version of n8n. This workflow prov...
Reusable and Independently Testable Sub-workflow
Reusable and Independently Testable Sub-workflow This n8n workflow provides a standardized structure for building and te...
π Please log in to import templates to n8n and favorite templates
Workflow Visualization
Loading...
Preparing workflow renderer
Comments (0)
Login to post comments