Logo Lanfrica

oryono/africastalking-elixir

Domain:

digital infrastructure

Record type:

software
Creator:
ory
Host:
Africa's Talking SDK for Elixir # AfricastalkingElixir **Elixir client library for Africa's Talking API** A simple, robust Elixir library for integrating with Africa's Talking services. This library provides easy-to-use functions for sending SMS messages and airtime transfers. ## Features - 📱 **SMS Messaging** - Send SMS to single or multiple recipients - 💰 **Airtime Transfer** - Send airtime to multiple recipients with different currencies - 🔒 **Secure** - Proper API key handling and validation - ⚡ **Fast** - Built with Hackney for efficient HTTP requests - 🧪 **Well Tested** - Comprehensive test coverage - 📖 **Well Documented** - Complete documentation with examples ## Installation Add `africastalking_elixir` to your list of dependencies in `mix.exs`: ```elixir def deps do [ {:africastalking_elixir, "~> 0.1.0"} ] end ``` Then run: ```bash $ mix deps.get ``` ## Configuration Configure your Africa's Talking credentials in `config/config.exs`: ```elixir config :africastalking_elixir, username: "your_username", api_key: "your_api_key", base_url: "api.africastalking.com" # Use sandbox URL for testing ``` ### Using Environment Variables For production environments, you can use environment variables: ```elixir config :africastalking_elixir, username: {:system, "AFRICASTALKING_USERNAME"}, api_key: {:system, "AFRICASTALKING_API_KEY"}, base_url: {:system, "AFRICASTALKING_BASE_URL"} ``` ### Sandbox vs Production - **Sandbox**: `api.sandbox.africastalking.…` (for testing) - **Production**: `api.africastalking.com` (for live transactions) ## Quick Start ### Sending SMS ```elixir # Send SMS to a single recipient {:ok, response} = AfricastalkingElixir.send_sms("+254722000000", "Hello World!") # Send SMS to multiple recipients {:ok, response} = AfricastalkingElixir.send_sms( "+254722000000,+254733000000,+254744000000", "Hello everyone!" ) ``` ### Sending Airtime ```elixir # Send airtime to single recipient recipients = [ %{ phone_number: "+254722000000", amoun …