Check Inventory and Calculate Reorder Quantities Automatically
Stock shortages are identified early: This workflow receives product data via webhook, checks inventory against defined thresholds, and calculates the necessary reorder quantities. Invalid inputs are reported clearly. The output is a structured JSON listing all items to reorder with quantities. Businesses seeking more efficient and transparent inventory management will benefit from this solution.
Businesses and teams that regularly monitor inventory levels and trigger reorders gain reliable support with this workflow. Through a POST webhook, any number of items can be submitted with fields sku (item number), stock (current stock), reorderPoint (reorder threshold), and targetStock (desired stock). The workflow validates input completeness and plausibility. For all items below the reorder threshold, it calculates the reorder quantity needed to reach the target stock. The result is a sorted JSON object listing all items to reorder, their quantities, and a total sum. Invalid or incomplete inputs receive a clear error message with HTTP status 400. Webhook authentication must be configured separately in n8n to prevent unauthorized access. Execution data is stored in n8n and should be regularly reviewed and managed. The workflow is flexible and can serve as a basis for further automations such as notifications or ERP integrations.
AI-generated image
Installation
1. Import the workflow into n8n.
2. Open the Webhook node and start the test listener.
3. Copy the displayed test URL and use it for test requests.
4. After successful testing, activate/publish the workflow and use the production URL from the Webhook node.
5. Set up webhook authentication in n8n to prevent unauthorized access.
6. Optionally, configure execution logs and data retention in n8n.
Usage
1. Send a POST request with Content-Type application/json to the webhook URL.
2. Example input:
```json
{
"items": [
{"sku": "A1", "stock": 5, "reorderPoint": 10, "targetStock": 20},
{"sku": "B2", "stock": 12, "reorderPoint": 10, "targetStock": 15}
]
}
```
Expected response:
```json
{
"status": "success",
"reorderItems": [
{"sku": "A1", "stock": 5, "reorderPoint": 10, "targetStock": 20, "reorderQuantity": 15}
],
"totalReorderQuantity": 15,
"checkedCount": 2
}
```
HTTP status: 200
Error case (e.g., missing fields):
```json
{
"status": "error",
"message": "Ungültige Lagerdaten.",
"invalidIndex": 1
}
```
HTTP status: 200 (error indicated in JSON)
3. Adjust thresholds and fields as needed.
4. Regularly check stored execution data in n8n.
Required connections and APIs
API connections
No saved API credentials were detected in the workflow JSON. Still check webhooks, target systems, credentials, and data protection before activation.
Nodes
WebhookCodeRespond to Webhook
Isolated functional test passed
Optional isolated functional test
The isolated data flow was tested without external services or credentials.
✓ Standard case with complete dataChecks the complete standard flow with valid sample data.Isolated functional test passed✓ Variation or boundary caseChecks a valid variation or an important boundary case.Isolated functional test passed✓ Additional processing ruleChecks this workflow's additional business processing rule.Isolated functional test passed✓ Invalid or incomplete inputChecks that invalid or incomplete data is rejected safely.Isolated functional test passed✓ Empty inputChecks that an empty request receives a controlled response.Isolated functional test passed