Skip to main content

📱 SMSGate Python Client

Contributors Forks Stars Issues License PyPI Version

A modern Python client for the SMSGate API: send SMS messages through your Android devices with synchronous and asynchronous interfaces, Basic or JWT authentication, and optional end-to-end encryption. See the client libraries overview for the full ecosystem.

📖 About

android-sms-gateway is a typed Python library for the SMSGate 3rd-party API, with fully type-hinted domain models. It ships a synchronous APIClient and an asynchronous AsyncAPIClient, auto-detects the installed HTTP backend (requests, aiohttp, or httpx), and supports optional end-to-end message encryption via Encryptor (AES-256-CBC). Covers messages (SMS, data, and MMS), inbox (refresh, attachments), devices, webhooks, settings, logs, health probes, and the JWT token lifecycle.

📚 Table of Contents

⭐ Features

  • Synchronous APIClient and asynchronous AsyncAPIClient (context managers)
  • Basic and JWT authentication; token generate, refresh, and revoke
  • HTTP backends: requests (sync), aiohttp (async), httpx (both), auto-detected
  • Optional end-to-end encryption via Encryptor (AES-256-CBC)
  • Webhooks, devices, settings, logs, and health probes (live, ready, startup)
  • Outgoing MMS with subject, text, and base64 attachments via MmsMessage (E2E-encrypted when configured)
  • Inbox refresh with webhook delivery and MMS attachment download
  • Full type hints and typed exceptions (APIError subclasses)

📦 Installation

pip install android-sms-gateway

Requires Python 3.9+. Optional extras:

pip install android-sms-gateway[requests]    # sync requests backend
pip install android-sms-gateway[aiohttp]     # async aiohttp backend
pip install android-sms-gateway[httpx]       # httpx backend (sync + async)
pip install android-sms-gateway[encryption]  # end-to-end encryption (pycryptodome)

🔑 Authentication

Two methods are supported: Basic authentication with account credentials, and JWT bearer tokens with scoped permissions. Pass login=None with a token to switch to JWT.

Basic Authentication

import os

from android_sms_gateway import client, domain

login = os.getenv("SMSGATE_LOGIN")
password = os.getenv("SMSGATE_PASSWORD")
message = domain.Message(
    phone_numbers=["+12025550100"],
    text_message=domain.TextMessage(text="Hello from Python"),
)

with client.APIClient(login, password) as c:
    state = c.send(message)

JWT Authentication

from android_sms_gateway import client, domain

with client.APIClient(login, password) as c:
    token = c.generate_token(
        domain.TokenRequest(scopes=["messages:send", "messages:read"], ttl=3600)
    )

jwt_client = client.APIClient(None, token.access_token)

🚀 Quickstart

import os

from android_sms_gateway import client, domain

message = domain.Message(
    phone_numbers=["+12025550100"],
    text_message=domain.TextMessage(text="Hello from Python"),
    with_delivery_report=True,
)

with client.APIClient(os.getenv("SMSGATE_LOGIN"), os.getenv("SMSGATE_PASSWORD")) as c:
    state = c.send(message)
    print(f"Message ID: {state.id}")

💻 Usage

Beyond sending, the client covers message listing and cancellation, inbox listing and refresh, device management, health checks, logs, settings (get, update, patch), webhooks, and the token lifecycle. See android_sms_gateway/client.py for the complete method list with signatures and android_sms_gateway/domain.py for the domain models.

📖 API Reference

🤝 Contributing

Contributions are welcome. Open an issue to discuss major changes before submitting a pull request; PRs target the master branch.

📄 License

Distributed under the Apache License 2.0. See LICENSE.

Metadata

Release files for android-sms-gateway 4.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for android-sms-gateway 4.3.1
File Size Uploaded
android_sms_gateway-4.3.1.tar.gz 38.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for android-sms-gateway 4.3.1
File Interpreter ABI Platform
android_sms_gateway-4.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 65.5 kB

Release files / android_sms_gateway-4.3.1.tar.gz

Download URL android_sms_gateway-4.3.1.tar.gz
Size 38.3 kB
Tags Source
SHA-256 checksum
How to use checksums
7b28707feccc88961c287b96b71495ce4b20a94918933c76b3a1b95eae655209
BLAKE2b-256 checksum
How to use checksums
664d1ebf90737eb60da208bf535eae8b69816cbfeead21ea0565a9d5ba1a9525
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 6, 2026.

Transparency log

Release files / android_sms_gateway-4.3.1-py3-none-any.whl

Download URL android_sms_gateway-4.3.1-py3-none-any.whl
Size 27.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3051d03a1800ac85007cb9aa91225b8173084d796c6e5bde3e09a08e91d0186e
BLAKE2b-256 checksum
How to use checksums
71cc1129a2313d67189129008ea077b58b47469b9297c10b1e91bfbd56438d3a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 6, 2026.

Transparency log

Release history Release notifications | RSS feed

4.3.2

2 release files

This release

4.3.1 This release

2 release files

4.3.0

2 release files

4.2.1

2 release files

4.2.0

2 release files

4.1.0

2 release files

4.0.0

2 release files

3.3.0

2 release files

3.2.2

2 release files

3.1.1

2 release files

3.1.0

2 release files

3.0.0

2 release files

2.1.0

2 release files

2.0.0

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.0.3

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page