Skip to content

Python

Install

Terminal window
pip install sendbyte

Python 3.8+, no dependencies, fully type-hinted (py.typed).

Use

from sendbyte import SendByte, SendByteError
sendbyte = SendByte(os.environ["SENDBYTE_API_KEY"])
try:
email = sendbyte.emails.send(
from_="PayLink <receipts@paylink.ng>",
to="amaka@halo.ng",
subject="Receipt for ₦45,000",
html="<p>Payment received. Thank you, Amaka.</p>",
idempotency_key="order-4421-receipt",
)
except SendByteError as err:
print(err.code, err, err.docs_url)

Note the trailing underscore in from_ (Python keyword).

Async

from sendbyte import AsyncSendByte
client = AsyncSendByte(os.environ["SENDBYTE_API_KEY"])
email = await client.send_email(from_="...", to="...", subject="...", html="...")

Surface

  • emails.send / get / list, domains.create / list / get / verify, webhooks.create / list / disable / replay
  • verify_webhook_signature(secret, header, body) for inbound webhooks
  • AsyncSendByte mirrors the surface with awaitable methods