Template
Extract always-on public/portal/UTM plus optional email_sms, directmail, blog, payments, social, and social_ai so new client sites can be bootstrapped from this seed. Refs #1 Refs #2 Co-authored-by: Cursor <cursoragent@cursor.com>
25 lines
759 B
Python
25 lines
759 B
Python
"""Channel dispatch — email / SMS."""
|
|
|
|
from dataclasses import dataclass
|
|
|
|
from contacts.models import Channel
|
|
from email_sms.models import Message
|
|
from email_sms.providers.email.smtp2go import send_email
|
|
from email_sms.providers.sms.smtp2go import send_sms
|
|
|
|
|
|
@dataclass
|
|
class ProviderResult:
|
|
provider: str
|
|
provider_id: str
|
|
|
|
|
|
def dispatch_message(message: Message) -> ProviderResult:
|
|
if message.channel == Channel.EMAIL:
|
|
result = send_email(message)
|
|
return ProviderResult(provider="smtp2go_email", provider_id=result)
|
|
if message.channel == Channel.SMS:
|
|
result = send_sms(message)
|
|
return ProviderResult(provider="smtp2go_sms", provider_id=result)
|
|
raise ValueError(f"Unsupported channel: {message.channel}")
|