Skip to content

Latest commit

 

History

31 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📡 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

Stargazers over time

🧑‍💻 Author

Developed by Ali Sharify

About

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

Topics

Resources

Stars

14 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages