LemonGateway.Sms.Inbox (lemon_gateway v0.1.0)

View Source

GenServer that stores and queries inbound SMS messages.

Ingests Twilio SMS webhook payloads, extracts verification codes (4-8 digit sequences), and supports filtering, claiming, and waiting for incoming codes. Expired messages are periodically cleaned up based on a configurable TTL.

Summary

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

claim_message(session_key, message_sid)

@spec claim_message(binary() | nil, binary()) :: :ok | {:error, term()}

inbox_number()

ingest_twilio_sms(params)

@spec ingest_twilio_sms(map()) :: {:ok, :stored | :duplicate} | {:error, term()}

list_messages(opts \\ [])

@spec list_messages(keyword()) :: [map()]

start_link(opts \\ [])

wait_for_code(session_key, opts \\ [])

@spec wait_for_code(
  binary() | nil,
  keyword()
) ::
  {:ok, %{code: binary(), message: map()}}
  | {:error, :timeout}
  | {:error, term()}