This page documents a capability that is available under Forge's Early Access Program (EAP). This capability is only available to participants. To join this EAP, refer to the Atlassian Developer Community announcement for instructions.
Forge’s EAP offers experimental features to selected users for testing and feedback purposes. These features are not supported or recommended for use in production environments. They are also subject to change without notice.
For more information, see Forge EAP, Preview, and GA.
This page describes how to migrate Confluence content macros from Connect to Forge.
It also describes the differences between Connect and Forge custom macro data.
After migrating your Connect app's staticContentMacro and dynamicContentMacro modules to Forge macro modules, the Connect macros saved within Confluence pages will invoke the corresponding Forge macro module, along with a migrated version of the Connect app's stored custom data.
To display a Connect macro's data with a Forge macro module, make sure your Forge macro key matches the Connect macro key.
For example, if your Connect app has a macro with key static-macro-key
, your manifest should include this in modules.macro[].key
, like this:
1 2modules: macro: - key: static-macro-key ## Forge macro key - matches Connect macro key function: main # ... remotes: - key: connect baseUrl: https://hello-world-app.example.com app: id: ari:cloud:ecosystem::app/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee connect: key: hello-world ## Target connect app key remote: connect
You can access the Connect app macro config data from your Forge app using the useConfig
hook.
When the Forge macro is invoked, the useConfig
hook returns the key-value pairs of both migrated Connect custom data and the Forge configuration data.
1 2import { useConfig, Text } from '@forge/ui'; const defaultConfig = { // Connect stores and sends custom data as a string connectUsers: 'd937s5q89n47okrxdzv854d5,3stlhnx34at4uusanwtbwnev', // Forge supports array type custom data forgeUsers: ['d937s5q89n47okrxdzv854d5','3stlhnx34at4uusanwtbwnev'] }; const App = () => { // Retrieve the configuration const config = { ...defaultConfig, ...useConfig() } // Use the configuration values return <SectionMessage> <Text>Old value from connect : {config.connectUsers}</Text> <Text>Forge value : {config.forgeUsers.join(',')}</Text> </SectionMessage>; };
Connect custom macro parameters keep their format when passed to a Forge macro module.
For example,
VALUE1,VALUE2
.
,
) this is not escaped, so special handling is needed.Current Space
for the spacekey
parameter type, the Forge app receives the string currentSpace()
, instead of the literal space key.Connect macro parameter | Example | Parameter name |
---|---|---|
attachment | file_name.txt,file_name.json | Same as the Connect parameter identifier |
boolean | true,false | Same as the Connect parameter identifier |
confluence-content | ~123456:SPCKEY:Space Title,~123459:SPCKEY2:Space2 Title | Same as the Connect parameter identifier |
enum | OPTION_1,OPTION_2 | Same as the Connect parameter identifier |
spacekey | currentSpace(),SPACEKEY | Same as the Connect parameter identifier |
username | 5e68dltko888jugaukrgg55e,5d33vdjq0ilg19qyy25ik45v | Same as the Connect parameter identifier |
string | Example input string | Same as the Connect parameter identifier |
urlParameter from autoconvert | https://www.example.com/converted | urlParameter |
plain-text macro body | {\n \"foo\": \"bar\"\n} | __bodyContent |
rich-text macro body | <h1 id="pagetitle-RichTextBody">Rich Text Body</h1><p>Congratulations!</p> | Not supported |
Connect macro variable | Forge product context | Description |
---|---|---|
macro.id | extensionContext.connectMetadata.macroId | The unique ID of the Connect macro. Only exists for migrated Connect macros. |
macro.body | Not supported | The macro body, truncated to 128 characters |
macro.truncated | Not supported | True if the macro body was truncated, false if not |
page.id | contentId | The ID of the content this component appears in |
page.title | Not supported, page information can be fetched using the Confluence API with the contentId . | The page title |
page.type | The page type | |
page.version | The page version | |
space.id | The space ID | |
space.key | spaceKey | The space key |
output.type | Not supported | The output type. For example, display or preview |
Not supported | accountId | The Atlassian ID of the user that interacted with the component |
Not supported | localId | A unique ID for this instance of this component in the content |
N/A | installContext | The ARI identifying the cloud or product context of this component installation |
N/A | extensionContext | Contextual information about the current environment that relates to the extension |
Not supported | license | Whether a paid app is licensed in the installation context. This field is only present for paid apps in the production environment. |
Stored Connect macro data is only converted to the Forge macro format when a user edits the macro and publishes the page.
This means that while it's possible to rollback to a Connect macro module on Forge, only macros that have not been edited by a user can be rolled back to a Connect macro module.
To rollback to a Connect macro module, define the Connect module in your Forge manifest, like this:
1 2connectModules: 'confluence:staticContentMacros': - key: static-macro-key # Add connect macro module back url: /view_macro ... modules: # macro: # Remove the Forge macro to rollback # - key: static-macro-key # function: main # ... ... remotes: - key: connect baseUrl: https://hello-world-app.example.com app: id: ari:cloud:ecosystem::app/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee connect: key: hello-world remote: connect
rich-text
body are not supported in Forge.macroId
is no longer available.export
property of Macro module properties for details.undefined
when migrated.
See Adopting Forge from Connect for all the steps to incrementally start using Forge.
Rate this page: