Spaces:
Build error
Build error
Commit ·
77ac737
1
Parent(s): 6980de8
Change webhook
Browse files- app/main.py +3 -11
app/main.py
CHANGED
|
@@ -3,16 +3,8 @@ from fastapi.responses import JSONResponse
|
|
| 3 |
|
| 4 |
app = FastAPI()
|
| 5 |
|
|
|
|
| 6 |
@app.post("/webhook")
|
| 7 |
-
async def
|
| 8 |
data = await request.json()
|
| 9 |
-
|
| 10 |
-
print(f"Received data: {data}")
|
| 11 |
-
|
| 12 |
-
# Prepare a response
|
| 13 |
-
response_data = {
|
| 14 |
-
"message": "Hello! This is an automatic reply.",
|
| 15 |
-
"received": data
|
| 16 |
-
}
|
| 17 |
-
|
| 18 |
-
return JSONResponse(content=response_data)
|
|
|
|
| 3 |
|
| 4 |
app = FastAPI()
|
| 5 |
|
| 6 |
+
# Webhook to handle incoming messages
|
| 7 |
@app.post("/webhook")
|
| 8 |
+
async def whatsapp_webhook(request: Request):
|
| 9 |
data = await request.json()
|
| 10 |
+
print("Webhook received:", data)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|