Webhook Integration
This guide provides instructions for setting up and configuring webhooks in our system. The webhook system supports multiple authentication types, allowing you to secure your webhook endpoints according to your security requirements.
Overview
Webhooks allow you to receive real-time updates about specific events in your azakaw integration. When an event occurs, our system sends an HTTP POST request to your configured webhook endpoint with relevant information about the event.
Webhook Configuration
Each webhook is associated with a tenant and includes several configurable properties:
Configuration Properties
These are set by Azakaw when your webhook is provisioned. They are listed so you know what to supply and what to ask for when something needs changing.
| Property | Description |
|---|---|
| Id | Unique identifier for the webhook configuration |
| TenantId | Your tenant's unique identifier |
| RetryCount | Number of retry attempts after a failed delivery |
| RetryInterval | Fixed wait between retry attempts. It does not grow between attempts. |
| WebhookBaseUrl | Base URL of your endpoint, e.g. https://example.com/api |
| WebhookRelativePath | Path appended to the base URL, without a leading slash, e.g. webhook/events. A leading slash produces a doubled separator in the final URL. |
| IsActive | Whether the webhook is currently enabled |
| AuthType | Which authentication method is used — see Authentication Types |
| AuthSettings | The credentials for that method (API key, Basic username/password, or HMAC secret) |
A tenant has a single active webhook, and every event type is delivered to that one URL.
There is no per-event subscription — branch on the Type field in the payload to tell them apart.
Authentication Types
Every webhook uses exactly one authentication method, chosen when Azakaw provisions your webhook. They are mutually exclusive — a webhook configured for HMAC does not also send an API key, and vice versa.
There is no self-service API for webhook configuration. Contact your Azakaw representative with your endpoint URL and preferred authentication method, and they will provision it and hand over any generated credentials.
None
No authentication headers are sent. Available for sandbox testing only — do not use it in production, where anyone who learns your endpoint URL can post arbitrary payloads to it.
API Key
A static key is sent in a custom header on every delivery:
x-api-key: your-api-key
The header name is lower-case x-api-key, not Authorization. Compare the value against your
stored copy in constant time, and reject the request with 401 if it does not match.
Basic Authentication
Standard HTTP Basic, sent on every delivery:
Authorization: Basic base64(username:password)
Credentials are encoded as ASCII. Usernames and passwords containing non-ASCII characters — accented Latin, Arabic, and so on — will not transmit correctly. Use ASCII-only credentials.
HMAC Signature
The strongest option, and the one to prefer for production. Instead of sending a shared secret, Azakaw sends a signature derived from it. The secret itself never travels over the network, so capturing a request does not let an attacker forge future ones.
Two headers are added to every delivery:
X-Azakaw-Timestamp: 1756041600
X-Azakaw-Signature: v1=54b62fe6af3abf989969879eed7323ed5c1011713e78ef28bf119f965c9d2cb3
| Header | Meaning |
|---|---|
X-Azakaw-Timestamp | Unix time in seconds at which the request was signed |
X-Azakaw-Signature | v1= followed by lower-case hex HMAC-SHA256. The v1 prefix identifies the scheme so future versions can be introduced without breaking existing receivers. |
How the signature is computed
-
Join the timestamp and the raw request body with a single
.character:1756041600.{"Type":"RiskAssessmentCalculated","SubmissionId":"67890"} -
Compute
HMAC-SHA256over that string, using your webhook secret as the key. -
Hex-encode the result in lower case.
Verifying a delivery
import { createHmac, timingSafeEqual } from 'crypto';
const SECRET = process.env.AZAKAW_WEBHOOK_SECRET;
const TOLERANCE_SECONDS = 300;
function verify(rawBody, headers) {
const timestamp = headers['x-azakaw-timestamp'];
const received = (headers['x-azakaw-signature'] ?? '').replace(/^v1=/, '');
// Reject anything outside the tolerance window, so a captured request cannot be replayed.
const age = Math.abs(Math.floor(Date.now() / 1000) - Number(timestamp));
if (!timestamp || age > TOLERANCE_SECONDS) return false;
const expected = createHmac('sha256', SECRET)
.update(`${timestamp}.${rawBody}`)
.digest('hex');
const a = Buffer.from(received);
const b = Buffer.from(expected);
return a.length === b.length && timingSafeEqual(a, b);
}
import hashlib, hmac, os, time
SECRET = os.environ["AZAKAW_WEBHOOK_SECRET"].encode()
TOLERANCE_SECONDS = 300
def verify(raw_body: bytes, headers: dict) -> bool:
timestamp = headers.get("X-Azakaw-Timestamp", "")
received = headers.get("X-Azakaw-Signature", "").removeprefix("v1=")
if not timestamp or abs(int(time.time()) - int(timestamp)) > TOLERANCE_SECONDS:
return False
signed = f"{timestamp}.".encode() + raw_body
expected = hmac.new(SECRET, signed, hashlib.sha256).hexdigest()
return hmac.compare_digest(received, expected)
Compute the signature over the exact bytes you received. If your framework parses the JSON
and you re-serialize it before verifying, key order and whitespace will differ and the signature
will never match. In Express use express.raw() or bodyParser.json({ verify }); in Flask use
request.get_data().
Secret rotation
A webhook has a single active secret. Rotating it is a coordinated cutover — contact Azakaw to schedule one, and be ready to accept the new secret at the agreed time. Deliveries signed with the old secret will fail verification immediately after the switch.
Retry Mechanism
In the event of a failed webhook request (e.g., if your server returns a 500 status code), the system will automatically retry the request based on the following configuration:
- RetryCount: The maximum number of retry attempts
- RetryInterval: The time between retry attempts
Webhook Request Body
The body of the webhook request will contain important information depending on the event being triggered. Below are the structures for webhook events.
RiskAssessmentCalculated
When the RiskAssessmentCalculated event is triggered, the body will contain the following fields:
{
"Type": "RiskAssessmentCalculated",
"RiskAssessmentId": "{RiskAssessmentId}",
"SubmissionId": "{SubmissionId}",
"Risk": "{RiskTypeId}",
"ClientRating": "{ClientRating}"
}
Properties
| Property | Description | Values |
|---|---|---|
| Type | Event type | "RiskAssessmentCalculated" |
| RiskAssessmentId | Unique identifier for the risk assessment | String |
| SubmissionId | Submission identifier | String |
| Risk | Risk level of the profile | "Low", "Medium", "High" |
| ClientRating | Customer segment rating | "Retail", "Professional", "N/A" |
Example
{
"Type": "RiskAssessmentCalculated",
"RiskAssessmentId": "12345",
"SubmissionId": "67890",
"Risk": "Low",
"ClientRating": "Retail"
}
ProfileStatusUpdated
Sent when a profile's status changes. What you receive depends on your webhook configuration:
- Standard (default) — sent only when an officer approves a profile.
Statusis always"Approved". - All status changes (on request) — sent for every status change you ask for: approvals, rejections, freezes, closures and so on, whether an officer, an external approver or the system made the change. You can ask for specific statuses, or for every status including any added in future. Contact Azakaw support to switch this on.
Before asking for All status changes, make sure your receiver checks Status. Do not treat a ProfileStatusUpdated event as an approval. A receiver that ignores Status would treat a rejected or frozen profile as approved. If you ask for every status, ignore any Status value you don't recognise, because new statuses may be added.
Standard payload
{
"Type": "ProfileStatusUpdated",
"RiskAssessmentId": "{RiskAssessmentId}",
"SubmissionId": "{SubmissionId}",
"Status": "Approved",
"ClientRating": "{ClientRating}",
"ApprovedBy": {
"Id": "{userId}",
"Name": "{fullName}",
"Email": "{email}",
"Roles": [
"{role1}",
"{role2}"
]
}
}
| Property | Description |
|---|---|
| Type | Event type ("ProfileStatusUpdated") |
| RiskAssessmentId | Unique identifier for the associated risk assessment |
| SubmissionId | Submission identifier |
| Status | Always "Approved" |
| ClientRating | Customer segment rating, or "N/A" |
| ApprovedBy | The officer who approved the profile |
| ApprovedBy.Id | The id of the officer who approved |
| ApprovedBy.Name | The full name of the officer who approved |
| ApprovedBy.Email | The email of the officer who approved |
| ApprovedBy.Roles | The officer's roles |
The standard payload has no event id. If an officer approves a profile that is already approved, you receive the
event again, so handle it idempotently, for example by RiskAssessmentId.
All status changes payload
{
"EventId": "{EventId}",
"Type": "ProfileStatusUpdated",
"OccurredAtUtc": "{timestamp}",
"RiskAssessmentId": "{RiskAssessmentId}",
"SubmissionId": "{SubmissionId}",
"Status": "{Status}",
"PreviousStatus": "{PreviousStatus}",
"PendingState": "{PendingState}",
"Source": "{Source}",
"Reason": "{Reason}",
"ClientRating": "{ClientRating}",
"UpdatedBy": {
"Id": "{userId}",
"Name": "{fullName}",
"Email": "{email}",
"Roles": ["{role1}"]
},
"ApprovedBy": { "...": "same shape as UpdatedBy" }
}
| Property | Description | Values |
|---|---|---|
| EventId | Unique id for this event. Retries of the same delivery reuse it, so use it to discard duplicates | String (GUID) |
| Type | Event type | "ProfileStatusUpdated" |
| OccurredAtUtc | When the status changed (UTC). Use it to order events, since delivery order is not guaranteed | ISO 8601 timestamp |
| RiskAssessmentId | Unique identifier for the associated risk assessment | String |
| SubmissionId | Submission identifier | String |
| Status | The new status | "Pending", "Approved", "Rejected", "Frozen", "Expired", "Closed", "Dormant" (more may be added) |
| PreviousStatus | The status before the change. null when the profile has just been created | Same values as Status, or null |
| PendingState | The review stage. Only present when Status is "Pending" | "ComplianceReview", "InternalInfoMissing", "ClientInfoMissing" |
| Source | What made the change | "Manual" (an officer), "AutoApproval", "ExternalApproval", "System" (e.g. document expiry), "RiskRecalculation" (submission, KYC refresh, re-submission or a closed screening hit) |
| Reason | Why a system or recalculation change happened. Only present for those changes | e.g. "DocumentExpired", "JointAccountDocumentExpired", "ProfileSubmitted", "KycRefresh", "RiskRecalculated" |
| ClientRating | Customer segment rating | String, or "N/A" |
| UpdatedBy | The user who made or triggered the change. This is usually an officer, but for a recalculation it can be the customer (for example after a KYC refresh). null when the system made the change; Source tells you which | Object or null |
| UpdatedBy.Id / Name / Email / Roles | The user's id, full name, email and roles. Roles is empty if roles could not be loaded | |
| ApprovedBy | The same user as UpdatedBy. Only present when Status is "Approved", for compatibility with the standard payload. Use UpdatedBy | Object |
With All status changes, you receive an event only when the status actually changes. Re-saving a profile with the same status sends nothing.
A status can also go backwards. When a profile's risk is recalculated (a KYC refresh, a re-submission or a closed
screening hit), an approved, rejected or frozen profile returns to "Pending" for review. You then receive an event
with Source "RiskRecalculation" and PreviousStatus set to the old status.
Examples
Standard payload, approved by an officer:
{
"Type": "ProfileStatusUpdated",
"RiskAssessmentId": "1bf4f6ad-807d-45e4-8e8b-613e51203618",
"SubmissionId": "9dc1b390-4a35-4310-a85a-25e6bd7cd3f6",
"Status": "Approved",
"ClientRating": "Retail",
"ApprovedBy": {
"Id": "8392d3fb-ad15-43ca-8b9e-a7cbcf411067",
"Name": "Noelani Alfreda Boone William",
"Email": "tazixog@yopmail.com",
"Roles": [
"MLRO"
]
}
}
All status changes, rejected by an officer:
{
"EventId": "e4b0d2a8-6c1f-4f7e-9b2d-3a8c5e1f7b90",
"Type": "ProfileStatusUpdated",
"OccurredAtUtc": "2026-10-05T09:20:03.4127651Z",
"RiskAssessmentId": "1bf4f6ad-807d-45e4-8e8b-613e51203618",
"SubmissionId": "9dc1b390-4a35-4310-a85a-25e6bd7cd3f6",
"Status": "Rejected",
"PreviousStatus": "Pending",
"Source": "Manual",
"ClientRating": "Retail",
"UpdatedBy": {
"Id": "8392d3fb-ad15-43ca-8b9e-a7cbcf411067",
"Name": "Noelani Alfreda Boone William",
"Email": "tazixog@yopmail.com",
"Roles": ["MLRO"]
}
}
All status changes, frozen by the system because a document expired:
{
"EventId": "0f93c6e1-2d4b-4a8e-b7f1-9c3e6a2d5b48",
"Type": "ProfileStatusUpdated",
"OccurredAtUtc": "2026-10-05T02:00:41.6278678Z",
"RiskAssessmentId": "1bf4f6ad-807d-45e4-8e8b-613e51203618",
"SubmissionId": "9dc1b390-4a35-4310-a85a-25e6bd7cd3f6",
"Status": "Frozen",
"PreviousStatus": "Approved",
"Source": "System",
"Reason": "DocumentExpired",
"ClientRating": "Retail",
"UpdatedBy": null
}
NafathVerificationCompleted
When the NafathVerificationCompleted event is triggered, the body will contain the following fields:
{
"Type": "NafathVerificationCompleted",
"TransId": "{TransId}",
"Status": "{Status}"
}
Properties
| Property | Description | Values |
|---|---|---|
| Type | Event type | "NafathVerificationCompleted" |
| TransId | Transaction identifier from Nafath | String |
| Status | Verification status | "Completed", "Rejected" |
Example
{
"Type": "NafathVerificationCompleted",
"TransId": "abc123-def456-ghi789",
"Status": "Completed"
}
Notes
- This webhook is sent once, when the user approves or rejects the request in their Nafath mobile app, for requests made through the Nafath API
Statusis "Completed" or "Rejected" (note the casing: compare case-insensitively). Retrieve user details only for "Completed"- If you have not received a webhook, use the status endpoint to check the outcome
- You can use the
TransIdto retrieve full user details via the Nafath API - For more information on Nafath integration, see Nafath Identity Verification