Registry / crm-productivity / confluence-api

confluence-api

JSON →
library1.4.0jsnpmunverified

The `confluence-api` package provides a Node.js wrapper for interacting with Atlassian's Confluence REST API. It simplifies common operations such as content retrieval by ID or page title, creating and updating content, managing attachments, labels, and performing searches within Confluence. The current stable version is `1.4.0`. Releases tend to be feature-driven or for dependency maintenance, with no strict time-based cadence, but show active development. This library differentiates itself by offering a straightforward, callback-based interface for Confluence API access, supporting basic HTTP authentication, and including specific configuration options for compatibility with older Confluence instances, such as version 4, via a `version` parameter in its configuration object. It's suitable for backend Node.js applications needing to programmatically manage Confluence content.

npm install confluence-api
INSTALL
IMPORT
SIG · CONFLUENCE-API
C
confluence-api
crm-productivityjavascriptv1.4.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Confluence
const Confluence = require('confluence-api');
import Confluence from 'confluence-api';
This library is primarily a CommonJS module. While ES module syntax might work with bundlers or Node.js's interop features, the intended and documented usage is CommonJS 'require()'.

This quickstart initializes the Confluence API client and demonstrates fetching content by space key and page title. It uses environment variables for sensitive credentials.

const Confluence = require('confluence-api'); const config = { username: process.env.CONFLUENCE_USERNAME ?? 'your-confluence-username', password: process.env.CONFLUENCE_PASSWORD ?? 'your-confluence-api-token-or-password', baseUrl: process.env.CONFLUENCE_BASE_URL ?? 'https://your-instance.atlassian.net/wiki', version: parseInt(process.env.CONFLUENCE_VERSION ?? '0', 10) || undefined // Optional: Set to 4 for Confluence v4, otherwise omit or leave undefined for latest. }; const confluence = new Confluence(config); console.log('Attempting to fetch content by page title...'); confluence.getContentByPageTitle('my-space-key', 'My Page Title', function(err, data) { if (err) { console.error('Error fetching content:', err); // Handle specific error codes or messages from Confluence API return; } // Check if data and results exist before accessing if (data && data.results && data.results.length > 0) { console.log('Successfully fetched content. Stored markup for the first page:'); console.log(data.results[0].body.storage.value); } else { console.log('No content found for the specified space and title.'); } });
Debug
Known issues
gotchaVersion 1.4.0 upgraded the `superagent` dependency to address a reported security vulnerability. Using versions prior to `1.4.0` may expose your application to this vulnerability.
fix
Upgrade to `confluence-api@1.4.0` or later to ensure the patched `superagent` version is used. Run `npm install confluence-api@latest`.
affects: <1.4.0
gotchaWhen targeting older Confluence instances, specifically Confluence v4, you must explicitly set the `version` property in the configuration object to `4` for correct API compatibility.
fix
If connecting to Confluence v4, ensure your configuration includes `version: 4`, e.g., `{ baseUrl: '...', username: '...', password: '...', version: 4 }`.
affects: >=1.0.5
gotchaWhile the library supports direct password authentication, Atlassian recommends using REST API tokens for basic authentication, especially in cloud instances, due to enhanced security and revocability.
fix
Generate a Confluence REST API token from your Atlassian account settings and use it in place of your user password in the `password` field of the configuration object.
affects: All
Errors
Common errors & fixes
Error: Request failed with status code 401 (Unauthorized) or 'Authentication failed'
Incorrect username, password (or API token), or `baseUrl` for your Confluence instance.
fix
Verify that your `username`, `password` (or API token), and `baseUrl` in the configuration object are absolutely correct and that the user has the necessary permissions to access the Confluence instance.
Error: Request failed with status code 404 (Not Found) or 'Content not found'
The specified space key, page title, content ID, or attachment ID does not exist or is inaccessible at the provided `baseUrl`.
fix
Double-check the existence and exact spelling of `space`, `title`, `id`, or `attachmentId` parameters used in your API calls against your Confluence instance.
Upgrade
Version history
1.4.0latest on npm
Audit
Dependencies
superagentrequiredUsed as the underlying HTTP client for making requests to the Confluence API.
Agent activity
43 hits · last 30 days
node
36
Amazon
1
OpenAI (training)
1
Resources
confluence-api — npm install confluence-api · libregistry