Skip to main content

Camunda Workflow → RMA API Calls

Direction: Camunda BPMN → request-management-api (RMA) BPMN location: apps/forms-flow-ai/forms-flow-bpm/src/main/resources/processes/

This document maps each listed workflow to the RMA endpoints it reaches, the BPMN task that triggers the call, the payload shape, and any child workflow invoked along the way.


Conventions

ItemValue
Base URL${foiApiUrl} = env FOI_REQ_MANAGEMENT_API_URL
API prefix${foiApiUrl}/api
AuthEvery direct RMA call is preceded by a Get Token service task (POST Keycloak client_credentials). The RMA call uses Authorization: Bearer ${accessToken}.
RetryOn non-HTTP-200, workflows retry up to 3 times (1-minute timer between attempts), then raise a BPMN error.
Indirect callsSome tasks do not call RMA directly; they correlate a Camunda message that starts another workflow which performs the HTTP call. Those rows list the Called Workflow column.
Listener-based callsTasks Create Submission and Update Form Submission use Java execution listeners to call Form.io and forms-flow-api (not RMA). Marked as — (not RMA) in the table.

Master mapping table

Workflow NameTask NameRMA URLHTTPAPI PayloadCalled WorkflowComments
foi-rawrequest-processing.bpmnSend PID${foiApiUrl}/api/foirawrequestbpm/addwfinstanceid/${id}PUTrawReqPayload = { "wfinstanceid": execution.getVariable("pid"), "notes": "Workflow ID update" } — see Raw request payloads (Send PID)foi-rawrequest-api-manager.bpmnCorrelates message foi-update with category = "foi-rawrequest-update". The api-manager workflow performs the actual HTTP call.
foi-rawrequest-processing.bpmnIntake Analyst (task listener — assignment)${foiApiUrl}/api/foirawrequestbpm/addwfinstanceid/${id}PUTrawReqPayload = { "wfinstanceid": task.execution.getVariable("pid"), "status": "Intake in Progress", "notes": "Status update" } — see Raw request payloads (Intake assigned)foi-rawrequest-api-manager.bpmnFired when an assignee is set on the Intake task.
foi-rawrequest-processing.bpmnIntake Analyst (task listener — complete)${foiApiUrl}/api/foirawrequestbpm/addwfinstanceid/${id}PUTrawReqPayload = { "wfinstanceid": task.execution.getVariable("pid"), "status": "Archived", "notes": "Status update" } — see Raw request payloads (Intake completed)foi-rawrequest-api-manager.bpmnFired when the Intake task is completed.
foi-rawrequest-processing.bpmnFOI Request Processing (call activity)foi-request-processing.bpmnInvoked when raw request status is Open. Passes foiRequestMetaData, rawRequestPID, rawRequestID, foiApiUrl. No RMA call at this step.
foi-rawrequest-api-manager.bpmnUpdate FOI RawRequest${foiApiUrl}/api/foirawrequestbpm/addwfinstanceid/${id}PUT${rawReqPayload} see Raw request payloadsStarted by message foi-update when category == "foi-rawrequest-update". Backend handler: rawrequestservice.updateworkflowinstancewithstatus.
foi-rawrequest-api-manager.bpmnUpdate FOI Request${foiApiUrl}/api/foirequests/${foiRequestID}PUTreqPayload = { "wfinstanceId": execution.getVariable("pid")}; — see FOI request payloadStarted by message foi-update when category == "foi-request-update". Backend handler: requestservice.updaterequestFOIRequest.updateWFInstance.
foi-request-processing.bpmnSend PID${foiApiUrl}/api/foirequests/${foiRequestID}PUTreqPayload = { "wfinstanceId": execution.getVariable("pid")}; — see FOI request payloadfoi-rawrequest-api-manager.bpmnCorrelates message foi-update with category = "foi-request-update". Persists ministry subprocess Camunda PID on the FOI request.
foi-request-processing.bpmnIAO Team — boundary Correnspodencefoi-initial-payment-submission.bpmnOn message foi-iao-correnspodence (status ≠ Closed), correlates foi-fee-payment with servicekey = "correspondence". Starts fee/email flow; no direct RMA call here. # pragma: allowlist secret
foi-request-processing.bpmnIAO Team — boundary Complete (On Hold branch)foi-initial-payment-submission.bpmnWhen status becomes On Hold (not sync, not offline payment), correlates foi-fee-payment. Starts payment workflow.
foi-initial-payment-submission.bpmnInvoke Payment Details API${foiApiUrl}/api/foirequests/${foiRequestID}/ministryrequest/${ministryRequestID}/payonlineGETNoneProcess id: foi-fee-processing. Started by message foi-fee-payment. Loads request data for the payment form. Maps axisRequestId, fee, fileNumber, email, isofflinepayment from response. Sets paymentFormName to payfeeonline or payoutstandingform.
foi-initial-payment-submission.bpmnCreate Submission— (not RMA)Form.io: { "data": { ...Camunda execution variables } } — see Create SubmissionExecution listener: ExternalSubmissionListener. Runs when balanceDue_f > 0. Creates Form.io submission and forms-flow application record. Sets formUrl, formId, submissionId, applicationId used by Invoke Save API.
foi-initial-payment-submission.bpmnInvoke Save API (create payment link)${foiApiUrl}/api/foipayment/${foiRequestID}/ministryrequest/${ministryRequestID}POSTsaveDataPayload = { "paymenturl": execution.getVariable('foiwebUrl') + "/public/form/" + execution.getVariable('formId') + "/submission/" + execution.getVariable('submissionId') + "/edit", "paymentexpirydate": execution.getVariable('paymentExpiryDate') }; — see Payment save payloadRuns after Create Submission (when balance due). Saves payment URL and expiry date.
foi-initial-payment-submission.bpmnUpdate Form Submission— (not RMA)Form.io JSON Patch — see Update Form SubmissionExecution listener: BPMFormDataPipelineListener. Triggered on message foi-manage-payment (Payment Update Received). PATCHes Form.io submission with current status and paymentstatus Camunda variables before PAID / CANCELLED / EXPIRED branching.
foi-initial-payment-submission.bpmnInvoke Save API (cancel payment)${foiApiUrl}/api/foipayment/${foiRequestID}/ministryrequest/${ministryRequestID}/cancelPOST${saveDataPayload}Triggered when paymentstatus == "CANCELLED" (message foi-manage-payment). Payload may be empty or reuse prior saveDataPayload.
foi-initial-payment-submission.bpmnPost Expiry Notification${foiApiUrl}/api/foinotifications/${foiRequestID}/ministryrequest/${ministryRequestID}/payment/expiryPOSTNoneTriggered when paymentstatus == "EXPIRED". Creates payment-expiry notification event in RMA.
foi-initial-payment-submission.bpmnNotify Payment${foiApiUrl}/api/foiemail/${foiRequestID}/ministryrequest/${ministryRequestID}/${servicekey}POST(built in email workflow)foi-email-processing.bpmnAfter save API succeeds. Correlates foi-email with servicekey: correspondence, payoutstanding, or payonline depending on context.
foi-initial-payment-submission.bpmnNotify Payment Confirmation${foiApiUrl}/api/foiemail/${foiRequestID}/ministryrequest/${ministryRequestID}/${servicekey}POST(built in email workflow)foi-email-processing.bpmnAfter payment is PAID and workflow status is synced. Correlates foi-email with servicekey: outstanding-payment-receipt or fee-estimate-payment-receipt.
foi-email-processing.bpmnInvoke Email Notification API${foiApiUrl}/api/foiemail/${foiRequestID}/ministryrequest/${ministryRequestID}/${servicekey}POSTsaveDataPayload — see Email payloadStarted by message foi-email. Sends applicant email via RMA. servicekey examples: correspondence, payonline, payoutstanding, outstanding-payment-receipt, fee-estimate-payment-receipt.
foi-email-processing.bpmnInvoke Email Ack API${foiApiUrl}/api/foiemail/${foiRequestID}/ministryrequest/${ministryRequestID}/${servicekey}/acknowledgePOSTNoneRuns after successful send when isIMAPEnabled == 'True' (10 s delay via link event). Acknowledges email delivery in RMA. Skipped when IMAP is disabled — process ends after send API.
foi-cache-refresh.bpmnInvoke Cache Refresh API${foiApiUrl}/api/foiflow/cache/refreshPOSTNone (empty body)Process id: cache_refresh. Timer: daily at 13:00 UTC (0 0 13 * * ?). Refreshes all master-data cache keys.
foi-duedate-reminder.bpmnInvoke Reminder API${foiApiUrl}/api/foinotifications/reminderPOSTNoneProcess id: due_reminder_notifications. Timer: daily at 13:00 UTC. Posts due-date reminder events for eligible requests.

