The updateBylineProperties
function allows you to programmatically update the title
, icon
and tooltip
values for confluence:contentBylineItem
Forge apps. This function is available in @forge/confluence-bridge
version 3.1.0
and above.
While this function updates the byline properties, it does not update the values stored in the content key. You will need to make a separate call to the content property API to persist these values.
This function must be called in an app outside of confluence:contentBylineItem
, but rendered on the same page, like:
confluence:backgroundScript
confluence:pageBanner
macro
The updateBylineProperties
function accepts the following parameters:
Name | Type | Description |
---|---|---|
propertyKey | string | The key of the content property which stores the title , icon , and tooltip byline properties. This should match the byline module contentPropertyKey in the manifest. |
valueUpdate | { title?: string, icon?: string, tooltip?: string } | An object containing the updated values of the byline properties. If none is supplied, the app will fallback to using default byline properties. |
This example shows how to use updateBylineProperties
:
1 2import { updateBylineProperties } from '@forge/confluence-bridge'; import { requestConfluence } from '@forge/bridge'; // POST request to make contentProperty, e.g. const bodyData = `{ "key": "byline-property-unique-key" }`; const response = await requestConfluence(`/wiki/api/v2/pages/{page-id}/properties`, { method: 'POST', headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' }, body: bodyData }); // PUT request to update contentProperty with new values bodyData = `{ "key": "byline-property-unique-key", "value": { "title": "Updated title", "icon": "updated-image.png", "tooltip": "Updated tooltip" }, "version": { "number": 2, "message": "updated values" } }`; const response = await requestConfluence(`/wiki/api/v2/pages/{page-id}/properties/{property-id}`, { method: 'PUT', headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' }, body: bodyData }); // Calling updateBylineProperties to programmatically update the byline properties const propertyKey = 'byline-property-unique-key' const valueUpdate = { title: 'Updated title', icon: 'updated-image.png', tooltip: 'Updated tooltip' }; await updateBylineProperties({ propertyKey, valueUpdate });
The updateBylineProperties
function return type is Promise
.
Rate this page: