Test-Bot / app.py
jonathanjordan21's picture
Update app.py
0d6b0e6 verified
raw
history blame
559 Bytes
from fastapi import FastAPI, Query, HTTPException
app = FastAPI()
VERIFY_TOKEN = "lintasmediadanawa" # Replace with your actual verify token
@app.get("/webhooks")
async def handle_webhook(
hub_mode: str = Query(..., alias="hub.mode"),
hub_challenge: int = Query(..., alias="hub.challenge"),
hub_verify_token: str = Query(..., alias="hub.verify_token")
):
if hub_mode == "subscribe" and hub_verify_token == VERIFY_TOKEN:
return int(hub_challenge)
else:
raise HTTPException(status_code=403, detail="Verification failed")