Skip to navigation Skip to main content
Free on WordPress.org 4.9 / 5 WordPress.org Explore both Plugins
Free on WordPress.org 4.9 / 5 WordPress.org Explore both Plugins
  • WordPress
    Products
    Smart Cycle DiscountsDiscount automation › TrustLensCustomer trust intel › Cycle AI AIPlain-English campaigns ›
    New pluginComing soon
    Resources & toolsDocs, pricing, support ›
    Smart Cycle Discounts

    Smart Cycle Discounts

    Automate WooCommerce discount campaigns — schedule, target, and measure.

    62%
    Free Pro $59 5 discount types Recurring
    Jump into the page
    How it works Capabilities Promo codes Pricing
    Docs
    Getting started Discount types Scheduling
    Explore Smart Cycle Discounts → Changelog
    TrustLens

    TrustLens

    Customer trust intelligence — score buyers, spot abuse, protect revenue.

    Trust 86
    Free Pro $79 6 segments Abuse detection
    Jump into the page
    How it works Detection Outcomes Pricing
    Docs
    Trust scoring Detection modules Card-testing defense
    Explore TrustLens → Verify a report Changelog

    Cycle AI inside Smart Cycle Discounts

    Describe a sale in plain English — Cycle AI builds the whole campaign.

    “20% off hoodies this weekend”
    Included in Pro Natural language Catalog-aware
    See it work

    Type a sentence, get a ready-to-launch discount campaign that already understands your products, prices, and schedule.

    Live demo How it works
    Meet Cycle AI →

    A new plugin Coming soon

    Something is loading in the lab. Join the list to get the reveal first.

    Notify me on launch →

    Resources & tools

    Everything around the plugins — docs, free tools, and help.

    Learn
    Documentation Pricing & bundle Support
    Free tools
    Discount Calculator Sale Calendar
    Stay current
    SCD changelog TrustLens changelog
    Compare all plans →
    Secure checkout WordPress.org 14-day refund View pricing →
  • Affiliate
    Program
    OverviewHow the program works How it works4 steps from apply to earn Commission details30% · 60-day cookie · recurring
    Get started
    Apply nowOpen Takes ~2 minutes Earnings calculatorEstimate your monthly income FAQPayouts, cookies, renewals
    Resources
    Brand kitLogos, banners, copy, social PlaybookTactics that actually convert FTC disclosureHow to disclose properly Affiliate termsFull program agreement Contact teamOpen the contact form
    Earn 30% recurring on every saleFree to join · 60-day cookie · monthly PayPal payouts Apply now
  • Blog
  • DOCS
    Docs & resources

    Guides, references, and answers for every Webstepper plugin.

    Smart Cycle DiscountsAutomated WooCommerce discount campaigns
    Getting started› Discount types› Cycle AI›
    TrustLensCustomer trust & fraud intelligence
    Trust scoring› Detection modules› Card-testing defense›
    Docs home Guides FAQ Pricing Support
    WordPress tools that solve real problems
  • Contact Us
  • About
    Company

    Our Story

    Founded 2020

    Built by store owners, for store owners. We make WordPress tools that solve real problems.

    Learn more
    Built from experienceTools we use ourselves
    Time is preciousSimple, intuitive UX
    Real supportTalk to the founders
    Legal & contact
    Contact us Privacy policy Terms of service Refund policy
    14-day money-backNo questions asked
Popular requests
  • smart cycle discounts
  • trustlens
  • chargeback protection
GET STARTED

Glossary

1
  • TrustLens Glossary

Detection Modules

9
  • Card Testing Defense
  • Chargeback Tracking
  • Shipping Anomalies
  • Linked Accounts Detection
  • Category Aware Risk
  • Coupon Abuse Detection
  • Order Pattern Analysis
  • Return Abuse Detection
  • Modules Overview

Card Testing Defense

9
  • Attack History
  • Allowlists
  • Geo Diversity
  • Auto Escalation
  • Fingerprinting
  • VIP Bypass
  • Panic Button
  • Velocity Thresholds
  • Overview

Chargeback Monitor

