Skip to main content

Customer Webhook Events

Receive notifications when customers are created, updated, or deleted.

Available Events

EventTrigger
customer.createdNew customer created
customer.updatedCustomer profile updated
customer.deletedCustomer deleted

customer.created

Triggered when a new customer is created.

Payload

{
  "id": "evt_abc123",
  "type": "customer.created",
  "created": "2024-01-20T14:30:00Z",
  "data": {
    "id": "cust_xyz789",
    "firstName": "John",
    "lastName": "Doe",
    "email": "[email protected]",
    "phone": "+1234567890",
    "loyaltyPoints": 0,
    "tags": [],
    "marketingConsent": true,
    "createdAt": "2024-01-20T14:30:00Z",
    "source": "web_app"
  }
}

Data Fields

id
string
Customer ID
firstName
string
First name
lastName
string
Last name
email
string
Email address
source
string
Where customer was created: web_app, api, booking_portal, import

Example Handler

case 'customer.created':
  const customer = event.data;
  
  // Sync to CRM
  await crm.createContact({
    externalId: customer.id,
    name: `${customer.firstName} ${customer.lastName}`,
    email: customer.email
  });
  
  // Send welcome email
  if (customer.marketingConsent) {
    await sendWelcomeEmail(customer.email);
  }
  break;

customer.updated

Triggered when customer profile is updated.

Payload

{
  "id": "evt_def456",
  "type": "customer.updated",
  "created": "2024-01-20T15:00:00Z",
  "data": {
    "id": "cust_xyz789",
    "firstName": "John",
    "lastName": "Doe",
    "email": "[email protected]",
    "phone": "+1234567890",
    "loyaltyPoints": 150,
    "tags": ["VIP"],
    "updatedAt": "2024-01-20T15:00:00Z"
  },
  "previousAttributes": {
    "email": "[email protected]",
    "loyaltyPoints": 100,
    "tags": []
  }
}

Additional Fields

previousAttributes
object
Previous values of changed fields

Example Handler

case 'customer.updated':
  const { data: customer, previousAttributes } = event;
  
  // Check what changed
  if (previousAttributes.email) {
    // Email changed - update in other systems
    await syncEmailChange(
      customer.id, 
      previousAttributes.email, 
      customer.email
    );
  }
  
  if (previousAttributes.tags && customer.tags.includes('VIP')) {
    // Customer became VIP
    await sendVIPWelcome(customer.email);
  }
  break;

customer.deleted

Triggered when customer is deleted.

Payload

{
  "id": "evt_ghi789",
  "type": "customer.deleted",
  "created": "2024-01-20T16:00:00Z",
  "data": {
    "id": "cust_xyz789",
    "deletedAt": "2024-01-20T16:00:00Z"
  }
}

Example Handler

case 'customer.deleted':
  const { id } = event.data;
  
  // Remove from external systems
  await crm.deleteContact(id);
  await emailService.unsubscribe(id);
  
  // Clean up related data
  await cleanupCustomerData(id);
  break;

Use Cases

CRM Synchronization

Keep your CRM in sync:
app.post('/webhooks/tiquo', async (req, res) => {
  res.status(200).send('OK');
  
  const event = req.body;
  
  switch (event.type) {
    case 'customer.created':
      await crm.create(event.data);
      break;
    case 'customer.updated':
      await crm.update(event.data.id, event.data);
      break;
    case 'customer.deleted':
      await crm.delete(event.data.id);
      break;
  }
});

Email List Management

Update marketing lists:
case 'customer.created':
  if (customer.marketingConsent) {
    await mailchimp.addSubscriber(customer.email);
  }
  break;

case 'customer.updated':
  if (previousAttributes.marketingConsent !== undefined) {
    if (customer.marketingConsent) {
      await mailchimp.subscribe(customer.email);
    } else {
      await mailchimp.unsubscribe(customer.email);
    }
  }
  break;

Analytics Tracking

Track customer lifecycle:
case 'customer.created':
  analytics.track('Customer Created', {
    customerId: customer.id,
    source: customer.source
  });
  break;