Event when confluence page is updated

Looking at Refresh jira:issueContext when users changes workflow - #2 by dmorrow, there is a way to subscribe to events in Jira to be notified when the Jira issue is updated.

import {events} from "@forge/bridge";
...
useEffect(() => {
  events.on('JIRA_ISSUE_CHANGED', () => {
      someFunction();
  });
}, []);

Question: is there a similar event when a Confluence page is updated ?
Bonus question: Where is the list of events we can subscribe to ?

1 Like

I believe you’re looking for this: https://developer.atlassian.com/platform/forge/events-reference/confluence/

Specifically, the avi:confluence:updated:page event.

1 Like

Thanks @rcsr but that is not what I’m referring to.
I was talking about the Forge frontend events, not the backend events we can subscribe to.

The event JIRA_ISSUE_CHANGED is emitted in the Frontend and can be caught by any Forge jira module to get notified of the change.

I’m really looking for a JIRA_ISSUE_CHANGED equivalent for confluence. I want to update the content of a macro when the Confluence page has been updated.

2 Likes

Hi @FabienLydoire
Currently, Confluence does not offer a direct way to subscribe to content changes on the front-end. However, we’ve developed a practical workaround to achieve similar functionality in one of our apps:

  1. Initial Page Versioning: When the front end is loaded, save the current version of the page.
  2. Long Polling for Updates: Implement a long polling mechanism to make a REST call that retrieves the latest version of the page. If the latest version is higher than the previously saved version, this indicates that the content has been updated.
  3. Trigger Notifications: Based on the updated content, apply any necessary changes, such as notifying the user or updating the display.
2 Likes

Thanks @AndreiPisklenov, that’s a nice workaround you proposed.

I wish Atlassian Team would answer this thread. If not, I’ll fill in a support ticket.
After all, switching to client/server arch with uikit2 makes those event mechanisms a necessity.

Hey @FabienLydoire I was also looking for something like that - for Jira.

It is said that each module can receive some specific set of events - if some e.g. https://developer.atlassian.com/platform/forge/manifest-reference/modules/jira-issue-panel/#events

Filled ECOHELP-54524 ticket.
Let’s wait and see :eyes:

1 Like

Great, thank you @FabienLydoire

Unfortunately no access for my user okosar@brizoit.com - to see details of the ticket

I’ll keep you posted :wink:

1 Like

Answer from Atalssian on my ECOHELP ticket.

Currently, only the JIRA_ISSUE_CHANGED event is supported in the front-end context and captures both issue updates and commented events. This is provided to display the up-to-date data to the user. If the issue is updated while the user is viewing it, you can use this event to refresh the data displayed by your app. It can also be used if the app is dependent on the issue state that might be updated by the user to avoid displaying stale information to the user.

Other events that we support via product triggers (such as issue created, project events, etc.) make less sense in this context. If you want to consume other events that are supported via product triggers from a front-end context, you’d probably want to consume them via a product trigger and store them, then poll them via a resolver.

:man_shrugging:t2:
I’m not really satisfied. Here is my answer.

As you mentioned, the product triggers are occurring server side and there is no efficient mechanism to get those events to the client: polling is really a very poor workaround.

We are aiming at making the best Forge applications for our customers, and this implies having rich UI client side. It would really help if there were a wide set of events on the client side we can subscribe to.

Also I’m not the first developer asking for a built-in mechanism to send events to the frontend from the backend (resolver) side of things (maybe using web sockets or similar ?).

1 Like

Thank you for the update @Fabien.
The Forge demo app is confusing then, so you are expecting after it to have subscription functionality working - not only this case :slight_smile:

I share the opinion in your response.

Atlassian support engineer created a ticket to enhance Client-Side Event Handling in UI Kit 2: https://jira.atlassian.com/browse/ECO-631

Vote if you want to support this initiative ! :slight_smile:

See also Jira