Skip to main content

SLA Alerts and Email Digest

This page documents the SLA alert system and email notifications for complaints.

Overview

The SLA alert system allows you to:

  • Detect complaints approaching their deadline
  • Send notifications to agents and supervisors
  • Generate periodic digest reports
  • Automatically escalate overdue complaints

Architecture

┌─────────────────────────────────────────────────────────────────────────┐
│ SLA ALERT SYSTEM │
├─────────────────────────────────────────────────────────────────────────┤
│ │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ Cron Job │ --> │ Deadline │ --> │ Send Email │ │
│ │ (Daily) │ │ Detection │ │ │ │
│ └──────────────┘ └──────────────┘ └──────────────┘ │
│ │ │ │
│ ▼ ▼ │
│ ┌──────────────┐ ┌──────────────┐ │
│ │ Automatic │ │ Coordinator│ │
│ │ Escalation │ │ Digest │ │
│ └──────────────┘ └──────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────┘

Notification Types

TypeTriggerRecipient
Pre-deadline alert24h before deadlineAssigned agent
Deadline alertDay of deadlineAgent + Supervisor
Overdue alertDeadline passedSupervisor + Coordinator
Daily digestEvery day at 8amGRM Coordinator
Weekly digestMonday 8amGRM Manager

Digest Service (PlainteDigestService)

Features

  • Aggregation of statistics by period
  • Identification of at-risk complaints
  • HTML and text report generation
  • Automated sending via cron

Included Statistics

IndicatorDescription
OpenNewly created complaints
In progressComplaints being processed
ResolvedComplaints resolved in the period
OverdueComplaints exceeding SLA
At riskComplaints approaching deadline (< 24h)

Test Endpoint

Send Digest Manually

POST /api/plaintes/digest/send

Request Body

{
"type": "daily",
"email": "coordinator@example.com",
"periode": "2026-06-11"
}

Response

{
"success": true,
"message": "Digest sent to coordinator@example.com",
"data": {
"plaintesOuvertes": 15,
"plaintesEnCours": 45,
"plaintesResolues": 12,
"plaintesEnRetard": 3,
"plaintesARisque": 8
}
}

Configuration

Environment Variables

# Enable notifications
PLAINTES_NOTIFICATIONS_ENABLED=true

# Coordinator emails
PLAINTES_COORDINATOR_EMAILS=coord1@example.com,coord2@example.com

# Digest send times
PLAINTES_DIGEST_DAILY_HOUR=8
PLAINTES_DIGEST_WEEKLY_DAY=1

# Alert thresholds (in hours)
PLAINTES_SLA_ALERT_HOURS=24
PLAINTES_SLA_URGENT_HOURS=6

Configuration in reference.php

'plaintes' => [
'notifications' => [
'enabled' => true,
'digest' => [
'daily' => true,
'weekly' => true,
'monthly' => true,
],
'alerts' => [
'pre_deadline' => 24, // hours
'deadline' => 0,
'overdue' => -1,
],
],
'coordinator_emails' => [
'coord@example.com',
],
],

Console Command

Send Digest Manually

php bin/console app:plainte-digest daily
php bin/console app:plainte-digest weekly
php bin/console app:plainte-digest monthly

Check SLA

php bin/console app:plainte-check-sla

This command:

  1. Identifies at-risk complaints
  2. Sends appropriate alerts
  3. Escalates overdue complaints

Email Template

Daily Digest Structure

<h2>GRM Report - [DATE]</h2>

<h3>Summary</h3>
<table>
<tr><td>New complaints</td><td>15</td></tr>
<tr><td>In progress</td><td>45</td></tr>
<tr><td>Resolved today</td><td>12</td></tr>
<tr style="color: red"><td>SLA overdue</td><td>3</td></tr>
</table>

<h3>Urgent Complaints</h3>
<ul>
<li>PLT-2026-001234 - Payment not received (deadline: tomorrow)</li>
<li>PLT-2026-001235 - Amount error (overdue: 2 days)</li>
</ul>

<h3>By Category</h3>
...

Automatic Escalation

Escalation Rules

ConditionAction
SLA exceeded by 24hSupervisor notification
SLA exceeded by 48hLevel 2 escalation
SLA exceeded by 72hCoordinator alert

Workflow

┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ Overdue │ --> │ Agent │ --> │ Escalation │
│ complaint │ │ Alert │ │ Supervisor │
└──────────────┘ └──────────────┘ └──────────────┘


┌──────────────┐
│ Coordinator │
│ Notification │
└──────────────┘

SLA Statistics API

Global Statistics

GET /api/plaintes/stats/sla

Response

{
"success": true,
"data": {
"tauxRespectSLA": 92.5,
"tempsResolutionMoyen": 3.2,
"plaintesEnRetard": 8,
"plaintesARisque": 15,
"parPriorite": {
"urgente": {"total": 10, "enRetard": 1},
"haute": {"total": 25, "enRetard": 3},
"moyenne": {"total": 45, "enRetard": 4},
"basse": {"total": 20, "enRetard": 0}
},
"evolution": [
{"date": "2026-06-05", "tauxSLA": 91.2},
{"date": "2026-06-06", "tauxSLA": 92.1},
{"date": "2026-06-07", "tauxSLA": 92.5}
]
}
}

Notification Customization

Per Team

Each team can have its own settings:

{
"equipe": "Oio Team",
"notifications": {
"digestEnabled": true,
"alertsEnabled": true,
"escalationEnabled": true,
"recipients": ["supervisor.oio@example.com"]
}
}

Per Complaint Category

Sensitive categories (GBV, SEA/SH) have specific rules:

  • Reduced SLA deadlines
  • Priority notifications
  • Immediate escalation to coordinator

Best Practices

:::tip Recommendations

  1. Monitor digests: Read the daily digest every morning
  2. React to alerts: Pre-deadline alerts help avoid delays
  3. Analyze trends: Use weekly stats to improve processes
  4. Update contacts: Ensure emails are current :::