Skip to main content

An easy to use wrapper for Hubtel's SMS APIs.

Project description

pyhubtel-sms

Code style: black license

This package provides a convenient and easy way to use / integrate Hubtel's SMS APIs in your python project.

NOTE: This project is a beta release and as such might be subject to minor changes in the future.

Installation

Install and update using pip.

pip install -U pyhubtel-sms
🎉

A Simple Example

>>> # send an SMS to a single recipient
>>> from pyhubtel_sms import SMS
>>> sms = SMS(client_id='iwwofuxx', client_secret='icctaeik')
>>> sms.send_message(sender='PyHubtel', recipient='0502345678', content='Hello world', registered_delivery=True)
{'MessageId': 'f2665231-522f-32b6-accf-6ac8426bfd5c', 'Rate': 1, 'NetworkId': '62002', 'Status': 0}

Usage

Below are usage examples for the implemented send message and batch sms APIs.

Send a message to a single recipient

>>> from pyhubtel_sms import SMS, Message
>>> sms = SMS(client_id='iwwofuxx', client_secret='icctaeik')
>>> message = Message(
...     sender='PyHubtel',
...     content='Apples',
...     recipient='0502345678',
...     registered_delivery=True,
... )
>>> sms.send(message)
{'Status': 0, 'NetworkId': '62002', 'MessageId': '3f20fe72-e0fd-437b-b63d-dbf2b0af9c8b', 'Rate': 1}

Send the same message to different recipients

>>> from pyhubtel_sms import SMS, Message
>>> sms = SMS(client_id='iwwofuxx', client_secret='icctaeik')
>>> bulk_message_one = Message(
...     sender='PyHubtel',
...     content='Oranges',
...     recipients=['0202345678', '0502345678'],
...     campaign_name='PyHubtel SMS Campaign',
... )
>>> sms.send(bulk_message_one)
{'Status': 'Scheduled', 'Name': 'PyHubtel SMS Campaign', 'SenderId': 'PyHubtel', 'TotalCount': 2, 'Time': '2018-04-06 04:16', 'Id': 664544, 'Stats': {'Pending': 2}}

Send personalized messages to recipients

>>> from pyhubtel_sms import SMS, Message, Messages
>>> sms = SMS(client_id='iwwofuxx', client_secret='icctaeik')
>>> message_one = Message(
...     content='Apple Pie',
...     recipient='0202345678',
... )
>>> message_two = Message(
...     content='Orange Tart',
...     recipient='0572345678',
... )
>>> bulk_message_two = Messages(
...     sender='PyHubtel',
...     campaign_name='PyHubtel SMS Campaign',
...     batch=[message_one, message_two],
...     time='12:46 pm'
... )
>>> sms.send(bulk_message_two)
{'Stats': {'Pending': 2}, 'Status': 'Scheduled', 'Time': '2018-04-07 12:46', 'SenderId': 'PyHubtel', 'TotalCount': 2, 'Name': 'PyHubtel SMS Campaign','Id': 664817}

Contributing

All contributions are welcome - from typo fixes to complete refactors and new features. If you happen to encounter a bug or would like to suggest an improvement, please feel free to open an issue or submit a pull request.

License

This project is released under the Apache License, Version 2.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyhubtel-sms-0.0.1.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

pyhubtel_sms-0.0.1-py2.py3-none-any.whl (11.1 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file pyhubtel-sms-0.0.1.tar.gz.

File metadata

File hashes

Hashes for pyhubtel-sms-0.0.1.tar.gz
Algorithm Hash digest
SHA256 e7ef2a2048b6a7c7a686509ebf74e575ce5eeb116a82c6858af2d53071a90237
MD5 ec30b9dec001d72203d8356c70b7fe99
BLAKE2b-256 d6fe5c8f6f0691cff693749321ba72cfe086d12f5575e2296620479351eae4a8

See more details on using hashes here.

File details

Details for the file pyhubtel_sms-0.0.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for pyhubtel_sms-0.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 5e7743539e013bc9c065803cdda5b8ea44f163905162d43dd99218d491f291fa
MD5 7f049bcc05be92a01dc44719436ca0f6
BLAKE2b-256 3b0e0a4ffe8a7f2b92586983d540d2bfbd505529876d1388782bdfce10f425d6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page