Skip to main content

From Alert to Reaction

The detection lessons got a Condor event onto the map and into the operator's console — but seeing a threat isn't reacting to one. A confirmed threat has to reach the right people, on the channel they chose, with enough to act on: the camera, the location, the image, the confidence. That's the dispatch pipeline, and it's the half of the app that turns a detection into a reaction.

The one idea to hold on to​

Dispatch is two HTTP steps: first decide the audience, then deliver to each recipient on their chosen channels — and both steps run against SQL and the shared services. A detection surfaced to operators becomes, once someone raises an alert, a set of notifications people receive.

Step 1 — decide the audience​

CreateNotifications (an HTTP function) loads the alert by id and calls AlertService.CreateNotificationFromAlertMessage. That's the subscriber-matching logic from the Infrastructure alert docs: geographic intersection (whose subscription areas contain the alert), then the urgency-bitmask-and-schedule filter (who wants this severity, at this time of day). The survivors become a Notification row plus one UserNotification per recipient in SQL. If nobody survives, nothing is created — an important silence, covered below.

Step 2 — deliver on each recipient's channels​

SendNotificationMessage (API-key gated) takes that notification and does the delivery. GetNotificationWithRecipientsAsync reads it back from SQL — the recipients, the sender, and the alert's display details (the detection image, the map image, the lat/lon) — and then the key move: it groups recipients by their preferred communication method. DeliveryType is a bitmask, so a single recipient can be on email and SMS and a phone call:

  • Email — a filled HTML template carrying the detection image, the map image, the location and coordinates, the sender's name and organization, the alert time (in Pacific), the confidence level and radius, and a deep link to the camera (pointing at the environment's subdomain — production maps to beta). It's a briefing, not a one-liner.
  • SMS — the short-form alert, chunked automatically for large recipient lists (the Infrastructure SMS service handles the 100-per-batch limit).
  • Phone call — an outbound call whose spoken script is built from the alert message, with the call events handled by the callbacks below.
  • External apps — the same alert POSTed to any enabled external client (bespoke per-client endpoint and auth), in the same pass.

Once delivery is done, the notification's status is updated to Sent in SQL — so the record reflects that people were reached, not just that recipients were chosen.

Gotcha: an alert with no surviving subscribers dispatches nothing — silently

Dispatch is only as loud as the matcher. If the urgency/schedule/geo filter removes everyone (all paused, wrong time of day, no overlap), CreateNotifications produces an empty recipient set and SendNotificationMessage has nobody to deliver to — no error, just silence. "The alert did nothing" and "the alert failed" look identical from outside; confirm subscribers survived matching before suspecting a delivery problem.

How a detection becomes a reaction​

Putting the two halves together answers the through-line of this whole section. A Condor detection is ingested and reconciled into an event (Cosmos incident + SQL record), which surfaces to operators on the map and in the console and keeps the camera lit for the duration of the detection window. When a threat is confirmed and an alert message is raised, this pipeline matches it to the subscribers who care and delivers it on their chosen channels — email, SMS, phone, or an external system — and records that they were reached. Detection makes it visible; dispatch makes it actionable.

Wrapping up​

Dispatch is two HTTP steps against SQL and the shared services: CreateNotifications matches an alert to subscribers and writes a Notification plus a UserNotification per recipient; SendNotificationMessage groups recipients by their DeliveryType bitmask and delivers to each — a rich HTML email, an SMS, a phone call with callbacks, and any external app — then marks the notification Sent. An unmatched alert is silent by design. Together with ingestion and the detection lifecycle, that's the full arc from a Condor signal to a person taking action.

That closes the loop: detections and reports flow in, alerts flow out, and at the center of it all is the engine keeping ~1,400 cameras watching. Back to the heart of it: Two Machines, One Camera.