Deploy AIOS web (React glide grid + FastAPI slice)
Browse files- RELEASES.json +1 -1
- VERSION +1 -1
- api/telnyx_whatsapp.py +4 -0
- api/whatsapp_door.py +10 -2
- web/public/AIOS_DEPLOY_RECEIPT +1 -1
RELEASES.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
{
|
| 2 |
-
"current": "
|
| 3 |
"releases": []
|
| 4 |
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"current": "305493b0",
|
| 3 |
"releases": []
|
| 4 |
}
|
VERSION
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 1 |
+
305493b0
|
api/telnyx_whatsapp.py
CHANGED
|
@@ -107,6 +107,10 @@ def _send(to, message, *, purpose, tenant, username, transport, store_):
|
|
| 107 |
"name": message["template"], "language": {"code": "en_US"},
|
| 108 |
"components": [{"type": "body", "parameters": [
|
| 109 |
{"type": "text", "text": p} for p in message["params"]]}]}}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
else:
|
| 111 |
whatsapp_message = {"type": "text", "text": {"body": message["text"]}}
|
| 112 |
payload = {"from": sender, "to": to, "whatsapp_message": whatsapp_message}
|
|
|
|
| 107 |
"name": message["template"], "language": {"code": "en_US"},
|
| 108 |
"components": [{"type": "body", "parameters": [
|
| 109 |
{"type": "text", "text": p} for p in message["params"]]}]}}
|
| 110 |
+
if purpose == "auth_code" and message["template"] == auth_template():
|
| 111 |
+
whatsapp_message["template"]["components"].append({
|
| 112 |
+
"type": "button", "sub_type": "url", "index": 0,
|
| 113 |
+
"parameters": [{"type": "text", "text": message["params"][0]}]})
|
| 114 |
else:
|
| 115 |
whatsapp_message = {"type": "text", "text": {"body": message["text"]}}
|
| 116 |
payload = {"from": sender, "to": to, "whatsapp_message": whatsapp_message}
|
api/whatsapp_door.py
CHANGED
|
@@ -151,8 +151,16 @@ def accept(raw: bytes, signature: str, timestamp: str, *, now=None):
|
|
| 151 |
payload = data["payload"]
|
| 152 |
message_id = payload["id"]
|
| 153 |
phone = whatsapp_identity.normalize_phone(payload["from"]["phone_number"])
|
| 154 |
-
|
| 155 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 156 |
raise ValueError("Invalid message fields")
|
| 157 |
except (ValueError, TypeError, KeyError) as exc:
|
| 158 |
raise ValueError("The WhatsApp webhook payload is invalid.") from exc
|
|
|
|
| 151 |
payload = data["payload"]
|
| 152 |
message_id = payload["id"]
|
| 153 |
phone = whatsapp_identity.normalize_phone(payload["from"]["phone_number"])
|
| 154 |
+
if not isinstance(message_id, str) or not message_id.strip():
|
| 155 |
+
raise ValueError("Invalid message fields")
|
| 156 |
+
body = payload.get("body", "")
|
| 157 |
+
# Edits and media can carry decoy text; ignore them before claiming receipt/window.
|
| 158 |
+
if isinstance(body, dict) and body.get("type") != "text":
|
| 159 |
+
return None
|
| 160 |
+
text = payload.get("text", body)
|
| 161 |
+
if isinstance(body, dict) and not isinstance(text, str):
|
| 162 |
+
text = body["text"]["body"]
|
| 163 |
+
if not isinstance(text, str):
|
| 164 |
raise ValueError("Invalid message fields")
|
| 165 |
except (ValueError, TypeError, KeyError) as exc:
|
| 166 |
raise ValueError("The WhatsApp webhook payload is invalid.") from exc
|
web/public/AIOS_DEPLOY_RECEIPT
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 1 |
+
e3a0975a29152a470fa71f77964586c6ff4e4c64574582260ed33d39319cef89
|