Rate this page:
This tutorial walks through creating a Forge app to display content on a Confluence page.
Complete Getting started before working through this page.
Create an app based on the confluence macro template.
Note, Forge provides multiple environments where you deploy the app. This tutorial uses the CLI default, the environment. See Environments to learn more.
Note, the CLI uses keychain to securely store your login details. If you see a prompt for keychain access when running a command, approve it to allow the CLI to run the command.
Create your app by running:
The confluence-macro template uses Node.js and has the following structure:
1 2 3 4 5 6 7
hello-world-app |-- src | `-- index.jsx |-- manifest.yml |-- package.json |-- package-lock.json `-- README.md
Let’s have a look at what these files are:
This app displays content within a Confluence page using a . Confluence shows the title of the macro in the quick insert menu when you add the app to a page. Let's change the title to include your name.
Your file should look like the following, with your values for the title and app ID.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
permissions: scopes: - 'read:confluence-content.summary' modules: macro: - key: hello-world-app-hello-world function: main title: Forge app for Mia description: Inserts hello world! function: - key: main handler: index.run app: id: '<your app id>' name: hello-world-app
Deploy your app, with the command, any time you make changes to the code. This command builds your code and reports any compilation errors.
Install your app, with the command, when you want to install your app on a new site. Note, once the app is installed on a site, the site picks up the new app changes you deploy without needing to run the install command again.
In the Forge environment, your app is deployed with all available OAuth scopes. Later in this tutorial, you’ll learn how to restrict your app to request just the access it needs.
Navigate to the app's top-level directory and deploy your app by running:
Install your app by running:
With your app installed, it’s time to see the app on a page.
Publish the page.
Your hello world app is now installed into your development site. The app should display on the page like the image below.
See Part 2: Call a Confluence API to learn how to call a product API from your app.
Rate this page: