# Customer Events

Customer webhooks allow you to track changes to user profiles, including name changes, email updates, badge assignments, and account lifecycle (creation, updates, and deletion).

#### Available Events

-   `customer.firstName.updated` Triggered when the first name is modified. 
-   `customer.lastName.updated` Triggered when the last name is modified. 
-   `customer.email.updated` Triggered when an existing email is updated. 
-   `customer.email.added` Triggered when a new email is added to a profile. 
-   `customer.account.added` Triggered when a customer account is created. 
-   `customer.account.updated` Triggered when an account changes: profile, badges, e-wallet balance, or activation status (enable/disable). 
-   `customer.account.deleted` Triggered when a customer account is archived (removed from the referential). 
-   `customer.badgeNumber.updated` Triggered when the badge number (RFID/NFC) is changed. 
-   `customers.imported` Triggered when a customer is imported via external tools. 

### Payload Examples

##### Badge Update

```json
{
  "brandId": 10,
  "siteId": "22ED2E",
  "customerId": 8,
  "badgeNumber": "74195",
  "eventType": "customer.badgeNumber.updated"
}
```

##### Email Update

```json
{
  "brandId": 10,
  "siteId": "22ED2E",
  "customerId": 8,
  "email": "john.doe@example.com",
  "eventType": "customer.email.updated"
}
```

##### Name Update

```json
{
  "brandId": 10,
  "siteId": "22ED2E",
  "customerId": 8,
  "firstName": "John",
  "eventType": "customer.firstName.updated"
}
```

##### Import Event

```json
{
  "brandId": 10,
  "siteId": "22ED2E",
  "customerId": 8,
  "eventType": "customers.imported"
}
```

##### Account Created / Updated

```json
{
  "brandId": 10,
  "siteId": "22ED2E",
  "customerId": 8,
  "email": "john.doe@example.com",
  "balance": 675,
  "accountPaymentType": "PREPAYMENT",
  "lastSeenAt": "2026-03-25T12:32:00.000Z",
  "disabledAt": null,
  "badges": [
    { "value": "3994260718", "type": "classic", "isBlocked": false }
  ],
  "eventType": "customer.account.added"
}
```

##### Account Deleted

```json
{
  "brandId": 10,
  "siteId": "22ED2E",
  "customerId": 8,
  "eventType": "customer.account.deleted"
}
```

Account events carry a full snapshot. Every `customer.account.added` and `customer.account.updated` delivery contains the complete account state at the time of the change (email, balance, payment type, badges, activation status), regardless of which field triggered it. A disabled account is signalled by a non-null `disabledAt`; a `customer.account.deleted` event carries only the identifiers.

### Field Reference

| Field | Type | Description |
| --- | --- | --- |
| brandId | Integer | The unique identifier of the brand. |
| siteId | String | External identifier of the site (restaurant). |
| customerId | Integer | The unique identifier of the customer. |
| eventType | String | The specific event name (e.g., `customer.email.updated`). |
| firstName | String | Present in name update events. |
| lastName | String | Present in name update events. |
| email | String | Present in email update/add events. |
| badgeNumber | String | Present in badge update events. |
| balance | Integer | Present in `customer.account.added`/`updated` events. Current e-wallet balance, in cents. |
| accountPaymentType | String | Present in `customer.account.added`/`updated` events. One of `PREPAYMENT`, `POSTPAYMENT`, `CASH`, or `null`. |
| lastSeenAt | String | Present in `customer.account.added`/`updated` events. ISO 8601 (UTC) timestamp of the last activity, or `null`. |
| disabledAt | String | Present in `customer.account.added`/`updated` events. ISO 8601 (UTC) timestamp when the account was disabled, or `null` when active. |
| badges | Array | Present in `customer.account.added`/`updated` events. Each item is `{ value, type, isBlocked }` (`type` is `classic` or `toqla`). |
