Logo Lanfrica

ronaldgosso/pynextsms

Domain:

digital infrastructure

Record type:

software
Creator:
ron
Host:
Python SDK for the NEXT SMS Tanzania - (app.nextsms.co.tz) SMS API v2 # pynextsms πŸ‡ΉπŸ‡Ώ **Python SDK for the NEXT SMS Tanzania SMS API v2** --- ## Table of Contents - Documentation - Requirements - Features - Installation - Quick Start - Authentication - Usage Guide - Send a Single SMS - Broadcast to Multiple Recipients - Send Different Messages (Bulk) - Schedule an SMS - Scheduled + Recurring SMS - Flash SMS - Context Manager - Environment Variables - Response Objects - Error Handling - Logging - Running Locally - Contributing - Changelog - License --- ## Documentation - Official Next SMS API Documentation ## Requirements - Next SMS Registration - Python 3.8+ - requests >= 2.28 ## Features | Feature | Support | |---|---| | Send SMS to a single recipient | βœ… | | Broadcast same message to multiple recipients | βœ… | | Send different messages to different recipients | βœ… | | Schedule SMS (one-time) | βœ… | | Schedule SMS (recurring: hourly / daily / weekly / monthly) | βœ… | | Flash (Class-0) SMS | βœ… | | Auto-retry on transient 5xx errors | βœ… | | Typed responses β€” no raw dict-wrangling | βœ… | | Full type annotations + `py.typed` (mypy strict) | βœ… | | Environment-variable credentials (12-factor ready) | βœ… | | Zero dependencies beyond `requests` | βœ… | | Python 3.8 – 3.12 | βœ… | --- ## Installation pynextsms ```bash pip install pynextsms ``` --- ## Quick Start ```python from pynextsms import SMSClient client = SMSClient(token="your_bearer_token", sender_id="YOURBRAND") resp = client.sms.send("255763930052", "Hello from PyNextSMS!") print(resp) # SMSResponse(βœ… sent, http=200, ref='a3f1c2d4') ``` --- ## Authentication Generate your **Bearer Token** from your Next SMS API Documentation. ### Option 1 β€” pass credentials directly *(quick scripts, notebooks)* ```python client = SMSClient(token="your_bearer_token", sender_id="YOURBRAND") ``` ### Option 2 β€” environment variables *(recommended for production)* ```bash export PYNEXTSMS_TOKEN="your_bearer_token" export PYNEXTSMS_SENDER_ID="YOURBRAND" ``` ```python client = SMSCl …