Skip to main content

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.

FieldNotes
fileObjectId → files (the stored image)
defaultbool — the active default background
timestampscreated_at / updated_at

Call Recordings — /admin/call-recordings​

Source: call-recordings/Index.vue (tabbed) → frontend/src/repositories/admin/call-recordings.js. Four tabs:

TabSourceRepo call / endpoint
Twilio RecordingsTwilio compositionsgetCallRecordings → /call-recordings; playback …/recordings/call/:sid
AI RecordingsUltravox/ElevenLabs AI callsgetAICallRecordings → /ai-call-recordings; playback …/recordings/agent/:callId
Inbound & Outboundms-communication AI phone callsgetAIPhoneTranscripts → …/inbound-outbound-calls (transcripts + ElevenLabs audio)
Forwarded Callsforwarded callsgetForwardedCalls → /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).

FieldNotes
video_pathstored video path (URL-sourced)
video_fileObjectId → files (uploaded file)
categorywidget (default) / client_invitation
is_defaultbool — active default for the category
has_audiobool
is_activebool, 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).

FilterNotes
Searchpath / method / IP / platform
MethodAll · GET · POST · PUT · PATCH · DELETE
Platformsortable column/filter
Start/End daterange

List columns: Method, Path, Platform, IP, time. Detail shows the full record:

FieldNotes
method, path
headers, params, query, bodymixed/JSON, nullable
ip, user_agent, platform
user_idref → 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).

FilterNotes
Search
Sort / order
Start/End daterange

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:

FieldNotes
typeerror (default) / info / warning
description
company_id, user_session_id, service_room_idstring context, nullable
user_typeadmin / 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 returns has_more instead of a total. Each row carries company_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 by at.

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):

PanelEndpointsWhat
Storage Stats (read-only)POST /admin/storage/stats + GET /admin/storage/stats/jobs/:job_idWhole-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 CleanupPOST /admin/storage/session-files-cleanup + GET /admin/storage/session-files-cleanup/jobs/:job_idDeletes 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).

FieldNotes
title, messagerequired content
target_typeall_companies / companies / all_users / users
target_ids[]specific company/user ids when not "all" (typeahead via searchCompanies / searchUsers)
target_names[]resolved labels
sent_byadmin who sent it
recipients_countcomputed 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 report POST /popups/:id/event (seen / snooze / action). Per-user state is in popup_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 the request-attention IPC 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_requests and logs auto-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 one is_default per category (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 404 usually means the provider purged the asset. Inbound/outbound AI calls are soft-deleted (deleted_at) and only re-appear with include_deleted=true.
  • Notification "all" vs targeted: all_companies/all_users ignore target_ids; companies/users require picked ids. recipients_count reflects 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 under backend/app/.
  • Call logs: backend AdminCallsController@listCallLogs / @showCallLogs; writer ms-comm app/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 under frontend/src/views/admin/ (matching folders).
  • Recording playback is served by ms-communication (Twilio compositions, Ultravox/ElevenLabs AI recordings).

The record-change Audit Trail and the per-call step log are documented in Audit Trail & Call Logs.