Skip to content

Feature: Assignment Workflow

Overview

The Assignment Workflow feature enables teams to distribute email threads among team members, ensuring clear ownership and accountability for every conversation. It provides the foundation for workload management and prevents threads from falling through the cracks.

Feature Purpose

Assignment transforms shared inboxes from passive repositories into active workspaces. By explicitly assigning threads to individuals, teams gain visibility into who is responsible for what, enabling better coordination and balanced workload distribution.

User Value Proposition

For Support Agents:

  • Clear view of personal responsibilities via "Assigned to me"
  • Take ownership of threads they're working on
  • Reassign threads to specialists when needed
  • Focus on assigned work without distractions

For Team Leads:

  • Distribute work fairly across team members
  • Monitor who's working on what
  • Identify bottlenecks and overloaded team members
  • Ensure every thread has an owner

For Organizations:

  • Reduce duplicate work (two people handling same thread)
  • Improve accountability and response times
  • Enable workload balancing for better team health
  • Track individual and team productivity

Key Capabilities

1. Assign Thread to User

Description: Assign a thread to a specific team member, making them responsible for handling it.

User Experience:

  • Assignment control in thread detail view (top bar)
  • Shows current assignee or "Unassigned"
  • Clicking opens dropdown with team member list
  • List shows all users with access to the inbox
  • Selected user is highlighted
  • Assignment updates immediately
  • Timeline shows assignment action

Acceptance Criteria:

  • Only users with inbox access appear in list
  • Assignment saves to backend within 500ms
  • All users see updated assignment in real-time
  • Assignee receives notification via WebSocket
  • Assignment action recorded in timeline

2. "Assigned to Me" View

Description: Personal inbox showing all threads assigned to the current user across all shared inboxes.

User Experience:

  • "Assigned to me" in sidebar under "For You"
  • Icon: person silhouette
  • Shows threads from all accessible inboxes
  • Sorted by most recent activity
  • Thread list shows source inbox
  • Count badge (future)

Acceptance Criteria:

  • View loads all assigned threads from backend
  • Threads from multiple inboxes appear together
  • Correct inbox context maintained for each thread
  • Updates in real-time when threads assigned/unassigned
  • Empty state shown when no assignments

3. Reassign Thread

Description: Change the assignee of an already-assigned thread to another team member.

User Experience:

  • Same assignment control as initial assignment
  • Current assignee shown in control
  • Selecting different user reassigns thread
  • Previous assignee can still see thread history
  • Timeline shows reassignment action

Acceptance Criteria:

  • Reassignment replaces previous assignee
  • Both old and new assignee notified
  • Thread moves between users' "Assigned to me" views
  • Reassignment action includes both users in timeline

4. Unassign Thread

Description: Remove assignment, returning thread to unassigned pool.

User Experience:

  • Assignment dropdown includes "Unassign" option
  • Clicking unassign removes assignee
  • Thread no longer in anyone's "Assigned to me"
  • Thread available for anyone to assign
  • Timeline shows unassignment action

Acceptance Criteria:

  • Unassignment clears assignee field
  • Thread removed from previous assignee's view
  • All users notified of unassignment
  • Action recorded in timeline

5. Auto-assign on Status Change

Description: Automatically assign thread to user who changes its status from unassigned.

User Experience:

  • User changes status of unassigned thread to "to-do"
  • Thread automatically assigned to that user
  • Assignment appears without explicit action
  • Timeline shows both status change and assignment
  • Transparent to user (feels like one action)

Acceptance Criteria:

  • Status change from null to "to-do" triggers auto-assign
  • User making change becomes assignee
  • Both actions recorded separately in timeline
  • Already-assigned threads not affected
  • Assignment can still be changed afterward

6. Assignment Notifications

Description: Real-time notifications when threads are assigned/reassigned.

User Experience:

  • WebSocket message sent to affected users
  • Notification includes thread ID and action
  • Recipient's UI updates automatically
  • Thread appears/disappears from "Assigned to me"
  • Assignment visible in thread list

Acceptance Criteria:

  • Notification sent within 1 second
  • All affected users receive notification
  • UI updates without page refresh
  • No duplicate notifications
  • Works even if assignee not currently viewing app

UI/UX Design

Assignment Control

Thread Detail View - Top Bar
┌──────────────────────────────────────────────┐
│ [Subject]                                     │
│ [Tags: Urgent, L2]                           │
│                                               │
│ Assigned to: [John Doe ▼]  Status: [To Do ▼]│
└──────────────────────────────────────────────┘

Dropdown:
┌──────────────────┐
│ Unassign        │
├──────────────────┤
│ ✓ John Doe      │
│   Jane Smith    │
│   Bob Johnson   │
└──────────────────┘

