Automate Notion Content Conversion with n8n Workflow

Discover how this unique n8n workflow automates converting Notion database page updates into rich Markdown content and back to Notion blocks, saving hours of manual formatting and duplication work for Notion users.
notionTrigger
notion
code
+3
Workflow Identifier: 2301
NODES in Use: notionTrigger, notion, code, splitOut, httpRequest, stickyNote

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

Visit through Desktop for Best experience

1. Opening Problem Statement

Meet Sarah, a content manager who relies heavily on Notion to maintain project documentation and meeting notes. Each time a page in her Notion journal database is updated, she finds herself manually copying content, reformatting it in Markdown for sharing or publishing, and then recreating it back into Notion blocks for related pages. This tedious cycle wastes hours every week, leading to errors like lost formatting (bold, links) and inconsistent content presentation.

For Sarah, this manual back-and-forth between Notion and Markdown is a costly drain of productivity and correctness. With many pages updated daily across her team, the challenge is not just about saving time but ensuring content consistency and rich formatting are preserved when converting between Notion’s native blocks and Markdown.

2. What This Automation Does

This n8n workflow expertly automates the entire content conversion process for Notion pages within a specified database. Here’s what happens when it runs:

  • Detects when a page in Sarah’s specified Notion journal database is updated (triggered every minute).
  • Fetches the updated Notion page block content along with all child blocks for full context.
  • Converts the rich text Notion blocks into clean Markdown, preserving important formatting like headings, bold, italics, lists, code blocks, quotes, and links.
  • As a demo, triples the Markdown content to showcase content manipulation capabilities.
  • Converts the enhanced Markdown back into fully formatted Notion blocks, including rich formatting and links.
  • Updates the original Notion page by patching these Markdown-converted blocks back as children, effectively syncing enhanced content seamlessly.

This automation saves Sarah potentially hours weekly, eliminating manual copy-paste errors and preserving consistent formatting, while allowing enhanced Markdown editing workflows before pushing content back to Notion.

3. Prerequisites ⚙️

  • n8n Account with access to workflows
  • Notion account with access to the target database (here used as Journal Database)
  • Notion API integration credentials connected in n8n
  • Basic knowledge of Markdown syntax and Notion block types

4. Step-by-Step Guide

Step 1: Configure Notion Trigger for Page Updates

Navigate to Nodes > Add New Node > Notion Trigger. Set the event to pagedUpdatedInDatabase and choose your Notion database ID (e.g., the Journal database). Set polling interval to every minute.

Expected outcome: Workflow triggers automatically whenever a page in the database is updated, capturing the page ID.

Common mistake: Using incorrect database IDs or not properly authenticating your Notion account will prevent triggers from firing.

Step 2: Fetch Notion Page Blocks

Add a Notion node configured to getAll blocks for the updated page ID received from the trigger. This retrieves the base block data.

Outcome: You get JSON block data representing the content structure of the updated page.

Step 3: Retrieve Children Blocks via HTTP Request

Add an HTTP Request node named Get Child blocks. Use the URL:

=https://api.notion.com/v1/blocks/{{ $json.id }}/children

Set method to GET, authenticate with your Notion API credentials. This fetches child blocks of the main block.

Outcome: Full child block content is retrieved for accurate conversion.

Step 4: Split Out Results for Individual Processing

Insert a Split Out node on the results field from HTTP response. This separates individual blocks for fine handling.

Outcome: Each block can be individually processed, enabling detailed content conversion.

Step 5: Convert Notion Blocks to Markdown with Code Node

Use a Code node named Full Notion Blocks to Md with JavaScript code that iterates blocks and parses rich text annotations into Markdown equivalents, handling:

  • Headings (`#`, `##`, `###`)
  • Paragraphs
  • Lists (bulleted, numbered)
  • Todos
  • Quotes
  • Inline styles (bold, italic, strikethrough, underline, code)
  • Links

Here’s the core parsing function snippet:

function parseRichText(richTextArray) {
  return richTextArray.map(text => {
    let content = text.text.content;
    if (text.annotations.bold) content = `**${content}**`;
    if (text.annotations.italic) content = `*${content}*`;
    if (text.annotations.strikethrough) content = `~~${content}~~`;
    if (text.annotations.underline) content = `_${content}_`;
    if (text.annotations.code) content = ``${content}``;
    if (text.text.link) content = `[${content}](${text.text.link.url})`;
    return content;
  }).join("");
}

Outcome: Rich Notion content is exported as Markdown, maintaining formatting and links.

Step 6: Manipulate Markdown Content (Optional Demo)

The workflow shows a demo step where the Markdown content is tripled to illustrate transform capabilities. In practical use, you can modify or apply edits here.

Step 7: Convert Markdown Back to Notion Blocks

Add a Code node named Md to Notion Blocks v3. This node parses Markdown lines back into Notion block objects with appropriate rich text annotations, supporting headings, lists, quotes, and code blocks.

Example parsing logic:

if (line.startsWith('# ')) {
  blocks.push({ type: 'heading_1', heading_1: { rich_text: parseRichText(line.slice(2)) } });
} else if (line.startsWith('- ')) {
  blocks.push({ type: 'bulleted_list_item', bulleted_list_item: { rich_text: parseRichText(line.slice(2)) } });
} else if (line.startsWith('> ')) {
  blocks.push({ type: 'quote', quote: { rich_text: parseRichText(line.slice(2)) } });
}

