Automation modules
Bitbucket modules
Common modules
Compass modules
Confluence modules
Jira modules
Jira Service Management modules
Rovo modules
Last updated Nov 11, 2024

Function

The function module is where the app's behavior is defined. Other modules specify the function module that defines the actions to take.

Properties

PropertyTypeRequiredDescription
keystringYes

A key for the module, which other modules can refer to. Must be unique within the manifest and have a maximum of 23 characters.

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

handlerstringYes

A pointer to the function responsible for handling invocations.

Expected format: file.function

For example, jira.issueCreationTrigger calls the issueCreationTrigger function defined in jira.js in the app's src directory.

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

providersProviders

A list of the providers required by the function.

timeoutSecondsintegerNo

The maximum timeout, specified in seconds. This applies only to the scheduled triggers module and the consumer of an asynchronous event. If this parameter is set for a function used by multiple modules, the function timeout will be the lowest timeout value among all modules.

This parameter does not affect functions that are not used as asynchronous event consumers or scheduled triggers.

Valid range: 1 and 900 seconds

Example: If you have a function used by both a scheduled trigger (timeoutSeconds: 300 seconds) and an async event consumer (timeoutSeconds: 120 seconds), the function will timeout after 120 seconds, because that’s the lowest value.

runtimeRuntimeNoOverride Forge runtime configuration defined in app.runtime. For now, only memoryMB property is allowed.

Example

1
2
modules:
  function:
    - key: main
      handler: index.run
      runtime:
        memoryMB: 1024

Provider reference

1
2
export interface ProviderReference {
  provider: string;
  requiredScopes?: string[];
}
PropertyTypeRequiredDescription
authList<ProviderReference|string>Yes

A list of keys or objects referencing authentication providers.

Using requiredScopes in the reference object also allows you to specify scopes that must be granted by the external provider before invocation. If any of these specified scopes are not granted, the request will trigger the OAuth 2.0 consent flow, and the actual function code will not be invoked. This provides a better performance over using requestCredentials in the code.

Example

1
2
function:
  - key: google-macro
    handler: index.google_macro
    providers:
      auth:
        - provider: google
          requiredScopes:
            - "https://www.googleapis.com/auth/userinfo.profile"
            - "https://www.googleapis.com/auth/userinfo.email"
  - key: dropbox-macro
    handler: index.dropbox_macro
    providers:
      auth:
        - dropbox

Rate this page: