Spaces:
Sleeping
Sleeping
jonathanjordan21
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -22,45 +22,45 @@ async def handle_webhook(
|
|
22 |
|
23 |
|
24 |
|
25 |
-
@app.post("/webhooks")
|
26 |
-
async def handle_event_notifications(
|
27 |
-
|
28 |
-
|
29 |
-
):
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
|
65 |
|
66 |
|
|
|
22 |
|
23 |
|
24 |
|
25 |
+
# @app.post("/webhooks")
|
26 |
+
# async def handle_event_notifications(
|
27 |
+
# request: Request,
|
28 |
+
# x_hub_signature_256: Optional[str] = Header(None) # Header for signature verification
|
29 |
+
# ):
|
30 |
+
# # # Read and verify the request body
|
31 |
+
# # body = await request.body()
|
32 |
+
|
33 |
+
# # # Verify the X-Hub-Signature-256 header
|
34 |
+
# # if not x_hub_signature_256:
|
35 |
+
# # raise HTTPException(status_code=400, detail="Missing X-Hub-Signature-256 header")
|
36 |
|
37 |
+
# # # Compute the expected signature
|
38 |
+
# # expected_signature = (
|
39 |
+
# # "sha256="
|
40 |
+
# # + hmac.new(VERIFY_TOKEN.encode(), body, hashlib.sha256).hexdigest()
|
41 |
+
# # )
|
42 |
+
|
43 |
+
# # if not hmac.compare_digest(expected_signature, x_hub_signature_256):
|
44 |
+
# # raise HTTPException(status_code=403, detail="Signature verification failed")
|
45 |
+
# print("POST SUCCESS!", request)
|
46 |
+
# # Parse the JSON payload
|
47 |
+
# payload = await request.json()
|
48 |
+
# print("POST SUCCESS!", request)
|
49 |
+
# print(payload)
|
50 |
+
# object_type = payload.get("object")
|
51 |
+
# entries = payload.get("entry", [])
|
52 |
+
|
53 |
+
# # Log the received event (or process as needed)
|
54 |
+
# for entry in entries:
|
55 |
+
# changes = entry.get("changes", [])
|
56 |
+
# for change in changes:
|
57 |
+
# field = change.get("field")
|
58 |
+
# value = change.get("value")
|
59 |
+
# # Handle specific fields or values as required
|
60 |
+
# print(f"Received change for field: {field}, value: {value}")
|
61 |
+
|
62 |
+
# # Return a 200 OK response to acknowledge receipt
|
63 |
+
# return {"status": "ok"}
|
64 |
|
65 |
|
66 |
|