We built DEV3 AI Helpdesk & Ticket Triage as a WordPress plugin in PHP with a React admin and a dependency-free customer portal. The AI runs on the Google Gemini API with the site owner's own key.
Key design decisions
- Own IMAP client. A small IMAP4rev1 client over a socket (SSL, STARTTLS or plain) runs
UID SEARCH UNSEEN, fetches with BODY.PEEK[] and marks messages seen only after processing, in background jobs. An inbound webhook also accepts Mailgun, SendGrid Inbound Parse, Postmark, generic JSON and raw MIME.
- Threading in two steps. A
[#number] subject token first, then In-Reply-To and References matched against stored Message-IDs of every message the helpdesk sent. A stranger quoting someone else's ticket number opens a new ticket instead.
- Loop and abuse protection.
Auto-Submitted, Precedence and auto-reply headers, system senders, our own address, duplicate Message-IDs, a block list and a per-sender limit of 10 new tickets an hour.
- Quote stripping. Only the new text is kept: cut at the reply marker, "On … wrote:" lines in several languages, Outlook headers and signatures.
- AI that drafts. Thread summaries, triage suggestions (category, priority, sentiment, language), reply drafts grounded in help articles via embeddings with cited sources, rewrites, and help articles from solved tickets. Applying triage automatically and auto-sending replies are opt-in switches, off by default; auto-send also needs a cited article, a confidence threshold and no agent reply yet.
- SLAs that are fair. First-response and resolution targets per priority, optional business hours, and a clock that pauses while waiting on the customer.
Architecture
Tickets, replies, events and saved replies live in custom tables, attachments in a private folder behind signed, expiring links. Agents get their own role and capability. Guests reach their ticket through a private link, and WooCommerce customers through My Account. The API client, jobs, encryption, embeddings store and settings screens come from a shared core used across DEV3's plugins.