Developer
Documentation
Resources
Get Support
Sign in
Developer
Get Support
Sign in
DOCUMENTATION
Cloud
Data Center
Resources
Sign in
Developer
Sign in
DOCUMENTATION
Cloud
Data Center
Resources
Sign in
Framework overview
Building blocks
Security for Connect apps
Modules
JavaScript API
Last updated Oct 3, 2025

Ending Connect support

Have an existing Connect app? You can incrementally migrate it to Forge.

Confluence

A Confluence specific JavaScript module which provides functions to interact with the macro editor.

Methods

saveMacro (macroParameters, macroBody)

Save a macro with data that can be accessed when viewing the confluence page.

Parameters

Name Type Description

macroParameters

Object

data to be saved with the macro.

macroBody

String

the macro body to be saved with the macro. If omitted, the existing body will remain untouched.

Example

1
2
    AP.confluence.saveMacro({foo: 'bar'});
    
    AP.confluence.saveMacro({foo: 'bar'}, "a new macro body");

closeMacroEditor()

Closes the macro editor, if it is open.

This call does not save any modified parameters to the macro, and saveMacro should be called first if necessary.

Example

1
2
    AP.confluence.closeMacroEditor();

getMacroData (callback)

Get the data saved in the saveMacro method.

Parameters

Name Type Description

callback

function

callback to be passed the macro data.

Example

1
2
    AP.confluence.getMacroData(function(data){
      alert(data);
    });

getMacroBody (callback)

Get the body saved in the saveMacro method.

Parameters

Name Type Description

callback

function

callback to be passed the macro data.

Example

1
2
    AP.confluence.getMacroBody(function(body){
      alert(body);
    });

onMacroPropertyPanelEvent (eventBindings)

Provide handlers for property panel control events

Event name components :

  • control-key: "key" property provided for the custom control declared in the JSON descriptor
  • event-type: type of user interaction, as described below
  • macro-key: "key" property provided for the macro declared in the JSON descriptor

Event types :

  • click: the property panel control was clicked by the user

Parameters

Name Type Description

eventBindings

Object

An object which specifies property panel events as keys and handler functions as values. The handler does not take any arguments.

Example

1
2
    AP.confluence.onMacroPropertyPanelEvent({
      "{event-type}.{control-key}.{macro-key}.macro.property-panel": function() {
        // handle button click
        AP.confluence.closePropertyPanel();
      }
    });

closeMacroPropertyPanel()

Closes the macro property panel, if it is open.

Example

1
2
    AP.confluence.closeMacroPropertyPanel();

getContentProperty (key, callback)

⚠️ Deprecated: Use getContentPropertyV2 instead.

Provides the Content Property with the given key, on the current Content, to the callback.

Parameters

Name Type Description

key

String

the key of the property to retrieve

callback

function

callback to be passed the content property

Example

1
2
    AP.confluence.getContentProperty('propertyKey', function(property) {
      alert(property);
    });

setContentProperty (contentProperty, callback)

⚠️ Deprecated: Use postPropertyToServerV2 or updatePropertyToServerV2 instead.

Sets the provided Content Property against the current Content, sending the result to the callback.

Parameters

Name Type Description

contentProperty

confluence~ContentProperty

the content property to create or update

callback

function

callback to be passed the result

Example

1
2
    AP.confluence.setContentProperty({
      key: 'propertyKey',
      value: 'propertyValue',
      version: {
        number: 2
      }
    }, function(result) {
       alert(result.property); // the updated property, if successful
       alert(result.error);    // if unsuccessful, the reason for the failure
    });

syncPropertyFromServer (key, callback)

⚠️ Deprecated: Use syncPropertyFromServerV2 instead.

Raise contentProperty.update event for the Content Property with the given key on the current Content. It also provide content property to the callback like getContentProperty does.

Parameters

Name Type Description

key

String

the key of the property to retrieve

callback

function

callback to be passed the content property

Example

1
2
    AP.confluence.syncPropertyFromServer('propertyKey', function(property) {
      alert(property);
    });

getContentPropertyV2 (id, callback)

Gets the provided Content Property against the current Content using V2 API, sending the result to the callback. If you also want to update any listeners who is interested in contentProperty.update event, you should use syncPropertyFromServerV2 instead.

The returned object may be null if no Content Property exists.

Parameters

Name Type Description

id

String

the id of the property to retrieve

callback

function

callback to be passed the content property

Example

1
2
    AP.confluence.getContentPropertyV2('propertyId', function(property) {
      alert(property);
    });

syncPropertyFromServerV2 (id, callback)

Both getContentPropertyV2 and syncPropertyFromServerV2 would get the content property from the server, In addition, this method also trigger contentProperty.update event if value of property has changed.

Parameters

Name Type Description

id

String

the id of the property to retrieve

callback

function

callback to be passed the content property

Example

1
2
    AP.confluence.syncPropertyFromServerV2('propertyId', function(property) {
      alert(property);
    });

postPropertyToServerV2 (contentProperty, callback)

Posts a new provided Content Property against the current Content using V2 API, sending the result to the callback.

Parameters

Name Type Description

contentProperty

confluence~ContentProperty

the content property to create

callback

function

callback to be passed the result

Example

1
2
    AP.confluence.postPropertyToServerV2({
      key: 'propertyKey',
      value: 'propertyValue'
    }, function(result) {
       alert(result.value); // the created property, if successful
       alert(result.error);    // if unsuccessful, the reason for the failure
    });

updatePropertyToServerV2 (id, contentProperty, callback)

Updates the provided Content Property against the current Content using V2 API, sending the result to the callback.

Parameters

Name Type Description

id

String

the id of the property to update

contentProperty

confluence~ContentProperty

the content property to update, with the updated version number

callback

function

callback to be passed the result

Example

1
2
    AP.confluence.updatePropertyToServerV2('propertyId', {
      key: 'propertyKey',
      value: 'propertyValue',
      version: {
        number: 2
      }
    }, function(result) {
       alert(result.value); // the updated property, if successful
       alert(result.error);    // if unsuccessful, the reason for the failure
    });

Types

ContentProperty

A JavaScript object that defines a content property.

Properties

Name Type Description

key

String

the key of the property to create or update

value

String|Object

the value of the property - may be a String or JavaScript object

version

ContentProperty~version

a JavaScript object that defines the version of the content property

ContentProperty~version

A JavaScript object that defines the version of a content property.

Properties

Name Type Description

number

number

the version number of the content property

Rate this page: