This webhook is triggered when a new user is created.
Payload
Copy
Ask AI
{ "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) }}
This webhook is triggered when a user’s email or phone number is successfully updated.
Payload
Copy
Ask AI
{ "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) }}
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:
Copy
Ask AI
// Example webhook handlerapp.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);});