Automatically create and fill pages in Confluence

Import contents into Confluence through the user interface using a Puppeteer-controlled browser

Marian Čaikovski
6 min readMay 2, 2022

--

What are the options if you have to copy some somewhere existing contents into Confluence? Suppose you would not like to spend time on a boring task of creating pages and pasting the contents. In addition to the ways described in the Confluence documentation, you could automate creating pages and filling its fields in a browser. To me this approach seems more straightforward than directly using the Confluence REST services. To demonstrate this approach I created a simple script creating pages in a free space in the Confluence Cloud.

The script depends on Puppeteer, which is a library providing API to control a Chrome browser. Any repetitive task that can be done manually in a browser, for example filling in forms, can be automated using Puppeteer. Import of contents through a web application user interface is one of the intended use cases of Puppeteer.

I mention in this post first some sample results and then I discuss the details of the code.

First, to assess reliability of the script, I created 100 pages displaying two sample headings, a paragraph and an HTML table. The pages have are serially numbered from 0 to 99.

The point is that the script does not fail.

But the import through the user interface into the Confluence Cloud takes >20 min. So it is very slow, but only because of the throughput of the Confluence Cloud server. When Confluence is installed on a local server, the import is much faster.

A use case for automatic filling of Confluence — documenting database tables in Confluence

The idea to use Puppeteer to fill Confluence occurred to me because I had to document in a team space a schema with many tables in an Oracle database. It is quite common for developers to have to document something. So I think some of the readers might face a similar task. Documentation of…

--

--

Marian Čaikovski

Java, JavaScript and SQL developer. Interested in data collection and visualization.