7
  • Ratio Email Alerts
  • Dispute Evidence Report
  • Chargeback Monitor
  • Manual Dispute Entry
  • Stripe WooPayments Ingestion
  • Card Network Thresholds
  • Chargeback Ratio Speedometer

Customer Management

7
  • Admin Notes
  • Checkout Enforcement
  • Order Trust Column
  • Bulk Actions
  • Blocking and Allowlisting
  • Customer Detail Profile
  • Customer List

Automation

7
  • Async Dispatch Retries
  • Webhooks and HMAC
  • Rule Inspector
  • Actions Reference
  • Conditions Reference
  • Triggers Reference
  • Automation Overview

Trust Scoring

5
  • Account Age Loyalty Bonus
  • Signals Explained
  • Six Customer Segments
  • The 0–100 Score
  • How Trust Scoring Works
View Categories
  • Home
  • Docs
  • Trustlens
  • Automation
  • Webhooks and HMAC

Webhooks and HMAC

3 min read

Webhook actions let your TrustLens rules push events to external systems — CRMs, helpdesks, analytics, custom internal tools. Every webhook is signed with HMAC-SHA256 so the receiver can verify the request came from your TrustLens instance and wasn’t tampered with. This page covers the webhook payload format, the signature scheme, and how to implement receivers correctly.


Webhook Action Configuration #

In a rule’s action editor, choose Fire Webhook and configure:

Field Description
URL Full HTTPS URL of the receiver endpoint
Secret HMAC signing key. Auto-generated if blank; can be regenerated
Custom headers Optional key-value pairs added to the request
Timeout Defaults to 10 seconds

The secret is shown once when generated, then masked. Save it somewhere safe — you’ll need it on the receiver side.


Request Format #

Each webhook is an HTTP POST with:

  • Content-Type: application/json
  • Header X-TrustLens-Event: trigger event ID (e.g. chargeback_filed)
  • Header X-TrustLens-Signature: HMAC-SHA256 hex digest of the raw body, prefixed with sha256=
  • Header X-TrustLens-Delivery: unique delivery ID for deduplication
  • Header X-TrustLens-Timestamp: Unix timestamp at dispatch time
  • Header User-Agent: TrustLens/{version}

Payload Schema #

The body is a JSON object with these top-level fields:

{
  "event": "chargeback_filed",
  "delivery_id": "uuid-...",
  "timestamp": 1710000000,
  "rule": {
    "id": 42,
    "name": "Auto-block on dispute"
  },
  "data": {
    "customer": { ... },
    "order": { ... },
    "dispute": { ... }
  }
}

The data object’s shape depends on the trigger. Each trigger documents which sub-objects (customer, order, dispute, fingerprint, etc.) are included.


Signature Verification #

On the receiver side, verify the signature before trusting the payload. Reference implementation in pseudocode:

function verify(request) {
  body = request.raw_body            // exact bytes
  signature_header = request.headers['x-trustlens-signature']
  expected = "sha256=" + hmac_sha256_hex(secret, body)
  return constant_time_compare(signature_header, expected)
}

Key points:

  • Use the raw body bytes, not a re-serialized JSON. JSON serialization can vary by language; the signed bytes are whatever TrustLens sent.
  • Use constant-time comparison to prevent timing attacks. Most languages have this built in (Node: crypto.timingSafeEqual; Python: hmac.compare_digest; PHP: hash_equals).
  • Reject requests with missing or wrong signature — return 401, log the attempt

Implementation Examples #

Node.js / Express #

const crypto = require('crypto');

app.post('/trustlens-webhook', (req, res) => {
  const signature = req.headers['x-trustlens-signature'];
  const expected = 'sha256=' + crypto
    .createHmac('sha256', SECRET)
    .update(req.rawBody)
    .digest('hex');

  if (!crypto.timingSafeEqual(
    Buffer.from(signature),
    Buffer.from(expected)
  )) {
    return res.status(401).send('Invalid signature');
  }

  const event = JSON.parse(req.rawBody.toString());
  // ... handle event
  res.status(200).send('ok');
});

Python / Flask #

import hmac, hashlib
from flask import request

