Automate Confluence Page Creation from Template with n8n

This n8n workflow automates creating Confluence pages from templates, replacing placeholders dynamically via webhook input. Save time and reduce errors in Confluence documentation.
webhook
httpRequest
code
+2
Learn how to Build this Workflow with AI:
Workflow Identifier: 1529
NODES in Use: Webhook, Set, HTTP Request, Code, Sticky Note

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

Visit through Desktop for Best experience

Opening Problem Statement

Meet Alice, a project manager at a fast-paced software company. Every week, Alice spends hours manually creating project update pages in Atlassian Confluence. She copies the same template, fills in details, and hopes she hasn’t missed changing any placeholders like dates or project names. This repetitive task wastes 3-4 hours weekly and introduces risks of errors, like outdated info or broken links. With multiple teams needing pages quickly, Alice struggles to keep documentation consistent and timely.

Imagine how Alice’s workflow could improve if creating Confluence pages from templates was automated—no manual copy-pasting or placeholder edits, just fresh pages created automatically with the right data injected every time. This exact problem is solved by the n8n workflow we will explore.

What This Automation Does

This n8n workflow automatically generates new Atlassian Confluence pages from a predefined template by replacing placeholders based on data received via a webhook POST request. Here’s what happens when it runs:

  • Receives dynamic data from an external system through a webhook, such as user names, dates, or custom fields.
  • Retrieves the specified Confluence template content using Confluence API and basic authentication.
  • Programmatically replaces placeholders within the template’s title and body with the incoming webhook data using a JavaScript code node.
  • Creates a new Confluence page under a target space and parent page with the processed content.
  • Generates page titles with timestamps combined with dynamic content to ensure uniqueness and context.
  • Reduces manual effort and human errors in Confluence documentation, saving Alice several hours every week.

Prerequisites ⚙️

  • n8n account (self-hosting optional) 🔌
  • Atlassian Confluence instance with API access and a template ready to use 🔐
  • HTTP Basic Auth credentials with an Atlassian API token for authentication 🔑
  • Webhook-capable system or service to POST JSON payloads to the n8n webhook URL 📧

Step-by-Step Guide

Step 1: Set Up Your Confluence API Credentials

Navigate to n8n’s Credentials section, click Add New, and select HTTP Basic Auth. Enter your Atlassian email as the username and Atlassian API token as the password. Name this credential, for example, “Atlassian”.

Common mistake: Using your Atlassian password instead of the API token will cause authentication failures.

Step 2: Configure the ‘Set parameters’ Node

