from fastapi import FastAPI, Request from fastapi.middleware.cors import CORSMiddleware import requests app = FastAPI() app.add_middleware( CORSMiddleware, allow_origins=["*"], allow_credentials=True, allow_methods=["*"], allow_headers=["*"], ) @app.post("/") async def webhook(data: dict): print(data) headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + os.getenv('tokenAPI') } response = requests.post(os.getenv('urlAPI'), json=data, headers=headers) print("Response Content:", response.text) @app.get("/") def read_general(): return {"response": "Webhook Started"}