Skip to main content

Texto SMS — Python SDK

Official Python SDK for the Texto SMS API. Send SMS to Australian and New Zealand numbers, read replies, and manage sub-accounts, numbers, credits, API keys, webhooks and reporting.

Install

pip install texto-sdk

Requires Python 3.8 or newer.

Quick start

import os
from texto import Texto

texto = Texto(api_key=os.environ["TEXTO_API_KEY"])

result = texto.send(to="+61400000000", message="Your booking is confirmed for 2pm.")
print(result["message_id"], result["credits_used"])

Configuration

texto = Texto(
    api_key="txt_...",
    timeout=30.0,      # seconds
    max_retries=2,     # retries for idempotent requests
)

base_url can be overridden, but only to point tests at a mock server or a corporate proxy. The production API is always https://api.texto.com.au.

Sending

texto.send(
    to="0400000000",
    message="Hi Sam, your order has shipped.",
    sender="TEXTO",        # optional dedicated number or approved Sender ID
    link_tracking=True,     # optional per-message override
    campaign="Shipping",    # optional campaign name
)

texto.send_batch(
    message="Hi {name}, your appointment is {time}.",
    recipients=[
        {"phone": "0400000001", "merge_data": {"name": "Sam", "time": "2pm"}},
        {"phone": "0400000002", "merge_data": {"name": "Alex", "time": "3pm"}},
    ],
)

payload = texto.get_message(result["message_id"])
print(payload["delivery_receipt"])

Replies and opt-outs

inbox = texto.inbox(limit=50)
optouts = texto.optouts()

Credits, accounts and numbers

texto.balance()
texto.list_accounts()
sub = texto.create_account(business_name="Acme Pty Ltd", email="ops@acme.com.au")
texto.allocate_credits(sub["account_id"], 500)
texto.available_numbers(country="AU")
texto.purchase_number(label="Support line")

Account, team and group endpoints require account hierarchy to be enabled on your Texto account.

Reporting

texto.report(from_="2026-01-01", to="2026-01-31", direction="outbound")
texto.group_report(from_="2026-01-01")

Webhooks

from flask import Flask, request
from texto import parse_webhook_event, is_inbound_event

app = Flask(__name__)

@app.post("/texto-webhook")
def texto_webhook():
    event = parse_webhook_event(
        request.get_data(),                      # raw body, not re-serialised
        request.headers.get("X-Texto-Signature"),
        os.environ["TEXTO_WEBHOOK_SECRET"],
    )
    if is_inbound_event(event):
        print("Reply from", event["from"], event["body"])
    else:
        print("Delivery status", event["delivery_receipt"])
    return "", 200

Errors

from texto import TextoInsufficientCreditsError, TextoRateLimitError

try:
    texto.send(to="0400000000", message="Hi")
except TextoInsufficientCreditsError as err:
    print("Top up:", err.credits_required)
except TextoRateLimitError as err:
    print("Retry after", err.retry_after)

Every API error subclasses TextoApiError with status, code and body. Network failures and timeouts raise TextoConnectionError.

Support

License

MIT © Floop Pty Ltd trading as Texto

Metadata

Release files for texto-sdk 1.0.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 texto-sdk 1.0.0
File Size Uploaded
texto_sdk-1.0.0.tar.gz 9.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for texto-sdk 1.0.0
File Interpreter ABI Platform
texto_sdk-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 18.9 kB

Release files / texto_sdk-1.0.0.tar.gz

Download URL texto_sdk-1.0.0.tar.gz
Size 9.3 kB
Tags Source
SHA-256 checksum
How to use checksums
801f2559be477580350652c2170375476ed0441cd0ae572994c4eabd03ab307f
BLAKE2b-256 checksum
How to use checksums
a8e0e881b9eb09e744310e855de1d7b3b85948770f0b91c7177bc82bb767ac46
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 Sep 19, 2026.

Transparency log

Release files / texto_sdk-1.0.0-py3-none-any.whl

Download URL texto_sdk-1.0.0-py3-none-any.whl
Size 9.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4f34e414101f119d22fe8d5d50b88f69d8a90ef897140c81e1f54b5d2efb3766
BLAKE2b-256 checksum
How to use checksums
209f2a39a12dbebe58ef01338391887ba9360bea508d33b5c0a78cfac4ac15f5
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 Sep 19, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.0 This release

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