π² TwilioHelper
TwilioHelper is a lightweight and reliable Python wrapper around Twilio's WhatsApp API, designed for quick
integration and automated messaging. It provides built-in credential validation and error handling out of the box,
making it ideal for alerting systems, notification bots, and automation workflows.
π§ Features
- β
Credential Validation β Automatically validates Account SID and Auth Token during initialization.
- π€ WhatsApp Messaging β Send WhatsApp messages in just one function call.
- β Robust Error Handling β Handles common Twilio exceptions gracefully with meaningful feedback.
π Installation
Install the Twilio SDK (if not already installed):
pip install twilio
π§ͺ Getting Started
π¦ Usage
from twilio_helper.main import TwilioHelper
helper = TwilioHelper(account_sid="your_account_sid", auth_token="your_auth_token")
response = helper.send_whatsapp_message(
message="Battery is 90%, please unplug.",
from_number="whatsapp:+14400000000",
to_number="whatsapp:+919900000000"
)
print(response)
π‘ Error Handling
TwilioHelper raises clear, descriptive exceptions for:
- β Invalid Twilio credentials β Prevents initialization if credentials are incorrect.
- β Failed message send β Errors from invalid numbers, message content, or connectivity are caught and reported.
π§Ύ License
This project is licensed under the MIT License.
π¨βπ» Author
Built with β€οΈ by Lav
π¬ Contributions & Feedback
Feel free to open issues or PRs to improve functionality, add support for SMS or other Twilio services, or enhance
testing.