1. Opening Problem Statement
Meet Alex, an online store manager who sells limited-edition sneakers on his ecommerce site. Every hour, Alex has to manually check the product page to see if new stock is available or if items have sold out. This tedious routine eats up at least two hours a day, distracting Alex from more important tasks like marketing and customer service. Worse, missing the “Out Of Stock” notice means overselling or losing customers when the website inventory isn’t updated in real-time. This causes Alex stress, lost sales, and unhappy buyers.
What if Alex could automate these stock checks and get instant alerts when products run out? This is exactly what the n8n workflow we’ll explore does — it saves hours daily, eliminates errors from manual checks, and helps retain customers by always having fresh inventory information.
2. What This Automation Does
This automation runs every hour via a Cron trigger and performs a check on a target product webpage by making an HTTP request. It then evaluates the page content to detect if the phrase “Out Of Stock” appears and sends an immediate Discord alert accordingly. Here’s what happens when this workflow runs:
- Every hour, the workflow fetches the product page HTML as a text string.
- It scans the page content to identify if the specific phrase “Out Of Stock” exists.
- If the out-of-stock phrase is found, it sends a Discord message notifying the team about the stock status.
- If the phrase is not found, it sends a different Discord message confirming the stock is still available.
- Overall, it eliminates the need for manual hourly stock monitoring.
- Keeps your sales team instantly updated to manage inventory and customer expectations better.
By automating this simple but critical task, Alex saves close to 14 hours per week and reduces potential sales errors from outdated stock info.
3. Prerequisites ⚙️
- n8n account with workflow editing access.
- HTTP Request node connected to the product webpage URL for monitoring.
- Discord account with a setup Discord webhook URL ready for alert messages.
- Basic understanding of text content checking to customize the phrase “Out Of Stock”.
Optional: Self-hosting your n8n for complete control and no workflow run limits. See hostinger’s n8n self-hosting guide for details.
4. Step-by-Step Guide to Create This Workflow
Step 1: Set Up the Cron Trigger for Hourly Execution
In your n8n editor, click ‘+ New’ → choose ‘Cron’ node. Configure as follows:
- Trigger Times → Every Hourly (select “Every Hour” from the dropdown)
Visual: You should see a green circle on the Cron node indicating it’s ready to trigger on schedule.
Common mistake: Forgetting to set the timezone properly in workflow settings means you might miss expected trigger times.
Step 2: Add HTTP Request Node to Fetch Product Page
Add an HTTP Request node and connect the output of Cron to it. Configure it as:
- Set URL to your product page, e.g.,
https://example.com/product-page - Set Response Format to
Stringto get raw page HTML
Visual: The node will output a single string field named data containing the entire page HTML on execution.
Common mistake: Leaving the URL empty or wrong will cause HTTP errors or empty responses.
Step 3: Insert the IF Node to Check for “Out Of Stock” Text
Drag in an IF node and connect the HTTP Request output to it. Configure conditions:
- Set Operation to contains
- In Value1, enter:
{{$node["HTTP Request"].json["data"]}}to reference the HTML text - In Value2, type exactly Out Of Stock
Visual: The IF node splits the flow into two routes based on presence or absence of the phrase.
Common mistake: Misspelling “Out Of Stock” here means the check won’t work as expected.
Step 4: Set Up Discord Nodes for Alerts
Add two Discord nodes: one for the Out of Stock message and one for the In Stock message. Connect the True output of IF to the first Discord node, the False output to the second Discord node.
- Enter your Discord webhook URL in each node.
- Set the Text field appropriately:
- “value found” for Out Of Stock message
- “value not found” for In Stock message
Visual: Discord messages will post in your selected Discord channel during workflow tests or scheduled runs.
Common mistake: Leaving webhook URLs empty or incorrect causes failure to send messages.
Step 5: Activate and Test Your Workflow
Toggle the workflow active state to ON and run a manual test:
- The workflow triggers the HTTP Request and IF nodes.
- Discord messages appear based on stock presence or absence.
Visual: Monitor execution logs in n8n to verify each node ran successfully and see outputs.
5. Customizations ✏️
- Change monitored text: Modify the phrase “Out Of Stock” in the IF node to check for other stock status terms like “Sold Out” or “Unavailable”.
- Adjust check frequency: In the Cron node, change frequency to every 30 minutes or daily depending on needs.
- Send alerts to multiple channels: Duplicate Discord nodes with different webhook URLs to notify different teams like sales, logistics, etc.
- Add email notifications: Insert a Gmail node triggered alongside Discord nodes to send email alerts automatically.
- Parse JSON API responses: If your website returns an API JSON with stock status, switch HTTP Request responseFormat to JSON and adjust IF node accordingly.
6. Troubleshooting 🔧
- Problem: “HTTP Request node returns empty data”
- Cause: Incorrect or inaccessible URL, or website blocking bots.
- Solution: Double-check URL, verify with curl/postman outside n8n, consider adding headers or user-agent in HTTP Request node settings.
- Problem: “Discord message not sent”
- Cause: Invalid or missing Discord webhook URL.
- Solution: Recopy webhook URL from Discord channel settings, paste in node, test sending a message manually.
- Problem: “IF node condition never true”
- Cause: Text mismatch or case sensitivity.
- Solution: Ensure exact phrase matches, try converting to lowercase first or use regex conditions for flexibility.
7. Pre-Production Checklist ✅
- Verify Cron node is correctly set to your timezone.
- Test HTTP Request node standalone to confirm it fetches the page data.
- Check IF node condition exactly matches the target stock phrase.
- Test Discord nodes by sending sample messages.
- Run a full test workflow execution and confirm alerts happen correctly.
8. Deployment Guide
Once tested, activate the workflow to run hourly. Monitor via the n8n executions panel. Optionally, set up workflow error notifications in n8n to alert you if this automation fails. This workflow is low-complexity but mission-critical for inventory management, so keep tabs on execution logs regularly.
9. FAQs
Q: Can I monitor multiple product pages with this workflow?
Yes, duplicate the HTTP Request node for each URL and pass results through shared IF and Discord nodes or clone entire workflows.
Q: Does Discord webhook usage cost anything?
No, Discord webhooks are free, but n8n workflow executions might count towards your usage plan.
Q: Is this automation secure?
Yes, but keep webhook URLs private as anyone with the URL can send messages to your channels.
Q: Can this check API-based stock data?
Absolutely, as long as you adjust HTTP Request settings to parse JSON and change IF logic accordingly.
10. Conclusion
By creating this n8n workflow, you’ve built a hands-free website stock checker that notifies your team instantly via Discord when product availability changes. This eliminates hours of manual work and prevents lost sales from inventory inaccuracies. You’ve empowered your business with timely data and alerts, enhancing customer experience and operational efficiency.
Next, consider extending this automation to include email alerts, multi-product monitoring, or integration with your order management system for end-to-end stock control. Keep experimenting—automation is a powerful ally to help grow and streamline your business!