Observed since 20 Oct, 21:11 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
Official Africa's Talking Python SDK
The SDK provides convenient access to the Africa's Talking APIs to python apps.
Take a look at the API docs here.
$ pip3 install africastalking # python 3.8.x
OR
$ python3 -m pip install africastalking # python 3.8.x
The package needs to be configured with your app username and API key, which you can get from the dashboard. Note that all functions accept an optional timeout argument, but have a set default.
You can use this SDK for either production or sandbox apps. For sandbox, the app username is ALWAYS
sandbox
# import package
import africastalking
# Initialize SDK
username = "YOUR_USERNAME" # use 'sandbox' for development in the test environment
api_key = "YOUR_API_KEY" # use your sandbox app API key for development in the test environment
africastalking.initialize(username, api_key)
# Initialize a service e.g. SMS
sms = africastalking.SMS
# Use the service synchronously
response = sms.send("Hello Message!", ["+2547xxxxxx"])
print(response)
# Or use it asynchronously
def on_finish(error, response):
if error is not None:
raise error
print(response)
sms.send("Hello Message!", ["+2547xxxxxx"], callback=on_finish, timeout=(3, 6))
See example for more usage examples.
Initialize the SDK by calling africastalking.initialize(username, api_key). After initialization, you can get instances of offered services as follows:
africastalking.SMSafricastalking.Airtimeafricastalking.Voiceafricastalking.Tokenafricastalking.Applicationafricastalking.MobileDataafricastalking.Insightsafricastalking.WhatsappApplicationfetch_application_data(): Get app information. e.g balance.Airtimesend(recipients: [dict]): Send airtime
recipients: Contains an array of arrays containing the following keys
phone_number: Recipient of airtimeamount: Amount to send with currency e.g 100currency_code: 3-digit ISO format currency code (e.g KES, USD, UGX etc).max_num_retry: This allows you to specify the maximum number of retries in case of failed airtime deliveries due to various reasons such as telco unavailability. The default retry period is 8 hours and retries occur every 60 seconds. For example, setting max_num_retry=4 means the transaction will be retried every 60 seconds for the next 4 hours. OPTIONAL.
Smssend(message: str, recipients: [str], sender_id: str = None, enqueue: bool = False): Send a message.
message: SMS content. REQUIREDrecipients: An array of phone numbers. REQUIREDsender_id: Shortcode or alphanumeric ID that is registered with your Africa's Talking account.enqueue: Set to true if you would like to deliver as many messages to the API without waiting for an acknowledgement from telcos.send_premium(message: str, short_code: str, recipients: [str], link_id: [str] = None, retry_duration_in_hours [int] = None): Send a premium SMS
message: SMS content. REQUIREDshort_code: Your premium product shortCode. REQUIREDrecipients: An array of phone numbers. REQUIREDkeyword: Your premium product keyword.link_id: We forward the linkId to your application when a user sends a message to your onDemand serviceretry_duration_in_hours: This specifies the number of hours your subscription message should be retried in case it's not delivered to the subscriberfetch_messages(last_received_id: int = 0): Fetch your messages
last_received_id: This is the id of the message you last processed. Defaults to 0create_safaricom_subscription(short_code: str, keyword: str, phone_number: str, request_id: str, redirect_url: str, source_ip: str, user_agent: str): Create a premium Safaricom subscription
short_code: Premium short code mapped to your account. REQUIREDkeyword: Premium keyword under the above short code and is also mapped to your account. REQUIREDrequest_id: Request id associated with the request.redirect_url: URL that the user will be redirected to after they have confirmed their subscription.phone_number: PhoneNumber to be subscribed.source_ip: IP address the subscribing party is originating from.user_agent: String stating which browser was used to access the content.Voicecall(callFrom: str, callTo: [str]): Initiate a phone call
callFrom: Phone number on Africa's Talking (in international format). REQUIREDcallTo: An array of phone numbers that you wish to dial (in international format). REQUIREDfetch_queued_calls(phone_number: str): Get queued calls
phone_number: Phone number mapped to your Africa's Talking account (in international format). REQUIREDupload_media_file(phone_number: str, url: str): Upload voice media file
phone_number: phone number mapped to your Africa's Talking account (in international format). REQUIREDurl: The url of the file to upload. Should start with http(s)://. REQUIREDTokengenerate_auth_token(): Generate an auth token to use for authentication instead of an API key.MobileDatasend(product_name: str, recipients: dict): Send mobile data to customers.
product_name: Payment product on Africa's Talking. REQUIREDrecipients: A list of recipients. Each recipient has:
phoneNumber: Customer phone number (in international format). REQUIREDquantity: Mobile data amount. REQUIREDunit: Mobile data unit. Can either be MB or GB. REQUIREDvalidity: How long the mobile data is valid for. Must be one of Day, Week and Month. REQUIREDmetadata: Additional data to associate with the transaction. OPTIONALfind_transaction(transaction_id: str): Find a mobile data transaction.
fetch_wallet_balance(): Fetch a mobile data product balance.
Insightscheck_sim_swap_state(phone_numbers: [str]): Check the sim swap state of a given [array of ] phone number(s).Whatsappsend(body: dict, wa_number: str, phone_number: str): Send a whatsapp message to a given phone number.
wa_number: The number being used to send the message that is associated with the account. REQUIREDphone_number: The number that is to receive the message. REQUIREDbody: The message to be sent. The message has a combination of the following:
message: The message to be sent to the client. OPTIONALmediaType: The type of message being sent Can be one of Image, Video, Audio, Voice, Sticker or Document OPTIONALurl: The hosted URL of what is being sent. OPTIONALcaption: The caption associated with an image or video that is being sent. OPTIONALaction: A dictionary with a list of actions. OPTIONALbody: A dictionary containing what is being sent with the interactive button or list. OPTIONALheader: A dictionary containing what header is being sent with the interactive button or list.OPTIONALfooter: A dictionary containing what footer is being sent with the interactive button or list.OPTIONALsend_template(component: dict, wa_number: str, name: str, language: str, category: str): Send a Whatsapp template for your future messages.
wa_number: The Whatsapp phone number that will be used to send the messages associated with the template. REQUIREDname: The name of the template. This must be unique. REQUIREDlanguage: The language code associated with the template. REQUIREDcategory: The category associated with the template. REQUIREDcomponent: A complex type containing the values that will be in the template. It can contain the following types:
header: The header of the template to be sent. OPTIONALbody: The type of message being sent in the body of the template. OPTIONALfooter: The footer of the template to be sent. OPTIONALbuttons: A list of buttons to be sent in the template. OPTIONALUssdFor more information, please read https://developers.africastalking.com/docs/ussd
$ git clone https://github.com/AfricasTalkingLtd/africastalking-python.git
$ cd africastalking-python
$ python3 -m unittest
If you find a bug, please file an issue on our issue tracker on GitHub.
pypistats · 90 observations shown. Missing days are unknown. Source category: overall: without mirrors.
| Date / source period | Value | Observed at |
|---|---|---|
| 2026-10-20 – 2026-10-20 | 2,455 | 2026-10-21T09:37:37.6967496Z |
| 2026-10-19 – 2026-10-19 | 1,659 | 2026-10-21T09:37:37.6967496Z |
| 2026-10-18 – 2026-10-18 | 944 | 2026-10-21T09:37:37.6967496Z |
| 2026-10-17 – 2026-10-17 | 1,221 | 2026-10-21T09:37:37.6967496Z |
| 2026-10-16 – 2026-10-16 | 1,380 | 2026-10-21T09:37:37.6967496Z |
| 2026-10-15 – 2026-10-15 | 1,555 | 2026-10-21T09:37:37.6967496Z |
| 2026-10-14 – 2026-10-14 | 1,848 | 2026-10-21T09:37:37.6967496Z |
| 2026-10-13 – 2026-10-13 | 1,650 | 2026-10-21T09:37:37.6967496Z |
| 2026-10-12 – 2026-10-12 | 1,932 | 2026-10-21T09:37:37.6967496Z |
| 2026-10-11 – 2026-10-11 | 1,481 | 2026-10-21T09:37:37.6967496Z |
| 2026-10-10 – 2026-10-10 | 1,516 | 2026-10-21T09:37:37.6967496Z |
| 2026-10-09 – 2026-10-09 | 1,515 | 2026-10-21T09:37:37.6967496Z |
| 2026-10-08 – 2026-10-08 | 1,824 | 2026-10-21T09:37:37.6967496Z |
| 2026-10-07 – 2026-10-07 | 1,743 | 2026-10-21T09:37:37.6967496Z |
| 2026-10-06 – 2026-10-06 | 1,888 | 2026-10-21T09:37:37.6967496Z |
| 2026-10-05 – 2026-10-05 | 1,368 | 2026-10-21T09:37:37.6967496Z |
| 2026-10-04 – 2026-10-04 | 1,173 | 2026-10-21T09:37:37.6967496Z |
| 2026-10-03 – 2026-10-03 | 1,309 | 2026-10-21T09:37:37.6967496Z |
| 2026-10-02 – 2026-10-02 | 1,397 | 2026-10-21T09:37:37.6967496Z |
| 2026-10-01 – 2026-10-01 | 1,906 | 2026-10-21T09:37:37.6967496Z |
| 2026-09-30 – 2026-09-30 | 1,750 | 2026-10-21T09:37:37.6967496Z |
| 2026-09-29 – 2026-09-29 | 2,101 | 2026-10-21T09:37:37.6967496Z |
| 2026-09-28 – 2026-09-28 | 2,290 | 2026-10-21T09:37:37.6967496Z |
| 2026-09-27 – 2026-09-27 | 874 | 2026-10-21T09:37:37.6967496Z |
| 2026-09-26 – 2026-09-26 | 925 | 2026-10-21T09:37:37.6967496Z |
| 2026-09-25 – 2026-09-25 | 1,087 | 2026-10-21T09:37:37.6967496Z |
| 2026-09-24 – 2026-09-24 | 1,575 | 2026-10-21T09:37:37.6967496Z |
| 2026-09-23 – 2026-09-23 | 2,045 | 2026-10-21T09:37:37.6967496Z |
| 2026-09-22 – 2026-09-22 | 1,825 | 2026-10-21T09:37:37.6967496Z |
| 2026-09-21 – 2026-09-21 | 1,667 | 2026-10-21T09:37:37.6967496Z |
| 2026-09-20 – 2026-09-20 | 1,243 | 2026-10-21T09:37:37.6967496Z |
| 2026-09-19 – 2026-09-19 | 1,350 | 2026-10-21T09:37:37.6967496Z |
| 2026-09-18 – 2026-09-18 | 1,686 | 2026-10-21T09:37:37.6967496Z |
| 2026-09-17 – 2026-09-17 | 1,745 | 2026-10-21T09:37:37.6967496Z |
| 2026-09-16 – 2026-09-16 | 1,776 | 2026-10-21T09:37:37.6967496Z |
| 2026-09-15 – 2026-09-15 | 2,143 | 2026-10-21T09:37:37.6967496Z |
| 2026-09-14 – 2026-09-14 | 1,556 | 2026-10-21T09:37:37.6967496Z |
| 2026-09-13 – 2026-09-13 | 726 | 2026-10-21T09:37:37.6967496Z |
| 2026-09-12 – 2026-09-12 | 1,332 | 2026-10-21T09:37:37.6967496Z |
| 2026-09-11 – 2026-09-11 | 2,078 | 2026-10-21T09:37:37.6967496Z |
| 2026-09-10 – 2026-09-10 | 1,515 | 2026-10-21T09:37:37.6967496Z |
| 2026-09-09 – 2026-09-09 | 1,631 | 2026-10-21T09:37:37.6967496Z |
| 2026-09-08 – 2026-09-08 | 2,972 | 2026-10-21T09:37:37.6967496Z |
| 2026-09-07 – 2026-09-07 | 2,073 | 2026-10-21T09:37:37.6967496Z |
| 2026-09-06 – 2026-09-06 | 1,026 | 2026-10-21T09:37:37.6967496Z |
| 2026-09-05 – 2026-09-05 | 1,915 | 2026-10-21T09:37:37.6967496Z |
| 2026-09-04 – 2026-09-04 | 1,722 | 2026-10-21T09:37:37.6967496Z |
| 2026-09-03 – 2026-09-03 | 2,709 | 2026-10-21T09:37:37.6967496Z |
| 2026-09-02 – 2026-09-02 | 3,208 | 2026-10-21T09:37:37.6967496Z |
| 2026-09-01 – 2026-09-01 | 3,042 | 2026-10-21T09:37:37.6967496Z |
| 2026-08-31 – 2026-08-31 | 2,044 | 2026-10-21T09:37:37.6967496Z |
| 2026-08-30 – 2026-08-30 | 1,418 | 2026-10-21T09:37:37.6967496Z |
| 2026-08-29 – 2026-08-29 | 1,376 | 2026-10-21T09:37:37.6967496Z |
| 2026-08-28 – 2026-08-28 | 1,883 | 2026-10-21T09:37:37.6967496Z |
| 2026-08-27 – 2026-08-27 | 1,981 | 2026-10-21T09:37:37.6967496Z |
| 2026-08-26 – 2026-08-26 | 2,193 | 2026-10-21T09:37:37.6967496Z |
| 2026-08-25 – 2026-08-25 | 1,954 | 2026-10-21T09:37:37.6967496Z |
| 2026-08-24 – 2026-08-24 | 2,760 | 2026-10-21T09:37:37.6967496Z |
| 2026-08-23 – 2026-08-23 | 1,393 | 2026-10-21T09:37:37.6967496Z |
| 2026-08-22 – 2026-08-22 | 1,734 | 2026-10-21T09:37:37.6967496Z |
| 2026-08-21 – 2026-08-21 | 2,750 | 2026-10-21T09:37:37.6967496Z |
| 2026-08-20 – 2026-08-20 | 2,259 | 2026-10-21T09:37:37.6967496Z |
| 2026-08-19 – 2026-08-19 | 3,434 | 2026-10-21T09:37:37.6967496Z |
| 2026-08-18 – 2026-08-18 | 2,488 | 2026-10-21T09:37:37.6967496Z |
| 2026-08-17 – 2026-08-17 | 3,029 | 2026-10-21T09:37:37.6967496Z |
| 2026-08-16 – 2026-08-16 | 1,677 | 2026-10-21T09:37:37.6967496Z |
| 2026-08-15 – 2026-08-15 | 2,599 | 2026-10-21T09:37:37.6967496Z |
| 2026-08-14 – 2026-08-14 | 2,639 | 2026-10-21T09:37:37.6967496Z |
| 2026-08-13 – 2026-08-13 | 3,361 | 2026-10-21T09:37:37.6967496Z |
| 2026-08-12 – 2026-08-12 | 2,810 | 2026-10-21T09:37:37.6967496Z |
| 2026-08-11 – 2026-08-11 | 2,558 | 2026-10-21T09:37:37.6967496Z |
| 2026-08-10 – 2026-08-10 | 3,673 | 2026-10-21T09:37:37.6967496Z |
| 2026-08-09 – 2026-08-09 | 2,578 | 2026-10-21T09:37:37.6967496Z |
| 2026-08-08 – 2026-08-08 | 2,685 | 2026-10-21T09:37:37.6967496Z |
| 2026-08-07 – 2026-08-07 | 3,189 | 2026-10-21T09:37:37.6967496Z |
| 2026-08-06 – 2026-08-06 | 2,904 | 2026-10-21T09:37:37.6967496Z |
| 2026-08-05 – 2026-08-05 | 3,156 | 2026-10-21T09:37:37.6967496Z |
| 2026-08-04 – 2026-08-04 | 2,822 | 2026-10-21T09:37:37.6967496Z |
| 2026-08-03 – 2026-08-03 | 3,137 | 2026-10-21T09:37:37.6967496Z |
| 2026-08-02 – 2026-08-02 | 2,260 | 2026-10-21T09:37:37.6967496Z |
| 2026-08-01 – 2026-08-01 | 2,385 | 2026-10-21T09:37:37.6967496Z |
| 2026-07-31 – 2026-07-31 | 2,724 | 2026-10-21T09:37:37.6967496Z |
| 2026-07-30 – 2026-07-30 | 2,639 | 2026-10-21T09:37:37.6967496Z |
| 2026-07-29 – 2026-07-29 | 2,199 | 2026-10-21T09:37:37.6967496Z |
| 2026-07-28 – 2026-07-28 | 3,513 | 2026-10-21T09:37:37.6967496Z |
| 2026-07-27 – 2026-07-27 | 3,382 | 2026-10-21T09:37:37.6967496Z |
| 2026-07-26 – 2026-07-26 | 2,785 | 2026-10-21T09:37:37.6967496Z |
| 2026-07-25 – 2026-07-25 | 1,497 | 2026-10-21T09:37:37.6967496Z |
| 2026-07-24 – 2026-07-24 | 2,724 | 2026-10-21T09:37:37.6967496Z |
| 2026-07-23 – 2026-07-23 | 2,993 | 2026-10-21T09:37:37.6967496Z |
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 2.0.3 | 31 Jul 2026 | 3 |
This describes our collected data; it is not a security assessment.
Shared repository data · GitHub
Observed since 20 Oct, 21:11 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:2794ecabc9fcf8fb1b3818c9d022e2a7be3ffbc50f5542eb60396f0a10df948f