This section describes a Forge preview feature. Preview features are deemed stable; however, they remain under active development and may be subject to shorter deprecation windows. Preview features are suitable for early adopters in production environments.
We release preview features so partners and developers can study, test, and integrate them prior to General Availability (GA). For more information, see Forge release phases: EAP, Preview, and GA.
You can call your remote backend from your Forge functions. The diagram below illustrates the data flow.
To call your remote backend from a function you need to define a remote in your manifest.yml
.
Here's an example of how to set up your manifest:
1 2modules: trigger: - key: update-issue function: main events: - avi:jira:updated:issue function: - key: main handler: index.run remotes: - key: remote-app-node baseUrl: https://forge-remote-refapp-nodejs.services.atlassian.com operations: - compute auth: appSystemToken: enabled: true
To call your remote from a function, you can use the invokeRemote method from the @forge/api
package. This function allows you to make HTTP requests to your remote backend.
For example, a GET
request to a remote endpoint could look like this:
1 2import { invokeRemote } from "@forge/api"; const res = await invokeRemote('remote-app-node', { path: `/tasks/?team=Forge`, method: 'GET' }); if (!res.ok) { throw new Error(`invokeRemote failed: ${res.status}`); } const json = await res.json(); console.log(`Tasks: ${JSON.stringify(json)}`);
You will need to verify the requests received by your remote came from Atlassian and are intended for your app. For more information on how to do this, see Verifying remote requests.
Now that you’ve verified the requests and have received your access tokens, you can:
Rate this page: