I found this code where page creation with subpages is automated via the REST API. I'm interested to know if it's possible to modify this code to work with an event listener. I would like to have a button to create a new page with subpages. If it can't be done via an event listener, could someone explain to me how to integrate this code into a data center to work via an API, activated by a button, and of course, to set the page in the space and the page where the button is located.
Code: https://library.adaptavist.com/entity/project-creator-for-confluence