Logo Lanfrica

gabrielmahia/kenya-sms

Domaine:

natural language processingdigital infrastructure

Type de record:

software
Créateur:
gab
Hôte:
Kenya SMS — Africa's Talking SMS integration for civic AI tools. EN/SW bilingual alert templates. # kenya-sms **Africa's Talking SMS wrapper for Kenya — bilingual templates, delivery tracking, bulk sending.** SMS is the primary notification channel for Kenya. This library wraps the Africa's Talking API with the patterns that production Kenya systems actually need: bilingual English/Kiswahili templates, phone number normalisation, delivery receipt tracking, rate-limit backoff, and bulk broadcast sending. --- ## Install ```bash pip install kenya-sms ``` --- ## Quickstart ```python from kenya_sms import SMSClient, Templates, Language client = SMSClient( api_key="your_at_api_key", username="your_at_username", sender_id="MYAPP", # Registered with Communications Authority of Kenya ) # Single message — phone normalised automatically result = client.send("0712345678", "Your order is confirmed.") print(result.succeeded, result.cost) # True, "KES 1.0000" # Bilingual template — user's language preference result = client.send_template( "254712345678", Templates.CONTRIBUTION_RECEIVED, language=Language.KISWAHILI, name="Jane", amount="2,000", cycle="January", receipt="NLJ7RT61SV", ) # → "Habari Jane, mchango wako wa KES 2,000 kwa January umepokelewa. Risiti: NLJ7RT61SV." ``` --- ## Bilingual templates All templates render in English or Kiswahili with the same variables: ```python from kenya_sms import Template, Language # Built-in templates Templates.CONTRIBUTION_RECEIVED # Chama contribution confirmed Templates.CONTRIBUTION_REMINDER # Upcoming contribution due Templates.LOAN_APPROVED # Loan disbursement notice Templates.DROUGHT_ALERT # OpenResilience early warning Templates.PAYMENT_PROMPT # M-Pesa payment instructions Templates.OTP # Verification code # Custom template tpl = Template( en="Dear {name}, your loan repayment of KES {amount} is due on {date}.", sw="Habari {name}, malipo yako ya mkopo ya KES {amount} yanastahili tarehe {date}.", ) msg = tpl.render(Language.KISWAHILI, name="John", amo …