Nightly QuickBooks invoices for unpaid Acuity appointments

By General Input

Every night at 8pm, sweep yesterday's completed Acuity appointments that are still unpaid and open matching QuickBooks invoices with a Sheets audit log.

Integrations

  • Acuity Scheduling
  • QuickBooks Online
  • Google Sheets

Type

Deterministic Code

Categories

  • Finance
  • Operations

Every night at 8pm my practice's local time, run a deterministic code workflow that reconciles yesterday's Acuity Scheduling appointments against QuickBooks Online and logs every invoice created to a Google Sheets audit tab. This is a node-based flow, not an agent.

Step 1. Pull yesterday's appointments. Use Acuity Scheduling List Appointments with minDate set to yesterday at 00:00:00 and maxDate set to yesterday at 23:59:59 in the practice's local timezone (Acuity accepts any strtotime-parseable value, e.g. "2026-07-16T00:00:00-0500"). Paginate by advancing minDate to the last returned appointment's datetime with direction=ASC until the page is short. Keep only appointments whose paid field equals the string "no" (Acuity returns paid as a string, not a boolean) and whose email field is a non-empty string. Skip anything already flagged paid or missing an email.

Step 2. For each remaining appointment, find or create the QuickBooks customer. Call QuickBooks Query Entities with a SQL-like query: SELECT * FROM Customer WHERE PrimaryEmailAddr = '<client email>'. If exactly one match comes back, reuse that customer's Id. If no match, call QuickBooks Create Customer with the client's first name, last name, email, and phone from the Acuity appointment payload, and use the new Id.

Step 3. Create the invoice. Call QuickBooks Create Invoice with the customer Id from step 2 and a single line item whose description is the Acuity appointment type name and whose amount is the appointment's price. Acuity returns price as a decimal string like "150.00", so parse it to a number before sending. Set the invoice due date to the run date plus 14 days (net-14). Include the client's email on the invoice's billing address so QuickBooks can send it.

Step 4. Log the run. Call Google Sheets Append Values to add one row to the practitioner's "Acuity Invoices" audit tab with these columns in order: Appointment ID (Acuity's id), Client Name (firstName plus lastName), Session Type (Acuity's appointmentType or type), Amount (the parsed decimal), Invoice Number (DocNumber from the QuickBooks Create Invoice response), and Timestamp (ISO 8601 timestamp of the moment the invoice was created).

Guardrails. Never invoice an appointment that is already marked paid in Acuity, and never invoice an appointment missing a client email. On any per-appointment error (QuickBooks validation failure, missing customer data, network blip), log the failure with the appointment ID and continue to the next appointment so one bad row does not block the rest of the batch. Do not send Slack or email notifications. The Google Sheets tab is the entire audit trail.

Related prompts

Explore more prompts
Call overdue Xero customers with an AI collections agentLocal listing health board for every location you manageLet support send one-off Loops emails without an engineerStop cold emails to anyone with a live deal in PipedriveiMessage campaign console with pre-flight checks and delivery boardLinkedIn Ads budget pacing dashboard for every client accountFront desk appointment confirmation board for the next 3 daysGive your team Looker numbers without buying more seatsBuild audience segments from product usage and push to LoopsTurn the people who engage with your posts into Pipedrive leads