Runtimes
Web triggers
Async functions
Product REST APIs
Fetch APIs

Function Arguments

Forge functions recieve two arguments, a module specific payload and an object containing contextual information for the function invocation.

1
2
export const handler = (payload, context) => {
  // Do something
}

Functions implemented with @forge/resolver resolver definitions receive arguments differently.

Payload Schema

The payload is entirely module specific, for example a webtriggers request.

Context Schema

Context is the same for all modules.

1
2
export type Context = {
  installContext: string;
  principal?: Principal;
  license?: License;
  installation?: Installation;
  workspaceId?: string;
}

export type Principal = {
  accountId: string;
}

export type License = {
  isActive: boolean;
  billingPeriod?: string | null;
  capabilitySet?: string | null;
  ccpEntitlementId?: string | null;
  ccpEntitlementSlug?: string | null;
  isEvaluation?: boolean | null;
  subscriptionEndDate?: string | null;
  supportEntitlementNumber?: string | null;
  trialEndDate?: string | null;
  type?: string | null;
};

export type Installation = {
  ari: InstallationAri;
  contexts: ContextAri[];
}

export type InstallationAri = {
    installationId: string;
    toString: () => string;
};

export type ContextAri = {
  cloudId?: string;
  workspaceId?: string;
  toString: () => string;
}
PropertyTypeDescription
principalPrincipal | undefinedThe principal containing the Atlassian ID of the user that interacted with the component.
installContextstringThe ARI identifying the cloud or product context of this component installation.
workspaceIdstring | undefinedThe ID of the workspace on which the extension is working.
licenseLicense | undefinedContains information about the license of the app. This field is only present for paid apps in the production environment.
license is undefined for free apps, apps in DEVELOPMENT and STAGING environments, and apps that are not listed on the Atlassian Marketplace.
installationInstallation | undefinedA summary of the app installation, including the installation ARI and the contexts where the app is installed.

Rate this page: