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
Workflow Identifier: 1529
NODES in Use: Webhook, Set, HTTP Request, Code, Sticky Note

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

Learn how to Build this Workflow with AI:

Visit through Desktop for Best experience

What this workflow does

This workflow creates Confluence pages automatically from a template using data sent by a webhook.

It solves the problem of copying templates and replacing placeholders by hand every time.

When it runs, it makes a new page with the correct info filled in right away.


Who should use this workflow

This workflow fits people who work in teams needing fast, consistent Confluence pages.

If manual page creation wastes time or causes mistakes, this is helpful.

Users with access to an Atlassian Confluence account and webhook-capable systems can use it easily.


Tools and services used

  • n8n: automation platform for workflows.
  • Atlassian Confluence API: to get templates and create pages.
  • HTTP Basic Auth: with Atlassian email and API key for secure access.
  • Webhook: receives incoming data in JSON format.

Inputs, processing, and output

Inputs

  • JSON data sent by an external system via a webhook POST request.
  • The data includes values like names, dates, or custom info to use in the page.
  • Confluence template ID and base URL set in parameters.
  • Credentials for authentication.

Processing steps

  • Receive webhook JSON payload at the Webhook node.
  • Fetch the template content (title and body) via Confluence API using Confluence: Get template content node.
  • Replace placeholders marked by $placeholder$ within the template using JavaScript code in the Replace placeholders in template body and title code node.
  • Generate a new page title with timestamp and replaced content.
  • Create a new Confluence page with the replaced content using the Confluence: Create page from template node.

Output

A new Confluence page is created under the chosen space and parent page.

The page has a unique title with time and correct info filled in.

This removes manual copying and editing, saving time and lowering mistakes.


Beginner step-by-step: How to use this workflow in n8n

Importing the workflow

  1. Download the workflow file using the Download button on this page.
  2. Open the n8n editor.
  3. Click “Import from File” in the n8n menu and select the downloaded file.

Configuring after import

  1. Go to Credentials in n8n.
  2. Add new credentials with HTTP Basic Auth.
  3. Enter the Atlassian email as username and API key as password.
  4. In the Set parameters node, update the Confluence base URL, template ID, space key, and parent page ID.
  5. Double-check the webhook path and ensure your external system will POST JSON matching your template placeholders.
  6. If there is any code (like JavaScript to replace placeholders), copy it exactly as found here and paste into the code node.

Testing and activating

  1. Send a test POST request with sample JSON to the webhook URL using Postman or curl.
  2. Check the workflow runs without errors in the execution log.
  3. If all works, activate the workflow by toggling it on.

If using self-host n8n, make sure your server is accessible externally so webhooks work. self-host n8n setup can help.


JavaScript code for placeholder replacement explained

The code uses a pattern to find placeholders like $name$ in templates.

It replaces each placeholder with matching values from the webhook JSON object.

If a placeholder has dots like $user.name$, the code looks into nested JSON keys.

This ensures every placeholder is replaced by the correct dynamic data before creating the page.

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};

Customization ideas

  • You can change the page title format inside the creation node, adding different timestamp styles or labels.
  • Update the JavaScript code to add support for new or nested placeholder keys in the webhook JSON.
  • Make the workflow choose different templates based on webhook data by adding conditions before parameters are set.
  • Add nodes to notify team members using Slack or Email after page creation.

Troubleshooting common issues

  • 401 Unauthorized: Usually means wrong API key or Basic Auth details. Fix by checking credentials in n8n and regenerating API keys in Atlassian if needed.
  • Placeholders not replaced: Happens when webhook JSON keys don’t match placeholders exactly. Make sure names and nesting are correct.
  • Workflow not triggering: Check webhook URL and HTTP POST method. Use Postman to verify the webhook receives data properly.

Pre-production checklist

  • Check Atlassian API keys and make sure Basic Auth credentials are valid.
  • Manually test template retrieval using Confluence API with your credentials.
  • Send test webhook data to confirm placeholders get replaced correctly.
  • Review workflow logs in n8n to verify data flow.
  • Backup important Confluence pages before running many automated creations.

Deployment guide

Turn on the workflow in n8n after test runs pass.

Check recent executions in n8n to confirm pages create fine.

Schedule webhook calls from your external system as needed.

Keep credentials current and rotate API keys on schedule for security.


Summary of benefits and outcomes

✓ Save several hours every week by avoiding manual page creation.

✓ Reduce errors from missed placeholder replacements.

✓ Get up-to-date, consistent Confluence pages fast.

→ After setting up, pages create themselves with correct info each time.

→ Workflow fits teams needing documentation automation from external data.

Frequently Asked Questions

It uses a JavaScript code node to find placeholders marked by dollar signs and replaces them with matching values from the webhook JSON data.
HTTP Basic Auth credentials with Atlassian email as username and an API key as the password are needed.
Send a POST request with sample JSON to the webhook URL using tools like Postman and check if the workflow triggers properly.
Wrong API key or incorrect Basic Auth credentials usually cause the 401 Unauthorized error.

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 Workflows in n8n

A complete beginner guide to building an AI 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