whatsapp integration

This commit is contained in:
debu-2 2026-10-02 12:51:46 +05:30
parent d077292bbc
commit 141ca9fda3
15 changed files with 578 additions and 1 deletions

View file

@ -0,0 +1,13 @@
import hashlib
import hmac
def verify_meta_signature(app_secret: str, raw_body: bytes, signature_header: str | None) -> bool:
"""Validate X-Hub-Signature-256 from Meta webhook POSTs."""
if not app_secret or not signature_header:
return False
if not signature_header.startswith("sha256="):
return False
expected = signature_header.removeprefix("sha256=")
computed = hmac.new(app_secret.encode("utf-8"), raw_body, hashlib.sha256).hexdigest()
return hmac.compare_digest(computed, expected)