Perform read and write operations on a Confluence page from a Jira Plugin

Hello all,

Would appreciate some advice.

Context:
A user creates a Jira ticket. From this ticket they perform a transition that calls a custom plugin. We will call the transition “Create Calendar”.

The plug in should access a confluence page called Calendar Template, make a copy of it, and save it. I will leave it it that for now.

What is the best way to go about this?

Edit: Previous problem fixed, but still require a hint.

  1. Configure workflow transition to have a post function, that generates an event.
  2. Plugin listens to said event. https://developer.atlassian.com/server/jira/platform/writing-jira-event-listeners-with-the-atlassian-event-library/
  3. Plugin uses Confluence Server REST API to get the content required.
  4. Plugin saves the data, with https://developer.atlassian.com/server/framework/atlassian-sdk/store-and-retrieve-plugin-data/ or What is the best way to store data in a Jira Plugin? - #3 by t.neychev