Skip to content
Snippets Groups Projects
index.md 1.13 KiB
Newer Older
  • Learn to ignore specific revisions
  • Yoan VALLET's avatar
    Yoan VALLET committed
    In order to build an automated task within our cozy-stack, we can create *services* which are javascript files called from a trigger job.
    
    For instance on Ecolyo, to schedule a mail that alert the user that a new **monthly report** is available in the application, we add a trigger that is launched every month with a *cron* attribute. On that trigger we link a .js script then we instanciate this script with cozy-client.
    
    # Configuration
    ## Manifest
    The service should be described in the manifest.webapp file. it should defined the type, the file and the trigger. See more information in the official doc of Cozy [here](https://docs.cozy.io/en/howTos/dev/services/)
    
    Here is an exemple of service declaration in the ecolyo manifest:
    
    ![Manifest.webapp](/img/services/monthly-service.png)
    
    File location is determined after the build, see [here](https://forge.grandlyon.com/web-et-numerique/llle_project/ecolyo/-/tree/build/services/monthlyReport).
    
    !!! note "Cron"
        See the cron definition at [cozy-stack](https://docs.cozy.io/en/cozy-stack/jobs/#cron-syntax).
    
    # Ecolyo services
    Service code are located under **src\targets\services**.