Webhooks & Signature Validation
Webhooks allow your application to receive real-time HTTP POST notifications when events happen in your GetTru account (e.g., when a verification request is completed, approved, or updated). Instead of polling the API, your system can listen for incoming webhooks and act instantly.
1. Webhook Event Slugs
When configuring your app, you can subscribe to specific events. The system supports the following developer webhook event names:
| UI Setting | Event Slug | Description |
|---|---|---|
| Verification updated | verification.updated | Triggered when any field or status changes. |
| Verification approved | verification.approved | Triggered when the verification status is set to APPROVED (status code 2). |
| Verification rejected | verification.rejected | Triggered when the verification status is set to REJECTED (status code 3). |
| Verification completed | verification.completed | Triggered when the verification is either APPROVED or REJECTED. |
| Template created | template.created | Triggered when a new template is created. |
| Template updated | template.updated | Triggered when a template's metadata or input fields change. |
| Template deleted | template.deleted | Triggered when a template is removed. |
Verification Status Code Mapping
The status field in verification payloads represents the current state of the verification flow:
| Status Code | Label | Description |
|---|---|---|
1 | PENDING | The verification request has been sent and is awaiting user input. |
2 | APPROVED | The user's submitted verification data has been approved. |
3 | REJECTED | The user's submitted verification data has been rejected. |
2. Event Payload Structure
Webhooks are sent as POST requests with a application/json content type.
Verification Events Payload Example (verification.completed / verification.approved / verification.rejected)
Below is an example payload for verification events:
{
"event": "verification.completed",
"timestamp": "2026-08-10T04:20:00.000Z",
"data": {
"verificationUuid": "d2c7bcfb-e31e-41b4-ac96-a391ddcd3907",
"title": "Onboarding Verification for John Doe",
"description": "Please complete your government ID verification",
"status": 2,
"metadata": {
"candidate_id": "cand-90812",
"hr_manager": "Sarah Jenkins"
},
"completedAt": "2026-08-10T04:20:00.000Z",
"responseValues": [
{
"fieldUuid": "a82c49d8-912f-410a-b31a-f3bc498d1a44",
"label": "Government ID Number",
"value": "PRE-FILLED-ID-99"
},
{
"fieldUuid": "b47c49e2-913a-412b-b42c-f4dc498d1a55",
"label": "ID Document Copy",
"value": "profile/d2c7bcfb-e31e-41b4-ac96-a391ddcd3907.jpg"
}
]
}
}
Template Events Payload Example (template.created / template.updated / template.deleted)
Below is an example payload for template events (e.g., template.updated):
{
"event": "template.updated",
"timestamp": "2026-08-10T04:22:37.000Z",
"data": {
"templateUuid": "e7b0e118-2c2b-426b-800d-5853b0bc8ae1",
"name": "Standard Identity Verification",
"slug": "standard-identity-verification",
"description": "Verification of official government identification documents",
"isSystemTemplate": false,
"isActive": true,
"requiresInPersonVerification": false,
"applicationPolicy": "open",
"type": "identity",
"organization": {
"name": "Acme Corporation",
"slug": "acme-corp"
},
"verificationBaseType": {
"title": "Identity Verification",
"slug": "identity-verification",
"description": "Standard base verification flow for identities"
},
"groups": [
{
"name": "HR Department",
"description": "Human Resources Team"
}
],
"approverGroups": [
{
"name": "Compliance Officers",
"description": "Internal Auditors and Compliance Officers"
}
],
"fields": [
{
"fieldUuid": "a82c49d8-912f-410a-b31a-f3bc498d1a44",
"label": "Government ID Number",
"key": "gov_id_number",
"type": "TEXT",
"isRequired": true,
"displayOrder": 1,
"placeholder": "Enter your passport or ID number",
"defaultValue": null,
"validationRules": [
{
"ruleType": "regex",
"value": "^[A-Z0-9]{8,12}$",
"isEnabled": true
}
],
"constraints": [],
"approvalRules": [
{
"operator": "AND",
"value": "1",
"minApproverCount": 1
}
]
}
],
"createdAt": "2026-08-01T10:00:00.000Z",
"updatedAt": "2026-08-10T04:22:37.000Z"
}
}
3. Webhook Signature Validation
To ensure security, you must verify that incoming webhooks are genuinely sent by GetTru and have not been tampered with or spoofed by a third party.
GetTru signs every webhook request using your app's Webhook Validation Key (webhookSecret), which you obtained during App Setup.
How Validation Works
- GetTru generates a signature hash of the raw JSON request body using the HMAC-SHA256 algorithm, keyed with your
webhookSecret. - This signature is placed in the HTTP header
x-tru-signatureof the webhook POST request. - Your server should compute the HMAC-SHA256 signature of the incoming raw request body using your copy of the
webhookSecret. - Perform a timing-attack-safe comparison of your computed signature and the signature received in the
x-tru-signatureheader. If they match, the request is authentic.
Implementation Example (Node.js & Express)
Here is a production-ready Node.js code snippet demonstrating how to receive webhooks, parse the raw body, and validate the signature:
const express = require('express');
const crypto = require('crypto');
const app = express();
// IMPORTANT: We need the RAW request body to validate the signature.
// Do not use standard body-parser json middleware globally on the webhook path,
// as it modifies the raw payload string.
app.post('/webhook', express.raw({ type: 'application/json' }), (req, res) => {
const signature = req.headers['x-tru-signature'];
const webhookSecret = process.env.TRU_WEBHOOK_SECRET; // Your Webhook Validation Key (whsec_...)
if (!signature) {
return res.status(401).send('Missing signature header.');
}
if (!webhookSecret) {
console.error('Webhook secret not configured.');
return res.status(500).send('Configuration error.');
}
// 1. Compute the expected signature from the raw request body using HMAC-SHA256
const rawBody = req.body.toString('utf8');
const expectedSignature = crypto
.createHmac('sha256', webhookSecret)
.update(rawBody)
.digest('hex');
// 2. Perform a secure timing-safe comparison to prevent timing attacks
const signatureBuffer = Buffer.from(signature, 'utf8');
const expectedBuffer = Buffer.from(expectedSignature, 'utf8');
let isSignatureValid = false;
try {
isSignatureValid = crypto.timingSafeEqual(signatureBuffer, expectedBuffer);
} catch (e) {
// If buffer lengths differ, timingSafeEqual throws an error
isSignatureValid = false;
}
if (!isSignatureValid) {
console.warn('Webhook signature verification failed!');
return res.status(403).send('Invalid signature.');
}
// 3. Signature is valid! Parse and process the event payload
const payload = JSON.parse(rawBody);
console.log(`Received verified event: ${payload.event}`);
if (payload.event === 'verification.completed') {
// Act on verification completed (e.g. update user status in your DB)
const verificationData = payload.data;
console.log(`Verification ${verificationData.verificationUuid} completed with status ${verificationData.status}`);
}
// Respond with a 200 OK to acknowledge receipt
res.status(200).send('Webhook processed successfully.');
});
app.listen(3000, () => {
console.log('Webhook server is listening on port 3000');
});
:::tip Security Best Practices
- Always use HTTPS for your webhook URL endpoint in production.
- Use timing-safe string comparison (
crypto.timingSafeEqual) to prevent timing attacks. - Store your Webhook Secret securely using environment variables (
process.env.TRU_WEBHOOK_SECRET) instead of hardcoding it in your source code. :::