🎯 Purpose

WorkflowRequestResponse is a response from an external service to WorkflowFunctionRequest. These responses are used by the dispatcher to build the next step and to provide the final result via API.

🧭 Where it is used

Key places:

  • apps/workflows/consumer.py
    • find new responses (received=False)
    • set final=True for the last step
  • apps/api/v1/workflows/views.py
    • /workflows/result — get final response
    • /workflows/csv-result — CSV export
    • /workflows/debug — debug trace

🧩 Fields used in code

The following fields are referenced directly in code:

  • request — reference to WorkflowFunctionRequest
  • data — response payload
  • received — “response processed by dispatcher” flag
  • final — “final workflow step” flag
  • id — response identifier
  • workflow — used for CSV filename

Full field list is in webpush.apps.workflows.models.

📄 Data format

/csv-result logic:

  1. take response.data.get('result', {})
  2. if it contains list[dict], CSV is generated
  3. otherwise returns 204 No Content

🔁 Lifecycle

  1. Response is created by an external service
  2. Initially received=False
  3. Dispatcher marks received=True
  4. If the step is the last one — final=True, result is available at /result