Skip to content

Workflows

TechieGuy12 edited this page Jul 12, 2024 · 2 revisions

Note

Workflows are available in version 2.x and higher.

Workflows provide a way of executing a series of steps in a specific order. Each step of a workflow can contain an action, command or notification, but only one of each can be added to a step.

Multiple workflows can be added to a watch.

Two child elements can be specified under a <workflows> element. These elements are <workflow> and <variables>. The <workflow> element specifies a single workflow with the list of steps that will be executed for that workflow.

Structure

<watches>
    <watch>
        <workflows>
            <variables></variables>
            <workflow>
                <triggers></triggers>            
                <variables></variables>            
                <steps>
                </steps>
            </workflow>
        </workflows>
    </watch>
</watches>

Workflows Elements

A <workflows> element can contain the following child elements:

Element Description
variables (Optional) The variables for all child workflows. For more information, see Variables.
workflow Each workflow to be executed.

Workflow Elements

The following table lists the elements that can be provided for a <workflow> element:

Element Description
triggers The triggers for the workflow. For more information, see Triggers.
steps The steps to be executed. For more information, see Steps.
variables (Optional) The variables for the workflow. For more information, see Variables.

Examples

The following example will call an application to generate a checksum value for a photo that was just created in the watch folder. Once the checksum step has been completed, a notification about the change will then be sent to a Gotify endpoint.

<watches>  
    <watch>
        <path>F:\Pictures</path>
        <workflows>
            <workflow>
                <triggers>
                    <trigger>Create</trigger>
                </triggers>
                <steps>
                    <step>
                        <id>create-picture-get-checksum</id>
                        <command>          
                            <path>C:\Tools\fv\fv.exe</path>                 
                            <arguments>-f "[exactpath]" -sf C:\Tools\fv\config.xml</arguments>
                        </command>
                    </step>
                    <step>
                        <id>create-picture-gotify-send-message</id>
                        <needs>
                            <need>create-picture-get-checksum</need>
                        </needs>
                        <notification>
                            <url>[env:gotify_url]/message</url>
                            <method>POST</method>
                            <data>
                                <headers>
                                    <header>
                                        <name>X-Gotify-Key</name>
                                        <value>[env:gotify_key]</value>
                                    </header>
                                </headers>
                                <body>
                                    {
                                        "message": "[message]",
                                        "priority": 7,
                                        "title": "Pictures Folder"
                                    }            
                                </body>
                            </data>
                        </notification>                        
                    </step>
                </steps>
            </workflow>
        </workflows>
    </watch>
</watches>
Clone this wiki locally