sagentics.ai
sagentics.ai

Workflow automation with n8n

n8n vs custom code: the honest decision rule for South African builders

By SagenticsPublished

Use n8n for anything that doesn't touch money, regulated customer data, or complex multi-step logic. Move to custom code the moment a workflow needs to handle payments through PayFast or Yoco, store personal data under POPIA, or would require writing JavaScript in more than a third of its nodes anyway. That's the rule. Everything else in this article is context for applying it correctly.

The short answer

The one-line decision rule

If a workflow is internal, low-stakes, and mostly connects tools that already have APIs, build it in n8n. If it touches a bank account, a customer's ID number, or requires an AI agent to reason across multiple steps with memory and state, build it in code. That single test resolves most of the arguments we have with clients before a project starts.

Why it depends is still the honest answer

The rule above is a starting point, not a law. A ten-node n8n workflow that syncs leads from a WhatsApp form to a CRM is obviously fine in n8n. A payment reconciliation system for a business processing thousands of PayFast transactions a month is obviously not. The hard cases sit in between, where most of the actual decision-making happens. We've built both, and the pattern that separates a good call from a bad one is rarely which tool is better. It's whether the workflow's risk profile matches what the tool was designed to handle.

What n8n is genuinely good at

Gluing SaaS tools and APIs together fast

n8n earns its reputation here. If you need to connect WhatsApp Business API, Google Sheets, a CRM, and an email tool into one flow, n8n will get you there in a day, not a sprint. Its node library covers most SA-relevant tools out of the box. Where it doesn't, an HTTP request node fills the gap. For a full walkthrough of what this looks like in practice, see our n8n workflow automation guide.

WhatsApp, CRM, and back-office workflows that don't touch money

This is the sweet spot. Lead capture, appointment reminders, quote generation, internal notifications, document routing. None of these involve moving money or storing sensitive personal fields beyond a name and phone number, and all of them benefit from n8n's visual debugging and fast iteration. We've written specifically about n8n lead capture and CRM automation and about building a document automation loop in n8n, because these are the two categories where n8n consistently outperforms writing custom code from scratch.

Prototyping an idea before committing budget to custom build

n8n is also the right tool for testing whether an automation idea actually works before you spend real development budget on it. Build the rough version in n8n, run it for two or three weeks, watch where it breaks, and use that as the spec for the custom version if one turns out to be necessary. This is cheaper than writing a full spec on paper and building blind. If you're also weighing n8n against Make or Zapier for this prototyping phase, our comparison of n8n vs Make vs Zapier covers the tradeoffs.

The DecisionRules Node for n8n: No-Code Business Rule Automation

Where n8n quietly turns into custom development anyway

The 30% code-node threshold

Here's the thing nobody tells you upfront: n8n workflows that look "no-code" often aren't. The moment you're writing custom JavaScript in a Function node to handle conditional logic n8n's native nodes can't express, you've started doing custom development inside a visual wrapper. Once code nodes make up more than roughly a third of a workflow, you're paying the complexity cost of custom code without the benefits: no proper version control, no unit tests, no CI pipeline, and debugging through a browser-based execution log instead of a real IDE. At that point the honest move is to ask whether the workflow should just be code.

Debugging, version control, and testing gaps in the free and lower tiers

n8n's execution log is fine for spotting an obvious failure. It's not fine for tracing a subtle bug across a 40-node workflow with branching logic, especially when you can't easily diff two versions of the workflow or roll back cleanly. Git-based version control exists but isn't the default experience most teams use, and automated testing is close to nonexistent compared to what you'd get in a standard code repository with CI. For a workflow running quietly in the background this is a minor annoyance. For a workflow a business depends on daily, it's a real operational risk.

A real example: rebuilding an n8n workflow as a service

We had a client running quote generation through n8n with five code nodes handling pricing logic, tax calculation, and PDF formatting. Every pricing rule change meant editing JavaScript inside a Function node, testing it manually in the n8n UI, and hoping nothing else broke. We rebuilt the pricing logic as a small standalone service with proper tests, and kept n8n as the orchestration layer calling that service. Same workflow, same WhatsApp trigger, but the fragile part moved to where it could be tested and version-controlled properly. That's the hybrid pattern in miniature, and it's the one we reach for most often.

The real cost of self-hosting n8n in South Africa

VPS, backups, and DevOps time in rand

Self-hosting n8n isn't free, and the "free" framing is where a lot of businesses get caught out. A basic VPS capable of running n8n reliably costs somewhere between R150 and R400 a month depending on provider and specs. Add backups, SSL renewal, and monitoring, and you're realistically looking at R300 to R600 a month in infrastructure alone, before counting the hours someone spends keeping it patched and running. For a deeper breakdown of self-hosted versus cloud costs, we cover this in detail in self-hosting n8n vs cloud.

Load-shedding and uptime risk for self-hosted instances

