Skip to content

A Python SDK for the Devotel DevHub APIs, supporting SMS, Email, WhatsApp, RCS, and Contact management.

Devotel/devhub-python

Repository files navigation

DevHub Python SDK

PyPI version Python Support Documentation License: MIT

A Python SDK for the DevHub API, supporting SMS, Email, WhatsApp, RCS, and Contact management.

Features

  • 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 requests and pydantic
  • Python 3.8+ support: Compatible with modern Python versions

Installation

pip install devhub-python

Quick Start

from 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}")

Authentication

The SDK uses API key authentication:

from devhub_python import DevoClient

client = DevoClient(api_key="your-api-key")

Configuration

Client Configuration

client = DevoClient(
    api_key="your-api-key",
    timeout=30.0,  # Optional: request timeout
)

Custom Session

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
)

Models

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}")

Development

Setting up the development environment

# 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

Running tests

# Run all tests
pytest

# Run with coverage
pytest --cov=src/devhub_python

# Run specific test file
pytest tests/test_sms.py

Code formatting

# Format code with black
black src/ tests/

# Sort imports with isort
isort src/ tests/

# Run type checking with mypy
mypy src/

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Run tests and linting
  5. Commit your changes (git commit -m 'Add amazing feature')
  6. Push to the branch (git push origin feature/amazing-feature)
  7. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

Changelog

See CHANGELOG.md for details about changes in each version.

About

A Python SDK for the Devotel DevHub APIs, supporting SMS, Email, WhatsApp, RCS, and Contact management.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages