SMS.py Tutorials

Step-by-step guides to mastering SMS handling

Getting Started

Installation


pip install sms-py

First SMS Message


from sms import SMSClient

client = SMSClient(
  account_sid="AC123456789",
  auth_token="your_token",
  twilio_number="+15551234567"
)

client.send("+15559992222", "Hello from SMS!")

Replace credentials with your actual account details

Advanced Topics

Message Scheduling

Learn to schedule messages for future delivery using the `schedule` parameter.


client.send("+15559992222", "Good morning!", scheduled_time="2025-08-05T09:00:00Z")

Error Handling

Dive into handling common errors and ensuring message delivery reliability.


try:
  response = client.send("+15559992222", "Test message")
  print("Message ID:", response.sid)
except Exception as e:
  print("Error code:", e.http_status)
  print("Error message:", e.message)

Multiple Recipients

Batch send messages to multiple recipients with bulk messaging.


client.bulk_send(
  [
    {"number": "+15559992222", "message": "Hello A!"},
    {"number": "+15559993333", "message": "Hello B!"}
  ]
)

Status Callbacks

Set up webhook callbacks to track message status updates.


client.set_status_callback("https://yourdomain.com/status-callback")

Interactive Tutorial

Try the Code!