Spaces:
Sleeping
Sleeping
Upload main.py
Browse files
main.py
CHANGED
|
@@ -161,25 +161,14 @@ async def receive_update(req: Request):
|
|
| 161 |
return JSONResponse({"status": "duplicate", "id": msg_id})
|
| 162 |
processed_message_ids.add(msg_id)
|
| 163 |
|
| 164 |
-
#
|
| 165 |
-
if msg.get("type") == "interactive" and msg["interactive"]["type"] == "button_reply":
|
| 166 |
-
payload = msg["interactive"]["button_reply"]["id"]
|
| 167 |
-
if payload == "open_gallery":
|
| 168 |
-
send_whatsapp_message(
|
| 169 |
-
wa_id,
|
| 170 |
-
"👍 Great! Tap the 📎 (paper-clip) icon below and choose \"Photo & Video Library\" to select your ID image."
|
| 171 |
-
)
|
| 172 |
-
elif payload == "open_camera":
|
| 173 |
-
send_whatsapp_message(
|
| 174 |
-
wa_id,
|
| 175 |
-
"📸 Okay—tap the 📷 (camera) icon next to the text box to take and send a photo of your ID now."
|
| 176 |
-
)
|
| 177 |
-
return JSONResponse({"status":"handled_button", "payload":payload})
|
| 178 |
-
|
| 179 |
-
# TEXT: prompt with Quick-Reply buttons
|
| 180 |
if msg.get("type") == "text":
|
| 181 |
-
|
| 182 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 183 |
|
| 184 |
# IMAGE: if user sent an image, convert to Base64 preview
|
| 185 |
if msg["type"] == "image":
|
|
|
|
| 161 |
return JSONResponse({"status": "duplicate", "id": msg_id})
|
| 162 |
processed_message_ids.add(msg_id)
|
| 163 |
|
| 164 |
+
# TEXT: send welcome message
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 165 |
if msg.get("type") == "text":
|
| 166 |
+
send_whatsapp_message(
|
| 167 |
+
wa_id,
|
| 168 |
+
"Welcome to RUMAS! 📋\n\n"
|
| 169 |
+
"Please send an image of your South African ID document for processing."
|
| 170 |
+
)
|
| 171 |
+
return JSONResponse({"status": "welcome_sent"})
|
| 172 |
|
| 173 |
# IMAGE: if user sent an image, convert to Base64 preview
|
| 174 |
if msg["type"] == "image":
|