Forge Macro - get macro body

Hello guys. I have been trying to work on an app providing a macro functionality for some time in the Forge platform and can feel it is still limited in the area of macros.

Now I am trying to get the macro body through the rest api endpoint like this - https://itsgoodtobetrue.atlassian.net/wiki/rest/api/content/70778939/history/1/macro/id/e3087929-2c72-4613-b25d-6c68d0a53908 based on the information I get from the “get content” endpoint.

{
  id: 70778939,
  version: {
    number: 1,
    message: '',
    minorEdit: false,
    createdAt: '2023-03-17T11:34:32.584Z'
  },
  parentIdString: '71041041',
  idString: '70778939',
  spaceIdString: '33030',
  title: 'Hello',
  status: 'CURRENT',
  body: {
    atlas_doc_format: {
      value: '{"type":"doc","content":[{"type":"paragraph","content":[{"type":"inlineExtension","attrs":{"extensionType":"com.atlassian.ecosystem","extensionKey":"e6b0f129-11da-48b1-a888-a0c830c25bfd/70d79a7c-01d4-4bfb-b741-dcbe3956f00f/static/macro-automatic-labels","text":"macro-test (Development)","parameters":{"localId":"e3087929-2c72-4613-b25d-6c68d0a53908","extensionId":"ari:cloud:ecosystem::extension/e6b0f129-11da-48b1-a888-a0c830c25bfd/70d79a7c-01d4-4bfb-b741-dcbe3956f00f/static/macro-automatic-labels","extensionTitle":"macro-test (Development)"},"localId":"973a5563-4ded-4d31-bfa5-72f68e882348"}}]}],"version":1}',
      representation: 'ATLAS_DOC_FORMAT'
    }
  },
  parentId: 71041041,
  spaceId: 33030,
  createdAt: '2023-03-17T11:34:23.006Z'
}

But it still returns it could not findy any macro on the particular page. Am I missing anything? Let’s say the macro is supposed to just display one of few statuses (depending on its config) and I would like to have the ability to see (through rest) for the particular page the particular status provided by the macro. Is there any other way how to achieve it? Thank you for your time.

I managed to do it with the MacroConfig - when some value is set there - it is shown in the page content :slight_smile:

hi,
I am interested in implementing a similar solution. Could you please provide a detailed explanation of how you achieved this using macroConfig?

Hello, as far as I remember we were able to set the Marcro configuration by the config property you can set in the manifest file (https://developer.atlassian.com/platform/forge/manifest-reference/modules/macro/). It references the function module that defines the macro configuration.

For example:

const Config = () => {
  return (
    <Fragment>
      <MacroConfig>
        <CheckboxGroup label="Automatic" name="newValue">
          <Checkbox value="true" label="Checkbox label" />
        </CheckboxGroup>
      </MacroConfig>
    </Fragment>
  );
};

when you work with the Macro UI - the set value should be available through:  
const config = useConfig(); // @forge/ui function

When some macro values are set this way - you should be able to see the Macro informations within the page content then!