File size: 513 Bytes
7b7ca24 73b4d62 7b7ca24 73b4d62 7b7ca24 73b4d62 7b7ca24 73b4d62 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
from fastapi import FastAPI, Request
import uvicorn
# Initialize FastAPI app
app = FastAPI()
# FastAPI route to handle WhatsApp webhook
@app.post("/whatsapp-webhook")
async def whatsapp_webhook(request: Request):
data = await request.json() # Parse incoming JSON data
print(f"Received data: {data}") # Log incoming data for debugging
return {"status": "success", "received_data": data}
# Run the FastAPI app with Uvicorn
if __name__ == "__main__":
uvicorn.run(app, host="0.0.0.0", port=7860)
|