Skip to main content

Public Cloud (Infra) Webhooks

Webhooks enable your applications to receive real-time notifications when events occur in your infrastructure and cloud resources. This eliminates the need for polling and ensures your systems stay synchronized with infrastructure changes, deployments, and resource modifications across all integrated platforms.

Unizo normalizes webhook events from AWS, Azure, Google Cloud, Terraform, Kubernetes, and other infrastructure providers into a consistent format. This means you write your webhook handler once and it works with all supported platforms.

Webhook Configuration

To set up webhooks for your integration, visit the Unizo Console Webhooks section for step-by-step configuration guide.

Supported Event Types

These are the event types currently supported by Unizo's Public Cloud (Infra) webhooks. The list keeps growing as we add support for more events across different platforms.

Event TypeDescriptionTrigger Conditions
resource:createdA new resource has been createdVM, container, database, or other resource creation
resource:updatedResource configuration has been modifiedConfiguration changes, scaling, or tag updates
resource:deletedA resource has been deletedResource termination or removal
deployment:startedDeployment process has startedApplication or infrastructure deployment initiation
deployment:completedDeployment successfully completedSuccessful deployment completion
deployment:failedDeployment failedDeployment errors or rollback
scaling:triggeredAuto-scaling event triggeredScale up or scale down based on metrics
maintenance:scheduledMaintenance window scheduledPlanned maintenance or updates
cost:alertCost threshold exceededBudget alerts or cost anomalies

Webhook Security

Every webhook request sent by Unizo includes a cryptographic signature so you can verify that the payload is authentic and has not been tampered with.

Security Headers

HeaderDescription
x-unizo-event-typeThe type of event that triggered the webhook
x-unizo-signatureHMAC-SHA256 signature of the payload, prefixed with v1= (e.g., v1=ee084789...)
x-unizo-timestampUnix epoch timestamp (seconds) when the request was signed
x-unizo-delivery-idUnique identifier for this webhook delivery

Signature Verification

The signed payload is constructed by joining the timestamp and the raw request body with a dot separator: {timestamp}.{payload}. This ensures the timestamp is covered by the signature, preventing replay attacks.

Verification Steps

  1. Parse the timestamp from the x-unizo-timestamp header and reject the request if it falls outside your tolerance window (recommended: 5 minutes).
  2. Reconstruct the signed payload by concatenating the timestamp, a literal dot (.), and the raw request body.
  3. Compute the expected signature using HMAC-SHA256 with your webhook signing secret as the key.
  4. Strip the v1= prefix from the x-unizo-signature header to get the received signature.
  5. Compare the two signatures using a constant-time comparison function to prevent timing attacks.

Reference Implementation

const crypto = require("crypto");

function verifyWebhookSignature(
  payload,
  signatureHeader,
  timestampHeader,
  secret,
  toleranceSeconds = 300
) {
  // 1. Reject stale timestamps to prevent replay attacks
  const now = Math.floor(Date.now() / 1000);
  const timestamp = parseInt(timestampHeader, 10);

  if (Number.isNaN(timestamp)) {
    return false;
  }

  if (Math.abs(now - timestamp) > toleranceSeconds) {
    return false;
  }

  // 2. Reconstruct the signed payload: "{timestamp}.{payload}"
  const signedPayload = `${timestamp}.${payload}`;

  // 3. Compute the expected signature
  const expected = crypto
    .createHmac("sha256", secret)
    .update(signedPayload)
    .digest("hex");

  // 4. Strip the "v1=" prefix from the received signature
  const received = signatureHeader.startsWith("v1=")
    ? signatureHeader.slice(3)
    : signatureHeader;

  // 5. Constant-time comparison to prevent timing attacks
  try {
    return crypto.timingSafeEqual(
      Buffer.from(expected, "hex"),
      Buffer.from(received, "hex")
    );
  } catch {
    return false;
  }
}

