fsanyoto commited on
Commit
5888a21
·
verified ·
1 Parent(s): 56f0776

Deploy AIOS web (React glide grid + FastAPI slice)

Browse files
RELEASES.json CHANGED
@@ -1,4 +1,4 @@
1
  {
2
- "current": "8786e2f6f",
3
  "releases": []
4
  }
 
1
  {
2
+ "current": "305493b0",
3
  "releases": []
4
  }
VERSION CHANGED
@@ -1 +1 @@
1
- 8786e2f6f
 
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
- text = payload.get("text", payload.get("body", ""))
155
- if not isinstance(message_id, str) or not message_id.strip() or not isinstance(text, str):
 
 
 
 
 
 
 
 
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
- 1be91259a70363e71919686680278647d186f783611c977d7fd57278a395015b
 
1
+ e3a0975a29152a470fa71f77964586c6ff4e4c64574582260ed33d39319cef89