""" ARCHIVED 2026-03-17 The webhook endpoint (/webhook/novi) was removed — sync is cron-based. If Novi webhook support is added in future, restore the endpoint in api_v3_actions_e_novi_mailman.py and move this file back to tests/e2e/. The webhook secret is stored as novi_webhook_secret in IDAA site cfg_json. Original: Integration test — send a signed Novi webhook payload to the API. """ import os import json import hmac import hashlib import requests BASE_URL = os.environ.get('AE_API_BASE', 'https://dev-api.oneskyit.com') ENDPOINT = f"{BASE_URL}/v3/action/e_novi_mailman/webhook/novi" SECRET = os.environ.get('NOVI_WEBHOOK_SECRET', 'test-secret') payload = { "EventType": "MembershipActivated", "Member": { "Email": "test+webhook@example.com", "FirstName": "Test", "LastName": "Webhook", "MembershipStatus": "Active" } } body = json.dumps(payload).encode('utf-8') signature = hmac.new(SECRET.encode('utf-8'), body, hashlib.sha256).hexdigest() headers = { 'Content-Type': 'application/json', 'X-Novi-Signature': signature } print('Posting to', ENDPOINT) resp = requests.post(ENDPOINT, headers=headers, data=body, timeout=30) print('Status:', resp.status_code) try: print('JSON:', resp.json()) except Exception: print('Body:', resp.text) if resp.status_code == 200: print('\u2705 PASS: webhook accepted') else: print('\u274C FAIL: webhook rejected') raise SystemExit(1)