"""
Twilio — Send SMS Demo
=======================
A minimal, ready-to-run example of sending an SMS with Twilio.

Get credentials (free trial):
    1. Sign up at https://www.twilio.com/try-twilio
    2. On the Console dashboard, copy your Account SID and Auth Token.
    3. Get a phone number under Phone Numbers -> Manage -> Buy a number
       (the trial gives you one free); use it as TWILIO_FROM.

Setup:
    pip install twilio
    export TWILIO_ACCOUNT_SID="AC..."
    export TWILIO_AUTH_TOKEN="..."
    export TWILIO_FROM="+1..."        # your Twilio number

Run:
    python twilio_demo.py
"""

import os
from twilio.rest import Client

client = Client(
    os.environ.get("TWILIO_ACCOUNT_SID"),
    os.environ.get("TWILIO_AUTH_TOKEN"),
)


def send_sms(to: str, body: str) -> str:
    """Send an SMS and return the message SID."""
    message = client.messages.create(
        to=to,
        from_=os.environ.get("TWILIO_FROM"),
        body=body,
    )
    return message.sid


if __name__ == "__main__":
    sid = send_sms("+15558675309", "Hello from krueng.ai 👋")
    print(f"Sent. SID={sid}")
