> ## Documentation Index
> Fetch the complete documentation index at: https://crossmint-wallets-docs-2-5.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# User Webhooks

> Crossmint provides webhooks to notify your application about important user-related events. Below are the details of the available webhooks

### Webhook Events

#### `users.created`

This webhook is triggered when a new user is created.

##### Payload

```json theme={null}
{
    "type": "users.created",
    "status": "success",
    "data": {
        "userId": "123", // User's identifier
        "email": "test@test.com", // Optional (if user was created with email)
        "phoneNumber": "123456789" // Optional (if user was created with phone number)
    }
}
```

#### `users.updated`

This webhook is triggered when a user's email or phone number is successfully updated.

##### Payload

```json theme={null}
{
    "type": "users.updated",
    "status": "success",
    "data": {
        "actionId": "1234", // Update action identifier
        "userId": "123", // User identifier
        "oldEmail": "test@test.com", // Optional (if user was created with email)
        "newEmail": "test2@test2.com", // Optional (if user was created with email)
        "oldPhoneNumber": "123456789", // Optional (if user was created with phone number)
        "newPhoneNumber": "987654321" // Optional (if user was created with phone number)
    }
}
```

### Handling Webhooks

To handle webhooks, you need to set up an endpoint in your application that can receive HTTP POST requests from Crossmint. Here's an example of how you might handle a webhook in a Node.js application:

```javascript theme={null}
// Example webhook handler
app.post("/webhooks", (req, res) => {
    const event = req.body;

    switch (event.type) {
        case "users.created":
            handleUserCreated(event.data);
            break;
        case "users.updated":
            handleUserUpdated(event.data);
            break;
        default:
            console.log(`Unhandled event type: ${event.type}`);
    }

    res.sendStatus(200);
});
```
