Skip to main content

simplymsg

Official Python SDK for SimplyMsg — the WhatsApp messaging API for developers.

pip install simplymsg

Quickstart

from simplymsg import SimplyMsg

client = SimplyMsg(api_key="wsk_...")

result = client.messages.send(
    session_id="sess_abc123",
    to="14155551234",
    type="text",
    message="Your code is 4821",
)

print(result["messageId"])  # "msg_a82f7c4e"

Features

  • Sync + async — SimplyMsg and AsyncSimplyMsg, same API surface.
  • Type-hinted — full type coverage; works with mypy --strict.
  • One dependency — httpx only.
  • Idempotency keys — replay-safe sends.
  • Typed errors — catch RateLimitError, AuthenticationError, etc.
  • Webhook verification — built-in HMAC-SHA256 helper.

Sending messages

Text

client.messages.send(
    session_id="sess_abc",
    to="14155551234",
    type="text",
    message="Hello!",
)

Image / video / audio / document

client.messages.send(
    session_id="sess_abc",
    to="14155551234",
    type="image",
    media_url="https://example.com/cat.jpg",
    caption="Look at this cat",
)

Location

client.messages.send(
    session_id="sess_abc",
    to="14155551234",
    type="location",
    latitude=37.7749,
    longitude=-122.4194,
    name="Coit Tower",
)

Idempotent sends

client.messages.send(
    session_id=session_id,
    to=phone,
    type="text",
    message="Hello",
    idempotency_key="order-#A82F",
)

Async

import asyncio
from simplymsg import AsyncSimplyMsg

async def main():
    async with AsyncSimplyMsg(api_key="wsk_...") as client:
        result = await client.messages.send(
            session_id="sess_abc",
            to="14155551234",
            type="text",
            message="Async hello",
        )
        print(result["messageId"])

asyncio.run(main())

Bulk sends (Enterprise)

batch = client.messages.send_bulk(
    session_id="sess_abc",
    messages=[
        {"to": "14155551111", "type": "text", "message": "Hi customer 1"},
        {"to": "14155552222", "type": "text", "message": "Hi customer 2"},
    ],
)

status = client.messages.batch(batch["batchId"])
print(status["processed"], "/", status["total"])

Webhooks

Configure

webhook = client.webhooks.create(
    url="https://your-app.com/wa/status",
    events=["message.delivered", "message.failed", "session.disconnected"],
)
print(webhook["secret"])  # save this!

Verify incoming webhooks (Flask example)

import os
from flask import Flask, request, abort, jsonify
from simplymsg import SimplyMsg

app = Flask(__name__)
SECRET = os.environ["SIMPLY_WEBHOOK_SECRET"]

@app.post("/wa/status")
def status_webhook():
    raw = request.get_data()  # raw bytes — don't use request.json
    sig = request.headers.get("X-Webhook-Signature", "")

    if not SimplyMsg.verify_webhook(raw, sig, SECRET):
        abort(401)

    event = request.json
    print(event["event"], event["data"])
    return jsonify(ok=True)

Event types

  • message.sent — accepted by WhatsApp's servers
  • message.delivered — landed on recipient device
  • message.read — recipient opened it
  • message.failed — permanent failure
  • session.connected / session.disconnected / session.qr_ready / session.logged_out
  • batch.started / batch.progress / batch.completed / batch.failed

Error handling

from simplymsg import (
    SimplyMsg,
    AuthenticationError,
    RateLimitError,
    NetworkError,
)

try:
    client.messages.send(...)
except AuthenticationError:
    print("Bad API key")
except RateLimitError as e:
    print(f"Rate limited; retry after {e.retry_after}s")
except NetworkError:
    print("Connection failed")

Configuration

client = SimplyMsg(
    api_key="wsk_...",
    base_url="https://simplymsg.com",   # default
    timeout=30.0,                        # default: 30s
    user_agent="my-app/1.0.0",          # optional
)

Requirements

  • Python ≥ 3.9
  • httpx ≥ 0.25

License

MIT

Metadata

Release files for simplymsg 0.1.0

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

Source distribution (sdist)

Source distribution for simplymsg 0.1.0
File Size Uploaded Provenance Actions
simplymsg-0.1.0.tar.gz 10.3 kB Without provenance Details for simplymsg-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for simplymsg 0.1.0
File Interpreter ABI Platform Actions
simplymsg-0.1.0-py3-none-any.whl Python 3 none any Details for simplymsg-0.1.0-py3-none-any.whl

Total release size: 20.3 kB

Release files / simplymsg-0.1.0.tar.gz

Download URL simplymsg-0.1.0.tar.gz
Size 10.3 kB
Tags Source
SHA-256 checksum
How to use checksums
346069fdb52c256913005128d18184df429b907d83b6e66186edfebcfe798daf
BLAKE2b-256 checksum
How to use checksums
975af4704d7e1e9743902f7dfa163fd82bef24b449ff5c654ec5681d963d07f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / simplymsg-0.1.0-py3-none-any.whl

Download URL simplymsg-0.1.0-py3-none-any.whl
Size 10.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
15864b3723317daf16915a32e53fcda6a77f1da6971ffda4ded91ae83dabcbaf
BLAKE2b-256 checksum
How to use checksums
bf6bf6843ec7b7b53c14a6a6ab57b93cfddb860398d6d25f3860564f4b333ece
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Security for simplymsg 0.1.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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