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)