Integrez notre plateforme aussi simplement que vous installer une dépendance. Conçu pour simple, puissant et batterie-inclus.
Our Python SDK makes it easy to integrate SMS functionality into your Python applications. Follow these steps to get started.
Install the package using pip:
pip install rsendlyHere's a simple example to send an SMS:
from rsendly import Client
# Initialize the client
auth_token = "your-auth-token"
sender_token = "your-sender-token"
client = Client(auth_token=auth_token, sender_token=sender_token)
# Send a single SMS
response = client.send_sms(
to="+1234567890",
message="Hello from RSendly!"
)
# Response format:
# {
# "success": True,
# "messageId": "msg_abc123def456",
# "historyId": "hist_789xyz012"
# }
# Check the response
print(response["success"]) # True
print(response["messageId"]) # "msg_abc123def456"
print(response["historyId"]) # "hist_789xyz012"Send bulk SMS and check delivery status:
# Send bulk SMS to multiple recipients
response = client.send_sms(
to=["+1234567890", "+0987654321", "+2261234567"],
message="Bulk message to all recipients"
)
print(f"Sent {response['successful']} out of {response['total']} messages")
for result in response['results']:
print(f"{result['phone']}: {result['success']}")
# Check SMS delivery status
status = client.get_status("msg_123456")
print(f"Status: {status['status']}") # 'delivered', 'failed', etc.
# Get SMS history with pagination
history = client.get_history(limit=50, offset=0)
print(f"Total messages: {history['pagination']['total']}")
for sms in history['data']:
print(f"{sms['sentAt']}: {sms['to']} - {sms['status']}")Check account balance and validate phone numbers:
# Check account balance
balance = client.get_balance()
print(f"Current balance: {balance['balance']} {balance['currency']}")
print(f"Sender ID: {balance['senderId']}")
print(f"Sender name: {balance['senderName']}")
# Check phone number support
supported_numbers = client.check_number_support([
"+1234567890", # US number
"+22612345678", # Burkina Faso
"+33123456789" # France
])
print("Supported numbers:", supported_numbers['supported'])
print("Unsupported numbers:", supported_numbers['unsupported'])