jonathanjordan21 commited on
Commit
0d6b0e6
·
verified ·
1 Parent(s): b43091d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -4
app.py CHANGED
@@ -1,7 +1,17 @@
1
- from fastapi import FastAPI
2
 
3
  app = FastAPI()
4
 
5
- @app.get("/")
6
- def greet_json():
7
- return {"Hello": "World!"}
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastapi import FastAPI, Query, HTTPException
2
 
3
  app = FastAPI()
4
 
5
+ VERIFY_TOKEN = "lintasmediadanawa" # Replace with your actual verify token
6
+
7
+
8
+ @app.get("/webhooks")
9
+ async def handle_webhook(
10
+ hub_mode: str = Query(..., alias="hub.mode"),
11
+ hub_challenge: int = Query(..., alias="hub.challenge"),
12
+ hub_verify_token: str = Query(..., alias="hub.verify_token")
13
+ ):
14
+ if hub_mode == "subscribe" and hub_verify_token == VERIFY_TOKEN:
15
+ return int(hub_challenge)
16
+ else:
17
+ raise HTTPException(status_code=403, detail="Verification failed")