This is the part almost nobody outside South Africa accounts for. If you're self-hosting n8n on infrastructure with any dependency on local power stability, or if your team needs to manually intervene during an outage, load-shedding turns into a real uptime risk. Most reputable VPS providers run on infrastructure with proper backup power, so this mainly bites businesses hosting on local hardware or cheaper providers without redundancy. Either way, it's a question worth asking before you commit: what happens to this workflow during stage 4 load-shedding, and who notices if it silently stops running?

When self-hosted n8n actually beats a SaaS subscription

Self-hosting makes sense once your execution volume is high enough that n8n Cloud's per-execution pricing would cost more than a VPS plus a bit of maintenance time, typically somewhere north of a few thousand executions a month. It also makes sense if you need full control over data residency, which matters more in South Africa given POPIA's requirements around where and how personal data is processed. Below that volume, n8n Cloud is usually cheaper once you count your own time honestly.

n8n vs Claude Code Comparison: Real Scores, Real Verdict

When custom code is the right call

Anything that touches payments: PayFast and Yoco webhooks

This is the clearest trigger in the whole decision. The moment a workflow needs to verify a PayFast ITN callback or handle a Yoco webhook securely, you're dealing with signature verification, idempotency, retry handling, and reconciliation logic that needs to be airtight. n8n can technically receive these webhooks, but building the surrounding logic, retry safety, duplicate detection, proper logging, inside a visual workflow tool is asking for trouble the first time a payment fails silently. We've laid out exactly how this should work in our guide to accepting payments through WhatsApp using PayFast or Yoco.

Anything that touches personal data: the POPIA argument

POPIA doesn't ban automation tools, but it does require you to know exactly where personal data lives, how long it's kept, and who can access it. A visual workflow tool storing customer ID numbers, medical information, or financial details in execution logs by default makes that harder to guarantee than a purpose-built system where you control storage, encryption, and retention explicitly. This isn't a reason to avoid n8n for everything: most WhatsApp automation touches only a name and number, which is low risk. But the moment regulated personal data enters the picture, custom code gives you the audit trail POPIA compliance actually requires. We go deeper on this in whether WhatsApp automation is POPIA compliant.

Multi-step AI agent logic, state, and audit trails

n8n can call an LLM. It's not built to manage a multi-step agent that needs to hold conversation state across turns, make branching decisions based on prior reasoning, retry failed tool calls intelligently, and log every decision for review. That's agent architecture, and it needs proper state management, structured logging, and testable logic, which is what code gives you and a node-based canvas doesn't. If your project is heading in this direction, it's worth reading about custom AI development in South Africa before you sink weeks into forcing an agent workflow through n8n nodes.

The hybrid approach we actually build

n8n for the long tail of internal automations

Most businesses have twenty small automations that need to exist and none of them are worth custom development budget individually. Appointment reminders, internal Slack notifications, document generation, CRM field updates. This is where n8n keeps earning its cost, handling the long tail cheaply and visibly, with non-technical staff able to see and adjust the logic without needing a developer.

Custom code for what touches money or compliance

Everything that touches a payment gateway, stores regulated personal data, or needs an audit trail lives in code, properly tested, version-controlled, and monitored. This isn't overkill, it's matching the tool to the actual risk. A failed WhatsApp reminder is an annoyance. A failed payment reconciliation or a POPIA breach is a different category of problem entirely.

How to migrate a workflow from n8n to custom without a rebuild from scratch

You don't need to throw away the n8n workflow when a piece of it outgrows the platform. Pull the risky logic, payment handling, data storage, agent reasoning, into a small standalone service with its own tests and deployment, and keep n8n calling that service via HTTP request node for orchestration. This is exactly what we did in the quote generation example above. It's faster than a full rebuild and it keeps the parts of the workflow that were working fine, working fine.

A 10-minute decision checklist

Volume, sensitivity, and complexity questions to ask before you build

Before building anything, ask these five questions: Does this workflow touch a payment gateway, PayFast, Yoco, or otherwise? Does it store or process personal information regulated under POPIA? Would more than a third of the workflow's nodes need custom JavaScript to work? Is expected volume high enough that self-hosting infrastructure costs less than SaaS execution pricing? Does the logic require multi-step reasoning, memory, or state beyond a simple trigger-action pattern? Two or more "yes" answers means custom code, or at minimum a hybrid split, is the right call. If you're still unsure what any of this costs in practice, our breakdown of what WhatsApp automation actually costs in ZAR is a useful reality check before you commit budget either way.

Common questions

When should you start with n8n and when should you move to custom code? Start with n8n for anything internal, low-risk, and API-driven: lead capture, reminders, CRM syncs, document generation. Move to custom code the moment payments, POPIA-regulated personal data, or multi-step AI reasoning enter the picture. Use n8n to prototype first if you're unsure, then decide based on what the prototype reveals about complexity and risk.

At what point does an n8n workflow effectively become custom development? Once code nodes make up more than roughly a third of the workflow's logic, you're already doing custom development, just without proper version control, testing, or an IDE. At that stage, extracting the logic into a real codebase and calling it from n8n usually costs less long-term than maintaining fragile JavaScript inside Function nodes.

What does self-hosting n8n actually cost in South Africa, in rand? Expect R300 to R600 a month realistically, covering a capable VPS, backups, SSL, and monitoring, before counting the hours spent on maintenance. It's cheaper than n8n Cloud only once execution volume is high enough to make per-execution SaaS pricing costlier than infrastructure plus your own maintenance time.

Is n8n POPIA compliant for handling South African customer data? n8n itself isn't inherently non-compliant, but default execution logging and data handling make it harder to guarantee POPIA's requirements around data location, retention, and access control. For low-sensitivity data like names and phone numbers it's generally fine. For regulated personal data, custom code gives you the explicit control POPIA compliance requires.

Can n8n handle PayFast or Yoco payment webhooks safely? It can technically receive the webhooks, but signature verification, retry handling, and reconciliation logic are hard to build reliably inside a visual workflow tool. A failed or duplicated payment event needs airtight handling that custom code delivers more safely than a node-based canvas, especially once transaction volume grows.

At what execution volume does custom code become cheaper than n8n? There's no fixed number, but once a workflow runs tens of thousands of executions a month, or once maintenance time on a growing node count exceeds a few hours a week, the cost curve usually favours custom code. Below that, n8n's speed of iteration typically outweighs the setup cost of a bespoke build.

Does n8n work for complex AI agent logic or only simple automations? It handles simple LLM calls fine: one prompt in, one response out. It struggles with multi-step agents that need memory, branching reasoning, and tool retries, because that requires proper state management and structured logging that a node canvas isn't built for. Complex agent logic is a strong signal to move to custom code.

Is a hybrid n8n plus custom code setup normal, or should you pick one? Hybrid is normal and, in our experience, usually the right answer. Most working systems use n8n for orchestration and the long tail of internal automations, with custom code handling anything that touches money, regulated data, or complex reasoning. Picking one tool for an entire business's automation needs is rarer than it sounds.

If you're trying to work out where your own workflow falls on this line, or you want a second opinion before committing budget either way, send us a message on WhatsApp and we'll talk it through. You can also see our custom AI development work if you want to know what the custom side of this actually looks like in practice.

Common questions

When should you start with n8n and when should you move to custom code?

Start with n8n for anything internal, low-risk, and API-driven: lead capture, reminders, CRM syncs, document generation. Move to custom code the moment payments, POPIA-regulated personal data, or multi-step AI reasoning enter the picture. Use n8n to prototype first if you're unsure, then decide based on what the prototype reveals about complexity and risk.

At what point does an n8n workflow effectively become custom development?

Once code nodes make up more than roughly a third of the workflow's logic, you're already doing custom development, just without proper version control, testing, or an IDE. At that stage, extracting the logic into a real codebase and calling it from n8n usually costs less long-term than maintaining fragile JavaScript inside Function nodes.

What does self-hosting n8n actually cost in South Africa, in rand?

Expect R300 to R600 a month realistically, covering a capable VPS, backups, SSL, and monitoring, before counting the hours spent on maintenance. It's cheaper than n8n Cloud only once execution volume is high enough to make per-execution SaaS pricing costlier than infrastructure plus your own maintenance time.

Is n8n POPIA compliant for handling South African customer data?

n8n itself isn't inherently non-compliant, but default execution logging and data handling make it harder to guarantee POPIA's requirements around data location, retention, and access control. For low-sensitivity data like names and phone numbers it's generally fine. For regulated personal data, custom code gives you the explicit control POPIA compliance requires.

Can n8n handle PayFast or Yoco payment webhooks safely?

It can technically receive the webhooks, but signature verification, retry handling, and reconciliation logic are hard to build reliably inside a visual workflow tool. A failed or duplicated payment event needs airtight handling that custom code delivers more safely than a node-based canvas, especially once transaction volume grows.

At what execution volume does custom code become cheaper than n8n?

There's no fixed number, but once a workflow runs tens of thousands of executions a month, or once maintenance time on a growing node count exceeds a few hours a week, the cost curve usually favours custom code. Below that, n8n's speed of iteration typically outweighs the setup cost of a bespoke build.

Does n8n work for complex AI agent logic or only simple automations?

It handles simple LLM calls fine: one prompt in, one response out. It struggles with multi-step agents that need memory, branching reasoning, and tool retries, because that requires proper state management and structured logging that a node canvas isn't built for. Complex agent logic is a strong signal to move to custom code.

Is a hybrid n8n plus custom code setup normal, or should you pick one?

Hybrid is normal and, in our experience, usually the right answer. Most working systems use n8n for orchestration and the long tail of internal automations, with custom code handling anything that touches money, regulated data, or complex reasoning. Picking one tool for an entire business's automation needs is rarer than it sounds.

About Sagentics

Sagentics is an AI systems studio based in South Africa. We design and build WhatsApp automation, n8n workflows, and custom AI products for local and international clients. We write from systems we have actually shipped.

Start a WhatsApp conversation with Sagentics

Related reading