iMessage Python SDK
Send and receive iMessages from Python with Blooio's official iMessage Python SDK. Ships with both a sync client (for scripts, Celery tasks, Jupyter notebooks) and an async client (for FastAPI and asyncio applications), pydantic-typed payloads, and first-class webhook helpers for Flask and FastAPI.
Install
One command to add the iMessage Python SDK to your project.
pip install blooio
# or with uv
uv pip install blooio
Send your first iMessage
This is the smallest working example — authenticate with your Blooio API key, then call the send-message method on the client.
from blooio import Blooio
blooio = Blooio(api_key="blooio_live_...")
blooio.chats.send_message(
phone="+15551234567",
body="Hey Alex — thanks for booking a demo. Reply with any questions.",
)
Handle inbound iMessages and webhooks
Every inbound iMessage, delivery, read, and reaction event is POSTed to your webhook URL. Use the SDK's signature verifier to reject forged requests and deserialize the payload into typed objects.
from fastapi import FastAPI, Request, HTTPException
from blooio import verify_webhook, InvalidSignature
app = FastAPI()
@app.post("/webhooks/blooio")
async def blooio_webhook(request: Request):
body = await request.body()
signature = request.headers.get("x-blooio-signature", "")
try:
event = verify_webhook(
body=body,
signature=signature,
secret="whsec_...",
)
except InvalidSignature:
raise HTTPException(status_code=401, detail="bad signature")
if event.type == "message.received":
print("Inbound iMessage:", event.data.body)
return {"ok": True}
What the SDK gives you on top of raw REST
- Sync (requests) and async (httpx) clients that share a typed interface
- pydantic models for every endpoint and webhook payload
- Automatic retries with exponential backoff on 429 and 5xx responses
- Drop-in webhook verifiers for Flask, FastAPI, and Django
- Batched send helpers for bulk campaigns with rate-limit awareness
- Python 3.9+ supported — works in Lambda, Cloud Run, and containers
Python iMessage SDK FAQ
How do I install the Blooio iMessage Python SDK?
Run pip install blooio (or uv pip install blooio). The package is published to PyPI and requires Python 3.9 or newer.
Does the Python iMessage SDK support async?
Yes. Import AsyncBlooio for an httpx-based async client suitable for FastAPI and asyncio applications. The sync Blooio client uses requests and is safe to use in Django views, Celery tasks, and scripts.
How do I verify Blooio webhook signatures in Python?
Import verify_webhook from the blooio package, pass the raw request body, the x-blooio-signature header, and your webhook secret. The function returns a typed Event or raises InvalidSignature.
Does the Python SDK support bulk iMessage sends?
Yes. The blooio.chats.bulk_send helper accepts a list of recipient/message pairs and paces requests to stay within your plan's throughput limit. Failed sends are surfaced as a typed list for retry.
Is the Python SDK open source? Yes, MIT-licensed and public on GitHub at github.com/Blooio/blooio-python-sdk.