Verify Proxyclick (Eptura Visitor) webhooks

Proxyclick doesn't sign webhook requests, so there's no signature to check and no SDK to verify one. With Basic authentication set on the webhook, your endpoint compares the username and password from the Authorization header in constant time. That authenticates the sender, but it doesn't protect the body or stop a replay.

The facts

Signature header
None (unsigned)
What to build
Compare the Basic username and password with your stored values

Proxyclick (Eptura Visitor) webhook secret

You choose the username and password and enter them on the webhook. Proxyclick generates no secret. Keep it in an environment variable, not in source code.

  • Enter them when you add the webhook, in the Eptura Visitor dashboard under Settings, INTEGRATIONS, API and Webhooks.
  • Each webhook has its own settings, and Basic authentication is optional, so a webhook saved without credentials has none to send.
  • The docs don't describe rotation. To change the credentials, update the webhook and your stored values together.

Source: Proxyclick (Eptura Visitor) docs ↗

Code

express/src/index.js
javascript
// Generated with: proxyclick-webhooks skill
// https://github.com/hookdeck/webhook-skills
require('dotenv').config({ quiet: true });
const crypto = require('crypto');
const express = require('express');

const app = express();

/**
 * Constant-time string comparison. Hashing both sides first gives equal-length
 * buffers, so timingSafeEqual never throws and the secret's length isn't leaked.
 */
function safeEqual(a, b) {
  const ha = crypto.createHash('sha256').update(String(a)).digest();
  const hb = crypto.createHash('sha256').update(String(b)).digest();
  return crypto.timingSafeEqual(ha, hb);
}

/**
 * Parse `Authorization: Basic base64(username:password)`. The scheme is
 * case-insensitive and the credentials split on the FIRST colon, so the password
 * may itself contain colons. Returns null for anything malformed.
 */
function parseBasicAuth(header) {
  if (typeof header !== 'string') return null;
  const match = /^basic +([A-Za-z0-9+/]+={0,2}) *$/i.exec(header);
  if (!match) return null;
  const decoded = Buffer.from(match[1], 'base64').toString('utf8');
  const colon = decoded.indexOf(':');
  if (colon < 0) return null;
  return { username: decoded.slice(0, colon), password: decoded.slice(colon + 1) };
}

/**
 * Proxyclick does not sign payloads. The only security option is HTTP Basic auth,
 * which must arrive on the FIRST request (no 401 + WWW-Authenticate challenge).
 * Both comparisons run before the result is combined, so a wrong username is not
 * distinguishable by timing from a wrong password.
 */
function verifyProxyclickRequest(headers, config = process.env) {
  const expectedUser = config.PROXYCLICK_WEBHOOK_USERNAME;
  const expectedPass = config.PROXYCLICK_WEBHOOK_PASSWORD;
  if (!expectedUser || !expectedPass) return false; // never accept when unconfigured

  const creds = parseBasicAuth(headers['authorization']);
  if (!creds) return false;

  const userOk = safeEqual(creds.username, expectedUser);
  const passOk = safeEqual(creds.password, expectedPass);
  return userOk && passOk;
}

/**
 * ILLUSTRATIVE handler. Proxyclick's attribute reference shows API objects, not
 * a webhook body, and no event-type field is documented, so nothing here
 * dispatches on a field. Check a real delivery in your Hookdeck
 * or Proxyclick logs before relying on any key.
 */
function handleEvent(payload) {
  console.log(`Proxyclick webhook received (top-level keys: ${Object.keys(payload).join(', ')})`);
  // Your code: act on the visit or visitor data (check-in, check-out, visit created/updated/deleted)
}

// Read the body raw so the request is authenticated before anything is parsed,
// whatever Content-Type Proxyclick uses.
app.post('/webhooks/proxyclick', express.raw({ type: '*/*' }), (req, res) => {
  if (!verifyProxyclickRequest(req.headers)) {
    return res.status(401).json({ error: 'Invalid or missing Basic credentials' });
  }

  let payload;
  try {
    const raw = Buffer.isBuffer(req.body) ? req.body.toString('utf8') : '';
    payload = JSON.parse(raw);
  } catch {
    return res.status(400).json({ error: 'Invalid JSON body' });
  }

  if (!payload || typeof payload !== 'object' || Array.isArray(payload)) {
    return res.status(400).json({ error: 'Expected a JSON object' });
  }

  try {
    handleEvent(payload);
  } catch (err) {
    console.error('Error handling Proxyclick webhook:', err);
    return res.status(500).json({ error: 'Handler error' });
  }

  res.status(200).json({ received: true });
});

app.get('/health', (req, res) => {
  res.json({ status: 'ok' });
});

module.exports = app;
module.exports.verifyProxyclickRequest = verifyProxyclickRequest;
module.exports.parseBasicAuth = parseBasicAuth;

if (require.main === module) {
  const PORT = process.env.PORT || 3000;
  app.listen(PORT, () => {
    console.log(`Server running on http://localhost:${PORT}`);
    console.log(`Webhook endpoint: POST http://localhost:${PORT}/webhooks/proxyclick`);
  });
}
nextjs/app/webhooks/proxyclick/route.ts
typescript
// Generated with: proxyclick-webhooks skill
// https://github.com/hookdeck/webhook-skills
import { NextRequest, NextResponse } from 'next/server';
import { verifyProxyclickRequest } from '../../../lib/verify-proxyclick';

// ILLUSTRATIVE handler. No event-type field or payload attribute is documented in
// the pages this skill was written from, so nothing dispatches on a field. Check a
// real delivery before relying on any key.
function handleEvent(payload: Record<string, unknown>): void {
  console.log(`Proxyclick webhook received (top-level keys: ${Object.keys(payload).join(', ')})`);
  // Your code: act on the visit or visitor data (check-in, check-out, visit created/updated/deleted)
}

export async function POST(request: NextRequest) {
  // Authenticate before reading or parsing the body.
  if (!verifyProxyclickRequest(request.headers)) {
    return NextResponse.json({ error: 'Invalid or missing Basic credentials' }, { status: 401 });
  }

  let payload: unknown;
  try {
    // Read the raw text so any content type works.
    payload = JSON.parse(await request.text());
  } catch {
    return NextResponse.json({ error: 'Invalid JSON body' }, { status: 400 });
  }

  if (!payload || typeof payload !== 'object' || Array.isArray(payload)) {
    return NextResponse.json({ error: 'Expected a JSON object' }, { status: 400 });
  }

  try {
    handleEvent(payload as Record<string, unknown>);
  } catch (err) {
    console.error('Error handling Proxyclick webhook:', err);
    return NextResponse.json({ error: 'Handler error' }, { status: 500 });
  }

  return NextResponse.json({ received: true });
}
fastapi/main.py
python
# Generated with: proxyclick-webhooks skill
# https://github.com/hookdeck/webhook-skills
import base64
import binascii
import hmac
import json
import os
from typing import Optional, Tuple

from dotenv import load_dotenv
from fastapi import Depends, FastAPI, HTTPException, Request

load_dotenv()

app = FastAPI()


def safe_equal(a: str, b: str) -> bool:
    """Constant-time comparison. Encode both sides to bytes: compare_digest raises
    TypeError on a non-ASCII str."""
    return hmac.compare_digest(a.encode("utf-8"), b.encode("utf-8"))


def parse_basic_auth(header: Optional[str]) -> Optional[Tuple[str, str]]:
    """Parse `Authorization: Basic base64(username:password)`. The scheme is
    case-insensitive and the credentials split on the FIRST colon. Returns None
    for anything malformed."""
    if not header:
        return None
    scheme, _, encoded = header.partition(" ")
    if scheme.lower() != "basic":
        return None
    try:
        encoded = encoded.strip()
        encoded += "=" * (-len(encoded) % 4)  # accept unpadded base64, like the Node examples
        decoded = base64.b64decode(encoded, validate=True).decode("utf-8")
    except (binascii.Error, ValueError):
        return None
    username, sep, password = decoded.partition(":")
    if not sep:
        return None
    return username, password


def verify_proxyclick_request(headers, config=os.environ) -> bool:
    """Proxyclick does not sign payloads. The only security option is HTTP Basic auth,
    which must arrive on the FIRST request (no 401 + WWW-Authenticate challenge).
    Both comparisons run before the result is combined (no short-circuit)."""
    expected_user = config.get("PROXYCLICK_WEBHOOK_USERNAME")
    expected_pass = config.get("PROXYCLICK_WEBHOOK_PASSWORD")
    if not expected_user or not expected_pass:
        return False  # never accept when unconfigured

    creds = parse_basic_auth(headers.get("authorization"))
    if creds is None:
        return False

    user_ok = safe_equal(creds[0], expected_user)
    pass_ok = safe_equal(creds[1], expected_pass)
    return user_ok and pass_ok


async def require_proxyclick_auth(request: Request) -> None:
    """FastAPI dependency: reject the request before the body is parsed."""
    if not verify_proxyclick_request(request.headers):
        raise HTTPException(status_code=401, detail="Invalid or missing Basic credentials")


def handle_event(payload: dict) -> None:
    """ILLUSTRATIVE handler. No event-type field or payload attribute is documented in
    the pages this skill was written from, so nothing dispatches on a field. Check a
    real delivery before relying on any key."""
    print(f"Proxyclick webhook received (top-level keys: {', '.join(payload)})")
    # Your code: act on the visit or visitor data (check-in, check-out, visit created/updated/deleted)


@app.post("/webhooks/proxyclick", dependencies=[Depends(require_proxyclick_auth)])
async def proxyclick_webhook(request: Request):
    # Read the raw body so any content type works.
    raw_body = await request.body()

    try:
        payload = json.loads(raw_body)
    except (json.JSONDecodeError, UnicodeDecodeError):
        raise HTTPException(status_code=400, detail="Invalid JSON body")

    if not isinstance(payload, dict):
        raise HTTPException(status_code=400, detail="Expected a JSON object")

    try:
        handle_event(payload)
    except Exception as err:  # noqa: BLE001
        print(f"Error handling Proxyclick webhook: {err}")
        raise HTTPException(status_code=500, detail="Handler error")

    return {"received": True}


@app.get("/health")
async def health():
    return {"status": "ok"}


if __name__ == "__main__":
    import uvicorn

    uvicorn.run(app, host="0.0.0.0", port=8000)

From hookdeck/webhook-skills ↗

Or install the Proxyclick (Eptura Visitor) webhooks skill:

npx skills add hookdeck/webhook-skills --skill proxyclick-webhooks

Common failures

No credentials on the webhook

Basic authentication is optional, so a webhook saved without a username and password has none to send. Enter the same values on the webhook and your endpoint.

Credentials changed on one side

Editing the username or password on the webhook doesn't change your stored values. Update both together.

Password split on the wrong colon

Decode the base64 and split on the first colon only, because a password can contain one.

Credentials missing from the first request

Eptura doesn't say whether it sends Basic credentials up front or only after a 401 challenge. Log the headers of a test delivery to see what arrives.

From Hookdeck's Proxyclick (Eptura Visitor) guide

Let Event Gateway check Proxyclick's Basic credentials.

Event Gateway checks the webhook's username and password on each Proxyclick request before it reaches your service, then queues it and retries failures on your schedule.

Not affiliated with Proxyclick (Eptura Visitor). Facts are compiled from public sources and linked inline.