// Usage
const isValid = verifyWebhookSignature(
  rawBody,                                // raw request body string
  headers["x-unizo-signature"],           // "v1=ee084789..."
  headers["x-unizo-timestamp"],           // "1774093147"
  process.env.UNIZO_WEBHOOK_SECRET        // your signing secret
);

if (!isValid) {
  return res.status(401).json({ error: "Invalid signature" });
}

// Signature verified — process the event
handleEvent(JSON.parse(rawBody));

Event Details

Resource Events

Event TypeDescriptionTrigger Conditions
resource:createdA new resource has been createdVM, container, database, or other resource creation
resource:updatedResource configuration has been modifiedConfiguration changes, scaling, or tag updates
resource:deletedA resource has been deletedResource termination or removal

Resource Created

resource:created

Triggered when a new infrastructure resource is created
POSThttps://api.yourapp.com/webhooks/unizo/infrastructure
Headers
NameTypeRequiredDescription
Content-TypestringYesAlways application/json
x-unizo-event-typestringYesEvent type: resource:created
x-unizo-webhook-idstringYesUnique webhook configuration ID
x-unizo-delivery-idstringYesUnique delivery ID for idempotency
x-unizo-signaturestringYesHMAC-SHA256 signature, prefixed with v1=
Request Body Schema
PropertyTypeRequiredDescription
typestringYesEvent type identifier
versionstringYesWebhook payload version
resource.idstringYesUnique resource identifier
resource.namestringYesResource name
resource.typestringYesResource type (vm, container, database, etc.)
resource.regionstringYesDeployment region
resource.providerstringYesCloud provider
resource.configurationobjectYesResource configuration
resource.tagsobjectNoResource tags
resource.createdDateTimestringYesISO 8601 timestamp
resource.createdByobjectNoUser or system that created the resource
integrationobjectYesIntegration details
Example Payload
{
"type": "resource:created",
"version": "1.0.0",
"resource": {
"id": "i-1234567890abcdef0",
"name": "prod-web-server-01",
"type": "vm",
"region": "us-east-1",
"provider": "aws",
"configuration": {
"instanceType": "t3.medium",
"imageId": "ami-0123456789",
"vpcId": "vpc-12345",
"subnetId": "subnet-67890",
"securityGroups": [
"sg-web-prod"
]
},
"tags": {
"Environment": "production",
"Application": "web-app",
"Owner": "platform-team"
},
"createdDateTime": "2024-01-15T14:00:00Z",
"createdBy": {
"id": "user-123",
"email": "[email protected]",
"type": "user"
}
},
"integration": {
"type": "INFRASTRUCTURE",
"id": "int_123456",
"name": "AWS Production",
"provider": "aws"
}
}
Response
200 OKWebhook processed successfully
400 Bad RequestInvalid webhook payload
401 UnauthorizedInvalid or missing signature

Resource Updated

resource:updated

Triggered when a resource configuration is modified
POSThttps://api.yourapp.com/webhooks/unizo/scm
Headers
NameTypeRequiredDescription
Content-TypestringYesAlways application/json
x-unizo-event-typestringYesEvent type: resource:updated
x-unizo-webhook-idstringYesUnique webhook configuration ID
x-unizo-delivery-idstringYesUnique delivery ID for idempotency
x-unizo-signaturestringYesHMAC-SHA256 signature, prefixed with v1=
Request Body Schema
PropertyTypeRequiredDescription
typestringYesEvent type identifier
versionstringYesWebhook payload version
resource.idstringYesUnique resource identifier
resource.namestringYesResource name
resource.typestringYesResource type
resource.changesobjectYesObject containing changed fields
resource.updatedDateTimestringYesISO 8601 timestamp
resource.updatedByobjectNoUser or system that updated the resource
integrationobjectYesIntegration details
Example Payload
{
"type": "resource:updated",
"version": "1.0.0",
"resource": {
"id": "i-1234567890abcdef0",
"name": "prod-web-server-01",
"type": "vm",
"changes": {
"instanceType": {
"from": "t3.medium",
"to": "t3.large"
},
"tags": {
"added": {
"ScalingGroup": "web-asg-prod"
},
"removed": {},
"modified": {
"LastModified": {
"from": "2024-01-01",
"to": "2024-01-15"
}
}
}
},
"updatedDateTime": "2024-01-15T15:00:00Z",
"updatedBy": {
"id": "auto-scaling",
"type": "system"
}
},
"integration": {
"type": "INFRASTRUCTURE",
"id": "int_123456",
"name": "AWS Production",
"provider": "aws"
}
}
Response
200 OKWebhook processed successfully
400 Bad RequestInvalid webhook payload
401 UnauthorizedInvalid or missing signature