Outcome: Markdown content is accurately converted back into Notion blocks ready for API upload.

Step 8: Patch Updated Blocks Back to Notion Page

Finally, use an HTTP Request node Add blocks as Children to PATCH new content as children blocks to the original page. Configure:

  • URL: =https://api.notion.com/v1/blocks/{{ $('Notion Trigger').first().json.id }}/children
  • Method: PATCH
  • Body: JSON with the blocks array from Markdown conversion
  • Authentication: Your Notion API credentials

Outcome: Your Notion page content is seamlessly updated with enriched content without manual copy-pasting.

5. Customizations ✏️

  • Change database ID: In the Notion Trigger node, update the databaseId parameter to monitor a different Notion database.
  • Modify Markdown transformations: Customize the JavaScript in Full Notion Blocks to Md to add support for other Notion block types or styles.
  • Add content filters: Add a Function node after block splitting to filter out unwanted blocks before converting to Markdown.
  • Integrate with another tool: Add nodes after Markdown conversion for publishing to external CMS or sending notifications.
  • Refine back conversion: Enhance Md to Notion Blocks v3 code to support nested lists or tables.

6. Troubleshooting 🔧

Problem: “Notion Trigger not firing updates”
Cause: Incorrect database ID or missing Notion API credentials.
Solution: Verify your database ID in the trigger node and ensure your Notion API credentials are valid and connected properly.

Problem: “Child blocks not loading or empty response”
Cause: HTTP Request to Notion blocks children endpoint misconfigured or lack of permissions.
Solution: Confirm URL is correctly formed with dynamic page ID and check your integration has read permissions for page content.

Problem: “Markdown formatting lost or incorrect”
Cause: Limitations in code nodes parsing logic or unsupported Notion block types.
Solution: Review and extend the JavaScript parsing functions to handle additional syntax, test outputs thoroughly.

7. Pre-Production Checklist ✅

  • Verify Notion API credentials have read/write access to the target database and pages.
  • Test trigger firing by updating a page manually in your Notion journal database.
  • Check the HTTP requests return expected child blocks JSON with correct formatting.
  • Confirm code nodes accurately convert Notion blocks to Markdown and back without errors.
  • Backup original pages in Notion before running this workflow in production to avoid data loss.

8. Deployment Guide

After testing, activate the workflow in n8n’s interface by toggling the active switch. Monitor initial runs via the Executions tab to ensure proper trigger and content conversion without errors.

This workflow can run on n8n’s cloud or self-hosted environment. For more control and data privacy, consider self-hosting with providers like Hostinger.

10. Conclusion

You just automated converting updated content in your Notion journal pages to Markdown and back to rich Notion blocks using n8n. This transformation removes manual labor, ensures formatting consistency, and opens the door for richer content editing workflows in Markdown format.

By implementing this automation, you can save multiple hours weekly previously lost to repetitive copy-pasting and formatting corrections. As next steps, consider extending this workflow to integrate with publishing platforms, or add notifications to alert your team of content updates.

Keep exploring n8n to enhance your Notion workflows and turn tedious documentation tasks into seamless automated processes. Happy automating!

Promoted by BULDRR AI

Related Workflows

Automate Viral UGC Video Creation Using n8n + Degaus (Beginner-Friendly Guide)

Learn how to automate viral UGC video creation using n8n, AI prompts, and Degaus. This beginner-friendly guide shows how to import, configure, and run the workflow without technical complexity.
Form Trigger
Google Sheets
Gmail
+37
Free

AI SEO Blog Writer Automation in n8n (Beginner Guide)

A complete beginner guide to building an AI-powered SEO blog writer automation using n8n.
AI Agent
Google Sheets
httpRequest
+5
Free

Automate CrowdStrike Alerts with VirusTotal, Jira & Slack

This workflow automates processing of CrowdStrike detections by enriching threat data via VirusTotal, creating Jira tickets for incident tracking, and notifying teams on Slack for quick response. Save hours daily by transforming complex threat data into actionable alerts effortlessly.
scheduleTrigger
httpRequest
jira
+5
Free

Automate Telegram Invoices to Notion with AI Summaries & Reports

Save hours on financial tracking by automating invoice extraction from Telegram photos to Notion using Google Gemini AI. This workflow extracts data, records transactions, and generates detailed spending reports with charts sent on schedule via Telegram.
lmChatGoogleGemini
telegramTrigger
notion
+9
Free

Automate Email Replies with n8n and AI-Powered Summarization

Save hours managing your inbox with this n8n workflow that uses IMAP email triggers, AI summarization, and vector search to draft concise replies requiring minimal review. Automate business email processing efficiently with AI guidance and Gmail integration.
emailReadImap
vectorStoreQdrant
emailSend
+12
Free

Automate Email Campaigns Using n8n with Gmail & Google Sheets

This n8n workflow automates personalized email outreach campaigns by integrating Gmail and Google Sheets, saving hours of manual follow-up work and reducing errors in email sequences. It ensures timely follow-ups based on previous email interactions, optimizing communication efficiency.
googleSheets
gmail
code
+5
Free