Confluence Macro to pull the page body content and pass it to a REST API

Hi Team,

We have a requirement where we need to pass the confluence page body content when a user clicks on certain icon .

The flow would be :

  1. We will add a icon in the header section of confluence view page .
  2. Once the user clicks on that icon , the page body content should be passed to an external Rest API .

Could you please help to suggest which type of plugin module will be helpful in this case ? Can be this developed with confluence user macro feature ? If yes , Can you share any documentation to start with ?

Thanks & Regards