Integrations
eRx and insurance HTTP providers, webhooks, wholesaler and tax records, email, storage, MCP, and AI chat.
/dashboard/platform/integrations shows each IntegrationProvider with its type, status, and validation state (pharmacyIntegrationStatus). It needs canManageIntegrations.
Provider types
Onboarding creates four records, all unconfigured: eRx, Wholesaler, Insurance, and Tax. configurePharmacyIntegrationProvider configures erx and insurance providers. Wholesalers are managed as Suppliers and received by hand.
Configure eRx or insurance
Open the drawer
Press Configure on the provider.
Enter the endpoints
Base URL, validation path, submit path, and status path. eRx also needs a prescriber validation path that contains {npi}. Production endpoints must use HTTPS.
Enter secrets
A bearer token (16 characters or more) and a webhook secret (32 characters or more). They are write-only.
Save
The command calls the validation path. When it succeeds the provider becomes active and externalValidationComplete is set.
The adapter in features/integrations/erx and features/integrations/insurance is a generic HTTP client. Responses are size-bounded and requests time out after 20 seconds.
Operations
validatePharmacyPrescribercalls the eRx prescriber path with an NPI. See Prescribers.submitPharmacyExternalWorkflowsends a prescription (eRx) or an order (insurance) to the submit path with an idempotency key.refreshPharmacyExternalWorkflowreads the status path. Workflows areExternalIntegrationWorkflowrows:pending_submission,submitted,accepted,rejected,failed.ingestPharmacyIntegrationWebhookhandles inbound events atPOST /api/webhooks/integrations/[providerKey]. The adapter checks an HMAC-SHA256 of the raw body in thex-pharmacy-signature-sha256header.
Email and storage
SMTP settings send password-reset email. S3 storage holds Keystone image fields.
MCP and AI chat
/api/mcp-transport/[transport]is an MCP server for callers whose session hascanAccessDashboard. Tools:listModels,queryData,searchModels,getFieldsForType,lookupInputType,createData,updateData,deleteData, andmodelSpecificSearch. They run with the caller's session, so list access rules apply./api/completionis the dashboard AI chat. It needscanAccessDashboardand usesOPENROUTER_API_KEYandOPENROUTER_MODEL, or a key the user enters in the browser.
See also Audit and outbox for event delivery.