Triggering Forge Macro Update


I have multiple macros in confluence where some do updates and others are just for viewing. I want to put updating macros in same page as viewing macros and see them live updating aka re-rendering.

What have I done so far:

  1. Tried content property - this is not gonna fly since keys are prefix with forge-{localId} (as far as I understand it is somewhat like a macro instance id)
  2. Tried space property - this allows me to share data between both macro instances, but there are no live updates. It seems that content and space property hooks are just wrapped REST requests and therefore they are not triggered when they change from outside.
  3. Looked into triggers and events - I can add a trigger that will call a function, but this is not relevant to actual macro instance.
  4. Polling/ long polling goes out of the window since setTimeout, setInterval is not working and lambda has some running time limits (as I read somewhere 10 seconds)
  5. Storage and other apis does not have any listeners

I have ran out of ideas.

Is a refresh button the best I can do?

And if so are there any plans to have such mechanisms that will trigger macro updates in same page?


To answer my own question. I can create custom UI and in the react app use setInterval/setTimeout to poll the backend with import { invoke } from "@forge/bridge";

IMO question is somewhat answered since solution involves custom UI, but not the UI Kit.

Well since the macro is built using custom UI you can use external services and Websockets in your app. So something like or even Firebase Firestore would be your best bet.

1 Like