@app.post('/trustlens-webhook')
def webhook():
    signature = request.headers.get('X-TrustLens-Signature', '')
    expected = 'sha256=' + hmac.new(
        SECRET, request.get_data(), hashlib.sha256
    ).hexdigest()
    if not hmac.compare_digest(signature, expected):
        return ('Invalid signature', 401)
    event = request.get_json()
    # ... handle event
    return ('ok', 200)

PHP #

$body = file_get_contents('php://input');
$signature = $_SERVER['HTTP_X_TRUSTLENS_SIGNATURE'] ?? '';
$expected = 'sha256=' . hash_hmac('sha256', $body, SECRET);

if ( ! hash_equals( $signature, $expected ) ) {
    http_response_code( 401 );
    exit( 'Invalid signature' );
}

$event = json_decode( $body, true );
// ... handle event
http_response_code( 200 );
echo 'ok';

Replay Protection #

TrustLens includes a X-TrustLens-Delivery header with a unique UUID per dispatch attempt (different for retries). Receivers can dedupe on this if needed.

The X-TrustLens-Timestamp header lets receivers reject very old requests — useful protection against replay attacks. Convention: reject any request with a timestamp more than 5 minutes old.


Expected Response #

The receiver should respond with HTTP 2xx within 10 seconds. Any 2xx is treated as success; the action is marked complete.

Non-2xx responses (or timeouts) trigger automatic retry per the standard retry policy: 60s / 120s / 240s backoff. After 3 failed retries, the action is logged as failed.

If your receiver does long-running processing, respond 200 immediately and process asynchronously. Don’t keep TrustLens waiting.


Idempotency #

TrustLens may retry the same delivery on transient failures. Receivers should be idempotent — process the same delivery_id once, even if it arrives multiple times. The delivery_id stays the same across retries; only the timestamp changes.


Secret Rotation #

To rotate the secret:

  1. In the rule’s action editor, click “Regenerate Secret”
  2. Copy the new secret
  3. Update the receiver’s expected secret
  4. Save the rule

There’s no graceful transition window — the old secret stops working immediately when the new one is generated. For zero-downtime rotation, update the receiver first to accept both old and new secrets, then rotate, then remove the old secret.


Debugging #

The Automation Log shows each webhook attempt with:

  • URL
  • Request body (truncated if large)
  • Response status
  • Response body (truncated)
  • Time to first byte

For debugging signature issues, the log shows the body bytes used for signing — handy if you suspect serialization differences.

For new webhook endpoints, use a tool like webhook.site or RequestBin to inspect incoming requests before connecting your real receiver. TrustLens’s payload format is predictable; verifying it against a test endpoint is faster than debugging via real downstream effects.

Updated on June 18, 2026

What are your Feelings

  • Happy
  • Normal
  • Sad

Share This Article :

  • Facebook
  • X
  • LinkedIn
  • Pinterest
Async Dispatch RetriesRule Inspector
Table of Contents
  • Webhook Action Configuration
  • Request Format
  • Payload Schema
  • Signature Verification
  • Implementation Examples
    • Node.js / Express
    • Python / Flask
    • PHP
  • Replay Protection
  • Expected Response
  • Idempotency
  • Secret Rotation
  • Debugging
Newsletter

Insights that grow your business

Join thousands of WooCommerce store owners who get actionable tips, plugin updates, and industry news every week — plus 10% off either of our plugins as a welcome.

We respect your privacy. Unsubscribe at any time.

10% off welcome gift — A code for either plugin, on us
Weekly updates — Fresh content every Tuesday
Exclusive content — Tips you won't find on our blog
Early access — Be first to know about new plugins
Webstepper
Weekly WooCommerce Tips
Just now
This week: 5 proven strategies to boost your average order value using smart discount campaigns...
10% off inside
Webstepper

Tools for store owners who'd rather grow than grind.

Simple, powerful plugins that help WooCommerce store owners sell more — without the learning curve.

Products

  • Smart Cycle Discounts
  • TrustLens
  • Discount Calculator
  • Sale Calendar

Company

  • About Us
  • Blog
  • Contact
  • Affiliates
  • Log In

