The invokeRemote
bridge method enables apps to integrate with remote backends
hosted outside the Atlassian platform.
Requests are validated and hydrated with required authentication (e.g. OAuth tokens if configured) before being proxied from Forge to the remote server. The HTTP response is validated before being returned to the frontend.
To use the invokeRemote
bridge method, you need to define an endpoint
for your back end in the manifest.yml
file.
1 2interface InvokeRemoteInput { path: string; method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH'; headers?: Record<string, string>; body?: unknown; } function invokeRemote( input: InvokeRemoteInput ): Promise<{ [key: string]: any } | void>;
baseUrl
of the remote.A Promise
that resolves with the data returned from the invoked endpoint:
content-type
header must be application/json
.Promise
.headers
properties.Promise
will reject and a corresponding error message will be returned.Further information about the Forge Remote invocation contract can be found here.
Making a POST
request to a remote endpoint:
1 2import { invokeRemote } from "@forge/bridge"; const res = await invokeRemote({ path: `/tasks/`, method: 'POST', headers: { x-header-key: 'x-header-value', }, body: { department: 'Ecosystem', team: 'Forge', description: 'Write docs' } }); console.log(`Created task: ${JSON.stringify(res.task)}`);
Making a GET
request to a remote endpoint:
1 2import { invokeRemote } from "@forge/bridge"; const res = await invokeRemote({ path: `/tasks/?team=Forge`, method: 'GET' }); console.log(`Tasks: ${JSON.stringify(res.body[0])}`);
Rate this page: