create_flow
Create a Nextcloud Flow rule that runs an operation when chosen events fire and all checks match, scoped to the current user's files or globally.
Instructions
Create a Nextcloud Flow rule: when an event happens and all checks match, run an operation.
Use get_flow_options for the operation, entity, event and check class names of the scope; an unknown class name makes Nextcloud fail with a server error. User flows act on the current user's files only. Global flows act on everyone's and need the destructive permission level: a global access control rule whose checks match too much locks every user, this server included, out of their files. Operations that would run a command, or command-line arguments, of the agent's choosing on the server are refused.
Args: operation_class: Class of the operation to run, from get_flow_options. Example: "OCA\Talk\Flow\Operation" checks: Conditions that must all match, at least one. Each is an object with "class", "operator" and "value", e.g. {"class": "OCA\WorkflowEngine\Check\FileName", "operator": "matches", "value": "/.pdf$/i"}. get_flow_options lists operators and value formats for the built-in checks. scope: "user" (default) or "global" (admin only). name: Optional name for the rule. operation_config: The operation's own settings; the format depends on the operation. Talk's "Write to conversation" takes {"m": 1, "t": ""} (m: 1 no mention, 2 mention yourself, 3 mention everyone in the room, moderators only), as an object or a JSON string. Empty for operations without settings. entity: What the rule acts on. Defaults to files ("OCA\WorkflowEngine\Entity\File"), the only entity Nextcloud ships. events: Entity events that trigger the rule, e.g. ["\OCP\Files::postCreate"]. Required unless the operation has events_fixed in get_flow_options, in which case leave it empty.
Returns: JSON with the created flow, as list_flows shows it.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | ||
| scope | No | user | |
| checks | Yes | ||
| entity | No | OCA\WorkflowEngine\Entity\File | |
| events | No | ||
| operation_class | Yes | ||
| operation_config | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |