Rate this page:

Web trigger API

The web trigger runtime API can be used to programatically obtain web trigger URLs within your app.

Learn more about web triggers.

Import the Forge API package in your app, as follows:

1
import { webTrigger } from "@forge/api";

webTrigger.getUrl

Obtain the URL for the web trigger module specified by the given module key.

The web trigger URL is stable for each combination of:

  • module key
  • app
  • site
  • product
  • Forge environment

For example, redeploying a new version of your app to the Forge production environment does not change the web trigger URL. However, the web trigger URL for the same app in the development environment is different.

Method signature

1
webTrigger.getUrl(moduleKey: string): Promise<string>;

Example

In your manifest file, you'll need to have a web trigger module defined:

1
2
3
4
5
6
7
modules:
  webtrigger:
    - key: example-web-trigger-key
      function: web-trigger-function
  function:
    - key: web-trigger-function
      handler: index.runWebTrigger

Obtain the URL for this web trigger within a function by specifying the web trigger module key:

1
await webTrigger.getUrl("example-web-trigger-key");

Rate this page: