Skip to the content.

Table of contents

Triggers doctype

io.cozy.triggers documents are used by the stack to configure how and when a job should be runned.

This is a special doctype which can only be created from an app. We are using it in Cozy-Home to manage konnectors scheduling.

Attributes

Attribute Role
arguments Arguments related to the type attribute. For example it’s a cron configuration when the type is set to @cron.
debounce The debounce parameter can be used to limit the number of jobs created in a burst. It delays the creation of the job on the first input by the given time argument, and if the trigger has its condition matched again during this period, it won’t create another job. Its syntax is the one understood by go’s time.ParseDuration
message Parameters to pass to the the worker. For example, when the worker is set to konnector, message contains the related konnector and the related account.
options Parameters related to the job.
type Type of trigger. Can be @at, @cron, @event, @every, @in and @webhook. See the stack documentation for more informations.
worker Type of worker. Can be konnector or sendmail.

Example

Trigger configured to run the konnector Debug with the io.cozy.accounts document having the id 53fe4d0e4f6d3be99ba7a5d2580081a8.

{
  "type": "@cron",
  "worker": "konnector",
  "arguments": "0 45 4 * * 3",
  "debounce": "",
  "options": null,
  "message": {
    "konnector": "debug",
    "account": "53fe4d0e4f6d3be99ba7a5d2580081a8"
  }
}