In August I had twenty minutes on the Frappeverse stage to tell the story of moving a support team from Zendesk to Frappe Helpdesk. Twenty minutes is enough for slides. It is not enough for the story. This is the longer version, with the parts that didn’t fit.
It started with a number
When the project landed, the first thing I did was count. About 1.5 million tickets, each carrying AI triage data. Around 5 million replies and comments hanging off those tickets. 518 GB of attachments. 300,000 users, and 200 support agents who would log in on Monday and expect everything to just be there.
That last part was the real requirement. Moving data is a project. Moving data without the agents noticing is the job.
Zendesk wasn’t broken, so why move at all? Because every new agent meant another licence, every custom need meant hunting through a marketplace, and both the data and the workflows lived on the vendor’s terms. Frappe Helpdesk offered the opposite. It is open source and free to self-host, it is built on Frappe so every workflow can be shaped around the business, and the data stays with the people who own it.
In the end, it came down to cost. Zendesk charges per agent, and with 200 agents that bill was big and only moved one way: up, with every new hire. A self-hosted Frappe Helpdesk has no licence fee at all, so the money could go into building exactly what the team needed instead of renting what the vendor offered.
Two migrations, not one
Pretty early on I realised we weren’t doing one migration. We were doing two.
The first was data: tickets, replies, users and files. The second was behaviour: everything Zendesk did to a ticket without anyone clicking a button. Triggers that routed a ticket the moment it arrived. Automations that nudged or closed a ticket after hours of silence. Macros that agents fired dozens of times a day. Views, teams, routing rules, the email addresses customers wrote to.
If we moved the data and forgot the behaviour, agents would open Frappe Helpdesk on Monday, see every single ticket, and still not be able to do their job. So behaviour got the same weight as data, and every Zendesk feature the team relied on needed a home in Frappe Helpdesk:
| In Zendesk | Where it lives in Frappe Helpdesk now |
|---|---|
| Triggers | A Trigger doctype with categories and “meet all” / “meet any” condition sets, run on every ticket event |
| Automations | An Automation doctype, checked by an hourly job against time conditions like hours since the last customer reply |
| Macros | A Macro doctype scoped to teams, with special actions for assigning, tags and followers |
| Views | Helpdesk’s HD View, shared per team |
| Groups | HD Team, plus routing groups that cap how many open tickets each agent can hold |
| Ticket fields and forms | HD Ticket Type plus a new Ticket Subtype |
| Support email addresses | Aliases mapped to agents |
| Suspended users | A customer flag that blocks new tickets and shows a custom message |
| The client’s own AI triage app | Rebuilt inside Helpdesk: intent, sub-intent, sentiment and language on every ticket |
The first plan failed
Like most engineers, my first instinct was to write the extraction myself. A few Python scripts, the Zendesk API, a loop. How hard could it be?
Harder than it looked. The scripts were slow, and Zendesk’s API rate limits kept pulling the brakes. Just downloading the tickets took more than 24 hours, and that was before we had transformed or loaded a single row.
So we stopped building a downloader and picked up Airbyte, a plugin-based data integration tool. It pulled the Zendesk export into Postgres and kept it in sync on its own. The same download now took about 4 hours. The lesson stuck with me: the most boring part of a migration is exactly where you should not be clever.
We still call the Zendesk API, but only for the handful of ticket fields the export leaves out. Everything else is read from Postgres.
Order matters more than speed
The import itself became a Frappe app of its own, Zendesk Migrator, with one command and eight groups under it: bench migrate-zendesk tag, user, trigger, automation, macros, ticket, views and so on.
The thing that surprised me most was how much the order mattered. A trigger that hands tickets to a team can’t be created before the team exists. A ticket can’t point at an agent who hasn’t been imported yet. A view shared with a team needs both the team and the tickets. So the run became a fixed sequence of nine steps, and the behaviour moved before the tickets did.
Moving the tickets without making a mess
Three decisions made the ticket import boring, in the best way.
Keep the ticket numbers. The migrator reuses the Zendesk ticket ID as the Helpdesk ticket name. Ticket #48213 in Zendesk is #48213 in Frappe Helpdesk. Customers replying to an old email thread, agents searching by number, links pasted in internal docs: all of it kept working. For the rare backfill into a site where an ID is already taken, ticket run-missing lets Frappe assign a new ID and writes a mapping file so nothing gets lost.
Never query per ticket. The importer works a page at a time. For each page it fetches the comments, metric events, satisfaction scores and email notifications for every ticket on that page in one query each, transforms them in memory, writes them with frappe.db.bulk_insert and commits once per page. With ~5 million replies, a query per ticket would have turned hours into days.
Make every run safe to repeat. Inserts use ignore_duplicates, so running the same window twice does no harm. On top of that, every command takes the same set of flags:
# Look first: read and transform 10 tickets, write nothing
bench --site $SITE migrate-zendesk ticket run --limit 10 --dry-run
# Then move one year at a time
bench --site $SITE migrate-zendesk ticket run --updated-at-from 2021-01-01 --updated-at-to 2021-12-31
# Then fill the gaps
bench --site $SITE migrate-zendesk ticket run --only-missing
bench --site $SITE migrate-zendesk ticket run --only-missing-communicationsCareful
A dry run of ticket run is not completely free of side effects. It still seeds ticket statuses, ticket types and the AI intent and sentiment lists. Do your first dry run on a scratch site.
We moved tickets one year at a time and checked each year before starting the next. Part of that check was manual spot checks. The other part was a simple, ruthless comparison: fetch every ticket ID from the source, fetch every ticket name from Frappe Helpdesk, and the difference is the to-do list. --only-missing then imports exactly that difference, and --only-missing-communications does the same for replies on tickets that already exist.
518 GB of attachments
Attachments were the heaviest part by far, so they never went through the ticket pipe. The export’s files sat in an S3 bucket, and the migrator read each ticket’s attachments from there and created normal Frappe File records for them.
The interesting part is what happens next. We wrote a second app, Frappe Azure Blob Storage, that hooks into every new File record before it is saved. It pushes the bytes to Azure, into separate public and private containers, and rewrites the file’s URL to a small proxy in Frappe. When an agent clicks an attachment, the proxy checks their permission again and redirects them to a short-lived, read-only link. The files never pile up on the Frappe server, and a private file is never reachable by someone who can’t see the ticket.
Teaching Frappe Helpdesk Zendesk’s habits
This is the part that never fits on a slide, and it is where most of the work went.
Triggers are the heartbeat of a Zendesk setup, so they got the most care. Ours run every time a ticket is created or updated. Each one has two condition sets, “meet all” and “meet any”, exactly like Zendesk, so imported triggers map across one to one. Categories decide the order they run in.
The tricky part is that triggers talk to each other. One trigger sets a ticket type, and that makes a second trigger match. So the engine runs in passes: check every enabled trigger in order, fire the ones that match, then go round again. Each trigger fires at most once per run, and the loop stops when a pass fires nothing, or after 20 passes as a guard against circular rules. Field changes from all the triggers are collected and written once at the end, and then a live update goes out so any agent looking at the ticket sees it change.
Getting that right took a few guards. Adding a reply saves the ticket, saving the ticket runs triggers, and triggers can add a reply. So a ticket already being processed is skipped, and the same ticket and event pair only runs once per request.
AI triage came next. The client already had triage running beside Zendesk as a separate PHP app. We ported that logic into Frappe Helpdesk in Python. Every new ticket goes to Azure OpenAI with a structured JSON schema built from the intents, sub-intents and sentiments the admins have switched on, and comes back with an intent, sub-intent, sentiment, language and confidence scores.
That created a timing problem. Triggers on “ticket created” fire straight away, before triage has an answer, so a rule like “if intent is billing, send to the billing team” could never match. The fix was a triage gate. When it is switched on, the “created” triggers wait until triage concludes, whether it succeeds or fails. While it waits, the ticket is frozen for agents with a friendly “AI triage is still running” message. A timeout lifts the freeze if a background job dies, and a single conditional update claims the pending run so two workers can never fire it twice.
Automations are triggers on a clock. An hourly job checks them against time-based conditions: hours since the ticket was created, since the customer last replied, since an agent last replied, or since it entered a particular status. A separate job closes tickets that have sat in a resolved state for too many days.
Macros looked simple until we read Zendesk’s export. Many Zendesk macro actions don’t map to a ticket field at all: assign to an agent, add or remove tags, add a follower. Instead of complicating the macro schema, we kept it as plain field and value pairs and used special underscore-prefixed field names for those built-in actions. When a macro runs, those are caught and routed to their own handlers. Macros are also scoped to teams, so each team only sees its own.
Routing needed one thing Frappe Helpdesk didn’t have: capacity. Agents belong to a routing group, and each group sets the most open tickets an agent can hold. Open-ticket counts are cached in Redis, and the assignment rule skips anyone who is already full.
Then there was the long tail, the small things agents only notice when they’re gone. Email aliases mapped to agents. Suspended customers who can’t open new tickets. Customers who can’t close tickets themselves. Ticket translation, also through Azure OpenAI, run in the background so large tickets don’t time out. Time tracking on each ticket view, agent availability logs, and an automatic retry every few minutes for emails SendGrid dropped, resent through a fallback account.
Customising Frappe Helpdesk: override, don’t fork
All of this needed changes to Helpdesk’s screens, and this is where the project could have quietly gone wrong.
The obvious move was to fork Frappe Helpdesk. A fork works beautifully on day one. Then Frappe ships a release and you spend a week merging. Then another release. Slowly you stop taking upstream improvements at all, because each one costs too much. With a small team, that was a trap I didn’t want to walk into.
So we never touched Helpdesk’s code. Our custom app builds its own copy of the Helpdesk frontend on every build, straight from upstream’s source, and then lays our changed files on top.
It happens in four steps, all driven by one small prebuild script.
- Copy upstream. The script copies Helpdesk’s frontend source and its
frappe-uiinto our app. Both copies are gitignored, so they are rebuilt from scratch every time and nobody is tempted to edit them. - Lay our files on top. Our app keeps a
src_overridefolder that mirrors upstream’ssrcpaths. The script copies it over the fresh copy, so any file with the same path replaces upstream’s version. Everything else stays exactly as Frappe wrote it. - Build into our app. Our own
vite.config.jssends the build output into our app’spublicfolder and writes theindex.htmlfor the/helpdeskroute. - Serve it with upstream’s brain. Our
www/helpdesk/index.pysimply re-exports Helpdesk’s own page controller. Only the HTML is ours. The page context and boot data still come from upstream, so they can never drift apart.
The heart of it is a handful of fs-extra calls:
// simplified
import fs from "fs-extra";
// fresh copy of upstream, every build
fs.copySync("../helpdesk/desk/src", "src");
fs.copySync("../helpdesk/frappe-ui", "../frappe-ui", { filter: skipNodeModules });
// our files win
fs.copySync("src_override", "src");And the page controller is a single import:
from helpdesk.www.helpdesk.index import get_boot, get_context, get_context_for_dev, no_cache # noqa: F401The backend follows the same rule. Instead of editing Helpdesk’s Python, everything goes through Frappe’s hooks: override_doctype_class to extend 12 doctypes including HD Ticket, HD Agent and Assignment Rule, override_whitelisted_methods to swap 13 of Helpdesk’s APIs for our own versions, and doc_events to react when tickets, replies and tags change. If you read my earlier post, Why Your Frappe App Needs More Hooks, this is that idea at full scale.
The trade-off is real, and worth saying out loud. When Frappe changes a file we’ve overridden, we don’t get that change for free. Someone has to compare the two versions and carry the fix across. And that folder didn’t stay small. By the end, src_override held 214 files, from settings screens to the trigger builder to the ticket view. Every one of them is a promise to keep watching upstream.
A small team, and a lot of help
All of this was done by a small team, and AI-assisted engineering is a big part of how. It let us move far faster than a migration this size usually allows, without giving up on reliability, performance or what the agents saw on screen. The AI wrote a lot of code. People still decided what to build, and reviewed every change before it shipped.
Giving it back
Some of what we built belonged upstream, not in our app. So far we’ve contributed dark mode, read replicas for GET APIs, HD Team mentions and a Redis search optimization. That last one came straight from this project: Frappe cleared cache with Redis KEYS and DEL, which blocks Redis while it scans. Under load, with thousands of cache entries, that became our biggest bottleneck, so we switched it to the non-blocking SCAN and UNLINK. Triggers with advanced workflow logic and custom macros come next, once they’re ready.
We also open sourced the two tools that did the heavy lifting in this Frappe Helpdesk migration: Zendesk Migrator and Frappe Azure Blob Storage.
If I did it again
Over chai
If you’re about to start a migration like this: don’t write your own extractor. Treat behaviour as seriously as data, and list every trigger, automation and macro before you write a line of import code. Keep the old ticket numbers. Give attachments their own road. Build a dry run into your import from day one, and move in small batches you can check. And override, don’t fork.
Twenty minutes wasn’t enough. I hope this was.
