Issue sequential invoice and ticket numbers via webhook and Data Table
Ready for 3.0Ready for 3.0. This template uses no nodes that n8n 3.0 removes. No removed nodes, versions or helpers found. Static check, last run 2026-10-19.
Nodes used (4)
- Webhook
n8n-nodes-base.webhook - Code
n8n-nodes-base.code - Data table
n8n-nodes-base.dataTable - Respond to Webhook
n8n-nodes-base.respondToWebhook
What it does
Quick Overview This workflow exposes a POST webhook that issues the next gapless sequential number (for invoices, tickets, or other sequences) by reading and updating a counter stored in an n8n Data Table, and returns a formatted number with an optional prefix and zero padding. How it works 1. Receives a POST request on a webhook endpoint with a sequencekey and optional prefix and pad parameters. 2. Validates and normalizes the request values, falling back to safe defaults if inputs are missing or malformed. 3. Looks up the matching counter row in the n8n Data Table numbersequences using the provided sequencekey. 4. Calculates the next counter value, applies the requested or stored prefix, and formats the number using the requested zero-padding width. 5. Upserts the updated counter back into the numbersequences Data Table keyed by sequencekey. 6. Returns a JSON response containing the issued formatted number, the updated counter value, and a timestamp. Setup 1. Create an n8n Data Table named numbersequences with columns sequencekey (string), currentvalue (number), prefix (string), and updatedat (string). 2. Ensure the Data Table name/reference in the read and upsert steps points to numbersequences and that sequencekey is used as the matching column. 3. Activate the workflow, copy the production webhook URL for /next-number, and configure your calling system to POST a JSON body such as { "sequencekey": "invoice", "prefix": "INV-", "pad": 6 }. 4. If you require strictly no gaps, serialize requests to this endpoint (for example, by ensuring a single caller or limiting concurrent executions) to avoid simultaneous reads of the same counter value.