Send an SMS with Thinwrap (Python)
Send an SMS via the Thinwrap Sms facade in Python — one call shape for Twilio, Vonage, MessageBird and every other provider.
1. Install
pip install thinwrap-notifications2. Send the call
import os
from thinwrap.notifications import Sms, SmsSendInput, TwilioConfig, ConnectorError
s = Sms(TwilioConfig(
account_sid=os.environ["TWILIO_ACCOUNT_SID"],
auth_token=os.environ["TWILIO_AUTH_TOKEN"],
from_="+15551112222",
))
try:
res = s.send(SmsSendInput(to="+15552223333", body="Hello from Thinwrap"))
print(res.status.value, res.provider_message_id)
except ConnectorError as err:
print(f"{err.provider_code.value}: {err.provider_message}")
Same code works for all supported providers — just change the provider ID.