Resource Deleted

resource:deleted

Triggered when a resource is terminated or deleted
POSThttps://api.yourapp.com/webhooks/unizo/scm
Headers
NameTypeRequiredDescription
Content-TypestringYesAlways application/json
x-unizo-event-typestringYesEvent type: resource:deleted
x-unizo-webhook-idstringYesUnique webhook configuration ID
x-unizo-delivery-idstringYesUnique delivery ID for idempotency
x-unizo-signaturestringYesHMAC-SHA256 signature, prefixed with v1=
Request Body Schema
PropertyTypeRequiredDescription
typestringYesEvent type identifier
versionstringYesWebhook payload version
resource.idstringYesUnique resource identifier
resource.namestringYesResource name
resource.typestringYesResource type
resource.deletedDateTimestringYesISO 8601 timestamp
resource.deletedByobjectNoUser or system that deleted the resource
resource.reasonstringNoReason for deletion
integrationobjectYesIntegration details
Example Payload
{
"type": "resource:deleted",
"version": "1.0.0",
"resource": {
"id": "i-1234567890abcdef0",
"name": "prod-web-server-01",
"type": "vm",
"deletedDateTime": "2024-01-15T16:00:00Z",
"deletedBy": {
"id": "user-456",
"email": "[email protected]",
"type": "user"
},
"reason": "Instance replaced by new deployment"
},
"integration": {
"type": "INFRASTRUCTURE",
"id": "int_123456",
"name": "AWS Production",
"provider": "aws"
}
}
Response
200 OKWebhook processed successfully
400 Bad RequestInvalid webhook payload
401 UnauthorizedInvalid or missing signature

Deployment Events

Event TypeDescriptionTrigger Conditions
deployment:startedDeployment process has startedApplication or infrastructure deployment initiation
deployment:completedDeployment successfully completedSuccessful deployment completion
deployment:failedDeployment failedDeployment errors or rollback

Deployment Started

deployment:started

Triggered when a deployment process begins
POSThttps://api.yourapp.com/webhooks/unizo/scm
Headers
NameTypeRequiredDescription
Content-TypestringYesAlways application/json
x-unizo-event-typestringYesEvent type: deployment:started
x-unizo-webhook-idstringYesUnique webhook configuration ID
x-unizo-delivery-idstringYesUnique delivery ID for idempotency
x-unizo-signaturestringYesHMAC-SHA256 signature, prefixed with v1=
Request Body Schema
PropertyTypeRequiredDescription
typestringYesEvent type identifier
versionstringYesWebhook payload version
deployment.idstringYesUnique deployment identifier
deployment.namestringYesDeployment name
deployment.environmentstringYesTarget environment
deployment.versionstringYesApplication or configuration version
deployment.typestringYesDeployment type (rolling, blue-green, canary)
deployment.startedDateTimestringYesISO 8601 timestamp
deployment.initiatedByobjectYesUser or system that initiated deployment
integrationobjectYesIntegration details
Example Payload
{
"type": "deployment:started",
"version": "1.0.0",
"deployment": {
"id": "deploy-789",
"name": "web-app-v2.5.0",
"environment": "production",
"version": "2.5.0",
"type": "rolling",
"startedDateTime": "2024-01-15T14:00:00Z",
"initiatedBy": {
"id": "ci-system",
"name": "Jenkins Pipeline",
"type": "system"
}
},
"integration": {
"type": "INFRASTRUCTURE",
"id": "int_123456",
"name": "Kubernetes Production",
"provider": "kubernetes"
}
}
Response
200 OKWebhook processed successfully
400 Bad RequestInvalid webhook payload
401 UnauthorizedInvalid or missing signature

