Media Library & Operational Logs (Admin)
Audience: Ops · Super-admins · Support · Engineering · Where in app: /admin/call-backgrounds, /admin/call-recordings, /admin/default-videos, /admin/voice-previews, /admin/api-request-logs, /admin/email-logs, /admin/logs, /admin/call-logs, /admin/notifications, /admin/storage/maintenance · Access: Super admins, or admin staff with the Content & media (media screens), Logs & events (logs) or System tools (notifications, storage) section — see Team & access levels.
This cluster covers two things. Media library: the platform-default assets shown in product surfaces (call backgrounds, the widget/invitation default videos) and the browsing UI for call recordings. Operational logs: read-only forensics for support and engineering — what API requests came in, what emails went out (and which failed), what errored in the system, and what notifications and alert popups were broadcast.
What it does
- Call Backgrounds — upload/delete the default background images offered in calls; mark one default.
- Call Recordings — browse recordings across four sources (Twilio, AI, inbound/outbound AI phone, forwarded), with playback.
- Default Videos — manage the default widget video and the client-invitation demo video (file upload or URL); set the active default.
- Voice Previews — the sample clip each speech-to-speech voice plays in the voice pickers (generate or upload).
- API Request Logs — inspect incoming API requests (method, path, platform); 30-day TTL.
- Email Logs — every sent/failed outbound email with full headers and content.
- System Logs — error/info/warning entries with company/session/user context; 30-day TTL.
- Call Logs — the step-by-step log of one call (AI or human; server, socket, widget and dashboard steps), for debugging calls that didn't connect.
- Notifications — broadcast an admin notification to companies/users, optionally as a blocking alert popup, and view history + per-user popup tracking.
- Storage Maintenance — storage stats (Mongo + S3) and dry-run-first session-recording cleanup.
How it works
Frontend repos live under frontend/src/repositories/admin/ and views under frontend/src/views/admin/. Media uploads use multipart form-data (backgrounds) or a chunked/streamed upload with client-side compression (utils/streamUpload, default videos). Recordings are not stored in Mongo directly here — playback URLs point at ms-communication endpoints (Twilio compositions, Ultravox/ElevenLabs AI recordings). Logs are MongoDB collections; two of them (api_requests, logs) carry a 30-day TTL index that auto-purges old rows.
Screens & fields
Call Backgrounds — /admin/call-backgrounds
Source: call-backgrounds/List.vue → frontend/src/repositories/admin/call-backgrounds.js (/default-call-backgrounds). Model DefaultCallBackgroundModel.js (collection default_call_background).
Grid of background image cards; one shows a Default badge. An upload card creates a new background (POST multipart with the image file). Delete per card.
| Field | Notes |
|---|---|
file | ObjectId → files (the stored image) |
default | bool — the active default background |
| timestamps | created_at / updated_at |
Call Recordings — /admin/call-recordings
Source: call-recordings/Index.vue (tabbed) → frontend/src/repositories/admin/call-recordings.js. Four tabs:
| Tab | Source | Repo call / endpoint |
|---|---|---|
| Twilio Recordings | Twilio compositions | getCallRecordings → /call-recordings; playback …/recordings/call/:sid |
| AI Recordings | Ultravox/ElevenLabs AI calls | getAICallRecordings → /ai-call-recordings; playback …/recordings/agent/:callId |
| Inbound & Outbound | ms-communication AI phone calls | getAIPhoneTranscripts → …/inbound-outbound-calls (transcripts + ElevenLabs audio) |
| Forwarded Calls | forwarded calls | getForwardedCalls → /call-forwarded |
Common list filters: page/pageSize, sort/order, start/end date. Helpers: getCallType (video vs audio), formatDuration (→ HH:mm:ss), markCallAsHeard / markAllCallsAsHeard, getUnheardCallsCount, deleteRecording (soft delete), getElevenLabsAudio (blob). The inbound/outbound super-admin view can pass include_deleted=true to show soft-deleted calls; deleteAIPhoneCall soft-deletes (sets deleted_at, company-scoped).
Default Videos — /admin/default-videos
Source: default-videos/List.vue ("Video Templates") → frontend/src/repositories/admin/default-videos.js (/default-video). Model DefaultVideoModel.js (collection defaultvideos).
Category selector drives the view: widget (grid of templates) and client_invitation (a single demo-video URL field). Upload is staged (Uploading → Compressing → Saving) with progress; videos can also be created from a URL (createDefaultVideoUrl). Star icon = Set as Default (setDefaultVideo → PUT /create-default-video/:id).
| Field | Notes |
|---|---|
video_path | stored video path (URL-sourced) |
video_file | ObjectId → files (uploaded file) |
category | widget (default) / client_invitation |
is_default | bool — active default for the category |
has_audio | bool |
is_active | bool, default true |
Voice Previews — /admin/voice-previews
Source: voice-previews/List.vue ("Clips played next to speech-to-speech voices in every voice picker") → backend AdminVoicePreviewController (app/routes/voicePreviewRoutes.js, 2d0917ef6). Model VoicePreviewModel.js (collection voice_previews, unique provider + voice_id): file (→ files, on S3), source (generated / uploaded), generated_with, updated_by.
- Per voice: Generate / Regenerate (
POST /admin/voice-previews/:provider/:voice_id/generate— ms-ai synthesises the clip, since it holds the provider keys) or upload (…/upload). - A generate missing card (
POST /admin/voice-previews/generate-missing, async job polled at/admin/voice-previews/jobs/:job_id) fills every voice without a clip. - Pickers read
GET /voice-previews(any signed-in user) and play the saved clip first, then a built-in file. Only the GPT-Live clips (which can't be generated) and the official Grok clips (d3b3f045) still ship with the frontend.
API Request Logs — /admin/api-request-logs + …/:id
Source: api-request-logs/List.vue + Detail.vue → frontend/src/repositories/admin/api-request-logs.js (/api-request-logs). Controller ApiRequestLogController, model ApiRequestModel.js (collection api_requests).
| Filter | Notes |
|---|---|
| Search | path / method / IP / platform |
| Method | All · GET · POST · PUT · PATCH · DELETE |
| Platform | sortable column/filter |
| Start/End date | range |
List columns: Method, Path, Platform, IP, time. Detail shows the full record:
| Field | Notes |
|---|---|
method, path | |
headers, params, query, body | mixed/JSON, nullable |
ip, user_agent, platform | |
user_id | ref → users |
created_at |
Retention: 30 days — Schema.index({ created_at: -1 }, { expireAfterSeconds: 60*60*24*30 }) (the same index serves date-range sort). The list endpoint has its own documented page size, so it clears the X-Result-Limit-Capped header (see Backend › Request and result bounds).
Email Logs — /admin/email-logs + …/:id
Source: email-logs/List.vue + Detail.vue → frontend/src/repositories/admin/email-logs.js (/email-logs). Model EmailLogModel.js (collection email_logs).
| Filter | Notes |
|---|---|
| Search | |
| Sort / order | |
| Start/End date | range |
Status enum: sent / failed (the repo also exposes EMAIL_LOG_STATUS with SENT: 'send' and color helpers — green/sent, red/failed). Fields: from, to, cc, bcc, reply_to (all mixed — string or array), subject, content, status, error (mixed), timestamps. Indexed on {status, created_at} and {created_at}. No TTL — email logs are retained. The detail page renders the email body in a sandboxed iframe (35593de5), so a logged email's HTML can't run script in the admin session.
System Logs — /admin/logs
Source: logs/List.vue ("System Logs") → frontend/src/repositories/admin/logs.js (/error-logs). Model LogModel.js (collection logs).
Filters: search, sort (Date newest/oldest). A grouped view is available (getGroupedErrorLogs → /error-logs/grouped). List columns include Type, Description, context, Actions (view, delete). Fields:
| Field | Notes |
|---|---|
type | error (default) / info / warning |
description | |
company_id, user_session_id, service_room_id | string context, nullable |
user_type | admin / user (default user) |
created_at |
Indexed on {type, created_at}. Retention: 30 days (TTL on created_at). Individual logs can be deleted (deleteErrorLog).
Call Logs — /admin/call-logs
Source: call-logs/List.vue ("Call Logs" — "Step-by-step log of every AI and human call — server, widget and dashboard") + CallLogTimeline.vue → frontend/src/repositories/admin/call-logs.js. Sidebar entry Call Logs (460ff2a7). Data is service_rooms.call_logs (select: false), written by ms-comm CallLogHelper — see Calls › Per-call step log.
Endpoints (backend AdminCallsController, app/routes/adminCallsRoutes.js, passport + user_type === 'admin' else 403):
GET /admin/calls/logs— calls (service rooms, chats excluded) that have a log, newest first. Query:skip,limit(default 5, ≤ 100),company_id,search(service-room id or session id — must be an ObjectId, else 400),kind(ai/human),errors_only=true,start_date/end_date. Ranged and sorted on_id(primary index), so it returnshas_moreinstead of a total. Each row carriescompany_name,agent_name,log_count,error_count,warn_count,last_log_at.GET /admin/calls/:id/logs— one room's metadata plus its log entries sorted byat.
Filters in the UI: Call or session ID, Call type (All calls / Human (agent) calls / AI calls), From / To, Only calls with errors; Per page 5 / 10 / 25 / 50 with Previous / Next. The timeline colours entries by level and filters by source (server / socket / widget / dashboard). Logs live as long as the service room; each room keeps only its last 1000 entries.
Storage Maintenance — /admin/storage/maintenance
Source: frontend/src/views/admin/StorageMaintenance.vue → frontend/src/repositories/admin/storage.js. Backend: AdminStorageController (backend/app/routes/adminStorageRoutes.js), user_type === 'admin' enforced per request. Three panels, each a background job with progress polling (the third, Call Duration Backfill, reads widget AI voice call lengths back from ms-ai onto rooms that have none; optional company id):
| Panel | Endpoints | What |
|---|---|---|
| Storage Stats (read-only) | POST /admin/storage/stats + GET /admin/storage/stats/jobs/:job_id | Whole-DB and session_files sizes from Mongo metadata (no collection scan) + live S3 bucket object count/size (paged listing — large buckets take a minute) |
| Session Recordings Cleanup | POST /admin/storage/session-files-cleanup + GET /admin/storage/session-files-cleanup/jobs/:job_id | Deletes session_files docs + their S3/local chunks. Selectors: older_than_days (retention sweep) and/or min_files (runaway kiosk/bot sessions) — at least one required |
Cleanup is proxied to ms-sessions' api-key-gated /migrations/session-files-cleanup; stats are computed in the backend (shares the Mongo DB and S3 bucket). Every action defaults to dry run — review counts, then Apply (confirm dialog; deletion is permanent).
Notifications — /admin/notifications
Source: notifications/Index.vue → frontend/src/repositories/admin/notifications.js. Compose + send an admin broadcast (POST /admin/notifications/send) and view history (GET /admin/notifications). Model AdminNotificationModel.js (collection admin_notifications).
| Field | Notes |
|---|---|
title, message | required content |
target_type | all_companies / companies / all_users / users |
target_ids[] | specific company/user ids when not "all" (typeahead via searchCompanies / searchUsers) |
target_names[] | resolved labels |
sent_by | admin who sent it |
recipients_count | computed fan-out size |
created_at |
Targeting "companies"/"users" reveals a search box to pick specific recipients; "all_companies"/"all_users" broadcasts. (Per-recipient delivered notifications land in the notifications collection — NotificationModel.js.)
Alert popups (786bf77a5, 4b21bd61). The composer's Show as popup toggle ("Blocks the desktop app and flashes the window until each user responds") stores admin_notifications.popup: enabled, active, actions[] (label, optional url, style primary/secondary/danger, closes; default a primary Got it), allow_snooze + snooze_hours (1–168, 'Allow "Remind me later"'), below_version ("Only desktop apps older than", desktop only), include_web ("Also show in the web app"), and the audience frozen at send (company_ids, user_ids). Matching lives in backend/app/lib/alertPopup.js; only web_owner and member users get popups.
- Clients poll
GET /popups/active?platform=&app_version=(every 5 min and on window focus) and reportPOST /popups/:id/event(seen/snooze/action). Per-user state is inpopup_receipts(first_seen_at/last_seen_at,view_count,snooze_count,snoozed_until,acknowledged_at,clicks[],app_version,platform). - Popup tracking panel (
GET /admin/notifications/:id/popup): User / Company / Last seen / Views / Snoozed / Clicked / Acknowledged / App; End popup (PUT /admin/notifications/:id/popup/end). - The modal (
frontend/src/components/AlertPopup.vue) can't be closed by backdrop or Escape — only the admin's buttons (or "Remind me later") close it; on desktop it sends therequest-attentionIPC so the window comes forward and flashes.
Archived recipients are dropped (4e54db78a) on every target type: liveCompanyFilter() excludes companies with archived_at set and companies under an archived agency (agencies archive as deleted_at), hand-picked users must be status: 'active' (blocked/pending skipped), and the company picker hides archived companies. This covers in-app and push; email was already guarded in MailService.send.
Webhook Events (removed)
The /admin/webhook-events catalog screen was removed on 2026-09-07 (e20cc659); the webhook event catalogue now lives in code (see Webhooks).
Behaviors & edge cases
- Retention:
api_requestsandlogsauto-purge after 30 days (TTL index).email_logs,admin_notifications,popup_receipts, and media collections are retained until manually deleted. Recording media retention is governed by the upstream provider (Twilio / ElevenLabs), not these screens. - One default per category: call backgrounds have a single
default; default videos have oneis_defaultpercategory(widget vs client_invitation). Setting a new default flips the previous one. - Default-video upload is staged and compressed client-side (Uploading 0–40% → Compressing 40–80% → Saving 80–99%); URL-sourced videos skip compression.
- Recordings are external — playback URLs resolve against ms-communication; a
404usually means the provider purged the asset. Inbound/outbound AI calls are soft-deleted (deleted_at) and only re-appear withinclude_deleted=true. - Notification "all" vs targeted:
all_companies/all_usersignoretarget_ids;companies/usersrequire picked ids.recipients_countreflects the resolved fan-out. - Email logs store full content + headers — treat as sensitive (PII / message bodies).
Technical implementation
- Models:
backend/app/models/ApiRequestModel.js,EmailLogModel.js,LogModel.js,AdminNotificationModel.js,PopupReceiptModel.js,NotificationModel.js,VoicePreviewModel.js,DefaultVideoModel.js,DefaultCallBackgroundModel.js. - Routes/controllers:
backend/app/routes/apiRequestLogRoutes.js+ApiRequestLogController; email-log, error-log, notification (+popupRoutes), voice-preview, default-video, call-background routes/controllers underbackend/app/. - Call logs: backend
AdminCallsController@listCallLogs/@showCallLogs; writer ms-commapp/helpers/CallLogHelper.js. - Frontend repos:
frontend/src/repositories/admin/{call-backgrounds,call-recordings,default-videos,api-request-logs,email-logs,logs,call-logs,notifications}.js; views underfrontend/src/views/admin/(matching folders). - Recording playback is served by ms-communication (Twilio compositions, Ultravox/ElevenLabs AI recordings).
Related
The record-change Audit Trail and the per-call step log are documented in Audit Trail & Call Logs.