Click the Set parameters node. Enter your Confluence base URL (example: https://your-domain.atlassian.net), the template ID of the Confluence template you want to use, the target space key, and the parent page ID under which new pages should be created.

You can find the template ID by checking the Confluence template API or using the Atlassian UI developer tools.

Step 3: Set Up the Webhook to Receive Incoming Data

The Webhook node listens for POST requests at a unique path (example: /d291ef27-c27f-42cf-90cf-4dad7dd71a7c). Configure your external system to send JSON data here. The workflow expects placeholders in the incoming JSON matching those in your template.

Testing tip: Use a tool like Postman or curl to POST example JSON to your webhook URL and ensure it triggers the workflow.

Step 4: Retrieve Template Content from Confluence

The Confluence: Get template content node sends a GET request to Confluence’s REST API to fetch the raw template data, including title and body in “storage” format. It uses HTTP Basic Auth with your Atlassian credentials.

Important: The URL uses the confluence_base_url and template_id from the parameters node to dynamically target the template.

Step 5: Replace Placeholders in Template Title and Body

In the Replace placeholders in template body and title Code node, JavaScript processes the template content to substitute placeholders marked by dollar signs ($placeholder$) with actual values from the webhook JSON.

Here’s the core JavaScript snippet used:

function replacePlaceholders(template, values) {
    const placeholderPattern = /$(.*?)$/g;
    return template.replace(placeholderPattern, (match, p1) => {
        const keys = p1.split('.');
        let value = values;
        for (const key of keys) {
            if (value && key in value) {
                value = value[key];
            } else {
                return match;
            }
        }
        return value;
    });
}

const templateTitle = $('Confluence: Get template content').item.json.name;
const templateBody = $('Confluence: Get template content').item.json.body.storage.value;
const values = $('Webhook').item.json;

const pageTitle = replacePlaceholders(templateTitle, values); 
const pageBody = replacePlaceholders(templateBody, values);

return { "page_title": pageTitle, "page_body" :  pageBody};

This ensures the new page title and body are customized dynamically.

Step 6: Create the New Confluence Page

The Confluence: Create page from template node sends a POST request to create a new page in the specified space under the given parent page. It passes the replaced title and body content in the request body, also adding a timestamp prefix to the title for uniqueness.

After this step, your new Confluence page exists with all placeholders replaced and ready for team use.

Customizations ✏️

  • Change Page Title Format: In the Confluence: Create page from template node, modify the title field’s JavaScript template string to adjust timestamp or add other labels.
  • Add More Placeholder Keys: Update the Code node to include nested JSON keys or additional webhook fields for richer page content personalization.
  • Support Multiple Templates: Add logic before the Set parameters node to select different template IDs based on webhook input values.
  • Send Notification: Add a Slack or Email node after page creation to notify stakeholders automatically.

Troubleshooting 🔧

  • Problem: “401 Unauthorized” from Confluence API.

    Cause: Incorrect API token or Basic Auth credentials.

    Solution: Go to n8n Credentials, verify the Atlassian HTTP Basic Auth credentials, and regenerate your Atlassian API token if needed.
  • Problem: Placeholders not replaced in new page content.

    Cause: Mismatch between placeholder keys in template and webhook JSON.

    Solution: Confirm placeholder names in template match JSON payload keys exactly, including nested keys in dot notation.
  • Problem: Workflow not triggering on HTTP POST.

    Cause: Incorrect webhook URL or HTTP method.

    Solution: Check the webhook node’s path and method. Use Postman to confirm the POST request is sent correctly.

Pre-Production Checklist ✅

  • Validate your Atlassian API token and Basic Auth credentials.
  • Test retrieving template content manually using Confluence REST API with your credentials.
  • Test your webhook externally with sample JSON matching placeholder keys.
  • Confirm nodes handle data as expected by reviewing n8n execution logs.
  • Backup important Confluence pages before bulk automated creation as a precaution.

Deployment Guide

Activate the workflow in n8n by toggling it on. Keep monitoring the latest executions to ensure pages are created successfully. Optionally, schedule webhook calls from your external system based on your project timelines.

Ensure your Atlassian credentials remain valid and rotate API tokens periodically for security.

FAQs

  • Q: Can I use OAuth instead of Basic Auth for Confluence?

    A: This workflow uses Basic Auth with API tokens for simplicity, but OAuth can be integrated with additional node configuration.
  • Q: Does this consume Confluence API credits or has rate limits?

    A: Atlassian enforces API rate limits; consider them when planning volume. This workflow is suitable for moderate use.
  • Q: Can I customize templates dynamically aside from placeholders?

    A: Placeholders provide flexible dynamic content. For highly customized templates, consider multiple template IDs or further processing before page creation.

Conclusion

By implementing this n8n workflow, Alice now automates creating Confluence pages directly from templates, injecting real-time data effortlessly. This saves her team hours of manual work weekly and drastically cuts errors from manual editing.

This approach suits companies needing consistent, up-to-date documentation created dynamically from various data sources without manual intervention.

Next steps to expand this workflow could include adding notifications when pages are created, handling multiple templates based on project types, or integrating with Jira for automatic project status updates.

Give this workflow a try, and see how automating Confluence documentation improves your collaboration and productivity!

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