AshDispatch.Transports.SMS (AshDispatch v0.5.0)
View SourceSMS transport — delegates to a consumer-configured backend.
Configure a backend module in your app config and ash_dispatch will
call its deliver/4 callback every time an event with an :sms
channel fires:
config :ash_dispatch, :sms_backend, MyApp.SMSThe backend module must implement AshDispatch.SMSBackend —
essentially one function:
defmodule MyApp.SMS do
@behaviour AshDispatch.SMSBackend
@impl true
def deliver(receipt, context, channel, event_config) do
# send via Twilio/Telavox/etc.
# then update the receipt: status :sent (success) or :failed.
# return `{:ok, updated_receipt}` or `{:error, reason}`.
end
endWhen no backend is configured the receipt is marked :skipped with
error_message: "transport_not_implemented" — same as the original
stub. This preserves backwards-compat for consumers that haven't
wired SMS yet.
Summary
Functions
Callback implementation for AshDispatch.Transport.deliver/4.
Functions
Callback implementation for AshDispatch.Transport.deliver/4.