
Workflow
Workflow: How the helpdesk works
The full process from incoming ticket to resolution
Overview
This document describes the full process from incoming ticket to resolution, based on the Cusmato implementation.
[Email in] → [Postduif webhook] → [Redis pending] → [First-contact AI] → [Outbox] → [Send] → [Completed]Step 1: Incoming email
Tickets arrive via the Postduif webhook (Postal email infrastructure):
- Email — Webhook receives incoming email, stores in Redis
- Channel — Automatically determined (bolcom, demo, shopify, etc.) based on subject and reply-to
- Identification — Order ID, reply-to email or message_id as fallback
Automatic actions on receipt
- Storage in Redis — Email data (subject, body, from, to, channelKey) is stored
- Body cleaning — HTML/CSS is cleaned for AI processing
- Product info — With EAN in subject: product data is retrieved
- First-contact trigger — AI processing starts immediately after storage (asynchronous)
Step 2: First-contact AI
Immediately after storage, the AI pipeline starts (see AI model):
- Language detection — Language of the message
- Intent classification — refund, delivery, product_question, complaint, other
- Sentiment analysis — positive, neutral, negative
- RAG search — Relevant knowledge base documents
- Response generation — Based on system prompt, onboarding data, RAG, optional tool calls
- Auto-approval or review — Depending on configuration
Enrichment (where applicable)
For some channels (e.g. Bol.com with order ID), an enrichment_queue can be used:
- Retrieve order data
- Status:
pending_ai_processing - Then:
ai_processing_queue→ first-contact
Step 3: Outbox and approval
The generated response goes to the outbox:
- Auto-approval — At high confidence, the response is directly queued for sending
- Review — Otherwise it waits for human approval
- LLM approvals — Workflow for approving AI responses
Sending
After approval, the email is sent via the mail server. The ticket receives an outbox_expiry_marker for follow-up timing.
Step 4: Completed
The cron process-outbox periodically checks:
- When the expiry marker has expired → ticket moves from outbox to completed
- Billing is updated
- Ticket is archived
Step 5: Agent workflow (when manual)
When a ticket is handled manually or AI responses are adjusted:
- Read the full context — Including conversation history from outbox
- Adjust AI response — Or use quick-regenerate with feedback (see AI model)
- Send — After approval
- Jessica — For analysis and improvement of the AI system (see AI model - Jessica)
Closing
- Customer confirms the problem is resolved, or
- No response after agreed deadline
- Ticket moves to completed