A Python SDK for the DevHub API, supporting SMS, Email, WhatsApp, RCS, and Contact management.
- Multi-channel communication: SMS, Email, WhatsApp, RCS
- Contact management: Create, update, and manage contacts
- Unified messaging: View and manage messages across all channels
- Sync-first design: Simple, blocking API calls
- Type safety: Full Pydantic model support with type hints
- Minimal dependencies: Only requires
requestsandpydantic - Python 3.8+ support: Compatible with modern Python versions
pip install devhub-pythonfrom devhub_python import DevoClient
# Initialize the client
client = DevoClient(api_key="your-api-key")
# Send an SMS
sms_response = client.sms.send_sms(
recipient="+1234567890",
message="Hello, World!",
sender="+1987654321"
)
print(f"SMS sent with ID: {sms_response.id}")
# Send an email
email_response = client.email.send_email(
recipient="recipient@example.com",
subject="Hello from Devo!",
content="This is a test email from the Devo SDK.",
sender_email="sender@example.com"
)
print(f"Email sent with ID: {email_response.id}")
# Send a WhatsApp message
whatsapp_response = client.whatsapp.send_text_message(
recipient="+1234567890",
message="Hello via WhatsApp!"
)
print(f"WhatsApp message sent with ID: {whatsapp_response.id}")The SDK uses API key authentication:
from devhub_python import DevoClient
client = DevoClient(api_key="your-api-key")client = DevoClient(
api_key="your-api-key",
timeout=30.0, # Optional: request timeout
)You can provide your own requests.Session for advanced configuration:
import requests
from devhub_python import DevoClient
session = requests.Session()
session.proxies = {"https": "https://proxy.example.com:8080"}
client = DevoClient(
api_key="your-api-key",
session=session
)All API responses are returned as Pydantic models with full type support. The SDK includes models for:
- SMS:
SMSQuickSendResponse,SenderInfo,AvailableNumber - Email:
EmailSendResponse,EmailTemplateResponse - WhatsApp:
WhatsAppTextResponse,WhatsAppMediaResponse - RCS:
RCSMessage,RcsSendMessageSerializer - Contacts:
ContactSerializer,CreateContactDto,UpdateContactDto - Contact Groups:
ContactsGroup,CreateContactsGroupDto
Example usage:
# All responses are typed Pydantic models
sms_response = client.sms.send_sms(recipient="+1234567890", message="Hello", sender="+1987654321")
print(f"Message ID: {sms_response.id}") # Type-safe access
print(f"Status: {sms_response.status}")# Clone the repository
git clone https://github.com/devotel/devhub-python.git
cd devhub-python
# Install development dependencies
pip install -e ".[dev]"
# Install pre-commit hooks
pre-commit install# Run all tests
pytest
# Run with coverage
pytest --cov=src/devhub_python
# Run specific test file
pytest tests/test_sms.py# Format code with black
black src/ tests/
# Sort imports with isort
isort src/ tests/
# Run type checking with mypy
mypy src/- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Run tests and linting
- Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Documentation: https://devotel.github.io/devhub-python/
- Issues: GitHub Issues
- Email: support@devotel.io
See CHANGELOG.md for details about changes in each version.