Skip to main content

Official Python SDK for the Hellio Messaging API (SMS, OTP, Voice, Number Lookup, Email Verification, Webhooks).

Project description

Hellio Messaging - Official Python SDK

tests PyPI version Python versions License

Python client for the Hellio Messaging API v1: SMS, OTP (SMS / email / voice), Voice broadcasts, Number Lookup (HLR), Email Verification, and Webhooks. Fully type-hinted and synchronous.

Install

pip install helliomessaging

The import package is hellio (the main class is Hellio).

Configure

Generate a token in your dashboard -> Settings -> API -> Generate API token, then construct the client directly:

from hellio import Hellio

client = Hellio(
    token="your-token-here",
    default_sender="HellioSMS",   # optional default Sender ID for SMS
)

Or rely on environment variables:

HELLIO_API_TOKEN=your-token-here
HELLIO_BASE_URL=https://api.helliomessaging.com/v1
HELLIO_DEFAULT_SENDER=HellioSMS
client = Hellio()   # reads HELLIO_API_TOKEN, HELLIO_BASE_URL, HELLIO_DEFAULT_SENDER

Every call returns the decoded JSON response as a dict (payloads are under the data key). You can also use the client as a context manager so the underlying HTTP connection is closed for you:

with Hellio(token="your-token-here") as client:
    client.balance()

Usage

from hellio import Hellio

client = Hellio(token="your-token-here", default_sender="HellioSMS")

# Account
client.balance()            # {'data': {'balance': '195.0000', 'available': '194.65', ...}}
client.pricing("GH")        # optional ISO-2 country filter
client.pricing()            # all networks

# SMS (recipients: string, comma list, or list)
client.sms("233241234567", "Hello!")
client.sms(["233241234567", "233201234567"], "Hi all", sender="HellioSMS")
client.message(1024)        # delivery status
client.campaign(1024)       # campaign summary

# OTP - sender (Sender ID) is REQUIRED for sms/voice and must be approved on your account.
# Optional length (4-10 digits) and expiry (minutes). Returns status "queued".
client.otp("233241234567", "HellioSMS")                          # SMS
client.otp("233241234567", "HellioSMS", channel="voice")         # Voice (TTS reads the code)
client.otp("233241234567", "HellioSMS", length=6, expiry=10)     # custom length / expiry
client.otp("user@example.com", channel="email")                  # Email (no sender)
client.verify("233241234567", "123456")                          # bool
client.verify_otp("user@example.com", "123456", channel="email") # full response

# Voice broadcast - text (we TTS it) or a hosted audio_url
client.voice("233241234567", "HELLIO", text="Your code is 1 2 3 4")
client.voice(["233241234567"], "HELLIO", audio_url="https://cdn.example.com/promo.mp3")
client.voice_status(42)

# Number lookup (HLR) - async; poll results
client.lookup(["233241234567"])
client.lookups()
client.lookup_result(5)

# Email verification
client.verify_email(["user@gmail.com", "bad@nodomain.invalid"])

# Webhooks (receive delivery reports)
client.create_webhook("https://your-app.com/hooks/hellio", ["message.delivered", "message.failed"])
client.webhooks()
client.delete_webhook(1)

Error handling

Non-2xx responses raise typed exceptions (all extend HellioError). Each error carries message, status_code, and response (the parsed body); validation errors also expose errors.

Exception Status
InvalidApiTokenError 401
InsufficientBalanceError 402
ValidationError (.errors) 422
RateLimitError 429
HellioError other
from hellio import Hellio, InsufficientBalanceError

client = Hellio(token="your-token-here")

try:
    client.sms("233241234567", "Hi")
except InsufficientBalanceError:
    ...  # top up

verify() is a convenience wrapper: it returns False on a 422 validation error (invalid code) instead of raising.

Rate limit: 120 requests/minute per token.

Testing against the SDK

The client accepts an injected httpx.Client, so you can mock the transport in your own tests (for example with respx):

import httpx
from hellio import Hellio

client = Hellio(token="test", http_client=httpx.Client(base_url="https://api.helliomessaging.com/v1/"))

License

MIT

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

helliomessaging-1.0.0.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

helliomessaging-1.0.0-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file helliomessaging-1.0.0.tar.gz.

File metadata

  • Download URL: helliomessaging-1.0.0.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for helliomessaging-1.0.0.tar.gz
Algorithm Hash digest
SHA256 d2c1b577e4c88296e7fe708e583234ff8034ed01cfc58d4b415168739edb1f4d
MD5 f3128d5233e541b5890428de6e8f79cd
BLAKE2b-256 dc8be6e9bf6de2a169f32e2bb1eed34dea60cdc9cae2f8060fcea551bb3ee75e

See more details on using hashes here.

File details

Details for the file helliomessaging-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for helliomessaging-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8b957b830d268f0baa2bff7e8c5f34ee38e78523a353cfd121e74fbd599f0a46
MD5 5991e17b0de6d240c41588290a30f5b4
BLAKE2b-256 7a41584e937a902dd8c076b81291d8627f6bbae06289250b6eadef88ee837eae

See more details on using hashes here.

Supported by

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