Overview
The customer.deleted webhook is triggered when a customer is deleted from your Metrifox account.
When It’s Triggered
This event is sent immediately after a customer is successfully deleted through:
- The Metrifox API (
DELETE /api/v1/customers/{customer_key})
- Any other customer deletion method
Payload Structure
{
"id": "550e8400-e29b-41d4-a716-446655440002",
"type": "customer.deleted",
"created_at": 1704067320000,
"data": {
"customer": {
"id": "123",
"customer_key": "cust_abc123",
"name": "John Doe",
"email": "john@example.com",
"tenant_id": "456",
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-01T00:00:00Z"
// ... other customer fields
}
}
}
Data Fields
The data.customer object contains the customer record as it existed before deletion, including:
id: Internal customer ID
customer_key: The unique customer key
name: Customer name
email: Customer email address
tenant_id: The tenant ID this customer belonged to
created_at: Timestamp when the customer was originally created
updated_at: Timestamp when the customer was last updated
- Additional custom fields as configured
Important: This webhook is sent before the customer is permanently deleted. Use this event to clean up related data in external systems before the customer record is removed from Metrifox.
Example Use Cases
- Remove customer data from external systems
- Archive customer records in your database
- Trigger cleanup workflows
- Update analytics and reporting systems