Create Pages with AI
Ask an AI assistant to write a Confluence page, and get the diagrams already drawn on it.
Instead of writing a page, then adding a macro, then typing Mermaid syntax into it, you describe what you want once. The assistant creates the page with the explanation and the diagram in place, ready to read.
How it worksβ
The assistant puts the Mermaid source directly into the macro as it creates the page. Nobody has to open the page and fill the macro in afterwards, and the page exports to PDF and Word normally.
You can keep iterating. Ask for a change, the assistant rewrites the page, and everyone sees the new diagram. That stays true until somebody edits the diagram in Confluence, which hands ownership over to Confluence for good.
What you needβ
Two things, both one-off:
- Apportunity: Mermaid Diagrams Macro for Confluence installed on your site. This is what draws the diagrams.
- Apportunity Secure MCP Server connected to your AI assistant. This is what lets it create Confluence pages for you. Follow its Getting Started guide once, and you are done.
The MCP server acts as you, with your own Confluence permissions, so your assistant can only touch pages you could edit yourself. You never share a password or an API token with it.
How to askβ
Paste a link to this page, then say what you want. That is the whole technique.
Use this guide: https://docs.apportunity.xyz/mermaid-diagrams/create-pages-with-ai
Create a Confluence page in the DEV space called "Checkout flow" that explains how an order moves from cart to confirmation, with a diagram of the steps.
The link matters. Without it the assistant does not know how this app stores diagrams, and will usually fall back to pasting Mermaid code into the page as plain text, which does not render.
You do not need to mention the MCP server in your prompt. The assistant will find it, and this page tells it to use it.
Example promptsβ
Copy any of these and change the details.
A process, explained and drawn
Use this guide: https://docs.apportunity.xyz/mermaid-diagrams/create-pages-with-ai
Create a page in the OPS space called "Incident response" describing our escalation process: an alert fires, the on-call engineer triages it, and either resolves it or escalates to the team lead. Add a flowchart of the process and a short explanation above it.
Turn a conversation into a documented page
Use this guide: https://docs.apportunity.xyz/mermaid-diagrams/create-pages-with-ai
Summarise the architecture we just discussed into a Confluence page in the ARCH space, with a diagram of how the services talk to each other.
Document code you already have
Use this guide: https://docs.apportunity.xyz/mermaid-diagrams/create-pages-with-ai
Read the authentication module in this repository and create a Confluence page in the DEV space explaining the login flow, with a sequence diagram of the token exchange.
A page with several diagrams
Use this guide: https://docs.apportunity.xyz/mermaid-diagrams/create-pages-with-ai
Create a page in the DEV space called "Release process" with three sections: branching, testing, and deployment. Give each section its own diagram and a paragraph explaining it.
Tips for better resultsβ
- Say which space, by name or key. It is the one thing the assistant cannot guess.
- Ask it to send you the link when it is done, so you can check the result straight away.
- Ask for the explanation too, not only the diagram. A diagram with a paragraph above it is far more useful than a diagram alone.
- Say what kind of diagram if you have a preference, for example a sequence diagram or a Gantt chart. Otherwise the assistant picks one.
- One diagram per idea. Several diagrams on a page is normal and encouraged; each one goes in its own macro with its own introduction.
- Open the page and check it. If a diagram is wrong, ask the assistant to fix that section, or edit it yourself in the macro.
Changing a diagram afterwardsβ
Before anyone has edited it, just ask the assistant again.
Update the diagram on the "Checkout flow" page to include the refund path.
Once somebody has edited the diagram in Confluence, that edit wins and further requests to the assistant will not change what readers see. From then on, edit the diagram in Confluence: click the macro, change the source, and save. See Getting Started.
This is deliberate. A person's edit should never be silently overwritten by a regenerated page.
If something looks wrongβ
| What you see | What to do |
|---|---|
| The assistant says it cannot create pages | The Confluence MCP server is not connected. Follow its Getting Started guide. |
| Mermaid code appears as plain text on the page | The assistant did not follow this guide. Include the link in your request. |
| A grey box, or "app not found", where the diagram should be | The Mermaid Diagrams app is not installed on the site, or the assistant altered the extension-key below. |
| The macro appears but is empty | The guest-params block was built wrongly. Ask the assistant to re-read this page and try again. |
| The diagram shows an error message | The Mermaid syntax is invalid. Point the assistant at Diagram Syntax for AI. |
| Arrows missing, or a diagram cut short | The > characters were not escaped. See the escaping table below. |
| Two diagrams show the same content | The macros share a local-id. Each needs its own fresh UUID. |
| Updating the page no longer changes the diagram | Somebody has edited that diagram in Confluence, so it is now owned by the page. Edit it in Confluence instead. |
Instructions for your AI assistantβ
Everything below is written for the assistant. You do not need to read it.
Use the Confluence MCP serverβ
Create the page with the confluence_create_page tool from the connected Confluence MCP server.
Do not write scripts, do not call the Confluence REST API directly, and do not ask the user for an API token or password. If the MCP server is not connected, say so and stop.
Insert the diagram macroβ
confluence_create_page takes a space_key, a title, and content in Confluence Storage Format. Write the page as you normally would - headings, paragraphs, lists - and insert this block wherever a diagram belongs:
<ac:adf-extension><ac:adf-node type="extension"><ac:adf-attribute key="extension-type">com.atlassian.ecosystem</ac:adf-attribute><ac:adf-attribute key="extension-key">9d10a082-4d4e-4efa-996b-9c0170f3bfee/7a286cf2-9d8a-4c57-9bd2-102c413343b2/static/mermaid-macro</ac:adf-attribute><ac:adf-attribute key="local-id">PUT-A-FRESH-UUID-HERE</ac:adf-attribute><ac:adf-attribute key="parameters"><ac:adf-parameter key="local-id">PUT-A-FRESH-UUID-HERE</ac:adf-parameter><ac:adf-parameter key="guest-params"><ac:adf-parameter key="diagram">graph TD;
A[Start] --> B[End];</ac:adf-parameter><ac:adf-parameter key="size">medium</ac:adf-parameter></ac:adf-parameter></ac:adf-attribute></ac:adf-node></ac:adf-extension>
Only three things change per diagram:
| What | Where | Notes |
|---|---|---|
| A fresh UUID | local-id, in both places | Generate a new one for every macro. The two must match. |
| The Mermaid source | guest-params β diagram | Required. |
| The display height | guest-params β size | Optional. One of small, medium, large, xlarge, full. Defaults to medium. |
The long extension-key value is the same on every Confluence site. Copy it exactly.
Escape the diagramβ
The diagram sits inside XML, so three characters must be escaped:
| Character | Write it as |
|---|---|
> | > |
< | < |
& | & |
In practice this means arrows: --> is written -->, and ->> is written ->>. Line breaks stay as real line breaks.
One diagram per macroβ
A macro holds one diagram. For several diagrams on a page, insert several macros, each with its own fresh UUID and its own introduction.
Complete exampleβ
A page with two diagrams, each introduced by a sentence:
<h2>Checkout flow</h2>
<p>The diagram below shows how an order moves from cart to confirmation.</p>
<ac:adf-extension><ac:adf-node type="extension"><ac:adf-attribute key="extension-type">com.atlassian.ecosystem</ac:adf-attribute><ac:adf-attribute key="extension-key">9d10a082-4d4e-4efa-996b-9c0170f3bfee/7a286cf2-9d8a-4c57-9bd2-102c413343b2/static/mermaid-macro</ac:adf-attribute><ac:adf-attribute key="local-id">d7c1f0a2-6b4e-4a1b-9c3d-2f8e5a7b1c40</ac:adf-attribute><ac:adf-attribute key="parameters"><ac:adf-parameter key="local-id">d7c1f0a2-6b4e-4a1b-9c3d-2f8e5a7b1c40</ac:adf-parameter><ac:adf-parameter key="guest-params"><ac:adf-parameter key="diagram">graph TD;
A[Cart] --> B{Payment OK?};
B -- Yes --> C[Confirm order];
B -- No --> D[Show error];</ac:adf-parameter><ac:adf-parameter key="size">large</ac:adf-parameter></ac:adf-parameter></ac:adf-attribute></ac:adf-node></ac:adf-extension>
<p>Payment authorisation itself involves three services:</p>
<ac:adf-extension><ac:adf-node type="extension"><ac:adf-attribute key="extension-type">com.atlassian.ecosystem</ac:adf-attribute><ac:adf-attribute key="extension-key">9d10a082-4d4e-4efa-996b-9c0170f3bfee/7a286cf2-9d8a-4c57-9bd2-102c413343b2/static/mermaid-macro</ac:adf-attribute><ac:adf-attribute key="local-id">4b90e7d1-2c35-49aa-8f16-71d0c3ab5e92</ac:adf-attribute><ac:adf-attribute key="parameters"><ac:adf-parameter key="local-id">4b90e7d1-2c35-49aa-8f16-71d0c3ab5e92</ac:adf-parameter><ac:adf-parameter key="guest-params"><ac:adf-parameter key="diagram">sequenceDiagram
Shop->>Gateway: authorise
Gateway->>Bank: verify
Bank-->>Gateway: ok
Gateway-->>Shop: approved</ac:adf-parameter><ac:adf-parameter key="size">medium</ac:adf-parameter></ac:adf-parameter></ac:adf-attribute></ac:adf-node></ac:adf-extension>
Pass that as content, along with the space key and a title.
Changing a diagram you createdβ
Update the page with confluence_update_page: read it, replace the Mermaid source inside guest-params, and write it back.
This works until somebody edits the diagram in Confluence. At that point the app stores the diagram with the page and takes ownership of it, and further changes to the page source are ignored.
Writing good pagesβ
- Introduce each diagram with a sentence or two before it. A diagram with no explanation is hard to act on.
- Split a diagram that is getting dense into two simpler ones rather than growing it.
- Prefer
largefor flowcharts and sequence diagrams with more than about ten nodes,mediumfor small ones. - Keep each diagram's source to a reasonable size, roughly a page of text at most. The source travels inside the page, so very large diagrams make the page heavier for every reader.
- For choosing a diagram type and writing correct syntax, follow Diagram Syntax for AI.
Relatedβ
- Diagram Syntax for AI - choosing a diagram type and writing correct Mermaid
- Apportunity Secure MCP Server - connect Claude to Confluence
- Getting Started - creating and editing diagrams by hand