Skip to content

Email System Overview

The email system provides AI-assisted email automation with agent-based processing, workflow guidance, cross-channel context integration, and response drafting.

Key Features

AI Agent-Based Processing

  • Intelligent Agent Selection: Automatically assigns the best AI agent to handle each email based on workflow assignment, routing rules, or default settings
  • Agent Handoffs: Agents can hand off emails to specialized agents when needed (e.g., sales to support, general to technical)
  • Conversational AI: When no workflow matches, agents use conversational AI to respond naturally using business context
  • Natural Delays: Responses are sent with 5-15 minute delays to appear more human-like

Workflow-Based Guidance

  • Create custom workflows to guide AI agents (not as rigid templates)
  • Match workflows based on email content and goals
  • Workflows provide context and structure, but agents adapt responses naturally
  • Execute multiple steps in sequence (extract info, generate response, create tickets, etc.)

AI-assisted responses

  • Automatic email response generation using AI agents (OpenAI models including GPT-4o, GPT-4o Mini, GPT-4 Turbo, and GPT-3.5 Turbo)
  • Each agent has its own system prompt, personality, and signature
  • Workflows guide agents but don't constrain them to templates
  • Context-aware responses using business information, workflow context, and conversation history
  • Professional email signatures with random signoffs, agent name, and optional custom signature

Cross-Channel Integration

  • Links email conversations with SMS, voice, and chat
  • Provides AI agents with context from previous conversations across all channels
  • Unified contact data extraction and matching
  • Agents maintain conversation context across channels

Domain Management

  • Add and verify custom domains for email sending
  • SMTP credential management with encryption
  • Support for Emailit integration or custom SMTP servers

Email Threading

  • Intelligent conversation threading by subject and sender
  • Automatic conversation reactivation for replies
  • Unified conversation view across email threads
  • Agent assignments tracked per conversation

How It Works

  1. Email Reception: Emails arrive via webhook or IMAP polling
  2. Tenant Resolution: System identifies tenant from email address
  3. Contact Information Extraction: System automatically:
    • Extracts email address from sender (always known)
    • Extracts name, phone, company from email content using AI-assisted PII extraction
    • Creates or links to client record
    • Links conversation to client for cross-channel tracking
  4. Agent Selection: System selects appropriate AI agent based on:
    • Workflow-assigned agent (if workflow has agent assigned)
    • Routing rules matching email content/intent
    • Default email agent for the tenant
    • Fallback to general default assistant
  5. Information Collection: For new conversations:
    • Agent automatically asks for missing information (typically name)
    • Collection happens naturally in the first response
    • Example: "Hi! Before we continue, could I get your name?"
  6. Workflow Matching: Matches email to appropriate workflow based on goal and content (optional)
  7. Context Building: Gathers:
    • Agent's system prompt and personality
    • Workflow context (as guidance, not template)
    • Email context library entries
    • Cross-channel conversation history
    • Customer name (if available) for personalization
  8. Response Generation:
    • If workflow matches: Agent uses workflow as guidance to generate natural response
    • If no workflow: Agent uses conversational AI with business context
    • Agent addresses customer by name when available
  9. Signature Addition: Appends professional signature with signoff, agent name, and custom signature
  10. Response Queuing: Queues email with 5-15 minute delay for natural timing
  11. Email Sending: Worker processes queued emails and sends via SMTP
  12. Conversation Logging: Stores conversation, messages, and agent assignments in database

Contact Information Collection

Automatic Extraction

The email system automatically extracts contact information:

Always Available:

  • Email Address: Automatically known from sender address (channel_identifier)

Extracted from Content:

  • Name: Extracted using AI-assisted contact info extraction from the email body (when enabled)
  • Phone: Detected if mentioned in email content
  • Company: Identified from email signature or content

Extraction Methods:

  1. AI-assisted contact info extraction: Optional extraction using model support
  2. Regex Pattern Matching: Basic extraction for workflow-specific needs
  3. Email Signature Parsing: Extracts information from email signatures

Information Collection for New Conversations

Automatic Collection:

  • For new email conversations, the AI agent automatically requests missing information
  • Typically asks for name if not found in email content
  • Collection happens naturally in the first response
  • Example: "Hi! Before we continue, could I get your name?"

Client Record Management:

  • Extracted information automatically creates or updates client records
  • Conversations are linked to client records
  • Duplicate clients are automatically merged based on email matching
  • Cross-channel information is merged (SMS, chat, voice)

Best Practices

  1. Include Extract Info Step: Add extract_info step to workflows for additional extraction
  2. Review Client Records: Regularly review automatically created clients for accuracy
  3. Merge Duplicates: Manually merge duplicate client records when found
  4. Complete Information: Add missing details to client records as information becomes available

Integration Points

The email system integrates with:

  • SMS System: Shared contact matching and cross-channel context
  • Voice System: Unified conversation tracking
  • Chat System: Cross-channel conversation history
  • Billing System: Usage tracking and cost calculation

Next Steps

autoch.at Documentation