{"product_id":"idempotent-invoice-dunning-workflow-gmail-n8n-data-tables","title":"Idempotent Invoice \u0026 Dunning Workflow (Gmail, n8n Data Tables)","description":"\u003ch3\u003eStop duplicate billing emails and automate dunning end-to-end with an idempotent n8n invoice workflow\u003c\/h3\u003e\n\u003cp\u003eThis Idempotent Invoice \u0026amp; Dunning Workflow listens for job completion and payment webhooks, creates invoices with deterministic deduplication, and runs a controlled reminder\/escalation sequence via \u003cstrong\u003eGmail\u003c\/strong\u003e—stopping immediately as soon as payment is confirmed. Invoice state is persisted in \u003cstrong\u003en8n Data Tables\u003c\/strong\u003e so replays can’t accidentally resend invoices or nudge paid customers again.\u003c\/p\u003e\n\n\u003ch3\u003eWhat this workflow does\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eReceives job completion webhooks\u003c\/strong\u003e, validates a shared token, normalizes the payload against a fixed price book, and ignores non-completion events.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eIdempotent invoice creation\u003c\/strong\u003e: deduplicates completion events using a deterministic invoice key, stores invalid payloads as dead letters, and persists valid invoices to an \u003cstrong\u003en8n Data Table\u003c\/strong\u003e.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eSends a controlled test invoice email\u003c\/strong\u003e using \u003cstrong\u003eGmail\u003c\/strong\u003e and updates the invoice row as sent so webhook replays do not generate a second invoice.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eReceives payment webhooks\u003c\/strong\u003e, validates the token, normalizes payment payloads, and deduplicates payment events.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eStops dunning on payment\u003c\/strong\u003e: if the invoice exists and is not already marked paid, it marks it \u003cem\u003ePaid\u003c\/em\u003e (preventing future reminders). If the invoice can’t be matched, it queues the payment in a separate \u003cstrong\u003eData Table\u003c\/strong\u003e for human review.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eDaily scheduled sweeps\u003c\/strong\u003e recheck invoice status, claim due reminder actions, and send controlled reminder emails while updating nudge counters and next-due dates.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eEscalation sweep for stuck\/high-value overdue\u003c\/strong\u003e: identifies stuck or high-value overdue invoices, sends a controlled escalation email, and marks the invoice as \u003cem\u003eEscalated\u003c\/em\u003e.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eUse cases\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003eSaaS operators who want reliable invoice + dunning automation without duplicate emails.\u003c\/li\u003e\n  \u003cli\u003eAutomation engineers integrating job completion and payments via webhooks.\u003c\/li\u003e\n  \u003cli\u003eTeams that need auditable invoice state using n8n Data Tables and dead-letter handling.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eTechnical details\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003eIntegrations\/nodes: \u003cstrong\u003eWebhook\u003c\/strong\u003e, \u003cstrong\u003eGmail\u003c\/strong\u003e, \u003cstrong\u003en8n Data Table\u003c\/strong\u003e, plus \u003cstrong\u003eif\u003c\/strong\u003e, \u003cstrong\u003ecode\u003c\/strong\u003e, and \u003cstrong\u003eSticky Note\u003c\/strong\u003e.\u003c\/li\u003e\n  \u003cli\u003eCore mechanisms: token validation, payload normalization to a fixed price book, deterministic deduplication keys, dead-letter storage, and scheduled sweeps for reminders and escalation.\u003c\/li\u003e\n  \u003cli\u003eSetup includes creating \u003cstrong\u003etwo n8n Data Tables\u003c\/strong\u003e—one for invoices and one for unmatched payments (for review).\u003c\/li\u003e\n\u003c\/ul\u003e","brand":"N8N Commerce","offers":[{"title":"Default Title","offer_id":45862253134003,"sku":"N8N-18054","price":51.99,"currency_code":"GBP","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0749\/6279\/6723\/files\/LsONylMPe6s69OybzRsgX_mQpyiokI.png?v=1786958276","url":"https:\/\/buyflowscripts.com\/products\/idempotent-invoice-dunning-workflow-gmail-n8n-data-tables","provider":"N8N Commerce","version":"1.0","type":"link"}