Real-Time HMAC-SHA256 Webhooks
Receive instant signed HTTPS POST deliveries across 6 dividend and fixed-income event types. Included all-inclusive in Business API (up to 5 active endpoints with delivery logs and 1-click test events).
Supported Webhook Event Types (6)
| Event | Trigger | Key Payload Fields |
|---|---|---|
| dividend.cut | Confirmed regular dividend cut or suspension | symbol, previous_amount, amount, pct_change, ex_date, safety_grade |
| dividend.raise | Confirmed regular dividend increase | symbol, previous_amount, amount, pct_change, ex_date, growth_streak_years |
| dividend.special | Declared one-time special dividend payout | symbol, amount, ex_date, pay_date |
| dividend.ex_date | Confirmed dividend going ex-dividend tomorrow | symbol, amount, ex_date, last_day_to_buy, pay_date, forward_yield |
| safety.downgrade | Full letter-grade dividend safety downgrade (e.g. B -> C) | symbol, previous_grade, grade, previous_score, score, score_delta |
| fixed_income.redemption_notice | SEC Form 8-K or N-23C-2 preferred / baby bond call notice | symbol, income_type, call_price, market_price, announced_date, redemption_date, source_url |
Verifying X-SmarterDividends-Signature
Every webhook POST includes three headers: X-SmarterDividends-Event (event name), X-SmarterDividends-Delivery (unique idempotency UUID), and X-SmarterDividends-Signature formatted as t=<unix_timestamp>,v1=<hmac_sha256_hex>.
Compute an HMAC-SHA256 hex digest over the literal string `${t}.${rawBody}` using your endpoint's whsec_... signing secret (shown once when you create the endpoint at /account#webhooks) and compare with a constant-time equality check. Reject timestamps older than 5 minutes to prevent replay attacks.
import crypto from "node:crypto";
export function verifySmarterDividendsWebhook(
rawBody: string,
signatureHeader: string,
secret: string
): boolean {
const parts = Object.fromEntries(
signatureHeader.split(",").map((kv) => kv.split("="))
);
if (!parts.t || !parts.v1) return false;
// Reject stale deliveries (> 5 minutes)
if (Math.abs(Date.now() / 1000 - Number(parts.t)) > 300) return false;
const expected = crypto
.createHmac("sha256", secret)
.update(`${parts.t}.${rawBody}`)
.digest("hex");
const sig = Buffer.from(parts.v1, "hex");
const exp = Buffer.from(expected, "hex");
return sig.length === exp.length && crypto.timingSafeEqual(sig, exp);
}Delivery Guarantees & Auto-Pause
Return any 2xx HTTP status within 10 seconds to acknowledge delivery. Store X-SmarterDividends-Delivery to deduplicate safely. Endpoints automatically pause after 10 consecutive failed deliveries and can be resumed or tested anytime from /account#webhooks.
