Ussd.Response behaviour (Ussd v0.2.0)

Copy Markdown View Source

Shapes the engine's result into whatever your gateway expects. Wired in via Ussd.use_response/2, either as a module implementing this behaviour or as a 3-arity function (context, message, terminating? -> term).

The context is passed explicitly (unlike Laravel's Response, which pulls it from the service container) so a formatter's dependencies are visible in its signature.

Ships six ready-made formatters under Ussd.Responses.* for Africa's Talking, Speso, Nalo, Nsano, Moolre and Arkesel.

Summary

Callbacks

Formats the resolved message and terminating? flag into the shape your gateway expects.

Callbacks

respond(t, message, terminating?)

@callback respond(Ussd.Context.t(), message :: String.t(), terminating? :: boolean()) ::
  term()

Formats the resolved message and terminating? flag into the shape your gateway expects.