Skip to content

This package wraps Airtime, Sms, and Voice call from Africa's Talking APIs.

License

Notifications You must be signed in to change notification settings

EddieKamau/africas_talking-dart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This package wraps some functionalities from Africa's Talking API The functionalities implemented are;

  1. Sms
  • send message
  • fetch messages
  • generate checkout token
  • subscribe phone number
  • fetch subscriptions
  • delete a subscription
  1. Airtime
  • send airtime
  • check airtime transaction status
  1. Voice cal;
  • make a call

Usage

import 'package:africas_talking/africas_talking.dart';

main() {
  var africasTalking = AfricasTalking('YourUsername', key);

  // set to false when testing 
  africasTalking.isLive = false;

  // ***Sms***
  // initialize sms; Takes your registered short code or alphanumeric, defaults to AFRICASTKNG
  Sms sms = africasTalking.sms('ShortCode');
  
  // send sms
  sms.send(message: "Hello world", to: ['+XXXXXXXXXXXX']);
  // fetch messages
  sms.fetchMessages(lastReceivedId: '0');


  // ***Airtime***
  // initialize airtime
  Airtime airtime = africasTalking.airtime();

  // send airtime; takes a List of AirtimeRecipient
  airtime.send([AirtimeRecipient(amount: 20, phoneNo: '+XXXXXXXXXXXX', currency: 'KES')]);


  // ***Voice call***
  // initialize voice call; takes  Your Africa’s Talking phone number
  VoiceCall voiceCall = africasTalking.voiceCall('+XXXXXXXXXXXX');

  // make a call; takes a list of phone numbers
  voiceCall.call(to: ['+XXXXXXXXXXXX']);
}

About

This package wraps Airtime, Sms, and Voice call from Africa's Talking APIs.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages