Your Last Telco Integration in Africa

Access Telco APIs as a Web Service

Simplified REST API Workflow

6

Countries

15K+

Developers

15M+

Daily API Calls

Simple integration with your favorite language and framework

Read the docs
Making a voice call
// Include our gateway class
require_once('AfricasTalkingGateway.php');

// Specify your authentication credentials
$username   = "MyAfricasTalking_Username";
$apikey     = "MyAfricasTalking_APIKey";

// Specify your Africa's Talking phone number
$callFrom   = "+254711082XXX";

// Specify the numbers you want to call
$callTo     = "+254711XXXYYY,+254733YYYZZZ";

// Create a new instance of our gateway class
$gateway    = new AfricasTalkingGateway($username, $apikey);

try {
    // Make the call
    $results = $gateway->call($callFrom, $callTo);

    foreach($results as $result) {
        // Status "Queued" means the call was successfully placed
        echo $result->status;
        echo $result->phoneNumber;
    }

    // Our API will now contact your callback URL,
    // once the recipient answers the call!

} catch ( AfricasTalkingGatewayException $e ) {
    echo "Encountered an error while making the call: ".$e->getMessage();
}
                            
// Make sure the gateway class jar file is in the classpath
import org.json.*;

public class TestCalling
{
    public static void main(String[] args_)
    {
        // Specify your authentication credentials
        String username   = "MyAfricasTalking_Username";
        String apiKey     = "MyAfricasTalking_APIKey";

        // Specify your Africa's Talking phone number
        String callFrom   = "+254711082XXX";

        // Specify the numbers you want to call
        String callTo     = "+254711XXXYYY,+254733YYYZZZ";

        // Create a new instance of our gateway class
        AfricasTalkingGateway gateway  = new AfricasTalkingGateway(username, apiKey);

        try {
            // Make the call
            JSONArray results = gateway.call(callFrom, callTo);

            int len = results.length();
            for(int i = 0; i < len; i++) {
                JSONObject result = results.getJSONObject(i);

                // Status "Queued" means the call was successfully placed
                System.out.print(result.getString("status") + ",");
                System.out.print(result.getString("phoneNumber") + "\n");
            }

            // Our API will now contact your callback URL,
            // once the recipient answers the call!

        } catch (Exception e) {
            System.out.println("Encountered an error while making the call: " + e.getMessage());
        }
    }
}
                            
// Install our official gateway
using AfricasTalkingCS;
using Newtonsoft.Json.Linq;

using System;

namespace VoiceSample
{
    class Program
    {
        static void Main(string[] args)
        {
            // Specify your authentication credentials
            var username   = "MyAfricasTalking_Username";
            var apikey     = "MyAfricasTalking_APIKey";

            // Specify your Africa's Talking phone number
            var callFrom   = "+254711082XXX";

            // Specify the numbers you want to call
            var callTo     = "+254711XXXYYY,+254733YYYZZZ";

            // Create a new instance of our gateway class
            var gateway    = new AfricasTalkingGateway(username,apikey);

            try {
                dynamic results = gateway.Call(callFrom, callTo);

                foreach (var i in results) {
                    // Status "Queued" means the call was successfully placed
                    Console.WriteLine(results["status"] + ",");
                    Console.WriteLine(results["phoneNumber"]+"\n");
                }

                // Our API will now contact your callback URL,
                // once the recipient answers the call!

            } catch (AfricasTalkingGatewayException e) {
                Console.WriteLine("Encountered an error while making the call: " + e.Message);
            }
        }
    }
}
                            
// Require our official gateway package
const AfricasTalking = require('africastalking');

// Specify your authentication credentials
const username   = "MyAfricasTalking_Username";
const apiKey     = "MyAfricasTalking_APIKey";

// Specify your Africa's Talking phone number
const callFrom   = "+254711082XXX";

// Specify the numbers you want to call
const callTo     = "+254711XXXYYY,+254733YYYZZZ";

// Create a new instance of our gateway class
const gateway    = AfricasTalking({ username: username, apiKey: apiKey });

// Make the call
gateway.voice.call({ callFrom: callFrom, callTo: callTo })
.then(funtion(results) {
    results.forEach(function(r) {
        // Status "Queued" means the call was successfully placed
        console.log("Status: " + r.status + " phoneNumber: " + r.phoneNumber);
    });

    // Our API will now contact your callback URL,
    // once the recipient answers the call!

})
.catch(function(err) {
    console.log("Encountered an error while making the call: " + err);
});
                            
# Import our gateway class
from AfricasTalkingGateway import AfricasTalkingGateway, AfricasTalkingGatewayException

# Specify your authentication credentials
username    = "MyAfricasTalking_Username"
apikey      = "MyAfricasTalking_APIKey"

# Specify your Africa's Talking phone number
callFrom    = "+254711082XXX"

# Specify the numbers you want to call
callTo      = "+254711XXXYYY,+254733YYYZZZ"

# Create a new instance of our gateway class
gateway     = AfricasTalkingGateway(username, apikey)

try:
    # Make the call
    results = gateway.call(callFrom, callTo)

    for result in results:
        # Status "Queued" means the call was successfully placed
        print "Status : %s; phoneNumber : %s " % (result['status'], result['phoneNumber'])

    # Our API will now contact your callback URL,
    # once the recipient answers the call!

except AfricasTalkingGatewayException, e:
    print 'Encountered an error while making the call: %s' % str(e)
                            

Our Products

Integrate Once for High Impact Mobile Engagement Solutions