Logo Lanfrica

ronaldgosso/pynextsms

Domaine:

digital infrastructure

Type de record:

software
Créateur:
ron
HĂ´te:
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 …