Zamtel bulk SMS api example in Python
Installation
pip install zamtelsms
Setup
Create a .env file in the root of your project and add the following
API_KEY=YOUR_API_KEY_FROM_ZAMTEL
SENDER_ID=YOUR_SENDER_ID_FROM_ZAMTEL
BASE_URL=https://bulksms.zamtel.co.zm/api/v2.1/action/send/
- API_KEY is the API_KEY you were given by Zamtel
- SENDER_ID is the SENDER_ID you were given by Zamtel
Usage
You can use the function to send a single here is an example
from sms import send_sms
response = send_sms('0975442232', 'Hello there, I am testing the Zamtel Bulk SMS API')
print(response)
You can also pass an array of phone numbers to send a sms SMS to multiple clients.
from zamtelsms.sms import send_sms
phone_numbers = ['0976xxxxxx','0976xxxxxx','0976xxxxxx','0976xxxxxx','0976xxxxxx',]
message = 'Hello there, I am testing the Zamtel Bulk SMS API'
response = send_sms(phone_numbers, message)
print(response)
# output
{'success': True, 'responseText': 'SMS(es) have been queued for delivery'}
It is as simple as that 😃
Happy coding!!
Metadata
Release files for zamtelsms 0.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| zamtelsms-0.0.7.tar.gz | 3.3 kB | Details |
Release files / zamtelsms-0.0.7.tar.gz
| Download URL | zamtelsms-0.0.7.tar.gz |
|---|---|
| Size | 3.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9d9f7e65468931be88890159c4d681f6d54409d71ec62ce9119293c212ec6a1e
|
|
BLAKE2b-256 checksum How to use checksums |
8c7a9ff8874212f397c60f9271bd30e69c4c1d0d846c3331e4505ad08b7ee193
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.8.13
|