Zenaight commited on
Commit
a80303d
·
verified ·
1 Parent(s): 28f2afb

Upload main.py

Browse files
Files changed (1) hide show
  1. main.py +7 -18
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
- # Handle button-reply taps first
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
- send_welcome_buttons(wa_id)
182
- return JSONResponse({"status": "buttons_sent"})
 
 
 
 
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":