Skip to main content

Connect Media SMS for Python

Official Python client for the Connect Media SMS API. Send bulk and transactional SMS to Safaricom, Airtel and Telkom numbers in Kenya and to 190+ countries, check your balance, read sent history with delivery status and receive customer replies.

Get an API key

  1. Create a free account at dashboard.connectmedia.co.ke.
  2. Generate a 64-character API key under Profile, then API keys.
  3. Top up any amount and register a sender ID (see sender ID registration in Kenya).

Install

pip install connectmedia-sms

Usage

from datetime import datetime
from connectmedia_sms import Client, ConnectMediaError

client = Client("YOUR_64_CHARACTER_API_KEY")

try:
    client.send("0712345678", "Your order has shipped.", sender="YourBrand")
    client.send(["0712345678", "0733000111"], "Fees are due on Friday.", sender="YourSchool",
                schedule_at=datetime(2026, 12, 1, 9, 0))
    print(client.balance())
    print(client.history(limit=10))
    print(client.inbox(limit=10))
except ConnectMediaError as e:
    print(e.code, e.message)

Response codes

Action Success code
send 201
balance 200
history 202
inbox 302

Any other code raises an error carrying the API's code and message (for example 100 invalid API key, 101 insufficient balance, 104 invalid recipients, 105 invalid message, 500 server error). Network failures use code network; a non-JSON reply uses invalid_response.

Numbers are normalised for you: 0712345678, +254 712 345 678 and 254712345678 all become 254712345678. International numbers are passed through without punctuation.

Tests

python -m unittest discover -s tests -t .

License

MIT

Release files for connectmedia-sms 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for connectmedia-sms 1.0.0
File Size Uploaded
connectmedia_sms-1.0.0.tar.gz 6.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for connectmedia-sms 1.0.0
File Interpreter ABI Platform
connectmedia_sms-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 12.2 kB

Release files / connectmedia_sms-1.0.0.tar.gz

Download URL connectmedia_sms-1.0.0.tar.gz
Size 6.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e48dd6c05f560de5799367c3baf443a5ddc809300bc42ead030e7dbec529a452
BLAKE2b-256 checksum
How to use checksums
df81b545f912d09e4192a46d24b931dec4241ed1a2d4bbda6a2e3fa0856dec1f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.9

Release files / connectmedia_sms-1.0.0-py3-none-any.whl

Download URL connectmedia_sms-1.0.0-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
320dfe1508c91d3ceb3ab5ca1eca5a9c83058e98cd009bf9f9a6f749673bf68f
BLAKE2b-256 checksum
How to use checksums
20bd01e18ebc6b86e8a65826eecad82a6204cbbc631aae85a4ac963f2ddf5616
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.9

Release history Release notifications | RSS feed

10.0.0

2 release files

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page