Spaces:
Paused
Paused
Update main.py
Browse files
main.py
CHANGED
@@ -32,16 +32,14 @@ app.add_middleware(
|
|
32 |
@app.post("/whatsapp")
|
33 |
async def reply_whatsapp(request: Request):
|
34 |
form_data = await request.form()
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
raise HTTPException(status_code=400, detail="Invalid request: invalid or missing NumMedia parameter")
|
39 |
|
40 |
response = MessagingResponse()
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
return PlainTextResponse(str(response))
|
47 |
|
|
|
32 |
@app.post("/whatsapp")
|
33 |
async def reply_whatsapp(request: Request):
|
34 |
form_data = await request.form()
|
35 |
+
num_media = int(form_data.get("NumMedia", 0))
|
36 |
+
from_number = form_data.get("From")
|
37 |
+
message_body = form_data.get("Body")
|
|
|
38 |
|
39 |
response = MessagingResponse()
|
40 |
+
|
41 |
+
msg = response.message(f"hi your number is {from_number} and you sayed {message_body}")
|
42 |
+
msg.media(GOOD_BOY_URL)
|
43 |
+
|
44 |
+
return str(response)
|
|
|
45 |
|