• CusmatoDocumentatie
  • Overzicht
    • Richtlijnen
    • Workflow
    • AI-model
    • Jessica
    • Kennisbank
    • Patronen
    Workflow icon

    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

    1. Storage in Redis — Email data (subject, body, from, to, channelKey) is stored
    2. Body cleaning — HTML/CSS is cleaned for AI processing
    3. Product info — With EAN in subject: product data is retrieved
    4. 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):

    1. Language detection — Language of the message
    2. Intent classification — refund, delivery, product_question, complaint, other
    3. Sentiment analysis — positive, neutral, negative
    4. RAG search — Relevant knowledge base documents
    5. Response generation — Based on system prompt, onboarding data, RAG, optional tool calls
    6. 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:

    1. Read the full context — Including conversation history from outbox
    2. Adjust AI response — Or use quick-regenerate with feedback (see AI model)
    3. Send — After approval
    4. 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