Skip to content

Folder Worker⚓︎

This worker automates the file import process. It allows parameterization such as filters, monitoring time, specific folders, and more, in addition to integrating with external services via API.

We use the client credentials OAuth2.0 flow for authentication with external client applications.

To find out how you can obtain your own Client ID / Client Secret pair, check the Create Secrets section.

Finding your Workspace Id and Tenant Id⚓︎

Head to the Tasks Inbox screen and click the Import button, then the Folders tab.

Installation and Setup⚓︎

Before using the worker, ensure that the executable is available on your system.

  • Download the appropriate executable for your operating system.
  • To check available options, open a terminal and run:
<executable> --help

Basic Usage⚓︎

The basic command structure is:

<executable> [options]

Minimal example:

<executable> --client-id "your-client-id" --client-secret "your-client-secret" --tenant-id 201 --workspace-id 778

Available Options⚓︎

Below are all available options:

OptionDescriptionRequired/Optional
--client-idThe unique identifier for authentication with external services.Required
--client-secretThe secret key associated with the client ID for secure authentication.Required
--tenant-idThe unique identifier of the tenant.Required
--workspace-idThe unique identifier of the workspace.Required
--api-urlThe URL endpoint for integration with the processing worker, facilitating external service communication. Default value: https://cloud.smartdocumentor.net. Contact support for changes.Optional
--tus-urlThe URL endpoint for integration with the processing worker, facilitating external service communication. Default value: https://cloud.smartdocumentor.net. Contact support for changes.Optional
--filtersFilters applied when monitoring files (e.g., `*.pdf`).Optional
--actionAction to perform on files: Move or Remove. Default is Remove.Optional
--folderThe directory path where files should be monitored for changes or additions. Defaults to the current directory where the command is executed or the value provided (e.g., /path/to/watch).Optional
--destination-folderDirectory where files will be moved if --action is Move. Required if Move.Required if --action is Move
--include-subdirectoriesWhether to include subdirectories. Default is false.Optional
--delayDelay in milliseconds between file checks (minimum: 30,000 ms, maximum: 300,000 ms). Default is 30,000 ms.Optional
--helpDisplays this help message.

Practical Examples⚓︎

Run with basic credentials

<executable> --client-id "your-client-id" --client-secret "your-client-secret" --tenant-id 201 --workspace-id 778

Monitor PDF and JPG files

<executable> --client-id "your-client-id" --client-secret "your-client-secret" --tenant-id 201 --workspace-id 778 --filters "*.pdf|*.jpg"

Monitor a specific folder for PDF and JPG files every 30 seconds and move them to another folder

<executable> --client-id "your-client-id" --client-secret "your-client-secret" --tenant-id 201 --workspace-id 778 --folder "/path/to/watch" --destination-folder "/path/to/destination" --filters "*.pdf|*.jpg" --delay 30000 --action Move

Common Errors and Solutions⚓︎

  1. Error: "Filters must be provided"\ Cause: The --filters option is missing.\ Solution: Ensure that a valid filter is provided via command-line argument or configuration.
  2. Error: "Invalid delay value"\ Cause: The --delay value is outside the allowed range.\ Solution: The delay must be between 30,000 ms (30 seconds) and 300,000 ms (5 minutes).
  3. Error: "Invalid action type"\ Cause: The --action value is not Move or Remove.\ Solution: Ensure that the action is correctly set as Move or Remove.
  4. Error: "Destination folder required when action is Move"\ Cause: The --destination-folder is missing when --action Move is used.\ Solution: Provide a valid destination folder via command-line argument or configuration.
  5. Error: "API Base URL must be provided"\ Cause: The --api-url is missing.\ Solution: Ensure the API base URL is included in the command-line arguments.
  6. Error: "TUS Base URL must be provided"\ Cause: The --tus-url is missing.\ Solution: Provide a valid TUS upload service URL.
  7. Error: "Client ID is required"\ Cause: The --client-id is missing.\ Solution: Ensure the client ID is correctly specified in the command.
  8. Error: "Client Secret is required"\ Cause: The --client-secret is missing.\ Solution: Provide a valid client secret.
  9. Error: "Tenant ID must be greater than zero"\ Cause: The --tenant-id is missing or set to zero.\ Solution: Ensure the tenant ID is a positive integer.
  10. Error: "Workspace ID must be greater than zero"\ Cause: The --workspace-id is missing or set to zero.\ Solution: Provide a valid workspace ID greater than zero.