Skip to content

Automation

FolderSync events

Experimental feature

Starting with FolderSync v4.0.0 and FolderSync Desktop v2.0.0 it is possible to configure automation events in FolderSync without needing external tools. The automation options button is found on about screen on Android and in the left menu on desktop.

Note: Only V2 FolderPairs are selectable in Automation conditions and actions. Sync/enable/disable all applies to V1 folderPairs also.

An automation event consists on an event type and list of conditions and actions. When the event is triggered, attached conditions are checked - if conditions are met, the configured actions are executed.

See some examples here.

Event triggers supported

  • AppStarted: When app process is started
  • Schedule: At a specific point in time
  • SyncStart: When a FolderPair sync starts
  • SyncAnalysisComplete: When a FolderPair analysis phase is complete
  • SyncComplete: When a FolderPair sync is complete
  • WiFiConnect: Android only When Wi-Fi is connected
  • WiFiDisconnect: Android only When Wi-Fi is disconnected
  • SSIDChanged: Android only When Wi-Fi SSID changes

Event conditions supported

  • TimeBefore: Current time is before condition value
  • TimeAfter: Current time is after condition value
  • FolderPairPreviousSyncNewerThan: A specific folderPairs previous sync is newer than condition value
  • FolderPairPreviousSyncOlderThan: A specific folderPairs previous sync is older than condition value
  • FolderPairPreviousSyncState: A specific folderPairs previous sync state is equal to condition value
  • FolderPair: Event FolderPair matches condition value
  • SyncStateIs: Event sync state matches condition value
  • SyncTransferSizeLessThan: Event total transfer size is less than condition value
  • SyncTransferSizeMoreThan: Event total transfer size is more than condition value
  • SyncDeletedFilesLessThan: Event total deleted file count is less than condition value
  • SyncDeletedFilesMoreThan: Event total deleted file count is more than condition value
  • SyncTransferFilesLessThan: Event total transferred file count is less than condition value
  • SyncTransferFilesMoreThan: Event total transferred file count is more than condition value
  • SSIDIdentifierIs: Android only SSID name is equal to condition value
  • SSIDIdentifierIsNot: Android only SSID name is not equal to condition value
  • ConnectionType: Android only Connection type is equal to condition value

Some conditions are only available for certain events. For example sync related conditions requires the triggering event type to be either SyncAnalysisComplete or SyncComplete. FolderPair condition requires the triggering event type to be SyncStart, SyncAnalysisComplete or SyncComplete

Event actions supported

  • CancelSync: Cancel sync (all or for specific FolderPair)
  • StopCurrentSync: Stop the sync which triggered the event
  • EnableSchedule: Enabled scheduled syncing (all or for specific FolderPair)
  • DisableSchedule: Disable scheduled syncing (all or for specific FolderPair)
  • CreateBackup: Creates a database backup in the configured backup folder
  • StartSync: Start syncing folderPair(s) (all or for specific FolderPair)
  • WebHook: Call the configured webhook

Some actions are only available for certain events. For example the StopCurrentSync action requires the triggering event type to be either SyncStart or SyncAnalysisComplete.

If multiple actions types for an event is configured they are run in the order displayed. If 2 or more of the same action type is added for an event they are not run in any specific order.

Exposed event information

If calling a webhook, you might wish to send values related to the sync in your webhook data. A webhook allows you to specify properties as name-value pairs. If you use one of the following keys in the value field the value will be substituted as described, if its available. Sync related data is only available in a sync context. Value must match exactly, you can not have other characters or multiple keys in the same value.

  • %EVENT_NAME%: Name of event that was triggered
  • %EVENT_TYPE%: Type of event that was triggered
  • %SYNC_STATUS%: Status of the sync (in sync event context)
  • %SYNC_FOLDERPAIR_NAME%: Name of folderPair (in sync event context)
  • %SYNC_FILES_TRANSFERRED%: Number of files transferred (in sync event context)
  • %SYNC_FILES_DELETED%: Number of files deleted (in sync event context)
  • %SYNC_FILES_TRANSFER_SIZE%: Total transfer size in bytes (in sync event context)
  • %SYNC_START_TIME%: Sync start time in epoch milliseconds (in sync event context)
  • %SYNC_DURATION%: Sync duration in seconds (in sync event context)

Android external automation

Android only

FolderSync for Android works as Tasker plugin and supports deep links when triggered from other automation apps. This means one or more folderPair syncs can be initiated or cancelled when a condition or rule you configured in an automation app occurs.

Tasker

Configuring an automation apps is out of the scope of this help text, but FolderSync is found in the the Plugin section for Tasker. Note that syncs will run no matter what settings they are configured with, when initiated from automation app, except if the allowed connection requirement(s) are not met.

FolderSync also supports triggering actions via deep links. To trigger a deep link from Tasker use “Browse URL” action. For deep links to work automation must be enabled in FolderSync settings.

Opening deep links by copy/pasting directly url to a browser will not work, as this will just attempt to open it as a normal webpage and there is no web server listening for these types of links. The link has to be intercepted directly by the FolderSync app for it to work, using the deep link handling inherent in the Android system - which as mentioned will not work when directly entering the link into a browsers address bar, but it will work if triggered by an automation app like Tasker using Android intents.

Enabling deep links

For deep links to work they have to be enabled on the settings screen. This will also make the Automation tab visible on the folderPair screen.

Automation options

FolderPair specific

Find list of install-specific deep links under folderpair.

  • Sync
  • Cancel syncing
  • Enable scheduled sync
  • Disable scheduled sync

All

Find list of install-specific deep links in settings.

  • Sync all
  • Cancel syncing
  • Enable scheduled sync
  • Disable scheduled sync
  • Backup database