Resources

  • Help Center
  • Guides
  • Verify a report
  • Affiliate Program
  • Become a Partner

Questions? We actually answer.

Real humans, real help. No bots, no runaround. Usually within a few hours.

Get in touch
Operated by Setmood LLC · 7901 4th St N, St Petersburg, FL 33702 · United States

© 2026 Webstepper. All rights reserved.

Privacy Terms Refunds
Visa Mastercard PayPal Apple Pay Google Pay & more
Limited Time Offer

Get 10% off
Smart Cycle Discounts or TrustLens

Drop your email and we’ll send you a unique, single-use code — works on either plugin at checkout. New customers, first payment.

23 hours
:
59 minutes
:
59 seconds

No spam. Unsubscribe anytime.

  • WordPress
    Back
    Products
    Smart Cycle DiscountsDiscount automation › TrustLensCustomer trust intel › Cycle AI AIPlain-English campaigns ›
    New pluginComing soon
    Resources & toolsDocs, pricing, support ›
    Smart Cycle Discounts

    Smart Cycle Discounts

    Automate WooCommerce discount campaigns — schedule, target, and measure.

    62%
    Free Pro $59 5 discount types Recurring
    Jump into the page
    How it works Capabilities Promo codes Pricing
    Docs
    Getting started Discount types Scheduling
    Explore Smart Cycle Discounts → Changelog
    TrustLens

    TrustLens

    Customer trust intelligence — score buyers, spot abuse, protect revenue.

    Trust 86
    Free Pro $79 6 segments Abuse detection
    Jump into the page
    How it works Detection Outcomes Pricing
    Docs
    Trust scoring Detection modules Card-testing defense
    Explore TrustLens → Verify a report Changelog

    Cycle AI inside Smart Cycle Discounts

    Describe a sale in plain English — Cycle AI builds the whole campaign.

    “20% off hoodies this weekend”
    Included in Pro Natural language Catalog-aware
    See it work

    Type a sentence, get a ready-to-launch discount campaign that already understands your products, prices, and schedule.

    Live demo How it works
    Meet Cycle AI →

    A new plugin Coming soon

    Something is loading in the lab. Join the list to get the reveal first.

    Notify me on launch →

    Resources & tools

    Everything around the plugins — docs, free tools, and help.

    Learn
    Documentation Pricing & bundle Support
    Free tools
    Discount Calculator Sale Calendar
    Stay current
    SCD changelog TrustLens changelog
    Compare all plans →
    Secure checkout WordPress.org 14-day refund View pricing →
  • Affiliate
    Back
    Program
    OverviewHow the program works How it works4 steps from apply to earn Commission details30% · 60-day cookie · recurring
    Get started
    Apply nowOpen Takes ~2 minutes Earnings calculatorEstimate your monthly income FAQPayouts, cookies, renewals
    Resources
    Brand kitLogos, banners, copy, social PlaybookTactics that actually convert FTC disclosureHow to disclose properly Affiliate termsFull program agreement Contact teamOpen the contact form
    Earn 30% recurring on every saleFree to join · 60-day cookie · monthly PayPal payouts Apply now
  • Blog
  • DOCS
    Back
    Docs & resources

    Guides, references, and answers for every Webstepper plugin.

    Smart Cycle DiscountsAutomated WooCommerce discount campaigns
    Getting started› Discount types› Cycle AI›
    TrustLensCustomer trust & fraud intelligence
    Trust scoring› Detection modules› Card-testing defense›
    Docs home Guides FAQ Pricing Support
    WordPress tools that solve real problems
  • Contact Us
  • About
    Back
    Company

    Our Story

    Founded 2020

    Built by store owners, for store owners. We make WordPress tools that solve real problems.

    Learn more
    Built from experienceTools we use ourselves
    Time is preciousSimple, intuitive UX
    Real supportTalk to the founders
    Legal & contact
    Contact us Privacy policy Terms of service Refund policy
    14-day money-backNo questions asked
We use cookies to improve your experience on our website. By browsing this website, you agree to our use of cookies.
More info More info Accept