Payload reference

Raw request payloads

Built in foi-rawrequest-processing.bpmn and passed as JSON string in rawReqPayload:

TriggerJavaScript (BPMN script)
Send PID{ "wfinstanceid": execution.getVariable("pid"), "notes": "Workflow ID update" }
Intake assigned{ "wfinstanceid": task.execution.getVariable("pid"), "status": "Intake in Progress", "notes": "Status update" }
Intake completed{ "wfinstanceid": task.execution.getVariable("pid"), "status": "Archived", "notes": "Status update" }

Note: The RMA PUT handler reads wfinstanceid and notes only. The status field in the BPMN payload is not applied by the API.

FOI request payload

Built in foi-request-processing.bpmn (Send PID):

reqPayload = {
wfinstanceId: execution.getVariable('pid'),
};

Payment save payload

Built in foi-initial-payment-submission.bpmn (Invoke Save API — create path):

saveDataPayload = {
paymenturl:
execution.getVariable('foiwebUrl') +
'/public/form/' +
execution.getVariable('formId') +
'/submission/' +
execution.getVariable('submissionId') +
'/edit',
paymentexpirydate: execution.getVariable('paymentExpiryDate'),
};

Email payload

Built at start of foi-email-processing.bpmn (apply settings on message foi-email):

var saveDataPayload = {};
if (
execution.getVariable('servicekey') == 'correspondence' ||
templatename == 'PAYOUTSTANDING' ||
templatename == 'PAYONLINE'
) {
saveDataPayload = {
templateName: execution.getVariable('templateName'),
applicantCorrespondenceId: execution.getVariable('applicantCorrespondenceId'),
};
}

Default payload is {} for payment-notification servicekey values (payonline, payoutstanding, receipt templates).

Create Submission (ExternalSubmissionListener)

BPMN task Create Submission in foi-initial-payment-submission.bpmn registers this listener on event="start". Form name comes from ${paymentFormName} (payfeeonline or payoutstandingform).

The listener performs three HTTP calls (none to RMA):

StepMethodURLPayload
1. Resolve formGET${FORMIO_URL}/${paymentFormName}None — reads _id as form ID
2. Create submissionPOST${FORMIO_URL}/form/{formId}/submission{ "data": { ...all Camunda execution variables } } via FormSubmissionService.createFormSubmissionData()
3. Create applicationPOST${FORMSFLOW_API_URL}/application/create{ "formUrl", "formId", "submissionId", "processInstanceId" } — expects HTTP 201; retries once on failure

Variables set: formUrl (submission URL including ID), applicationId, plus BPMN outputs formId and submissionId parsed from formUrl.

// ExternalSubmissionListener — submission body shape (FormSubmissionService)
data.put("data", bpmVariables); // entire execution variable map

Update Form Submission (BPMFormDataPipelineListener)

BPMN task Update Form Submission registers this listener on event="start" with fields = ["status","paymentstatus"].

ItemValue
MethodPATCH
URL${formUrl} — Form.io submission URL set by Create Submission
PayloadJSON Patch array — one entry per field in fields
// Effective payload (FormElement builds op/path/value per field)
[
{ op: 'replace', path: '/data/status', value: '<execution variable status>' },
{ op: 'replace', path: '/data/paymentstatus', value: '<execution variable paymentstatus>' },
];

Expects HTTP 200. If formUrl is blank, the listener logs an error and returns without calling Form.io.


Workflow invocation map

Workflows that do not call RMA directly but start another workflow via Camunda message correlation or call activity:

Parent workflowTrigger / taskMessage or mechanismChild workflow
foi-rawrequest-processing.bpmnSend PID, Intake Analyst listenersfoi-updatefoi-rawrequest-api-manager.bpmn
foi-rawrequest-processing.bpmnFOI Request Processing (Open)call activityfoi-request-processing.bpmn
foi-request-processing.bpmnSend PIDfoi-updatefoi-rawrequest-api-manager.bpmn
foi-request-processing.bpmnIAO Team — Correnspodence / Complete (On Hold)foi-fee-paymentfoi-initial-payment-submission.bpmn
foi-initial-payment-submission.bpmnNotify Payment / Notify Payment Confirmationfoi-emailfoi-email-processing.bpmn
foi-initial-payment-submission.bpmnSync FOI Status in WFfoi-iao-completefoi-request-processing.bpmn

Per-workflow summary

BPMN fileDirect RMA endpointsIndirect (via child workflow)
foi-rawrequest-processing.bpmnPUT foirawrequestbpm/addwfinstanceid/{id} via api-manager
foi-rawrequest-api-manager.bpmnPUT wfinstanceid, PUT foirequests
foi-request-processing.bpmnPUT foirequests via api-manager; fee/email via payment + email workflows
foi-initial-payment-submission.bpmnGET payonline, POST foipayment, POST cancel, POST payment/expiryPOST foiemail via email workflow; Form.io + forms-flow-api via Create Submission / Update Form Submission listeners
foi-email-processing.bpmnPOST foiemail, POST acknowledge
foi-cache-refresh.bpmnPOST cache/refresh
foi-duedate-reminder.bpmnPOST notifications/reminder

Non-RMA HTTP calls (for awareness)

These tasks in foi-initial-payment-submission.bpmn invoke external services via Java execution listeners or the HTTP connector, not RMA.

Create Submission — ExternalSubmissionListener

ItemValue
Listenerorg.camunda.bpm.extension.hooks.listeners.execution.ExternalSubmissionListener
WhenAfter Invoke Payment Details API, when balanceDue_f > 0
TargetsForm.io (FORMIO_URL), forms-flow API (FORMSFLOW_API_URL)
DetailCreate Submission payload

Update Form Submission — BPMFormDataPipelineListener

ItemValue
Listenerorg.camunda.bpm.extension.hooks.listeners.BPMFormDataPipelineListener
WhenOn message foi-manage-payment (Payment Update Received)
TargetForm.io submission at ${formUrl}
DetailUpdate Form Submission payload

Sync FOI Status in WF — Camunda Engine REST

ItemValue
URL${foiwfUrl}/message (FORMSFLOW_WF_URL)
MethodPOST
WhenAfter payment status PAID
PurposePosts foi-iao-complete to sync ministry workflow state without a UI save
Payloadvar foistatuspayload = { "messageName" : "foi-iao-complete", "localCorrelationKeys" : { "id" : {"value" : execution.getVariable("fileNumber") , "type": "String"} }, "processVariables" : { "foiRequestMetaData" : {"value" : execution.getVariable("foiRequestMetaData") , "type": "String"} } }

Generated from BPMN definitions in forms-flow-bpm/src/main/resources/processes/.