africas_talking 0.0.1 copy "africas_talking: ^0.0.1" to clipboard
africas_talking: ^0.0.1 copied to clipboard

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

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']);
}
3
likes
120
pub points
27%
popularity

Publisher

verified publisherphan-tec.com

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

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

http

More

Packages that depend on africas_talking