Automation Runbooks
Production-ready workflows for insurance, marketplaces, and POS settlements
Every playbook documents the data contracts, integration cadence, and escalation paths required to keep multi-channel revenue flowing. Insurance claim filing is fully templated so Bupa and AXA submissions leave the clinic without spreadsheets or portal re-keying.
Insurance claim filing automation
Generate, submit, and reconcile insurer claims without leaving the Billing Agent. Bupa and AXA pathways are orchestrated end-to-end.
Triggers
- Encounter signed-off with billable insurer package
- Supporting documentation updated or received
- Remittance file posted by insurer to monitored channel
Prerequisites
- Bupa SFTP credentials stored in Motics Secrets Manager
- AXA Health robotic portal session configured
- CCSD to CPT procedure mapping validated for each clinic
Automation Channels
- Bupa UKSFTP
EDI batches sent with HL7 attachments once validation passes schema checks.
Endpoint: sftp://edi.bupa.co.uk/inbox
Cadence: Hourly 06:00–22:00 GMT
sftp provider_uat@edi.bupa.co.uk <<'EOF' cd inbox put ./exports/bupa/CLM-{{claimId}}.xml bye EOF - AXA HealthPortal
Robotic flow uploads .edi payloads and supporting PDFs, capturing claim IDs for tracking.
Endpoint: https://provider.axahealth.co.uk/api/claims
Cadence: Nightly queue with on-demand retries
const response = await fetch("https://provider.axahealth.co.uk/api/claims", { method: "POST", headers: { Authorization: "Bearer " + process.env.AXA_SESSION_TOKEN, }, body: buildAxaFormData(claimPack), }); await persistAxaClaimReference(claimPack.claimNumber, await response.text());
Execution Stages
- 1
Pre-flight validation
Ensure documentation aligns with insurer policy requirements before queuing a claim.
Eligibility & authorisation check
Confirm coverage dates and pre-authorisation numbers with insurer APIs; route exceptions to front desk teams.
Outputs: eligibility.json
Clinical coding audit
Map diagnosis and procedure codes to insurer dictionaries via the coding rules engine.
Outputs: coding-audit.csv
- 2
Claim pack assembly
Build compliant EDI payloads with attachments and signatures.
Generate insurer-specific payload
Merge SOAP notes, invoices, and consent forms into the insurer XML template.
Outputs: claim.xml, attachments.zip
Hash and archive
Create SHA256 digests for every attachment prior to submission and archive into cold storage.
Outputs: hash-report.json
- 3
Submission & tracking
Dispatch the claim and follow acknowledgements through to adjudication.
Dispatch payload
Route via SFTP or robotic portal automation based on insurer readiness with automatic retries on transient failures.
Outputs: dispatch-log.ndjson
Monitor adjudication
Poll remittance drops and update claim status; escalate rejections with templated next actions.
Outputs: remittance.json
- 4
Cash application
Apply receipts to patient balances and general ledger.
Match remittances
Match insurer payment amounts to outstanding balances with configurable tolerance rules.
Outputs: cash-application.csv
Post journals
Push approved journals to the accounting platform and notify finance leads.
Alerting & Response
EDI rejection
Condition: Insurer returns rejection code or error acknowledgement
Response: Open a revenue operations task with recommended fix and notify the clinician of missing artefacts.
SLA breach
Condition: No adjudication received within 48 hours of submission
Response: Escalate to insurer account manager and surface claim in the high-priority dashboard lane.
Marketplace settlement reconciliation
Normalise ClassPass and Treatwell deposits, reconcile fees, and generate GL-ready journals automatically.
Triggers
- Marketplace payout webhook received
- New booking adjustments detected
- Finance team requests historical replay
Prerequisites
- ClassPass and Treatwell API keys stored in secure vault
- Chart of accounts mapping completed
- Variance thresholds configured per clinic
Automation Channels
- ClassPassAPI
Fetch settlement payloads and attach booking metadata before ingestion into the warehouse.
Endpoint: https://partner-api.classpass.com/v1/payouts
Cadence: Webhook trigger with hourly catch-up
const payouts = await classpassClient.payouts.list({ status: "available" }); await queuePayoutsForReconciliation(payouts); - TreatwellAPI
Download settlement CSVs and convert to unified Motics ledger schema.
Endpoint: https://api.treatwell.com/v3/finance/payouts
Cadence: Daily at 05:00 UTC
Execution Stages
- 1
Ingestion
Collect settlement data from each marketplace and load into the warehouse.
Download settlement files
Invoke provider APIs or CSV exports and store raw files in object storage buckets.
Outputs: classpass-settlement.json, treatwell-settlement.csv
Normalise schema
Transform marketplace payloads into the Motics payout schema and enrich with clinic metadata.
Outputs: payouts-normalised.parquet
- 2
Reconciliation
Match payouts to the clinic ledger and compute variances.
Ledger matching
Join payouts to sales ledger entries using booking IDs and patient references.
Outputs: matched-ledger.csv
Variance analysis
Flag differences beyond configured tolerance and auto-assign to the responsible team.
Outputs: variance-report.json
- 3
Journaling
Publish journals and update finance dashboards.
Create journal entries
Aggregate reconciled payouts into balanced journal entries for the accounting platform.
Outputs: journals.csv
Notify finance
Send Slack notifications with summary metrics and outstanding variances.
Alerting & Response
Variance threshold breached
Condition: Variance exceeds configured tolerance for a payout batch
Response: Create finance review task and hold journal posting until resolved.
Missing payout
Condition: Expected marketplace payout not received by settlement date
Response: Trigger follow-up with marketplace support and flag in cash flow dashboard.
In-clinic POS close-out
Synchronise Stripe Terminal and Square takings, confirm deposits, and resolve card disputes proactively.
Triggers
- New POS payment recorded
- Provider settlement event received
- Dispute opened on card network
Prerequisites
- Stripe Terminal and Square OAuth connections active
- Dispute routing rules configured
- Clinic cash drawer schedule defined
Automation Channels
- StripeAPI
Stream card-present takings into the warehouse with fee breakdowns for settlement checks.
Endpoint: https://api.stripe.com/v1/payment_intents
Cadence: Every 2 hours
- SquareAPI
Fetch settlement batches and confirm deposits to the clinic bank account.
Endpoint: https://connect.squareup.com/v2/settlements
Cadence: Hourly
Execution Stages
- 1
Takings aggregation
Capture all POS activity across providers.
Stream payments
Use provider APIs to capture transactions and store them with terminal identifiers.
Outputs: pos-payments.json
Group by shift
Aggregate takings per clinic shift to prepare for reconciliation with bank deposits.
- 2
Settlement verification
Match takings to bank deposits and highlight discrepancies.
Compare expected vs received
Calculate expected settlement after fees and compare to actual deposits.
Outputs: settlement-diff.csv
Dispute monitoring
Detect open disputes and route to the clinic operations team for evidence upload.
- 3
Close-out reporting
Publish shift reports and update dashboards.
Generate close-out report
Create PDF summary for each shift including takings, deposits, and outstanding exceptions.
Outputs: shift-report.pdf
Notify stakeholders
Send notifications to clinic management with dispute status and settlement ETA.
Alerting & Response
Settlement delay
Condition: Deposit not received within expected settlement window
Response: Escalate to finance and open provider support case with settlement identifiers.
Dispute opened
Condition: Card network dispute created
Response: Auto-assign to operations with evidence checklist and due date aligned to response SLA.