The scheduledTrigger
module repeatedly invokes a function on a scheduled interval. Each trigger
is scheduled to start shortly after it is created, about 5 minutes after app deployment.
It then runs based on the configured interval hour
, day
, or week
.
Forge invocation limits also apply to web triggers (scheduled and unscheduled). Refer to our platform invocation limits for more details.
Every time any changes are made to any scheduled triggers module
, all scheduled triggers will be
recreated and their start times reset.
Scheduled triggers run without a user context, which means the principal
field of the
context
argument doesn't represent a user. If a function invoked from a scheduled trigger
returns a value, it is ignored. If the function throws an error, nothing will happen,
and the function invocation will not be retried. The function will be invoked the next time the
schedule is due.
Apps can declare up to five scheduled triggers in the manifest.yml
file.
Not all invocations for a single scheduled trigger will happen at once. To better improve overall performance,
invocations will be distributed in batches evenly across the interval specified on any given module
. Distribution is done
by installations, so not all installations of an app will have their triggers invoked together. This is however a
consistent distribution, meaning that if an hourly trigger invokes at 1:10 for a particular installation, and
at 1:20 for another, those installations will invoke again at 2:10 and 2:20 respectively.
There is a small chance of duplicated invocations, such scenarios should be handled in the apps code by the app developer.
For step-by-step instructions on how to use this module type, see the following tutorials:
Property | Type | Required | Description |
---|---|---|---|
key |
| Yes |
A key for the module, which other modules can refer to. Must be unique within the manifest. Regex: |
function | string | Required if using UI Kit 1 or triggers. | A reference to the function module that defines the module. |
endpoint | string | Yes (if no | A reference to the |
interval | 'hour' , 'day' , 'week' | Yes | The interval at which to invoke the function. |
1 2modules: scheduledTrigger: - key: example-scheduled-trigger function: my-scheduled-function interval: hour # Runs hourly function: - key: my-scheduled-function handler: index.trigger
Handler function in index.js
1 2// index.js export const trigger = ({ context }) => { console.log('Scheduled trigger invoked'); console.log(context); // Add your business logic here };
Rate this page: