AfricasTalking (ExUssd v0.1.2) View Source

Link to this section Summary

Link to this section Functions

End session by ID

Example

iex> AfricasTalking.end_session(session_id: "session_01")
{:error, :not_found}

Africa's talking

Configuration

Add below config to dev.exs / prod.exs files

config.exs

    config :ex_ussd :provider, AfricasTalking

Example

iex> defmodule DefaultHandler do
...>   @behaviour ExUssd.Handler
...>  def handle_menu(menu, _api_parameters) do
...>    menu |> Map.put(:title, "Welcome")
...>  end
...>end
iex> menu = ExUssd.Menu.render(name: "Home", handler: DefaultHandler)
iex> AfricasTalking.goto(
...>  internal_routing: %{text: "", session_id: "session_01", service_code: "*544#"},
...>  menu: menu,
...>  api_parameters: %{
...>      "sessionId" => "session_01",
...>      "phoneNumber" => "254722000000",
...>      "networkCode" => "Safaricom",
...>      "serviceCode" => "*544#",
...>      "text" => ""
...>    }
...>  )
{:ok, "CON Welcome"}
Link to this function

output(internal_routing, current_menu, menu_string)

View Source
Link to this function

process_text(internal_routing)

View Source