Timeline Action

┌──────────────────────────────────────┐
│ 👤 John Doe assigned to Jane Smith  │
│    by John Doe                       │
│    2 hours ago                       │
└──────────────────────────────────────┘

Visual Design

  • Assignment control uses dropdown pattern
  • Current assignee shows name with dropdown arrow
  • "Unassigned" shown in muted color
  • User list shows avatars + names
  • Selected user has checkmark
  • Assignment timeline action has person icon
  • "Assigned to me" sidebar item has person icon

Technical Implementation

Architecture

  • Frontend: Vue 3 component with assignment dropdown
  • Backend: Fastify endpoint for assignment updates
  • Database: PostgreSQL stores assignee in threads table
  • Real-time: WebSocket propagates assignments

API Endpoints

EndpointMethodPurpose
POST /threads/:inboxId/:threadId/assigneePOSTAssign/reassign/unassign thread
GET /threads/meGETFetch threads assigned to current user

Request/Response

Assignment Request:

{
  "user": {
    "id": 123,
    "context": 456
  }
}

Unassignment Request:

{
  "user": null
}

Data Model

Thread Assignment Field:

{
  assignee: {
    id: number,
    context: number
  } | null
}

Assignment Action:

{
  type: "assign",
  created_at: Date,
  data: {
    from: {
      id: number,
      context: number
    },
    to: {
      id: number,
      context: number
    } | null
  }
}

State Management

Threads Store:

  • Assignment updates both selectedThread.assignee and thread in threads array
  • assignThread(user, thread): Action to assign thread
  • WebSocket handler updates thread when remote assignment occurs

Folders Store:

  • Tracks available users per inbox
  • Used to populate assignment dropdown

Business Logic

Assignment Validation:

  1. Check if user has access to inbox (via users_to_inbox junction table)
  2. Verify thread belongs to inbox
  3. Validate user object structure
  4. Return 400 error if user lacks access

Auto-assignment Logic:

  1. Status change endpoint checks if thread unassigned
  2. If status changes from null to any value, auto-assign to requesting user
  3. Record both status change and assignment actions

"Assigned to Me" Query:

  1. Special inbox ID "me" triggers assignee filter
  2. Query filters threads by assignee = current_user
  3. Threads from all accessible inboxes included
  4. Results include inbox context for each thread

Real-time Synchronization

Assignment Flow:

  1. User selects assignee in UI
  2. Frontend calls POST /threads/:inboxId/:threadId/assignee
  3. Backend updates database (thread + action)
  4. Backend sends WebSocket message to inbox users
  5. Other users' clients receive teams:actions:new event
  6. Frontend updates thread list and detail view

Real-time Updates: See Technical Patterns - Thread Events. Event type: "assignment" with thread ID.

Performance Considerations

  • Assignment updates optimistic (UI updates before API response)
  • Rollback on API error
  • "Assigned to me" view caches results
  • Real-time updates batch within 100ms window

Dependencies

  • Thread Management feature (threads must exist to assign)
  • Shared Inboxes (provides user list for assignment)
  • Status Tracking (auto-assignment integration)
  • WebSocket infrastructure for real-time updates

Known Limitations

  • No assignment rules/automation (planned)

Future Enhancements

  1. Assignment Rules: Auto-assign based on criteria (keywords, sender, time)
  2. Load Balancing: Distribute assignments evenly across team
  3. Workload View: Dashboard showing assignments per user
  4. Assignment History: View all past assignments for a thread
  5. Bulk Assignment: Assign multiple threads at once
  6. Assignment Suggestions: AI-powered assignee recommendations
  7. Out-of-Office: Redirect assignments when user unavailable
  8. Assignment Templates: Save common assignment patterns

Integration with Other Features

Status Tracking Integration

Auto-assignment on Status Change:

  • When user changes status from null to "to-do", thread automatically assigned to that user
  • Only applies to unassigned threads

Auto-Reopen Behavior:

  • When done thread receives new email, status automatically resets to null (New)
  • Assignment is PRESERVED during auto-reopen (assignee remains the same)
  • Assignee sees reopened thread in "Assigned to me" view
  • Rationale: The person who closed the thread is best positioned to handle the follow-up
  • Thread Management
  • Status Tracking
  • Shared Inboxes
  • Real-time Collaboration
  • ADR-0006: Database layer for storing assignments
  • ADR-0007: Yjs for real-time state sharing (relevant for awareness)

Success Metrics

  • 100% of active threads have assignees within 15 minutes
  • Average assignment time < 5 seconds
  • Zero assignment conflicts (two people claiming same thread)
  • 80% of users prefer assigned view over shared view
  • Assignment notifications delivered within 1 second (p95)