Welcome, developers! Ready to extend the power of Compass by writing your own integrations? Have an another tool or data source you want to connect to Compass? You've come to the right place.
There are two ways to get started:
Use the Atlassian Forge developer platform to write and deploy apps in Compass. Forge apps run on Atlassian infrastructure and can call Compass APIs and customize the Compass user interface.
Call the Compass GraphQL API directly from your own application.
Need help? Checkout these helpful links or reach out on the Compass community.
Here, we'll explore of creating Forge apps for Compass. Refer to the Forge documentation for a compete reference guide.
If you don't already have a Compass site, get started for free.
Follow the Forge getting started guide to install the Forge CLI in your local environment. This guide will walk you through getting an API token for your Compass site and help you with the forge login
process which needs to be done before you can do the below.
1 2forge create
1 2forge deploy
1 2forge install
src/component-page.js
and changing the "Hello world!" text to something else.forge deploy
again.Forge modules let you extend the user interface and functionality of your app. Modules are defined in the file manifest.yml
at the root of your project.
The module definition refers to a handler function for the module. For example, in the example app you created above, the handler component-page.run
refers to the run
function exported in the file src/component-page.js
. Each time you add a module to your manifest, you'll add a corresponding handler function to your project.
Here are a few examples of useful modules for Compass:
See the Forge modules reference for a list of all the available modules.
The ability to access UI extensions in Compass depends on your user role. Product admins can access all extensions, while full users can access some extensions. Basic users can't access any extensions in Compass.
Before your app can call Compass APIs, you'll need to add permissions to the manifest.yml
file. For example, to enable your app to read and write Compass component data, you'll need to add these lines to your manifest:
1 2permissions: scopes: - "read:component:compass" - "write:component:compass"
See the Forge permissions reference for a list of all the available permissions; Compass scopes here.
After updating the manifest to include new permissions, update your existing app installation with this command:
1 2forge install --upgrade
Your app can read and write data from the Compass API if it has the correct permissions. Compass provides a GraphQL API Toolkit to simplify common operations like creating, updating, and deleting components. Get it with npm install @atlassian/forge-graphql
.
For an example of how to use the GraphQL API Toolkit, see the Compass metrics and events ingestor sample app.
As an alternative, you can also make calls directly to the GraphQL API using the requestGraph method in the Forge product fetch API.
Your app can store and retrieve its own data using Forge's Storage API. You'll need to declare this additional permission in your manifest.yml
to use the Storage API:
1 2permissions: scopes: "storage:app"
After updating the manifest to include new permissions, update your existing app installation with this command:
1 2forge install --upgrade
Now that you've learned the basics about the Forge platform, here are more helpful resources:
As an alternative to building a Forge app that runs within Compass, you may want to call the GraphQL API directly from your own application. The GraphQL API reference provides a comprehensive guide to Compass queries and mutations. You can use the API explorer to get acquainted with the Compass API.
As a starting point, here's an example query that fetches data about a Compass component. In the API explorer, paste this code into the main query window:
1 2query getComponent($componentId: ID!) { compass { component(id: $componentId) { __typename ... on CompassComponent { name type } } } }
In the query variables window, paste this code, substituting an existing Compass component ID:
1 2{ "componentId": "your-component-id-here" }
Now you can press the execute query button (triangle icon) at the top of the page. Details about your component will appear in the righthand window.
Have a question? Need help developing your app? Working on an integration that you'd like to distribute more broadly? We'd love to hear from you! Hit the "Give Feedback" button at the top of Compass.
Rate this page: