This directory contains comprehensive examples for using the Devo Global Communications SDK. Each resource has its own dedicated example file with detailed demonstrations of the available functionality.
basic_usage.py- Interactive overview and launcher for all examples
-
sms_example.py- ✅ Complete SMS API implementation- Send SMS messages via quick-send API
- Get available senders
- Search and purchase phone numbers
- Legacy compatibility methods
-
email_example.py- 🚧 Placeholder (Email functionality) -
whatsapp_example.py- 🚧 Placeholder (WhatsApp functionality) -
rcs_example.py- 🚧 Placeholder (RCS functionality)
contacts_example.py- 🚧 Placeholder (Contact management)
- API Key: Get your API key from the Devo dashboard
- Environment: Set the
DEVO_API_KEYenvironment variable# Windows (PowerShell) $env:DEVO_API_KEY = "your_api_key_here" # Windows (Command Prompt) set DEVO_API_KEY=your_api_key_here # Unix/Linux/macOS export DEVO_API_KEY=your_api_key_here
python examples/basic_usage.pyThis provides an interactive menu to choose and run specific examples.
# SMS functionality (fully implemented)
python examples/sms_example.py
# Other resources (placeholder examples)
python examples/email_example.py
python examples/whatsapp_example.py
python examples/contacts_example.py
python examples/rcs_example.pyThe SMS resource is fully implemented with all four API endpoints:
-
Send SMS -
client.sms.send_sms()- Uses POST
/user-api/sms/quick-send - High-quality routing validation
- Comprehensive response data
- Uses POST
-
Get Senders -
client.sms.get_senders()- Uses GET
/user-api/me/senders - Lists all available sender numbers/IDs
- Uses GET
-
Search Numbers -
client.sms.get_available_numbers()- Uses GET
/user-api/numbers - Filter by region, type, and limit results
- Uses GET
-
Purchase Numbers -
client.sms.buy_number()- Uses POST
/user-api/numbers/buy - Complete number purchasing workflow
- Uses POST
The SMS resource maintains backward compatibility with legacy methods while using the new API implementation underneath.
The following examples show the structure and planned functionality but are not yet implemented:
- Email: Send emails, attachments, templates
- WhatsApp: Text messages, media, templates, business features
- RCS: Rich messaging, cards, carousels, capability checks
- Contacts: CRUD operations, contact management
- Replace placeholder phone numbers (
+1234567890) with actual numbers - Ensure phone numbers are in E.164 format (e.g.,
+1234567890) - Use valid sender numbers from your Devo dashboard
- Some examples include test mode flags
- Number purchase examples are commented out to prevent accidental charges
- Always test with small limits when exploring available numbers
All examples include comprehensive error handling with:
- Detailed error messages
- HTTP status codes
- API-specific error codes
- Response data debugging
All examples use API key authentication:
from devo_global_comms_python import DevoClient
client = DevoClient(api_key="your_api_key_here")📱 SMS QUICK-SEND API EXAMPLE
------------------------------
📤 Sending SMS to +1234567890...
✅ SMS sent successfully!
📋 Message ID: msg_123456789
📊 Status: sent
📱 Recipient: +1234567890
🔄 Direction: outbound
👥 GET AVAILABLE SENDERS EXAMPLE
------------------------------
✅ Found 3 available senders:
1. 📞 Phone: +0987654321
🏷️ Type: longcode
🧪 Test Mode: No
When implementing new resources:
- Create Resource Example: Copy the structure from
sms_example.py - Update Basic Usage: Add the new resource to
basic_usage.py - Update This README: Document the new functionality
- Follow Patterns: Use consistent emoji, formatting, and error handling
- SDK Documentation: [Link to main documentation]
- API Reference: [Link to API docs]
- Devo Dashboard: [Link to dashboard]
- Support: [Link to support]
Need help? Check the individual example files for detailed comments and error handling patterns.