How can I call an external api and display its result in confluence page UI?

I am new to atlassian development. I want to call an external api via http, and display its result in confluence page UI. I want that every new page that is created in confluence of my organization has this section with a link/button to call the external api, and on click display the results on confluence UI.

Can I write a small Javascript/ client side script or macro for it? OR
do i have to create a forge application? Also how is forge application integrated in the confluence environment? Please share direction to look into.

For anyone looking to get started following steps helped me -

  1. Forge prompts you to select a template to help you start building the app. select the category UI kit and then the template confluence-content-byline. (You can select from any confluence module where you want your app to run on UI - https://developer.atlassian.com/platform/forge/manifest-reference/modules/confluence-content-action/. This is where your app will be placed for some action/ click on UI.)
  2. Update the manifest to include the required permissions manifest.yml
modules:
  jira:issuePanel:
    - key: my-test-panel
      function: main
      title: testApp
      icon: https://developer.atlassian.com/platform/forge/images/icons/issue-panel-icon.svg
  function:
    - key: main
      handler: index.run
permissions:
  scopes:
    - 'read:jira-work' // if you want to read from jira page 
  external:
    fetch:
      backend:
        - 'myapiurl.com' // give permission to external app url
app:
  id: <your-app-id>
1 Like