Skip to main content

Esteria API Client

A Rust-based client library for sending SMS messages via the Esteria API (https://esteria.eu). This project provides:

  • A core Rust library for programmatic SMS sending.
  • A command-line interface (CLI) for quick SMS dispatch.
  • Python bindings for easy integration into Python applications.

The client supports advanced features like scheduled sending, delivery reports, flash SMS, test mode, and custom encodings.

Features

  • Authentication: Secure API key-based access.
  • SMS Options:
    • Scheduled delivery.
    • Delivery report (DLR) callbacks.
    • Expiration timeouts.
    • Flags for debug, no-log, flash, test, no-blacklist, and character conversion.
  • Encodings: Default, 8-bit, or UDH (User Data Header).
  • Error Handling: Detailed error codes and messages from the API.
  • Cross-Platform: Works on Linux, macOS, and Windows.
  • Python Integration: Seamless Python API via PyO3 bindings.
  • CLI Tool: Simple command-line usage with environment variable support.

Installation

For Python Users (via PyPI)

Install the Python package directly:

pip install esteria-api-client

This installs the Python bindings, which include the underlying Rust library.

For Rust Users (via crates.io)

Add the library to your Cargo.toml:

[dependencies]
esteria-api-client = "0.1.0"  # Replace with the latest version

To install the CLI globally:

cargo install esteria-api-client --features cli

Note: The cli feature enables the command-line tool, and python enables Python bindings (used for building wheels).

Building from Source

Clone the repository:

git clone https://github.com/yourusername/esteria-api-client.git
cd esteria-api-client

Build the Rust library and CLI:

cargo build --features cli

For Python bindings, ensure you have maturin installed (for building wheels):

pip install maturin
maturin develop  # Builds and installs locally for development

To build a PyPI wheel:

maturin build --release

Usage

Environment Variables

The client supports these env vars for convenience:

  • ESTERIA_API_BASE_URL: API endpoint (default: https://api.esteria.eu).
  • ESTERIA_API_KEY: Your API key.

CLI Usage

The CLI tool (esteria-api-client) allows sending SMS from the terminal.

Basic example:

esteria-api-client \
  --api-url https://api.esteria.eu \
  --api-key YOUR_API_KEY \
  --sender "MySender" \
  --number "+1234567890" \
  --text "Hello, world!"

Full options:

esteria-api-client --help

Output:

Send SMS via Esteria API

Usage: esteria-api-client [OPTIONS] --api-url <API_URL> --api-key <API_KEY> --sender <SENDER> --number <NUMBER> --text <TEXT>

Options:
  -u, --api-url <API_URL>      API base URL (e.g., https://api.esteria.eu)
  -k, --api-key <API_KEY>      API key for authentication
  -s, --sender <SENDER>        Sender name or number
  -n, --number <NUMBER>        Recipient phone number (with or without +)
  -t, --text <TEXT>            Message text to send
      --time <TIME>            Schedule time (RFC3339 format, e.g., 2024-12-31T23:59:59Z)
      --dlr-url <DLR_URL>      Delivery report URL
      --expired <EXPIRED>      Expiration time in minutes
      --user-key <USER_KEY>    User key for tracking
      --debug                  Enable debug mode
      --nolog                  Disable logging
      --flash                  Send as flash SMS
      --test                   Test mode (don't actually send)
      --nobl                   No blacklist check
      --convert                Convert characters
      --encoding <ENCODING>    Encoding: default, 8bit, or udh [default: 8bit]
  -h, --help                   Print help
  -V, --version                Print version

On success, it prints the message ID (e.g., Message ID: 12345).

Python Usage

Import and use the SmsClient class:

import asyncio
from esteria_api_client import SmsClient, SmsFlags, PyEncoding

async def main():
    client = SmsClient("https://api.esteria.eu")

    # Basic send
    result = await client.send_sms(
        api_key="YOUR_API_KEY",
        sender="MySender",
        number="+1234567890",
        text="Hello from Python!"
    )
    print(result)  # Message ID on success

    # With options
    flags = SmsFlags.debug() | SmsFlags.flash()
    result = await client.send_sms(
        api_key="YOUR_API_KEY",
        sender="MySender",
        number="+1234567890",
        text="Scheduled flash SMS",
        time=1735689599,  # Unix timestamp
        dlr_url="https://your-callback-url.com",
        expired=60,  # Expires in 60 minutes
        flag_debug=True,
        flag_flash=True,
        user_key="my-tracking-key",
        use_8bit=False,  # Use default encoding
        udh=True  # UDH encoding
    )
    print(result)

# Run the async function
asyncio.run(main())
  • SmsFlags: Bitflags for options (e.g., SmsFlags.debug(), SmsFlags.flash()). Combine with |.
  • PyEncoding: Constants like PyEncoding.DEFAULT, PyEncoding.EIGHT_BIT, PyEncoding.UDH.
  • Errors: Raises RuntimeError on failure with details.

Note: The time parameter is a Unix timestamp (seconds since epoch).

Rust Usage (Library)

Use the SmsClient and SmsRequest structs:

use esteria_api_client::{SmsClient, SmsRequest, SmsFlags, Encoding};
use chrono::Utc;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = SmsClient::new("https://api.esteria.eu".to_string());

    let request = SmsRequest::new(
        "YOUR_API_KEY",
        "MySender",
        "+1234567890",
        "Hello from Rust!"
    )
    .with_flags(SmsFlags::DEBUG | SmsFlags::FLASH)
    .with_encoding(Encoding::Udh)
    .with_time(Utc::now())  // Schedule for now (or future)
    .with_dlr_url("https://your-callback-url.com")
    .with_expired(60)
    .with_user_key("my-tracking-key");

    match client.send_sms(request).await {
        Ok(code) => println!("Message ID: {}", code),
        Err(e) => eprintln!("Error: {}", e),
    }

    Ok(())
}
  • SmsFlags: Bitflags (e.g., SmsFlags::DEBUG).
  • Encoding: Enum for Default, EightBit, Udh.
  • Errors: SmsError variants for handling.

API Error Codes

If sending fails, the client returns detailed errors based on Esteria's response codes:

  • 1: System internal error
  • 2: Missing parameter
  • 3: Unable to authenticate
  • ... (see full list in esteria.rs)

Developer Notes

  • Features: Enable cli for the command-line tool or python for bindings via Cargo.
  • Dependencies: Uses reqwest for HTTP, chrono for dates, clap for CLI, pyo3 for Python, and bitflags for flags.
  • Logging: Uses env_logger (init in CLI).
  • Testing: Run cargo test. Use --flag-test for API test mode.
  • Contributing: Pull requests welcome! Focus on bug fixes, features, or docs.
  • License: GPLv3.

For issues or suggestions, open a GitHub issue.


This project is not affiliated with Esteria.eu. Ensure you have an active Esteria account and API key.

Metadata

Release files for esteria-api-client 0.0.23

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

Source distribution (sdist)

Source distribution for esteria-api-client 0.0.23
File Size Uploaded Provenance
esteria_api_client-0.0.23.tar.gz 9.0 MB Without provenance Details

Built distributions (wheels)

Table of built distributions (wheels) for esteria-api-client 0.0.23
File
esteria_api_client-0.0.23-cp314-cp314-manylinux_2_38_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.38+ x86-64 Details
esteria_api_client-0.0.23-cp314-cp314-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 macOS 11.0+ ARM64 Details
esteria_api_client-0.0.23-cp313-cp313-manylinux_2_38_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.38+ x86-64 Details
esteria_api_client-0.0.23-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details

Total release size: 18.0 MB

Release files / esteria_api_client-0.0.23.tar.gz

Download URL esteria_api_client-0.0.23.tar.gz
Size 9.0 MB
Tags Source
SHA-256 checksum
How to use checksums
d36816fea0763c3836101f0b2db3dbdd98f0494bcc5588666329e8b55726d3bb
BLAKE2b-256 checksum
How to use checksums
9e5fe317ca280f27169be01ce425275db6d03a16e7d4f119d09f54d3856a0a8f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / esteria_api_client-0.0.23-cp314-cp314-manylinux_2_38_x86_64.whl

Download URL esteria_api_client-0.0.23-cp314-cp314-manylinux_2_38_x86_64.whl
Size 2.4 MB
Tags CPython 3.14 Linux glibc 2.38+ x86-64
SHA-256 checksum
How to use checksums
b71d572585158c61cd48f9f973a8c46a51f4c77001f18288955f634235c831e8
BLAKE2b-256 checksum
How to use checksums
ff687d71094226018f0a0a2c0ce117fc28785d9af60df3fb8138c7a85960b840
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / esteria_api_client-0.0.23-cp314-cp314-macosx_11_0_arm64.whl

Download URL esteria_api_client-0.0.23-cp314-cp314-macosx_11_0_arm64.whl
Size 2.1 MB
Tags CPython 3.14 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
06bbf5f1e614c5c18134ae669cb714f3aae7cff7ab553ba3bef2f0c636eb959c
BLAKE2b-256 checksum
How to use checksums
c2c4aac0f78a9c62ba5fb0e91378b10a936523413d21cba39f15ebf56fe5b165
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / esteria_api_client-0.0.23-cp313-cp313-manylinux_2_38_x86_64.whl

Download URL esteria_api_client-0.0.23-cp313-cp313-manylinux_2_38_x86_64.whl
Size 2.4 MB
Tags CPython 3.13 Linux glibc 2.38+ x86-64
SHA-256 checksum
How to use checksums
b66e53bf7ee6e914026c05a0fc83ce430aa07cafd7cbdd6a0db03141ec19116a
BLAKE2b-256 checksum
How to use checksums
4e9dc22ab400bacfb26634c6d01d1cd416298319cfd6238ed4cf9d69053f906a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / esteria_api_client-0.0.23-cp313-cp313-macosx_11_0_arm64.whl

Download URL esteria_api_client-0.0.23-cp313-cp313-macosx_11_0_arm64.whl
Size 2.1 MB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
8c2971f24d2da7a049faf34de296391abbb9d92d89c153dd2cbb55ae520faa19
BLAKE2b-256 checksum
How to use checksums
dbc9492b59eddd39d4d47f517b8a49ceb26e662216f68aff1a5092a841076630
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Security for esteria-api-client 0.0.23

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.

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