Vetspire.Subscriptions.MessagingUsage.UsageEvent (vetspire v3.0.0)

View Source

One row per Twilio message, append-only. message_sid is the primary key, which makes every writer idempotent: the status callback handler, the inbound webhook handler, a backfill, and a replay all converge on the same row set.

units_count holds the segments Twilio reports; computed_units holds our own GSM-7/UCS-2 computation. org_id, location_id, and feature are nullable on purpose so unattributed traffic still counts and stays visible. There are no timestamps(): rows are never edited outside unit enrichment and occurred_at is the domain timestamp (bucketed on UTC, as Twilio bills).

Summary

Types

feature()

@type feature() ::
  :appointment_confirmation
  | :auth_code
  | :checkin
  | :client_initiated
  | :consent
  | :conversation
  | :kiosk
  | :marketing
  | :payment
  | :pickup
  | :ready_text
  | :reminder
  | :survey
  | :waitlist
  | :wait_time

t()

@type t() :: %Vetspire.Subscriptions.MessagingUsage.UsageEvent{
  __meta__: term(),
  computed_units: term(),
  delivery_status: term(),
  direction: term(),
  feature: term(),
  location: term(),
  location_id: term(),
  message_count: term(),
  message_sid: term(),
  num_media: term(),
  occurred_at: term(),
  org: term(),
  org_id: term(),
  twilio_category: term(),
  units_count: term()
}

Functions

changeset(usage_event, attrs \\ %{})