{"product_id":"n8n-webhook-workflow-sequential-invoice-ticket-numbers","title":"n8n Webhook Workflow: Sequential Invoice \u0026 Ticket Numbers","description":"\u003ch3\u003eGenerate gapless sequential invoice \u0026amp; ticket numbers via an n8n POST webhook\u003c\/h3\u003e\n\u003cp\u003eThis \u003cstrong\u003en8n Webhook Workflow: Sequential Invoice \u0026amp; Ticket Numbers\u003c\/strong\u003e issues the \u003cstrong\u003enext gapless sequential number\u003c\/strong\u003e on demand. It reads and updates a counter in an \u003cstrong\u003en8n Data Table\u003c\/strong\u003e, then returns a properly \u003cstrong\u003eformatted\u003c\/strong\u003e number (optional prefix + zero padding) as a JSON response.\u003c\/p\u003e\n\n\u003ch3\u003eWhat this workflow does\u003c\/h3\u003e\n\u003cp\u003eWhen you call the workflow with a POST request, it:\u003c\/p\u003e\n\u003cul\u003e\n  \u003cli\u003eAccepts a request on the webhook endpoint with a required \u003ccode\u003esequence_key\u003c\/code\u003e, plus optional \u003ccode\u003eprefix\u003c\/code\u003e and \u003ccode\u003epad\u003c\/code\u003e parameters.\u003c\/li\u003e\n  \u003cli\u003eValidates and normalizes inputs, applying safe defaults when values are missing or malformed.\u003c\/li\u003e\n  \u003cli\u003eLooks up the matching counter row in the n8n Data Table \u003cstrong\u003e\u003ccode\u003enumber_sequences\u003c\/code\u003e\u003c\/strong\u003e using \u003ccode\u003esequence_key\u003c\/code\u003e.\u003c\/li\u003e\n  \u003cli\u003eCalculates the next counter value, applies the requested (or stored) \u003cstrong\u003eprefix\u003c\/strong\u003e, and formats the output using the requested zero-padding width.\u003c\/li\u003e\n  \u003cli\u003eUpserts the updated counter back into the \u003cstrong\u003e\u003ccode\u003enumber_sequences\u003c\/code\u003e\u003c\/strong\u003e Data Table keyed by \u003ccode\u003esequence_key\u003c\/code\u003e.\u003c\/li\u003e\n  \u003cli\u003eReturns a JSON response including:\n    \u003cul\u003e\n      \u003cli\u003ethe issued formatted number,\u003c\/li\u003e\n      \u003cli\u003ethe updated counter value, and\u003c\/li\u003e\n      \u003cli\u003ea timestamp.\u003c\/li\u003e\n    \u003c\/ul\u003e\n  \u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eUse cases\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003eSaaS billing: generate \u003cstrong\u003einvoice numbers\u003c\/strong\u003e that are consistent and sequential across your system.\u003c\/li\u003e\n  \u003cli\u003eSupport operations: assign \u003cstrong\u003eticket numbers\u003c\/strong\u003e in a gapless order for every new request.\u003c\/li\u003e\n  \u003cli\u003eMulti-sequence systems: use different \u003ccode\u003esequence_key\u003c\/code\u003e values (e.g., \u003ccode\u003einvoice\u003c\/code\u003e, \u003ccode\u003eticket\u003c\/code\u003e) with the same webhook.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eTechnical details\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eWebhook\u003c\/strong\u003e (POST) endpoint exposed by n8n\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eData Table\u003c\/strong\u003e named \u003ccode\u003enumber_sequences\u003c\/code\u003e with columns:\n    \u003ccode\u003esequence_key\u003c\/code\u003e, \u003ccode\u003ecurrent_value\u003c\/code\u003e, \u003ccode\u003eprefix\u003c\/code\u003e, \u003ccode\u003eupdated_at\u003c\/code\u003e\n\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eCode\u003c\/strong\u003e node for validation, incrementing, and formatting logic\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eRespond to Webhook\u003c\/strong\u003e to return JSON (formatted number, counter, timestamp)\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eSticky Note\u003c\/strong\u003e for workflow documentation\u003c\/li\u003e\n\u003c\/ul\u003e\n\u003cp\u003eIdeal for automation engineers and n8n users who need reliable, sequential numbering without manual tracking.\u003c\/p\u003e","brand":"N8N Commerce","offers":[{"title":"Default Title","offer_id":45738517921971,"sku":"N8N-17547","price":18.99,"currency_code":"GBP","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0749\/6279\/6723\/files\/34CIXAoZYNkzNiuP5EgSs_xiqu1ryD.png?v=1785229697","url":"https:\/\/buyflowscripts.com\/products\/n8n-webhook-workflow-sequential-invoice-ticket-numbers","provider":"N8N Commerce","version":"1.0","type":"link"}