🎯 Purpose
WorkflowFunctionRequest is the core unit of the workflow engine.
Each workflow step becomes a separate request that must be
executed by the target service (directory / manager / statistics / SSO / LOCAL).
🧭 Where it is created
There are two main creation sources in the service:
-
API workflow start
apps/api/v1/workflows/serializers.py
→ creates a request for the internal workflowstart_new_workflow -
Step dispatcher
apps/workflows/consumer.py→_create_request(...)
→ creates a request for the next step based on the previous step response
🧩 Fields used in code
The following model fields are referenced directly in the code:
workflow— workflow nameservice— target servicefunction— step function namedata_json— payload (JSON)consumer_id— consumer id for a specific servicetransaction_id— workflow transaction UUIDstatus— used to findPENDINGcreated— used to reassign PENDING requests by TTL
Full field list is in
webpush.apps.workflows.models.
🔗 Relations
WorkflowFunctionRequest.response → WorkflowRequestResponse
Used in the debug endpoint and when restoring workflow state.
🔁 Lifecycle
- Request is created with status
PENDING - The target service consumer picks the request by
consumer_id - The service executes the function and creates
WorkflowRequestResponse - The dispatcher (
run_workflow_dispatcher) builds the next step