Deployment Completed

deployment:completed

Triggered when a deployment successfully completes
POSThttps://api.yourapp.com/webhooks/unizo/scm
Headers
NameTypeRequiredDescription
Content-TypestringYesAlways application/json
x-unizo-event-typestringYesEvent type: deployment:completed
x-unizo-webhook-idstringYesUnique webhook configuration ID
x-unizo-delivery-idstringYesUnique delivery ID for idempotency
x-unizo-signaturestringYesHMAC-SHA256 signature, prefixed with v1=
Request Body Schema
PropertyTypeRequiredDescription
typestringYesEvent type identifier
versionstringYesWebhook payload version
deployment.idstringYesUnique deployment identifier
deployment.namestringYesDeployment name
deployment.environmentstringYesTarget environment
deployment.versionstringYesApplication or configuration version
deployment.durationstringYesDeployment duration
deployment.completedDateTimestringYesISO 8601 timestamp
deployment.summaryobjectYesDeployment summary statistics
integrationobjectYesIntegration details
Example Payload
{
"type": "deployment:completed",
"version": "1.0.0",
"deployment": {
"id": "deploy-789",
"name": "web-app-v2.5.0",
"environment": "production",
"version": "2.5.0",
"duration": "5m32s",
"completedDateTime": "2024-01-15T14:05:32Z",
"summary": {
"nodesUpdated": 6,
"podsReplaced": 18,
"healthChecks": "passed",
"rollbackRequired": false
}
},
"integration": {
"type": "INFRASTRUCTURE",
"id": "int_123456",
"name": "Kubernetes Production",
"provider": "kubernetes"
}
}
Response
200 OKWebhook processed successfully
400 Bad RequestInvalid webhook payload
401 UnauthorizedInvalid or missing signature

Scaling Events

Event TypeDescriptionTrigger Conditions
scaling:triggeredAuto-scaling event triggeredScale up or scale down based on metrics

Scaling Triggered

scaling:triggered

Triggered when auto-scaling adjusts resource capacity
POSThttps://api.yourapp.com/webhooks/unizo/scm
Headers
NameTypeRequiredDescription
Content-TypestringYesAlways application/json
x-unizo-event-typestringYesEvent type: scaling:triggered
x-unizo-webhook-idstringYesUnique webhook configuration ID
x-unizo-delivery-idstringYesUnique delivery ID for idempotency
x-unizo-signaturestringYesHMAC-SHA256 signature, prefixed with v1=
Request Body Schema
PropertyTypeRequiredDescription
typestringYesEvent type identifier
versionstringYesWebhook payload version
scaling.resourceIdstringYesResource being scaled
scaling.resourceTypestringYesType of resource
scaling.directionstringYesScale direction: up or down
scaling.fromnumberYesPrevious capacity
scaling.tonumberYesNew capacity
scaling.metricobjectYesMetric that triggered scaling
scaling.triggeredDateTimestringYesISO 8601 timestamp
integrationobjectYesIntegration details
Example Payload
{
"type": "scaling:triggered",
"version": "1.0.0",
"scaling": {
"resourceId": "asg-web-prod",
"resourceType": "auto-scaling-group",
"direction": "up",
"from": 3,
"to": 5,
"metric": {
"name": "cpu_utilization",
"value": 85,
"threshold": 80,
"unit": "percent"
},
"triggeredDateTime": "2024-01-15T14:30:00Z"
},
"integration": {
"type": "INFRASTRUCTURE",
"id": "int_123456",
"name": "AWS Production",
"provider": "aws"
}
}
Response
200 OKWebhook processed successfully
400 Bad RequestInvalid webhook payload
401 UnauthorizedInvalid or missing signature

