Unify SMTP2GO email and SMS into one webhook URL.
Classify payloads on /webhooks/smtp2go/ so one SMTP2GO webhook covers both channels under the 10-webhook limit; keep /email/ and /sms/ as aliases and harden SMS event matching.
This commit is contained in:
@@ -37,9 +37,13 @@ def send_sms(message) -> str:
|
||||
)
|
||||
response.raise_for_status()
|
||||
data = response.json() if response.content else {}
|
||||
# SMTP2GO returns varying shapes; store a useful id when present.
|
||||
# Prefer SMS id fields used on webhooks (`message_id` / `sms_id`).
|
||||
nested = data.get("data") if isinstance(data.get("data"), dict) else {}
|
||||
return str(
|
||||
data.get("data", {}).get("sms_id")
|
||||
nested.get("sms_id")
|
||||
or nested.get("message_id")
|
||||
or data.get("sms_id")
|
||||
or data.get("message_id")
|
||||
or data.get("request_id")
|
||||
or f"sms-{message.pk}"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user