Skip to navigation Skip to main content

Trick-or-Treat Sale 30% off every Pro plan with code

Ends Oct 31 Pick your treatShop

Trick-or-Treat Sale 30% off every Pro plan with code

Ends Oct 31 Pick your treatShop
  • 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

10
  • Store Trust Network
  • 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 Alert

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

5 min read

0:00 / 7:05
  • View as Markdown Open this page as plain Markdown (opens in a new tab)
  • Open in ChatGPT Ask questions about this page (opens in a new tab)
  • Open in Claude Ask questions about this page (opens in a new tab)
  • Open in Google AI Studio Ask questions about this page (Google account required) (opens in a new tab)

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.

This page is about the Send Webhook automation action. The global webhook endpoints under Settings → Integrations → Webhooks are a separate feature with their own per-endpoint secrets and payloads.


Webhook Action Configuration #

In the rule editor, choose Send Webhook as the action and put the receiver’s URL in the action value:

Setting Description
URL Full URL of the receiver endpoint (the action value). Required; the rule won’t save without a valid URL. Use HTTPS, and use the final URL — redirects aren’t followed
Secret Not set per rule. TrustLens generates one signing secret for your site the first time a webhook is sent
Timeout Fixed at 10 seconds

There are no custom-header or timeout fields. The secret isn’t shown in the admin: it’s stored in the trustlens_automation_webhook_secret WordPress option (read it with wp option get trustlens_automation_webhook_secret), and developers can supply their own — per rule, if needed — with the trustlens/automation/webhook_secret filter. Save it somewhere safe — you’ll need it on the receiver side.


Sending to Slack #

Don’t paste a Slack incoming-webhook URL into Send Webhook. Slack only accepts a body with a text (or blocks) field, and the TrustLens payload has neither, so Slack rejects every delivery and the rule logs an error. Point the action at Zapier, Make or a small endpoint of your own, and have that post a formatted message to Slack.


Request Format #

Each webhook is an HTTP POST with:

  • Content-Type: application/json
  • Header X-TrustLens-Event: always trustlens_automation (the trigger is in the body)
  • Header X-TrustLens-Signature: sha256= followed by the hex HMAC-SHA256 of the timestamp, a dot, and the raw body
  • Header X-TrustLens-Delivery: a new UUID for every attempt
  • Header X-TrustLens-Rule-ID: the rule’s ID
  • Header X-TrustLens-Timestamp: Unix timestamp at dispatch time

The User-Agent is WordPress’s default.


Payload Schema #

The body is a flat JSON object:

{
  "event": "trustlens_automation",
  "rule": "Auto-block on dispute",
  "rule_id": "3f2b9c1e-…",
  "trigger": "chargeback_filed",
  "email_hash": "…",
  "trust_score": 18,
  "segment": "critical",
  "fired_at": "2026-03-15 12:00:00",
  "attempt": 1
}

rule_id is the rule’s UUID, trust_score and segment are read when the webhook is sent (null if the customer has no record), fired_at is the site’s local time at sending, and attempt counts 1 to 4. Rules on Refund Processed also include a refund_context object with the refund’s amount, ratio, type, classification, reason and the other refund fields. The payload carries no order, dispute or fingerprint data — use the email hash with the REST API if you need more.


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
  timestamp = request.headers['x-trustlens-timestamp']
  signature_header = request.headers['x-trustlens-signature']
  expected = "sha256=" + hmac_sha256_hex(secret, timestamp + "." + body)
  return constant_time_compare(signature_header, expected)
}

Key points:

  • Sign the timestamp too. The signed string is the X-TrustLens-Timestamp value, a ., then the body — not the body alone.
  • 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 timestamp = req.headers['x-trustlens-timestamp'] || '';
  const expected = 'sha256=' + crypto
    .createHmac('sha256', SECRET)
    .update(timestamp + '.' + req.rawBody)
    .digest('hex');

  if (signature.length !== expected.length || !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', '')
    timestamp = request.headers.get('X-TrustLens-Timestamp', '')
    signed = timestamp.encode() + b'.' + request.get_data()
    expected = 'sha256=' + hmac.new(
        SECRET, signed, 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');
$timestamp = $_SERVER['HTTP_X_TRUSTLENS_TIMESTAMP'] ?? '';
$signature = $_SERVER['HTTP_X_TRUSTLENS_SIGNATURE'] ?? '';
$expected  = 'sha256=' . hash_hmac('sha256', $timestamp . '.' . $body, SECRET);

if ( ! hash_equals( $expected, $signature ) ) {
    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).

The X-TrustLens-Timestamp header is part of the signed string, so it can’t be altered without breaking the signature — reject any request whose timestamp is more than 5 minutes old to block replays.


Expected Response #

The receiver should respond with HTTP 2xx within 10 seconds. Any 2xx is treated as success and logged as OK; the response body is ignored.

Anything else — a 3xx redirect, 4xx, 5xx, a timeout or a connection error — triggers automatic retry: 60s / 120s / 240s backoff. After 3 failed retries, the delivery is logged as failed.

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


Idempotency #

TrustLens retries a delivery only when it didn’t get a 2xx — but a receiver that processed the request and then timed out will see it again. Each retry carries a new X-TrustLens-Delivery UUID, a new fired_at and a higher attempt, so there’s no single ID that stays the same across retries. If duplicates matter, dedupe on rule_id + email_hash + trigger within a short window, or treat attempt > 1 as a possible repeat.

Before sending, identical pending deliveries (same rule and customer) are collapsed into one, and the one-hour rule cooldown limits how often the same rule can queue a webhook for the same customer.


Secret Rotation #

There’s no “Regenerate Secret” button. To rotate the site secret:

  1. Delete the trustlens_automation_webhook_secret option (e.g. wp option delete trustlens_automation_webhook_secret) — or return a new secret from the trustlens/automation/webhook_secret filter
  2. A new secret is used from the next delivery (a deleted one is regenerated automatically)
  3. Read the new value and update every receiver’s expected secret

There’s no graceful transition window — the old secret stops working as soon as the new one is in use, for every rule at once. For zero-downtime rotation, update the receiver first to accept both old and new secrets, then rotate, then remove the old secret.


Debugging #

The Rule Inspector shows each delivery’s final result:

  • QUEUED while the delivery waits in Action Scheduler
  • OK once a 2xx arrives
  • ERR after the last retry, with the HTTP status (“Webhook returned HTTP 500 after 4 attempt(s).”) or the connection error (“Webhook delivery failed: …”)

Request and response bodies aren’t stored. To see exactly what TrustLens sends, point a rule at a tool like webhook.site or RequestBin 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. Pending and retrying deliveries are visible under WooCommerce → Status → Scheduled Actions (hook trustlens/automation/dispatch_webhook).

Updated on October 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
  • Sending to Slack
  • 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

Halloween sale · ends Oct 31

Trick or treat?

Pick a door. Either way you leave with 30% off Pro.

Your treat

30% off

--days --hrs --min --sec
Claim it

Paste the code at checkout.

Renewals keep the discount · 14-day money-back guarantee

Halloween sale

That's a wrap for Halloween.

The sale ended at midnight. Both plugins are still free on WordPress.org, and Pro plans start at $59/year.

See plans
  • 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