Skip to content

bulksmszw api for sending text messages with bulksmsweb services with ease

License

Notifications You must be signed in to change notification settings

DonnC/BulkSmsZW-Api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

76 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

  • Unofficial bulksmszw api for sending affordable text messages in Python using zim bulksms getaway providers
  • Flutter dart package available here on pub.dev/bulksmszw
  • for Embedded device supported library in C++ for ESP8266-Arduino boards for IoT check out the ported library bulksms ESP8266

Installation

$ pip install bulksmsapi-zw

demo gif

Authentication details

  • register an account on bulksms website
  • if already have an account, login on bulksms web portal
  • Got to "My Account", then Click on "User Configuration", to obtain "Webservices token".

Sending default message

  • test file test_api.py
  • recipients is passed as a list of bulksms valid format 2637xxxxxxxx, list can also contain groups #devteam and can be mixed
 api = Client(<username>, <token>)
 respond = api.send("hello guys", ['2637xxxxxxxx', '#devteam', '#students'])
  • Example script
from BulkSmsApi.Client import Client

bulksms = Client(<username>, <web-token>)

response = bulksms.send(body="bulk sms ZW api testing", recipients=['2637xxxxxxxx', '2637yyyyyyyy'])

print(response)
  • On successful run, the response default message respond

test run gif

Send message and get credits(text messages) left

  • credits flag by default is set to False
  • to receive the number of credits on your web portal, set the credit flag to True
api = Client(<username>, <token>)

credits_response = api.send(body="hello world", recipients=['2637xxxxxxxx'], credits=True)

print(credits_response)

credits response

Catch BulkSmsZw status errors as python exceptions

  • You can wrap your code in a try - except to catch unsuccessful and bulksms error messages as normal python exceptions
# this wil throw an exception because of the wrong / not valid username

bulksms = Client(username=<wrong-username>, token=<web-token>)

try:
    response = bulksms.send(body="bulk sms ZW api testing", recipients=['2637xxxxxxxx', '2637yyyyyyyy'])
    print(response)

except Exception as exc:
    print("Encountered an Error: %s" %exc)

bulksms exception

Responses

  • responses are in default JSON format used by BulkSMSZW service

acknowledgements

HTTP API

  • Schedule messages
  • Validate phone numbers

get in contact

About

bulksmszw api for sending text messages with bulksmsweb services with ease

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages