Skip to main content

magfa-client is a python client library for interacting with magfa SMS webservice v2.

Project description

📡 MagfaSMS Python Client

A simple and clean Python client for interacting with the Magfa SMS HTTP API v2.
This library allows you to send SMS messages, check message statuses, retrieve inbound messages, and monitor your account balance.

Donate/Support [Optional]

GitHub repo size GitHub contributors GitHub repo Licence

Latest versionSupported python versions Downloads Downloads

🚀 Features

  • ✅ Send SMS messages to multiple recipients
  • 🔄 Track the delivery status of sent messages
  • 📥 Fetch inbound (received) messages
  • 💰 Check your Magfa account balance
  • 🧾 Error code mapping for human-readable error handling
  • 🔒 Built-in authentication with domain-based credentials

📦 Installation

pip install magfa

🛠️ Usage

🔐 Initialization

from magfa_sms import MagfaSMS

client = MagfaSMS(
    username="your_username",
    password="your_password",
    domain="your_domain",
    sender="your_sender_number"
)

✉️ Send an SMS

response = client.send(
    recipients=["09123456789"],
    messages=["Hello from Magfa!"]
)
print(response.json())

📊 Check Balance

balance_response = client.balance()
print(balance_response.json())

📩 Get Inbound Messages

inbound = client.messages(count=50)
print(inbound.json())

📡 Get Message Status

status = client.statuses(mid="123456789")
print(status.json())

🧠 Error Code Mapping

error_text = MagfaSMS.get_error_message(18)
print(error_text)  # Output: Invalid username or password.

🚧 Configuration

config name description type status
MAGFA_DEBUG log all requests/responses in stdout environment variable Optional

for enabling DEBUG mode you can directly pass debug option for magfa class or set an environment variable called MAGFA_DEBUG with string value ("True", "False")

from magfa import Magfa

magfa_client = Magfa(..., debug=False)

📚 Resources

Official API Docs

Error Codes Documentation

Star History

Star History Chart

🧑‍💻 Author

Developed by Ali Sharify

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

magfa-1.0.0.tar.gz (21.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

magfa-1.0.0-py3-none-any.whl (22.0 kB view details)

Uploaded Python 3

File details

Details for the file magfa-1.0.0.tar.gz.

File metadata

  • Download URL: magfa-1.0.0.tar.gz
  • Upload date:
  • Size: 21.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for magfa-1.0.0.tar.gz
Algorithm Hash digest
SHA256 17f6c7d30a27065b29817e42086b2c8929618a556d2485a2b8da4779d792c01a
MD5 b549c1fbabb95099ac7b7c899c032287
BLAKE2b-256 5f090190d91f1ccdd2f14ebc163195be0e09f5f8762022a096264f6cbeda8c6e

See more details on using hashes here.

File details

Details for the file magfa-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: magfa-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 22.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for magfa-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8bb09cc2035dc3d22bff677028570c2d09668778d5a5338186fdb937113f16d8
MD5 fa2469b3521ff50b66d3168532dfa640
BLAKE2b-256 f03dba242fe61bd6d8a2c70e7952903769413e9da85e44d7a1d3338ee7235a3d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page