Cost Events

Event TypeDescriptionTrigger Conditions
cost:alertCost threshold exceededBudget alerts or cost anomalies

Cost Alert

cost:alert

Triggered when cloud costs exceed defined thresholds
POSThttps://api.yourapp.com/webhooks/unizo/scm
Headers
NameTypeRequiredDescription
Content-TypestringYesAlways application/json
x-unizo-event-typestringYesEvent type: cost:alert
x-unizo-webhook-idstringYesUnique webhook configuration ID
x-unizo-delivery-idstringYesUnique delivery ID for idempotency
x-unizo-signaturestringYesHMAC-SHA256 signature, prefixed with v1=
Request Body Schema
PropertyTypeRequiredDescription
typestringYesEvent type identifier
versionstringYesWebhook payload version
cost.alertIdstringYesCost alert identifier
cost.alertNamestringYesAlert name
cost.budgetnumberYesBudget amount
cost.actualnumberYesActual spend
cost.forecastnumberNoForecasted spend
cost.currencystringYesCurrency code
cost.periodstringYesBudget period
cost.triggeredDateTimestringYesISO 8601 timestamp
integrationobjectYesIntegration details
Example Payload
{
"type": "cost:alert",
"version": "1.0.0",
"cost": {
"alertId": "budget-123",
"alertName": "Monthly AWS Budget",
"budget": 10000,
"actual": 11250,
"forecast": 13500,
"currency": "USD",
"period": "2024-01",
"triggeredDateTime": "2024-01-15T12:00:00Z",
"breakdown": {
"compute": 6500,
"storage": 2500,
"network": 1500,
"other": 750
}
},
"integration": {
"type": "INFRASTRUCTURE",
"id": "int_123456",
"name": "AWS Billing",
"provider": "aws"
}
}
Response
200 OKWebhook processed successfully
400 Bad RequestInvalid webhook payload
401 UnauthorizedInvalid or missing signature

Webhook Delivery & Retries

Unizo implements automatic retry logic for failed webhook deliveries:

  1. Initial Delivery: Immediate
  2. First Retry: After 1 minute
  3. Second Retry: After 5 minutes
  4. Third Retry: After 15 minutes
  5. Final Retry: After 1 hour

Webhooks are considered failed if:

  • Your endpoint returns a non-2xx status code
  • Connection timeout (30 seconds)
  • SSL/TLS errors

Best Practices

1. Idempotency

Idempotent Webhook Handler

async function handleWebhook(request) {
const deliveryId = request.headers['x-unizo-delivery-id'];

// Check if already processed
if (await isProcessed(deliveryId)) {
  return { status: 200, message: 'Already processed' };
}

// Process webhook
await processWebhook(request.body);

// Mark as processed
await markProcessed(deliveryId);

return { status: 200 };
}

2. Async Processing

Asynchronous Processing

app.post('/webhooks/infrastructure', (req, res) => {
// Validate signature
if (!verifySignature(req)) {
  return res.status(401).send('Invalid signature');
}

// Queue for processing
infraQueue.add(req.body);

// Return immediately
res.status(200).send('OK');
});

3. Resource Tracking

Resource State Tracking

async function processResourceEvent(payload) {
const { resource, type } = payload;

switch (type) {
  case 'resource:created':
    await addToInventory(resource);
    await updateCostTracking(resource);
    break;
  
  case 'resource:updated':
    await updateInventory(resource);
    await checkComplianceRules(resource);
    break;
  
  case 'resource:deleted':
    await removeFromInventory(resource);
    await updateBilling(resource);
    break;
}

// Update CMDB
await updateCMDB(payload);
}

Need Help?

For webhook-related support: