Developer
Get Support
Sign in
Get Support
Sign in
DOCUMENTATION
Cloud
Data Center
Resources
Sign in
Sign in
DOCUMENTATION
Cloud
Data Center
Resources
Sign in
Automation modules (Preview)
Bitbucket modules
Common modules
Compass modules
Confluence modules
Dashboard modules (EAP)
Jira modules
Jira Service Management modules
Jira Software modules
Rovo modules
Teamwork Graph modules
Last updated Nov 11, 2024

Trigger

The trigger module invokes a function or calls a remote backend when an Atlassian app event, Forge app event, Forge app lifecycle event, or data security policy event is fired.

Properties

PropertyTypeRequiredDescription
key

string

Yes

A key for the module, which other modules can refer to. Must be unique within the manifest.

Regex: ^[a-zA-Z0-9_-]+$

functionstringRequired if using triggers.A reference to the function module that defines the module.
endpointstring

A reference to the endpoint that specifies the remote back end that receives the event if you are using Forge Remote to integrate with a remote back end.

Required if no function is specified.

eventsArray<string>YesA list of Atlassian app events that trigger the function or endpoint.
filterFilterNoA set of options to prevent invoking a function or endpoint.

Filter reference

PropertyTypeRequiredDescription
ignoreSelfbooleanThe filter property must have either ignoreSelf or expression or both of them defined.

Ignore self-generated events.

For example, an app updates an issue and ignores the avi:jira:updated:issue event that is generated by this operation.

Note that currently ignoreSelf only works with Jira events.

expressionstring

An expression used to filter out unwanted events.

For example, instead of listening to all avi:jira:updated:issue events, an app can listen to events only from specific projects.

onErrorenumNo

Specify what should happen when an error occurs while evaluating the expression. You can either invoke a function or call a remote backend and publish app logs.

Can be used only with the expression property.

The possible values are:

  • (default) IGNORE_AND_LOG - don't invoke a function or call a remote backend; publish a log.
  • IGNORE - don't invoke a function or call a remote backend; don't publish a log.
  • RECEIVE_AND_LOG - invoke a function or call a remote backend; publish a log.
  • RECEIVE - invoke a function or call a remote backend; don't publish a log.

Function arguments

When your trigger function is invoked, it receives two arguments:

1
2
export async function myTriggerFunction(event, context) {
  // Handle the event
}

Arguments

  • event: A payload detailing the event that occurred. The structure depends on the specific event type. See the documentation for each event for detailed payload descriptions.
  • context: Additional information about the context the event occurred in. Refer to Context Schema for complete details.

Context object properties

The context object contains information about the environment and installation where the trigger was invoked:

PropertyTypeDescription
principalPrincipal | undefinedThe principal containing the Atlassian ID of the user that interacted with the component.
installContextstringThe ARI identifying the cloud or Atlassian app 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.

For complete context schema details and TypeScript definitions, see Function Arguments.

Example

1
2
modules:
  trigger:
    - key: issue-updated-trigger-with-ignore-self-and-expression
      function: main
      events:
        - avi:jira:updated:issue
      filter:
        ignoreSelf: true
        expression: event.issue.fields?.issueType.name == 'Bug'
        onError: RECEIVE_AND_LOG
  function:
    - key: main
      handler: index.run

Rate this page: