Skip to content

Latest commit

 

History

History
26 lines (19 loc) · 580 Bytes

File metadata and controls

26 lines (19 loc) · 580 Bytes

Webhooks

Signature Verification

from circle.webhooks import verify_signature

# In your webhook handler
payload = request.body  # raw bytes
signature = request.headers["X-Circle-Signature"]
secret = "your_webhook_secret"

if not verify_signature(payload, signature, secret):
    return Response(status=401)

Parsing Webhook Payloads

from circle.webhooks import parse_webhook

event = parse_webhook(request.json())
print(event.event_type)   # e.g. "post.created"
print(event.community_id)
print(event.data)          # full event payload dict