11. Webhooks
Alex wants LexVault to be notified whenever a new client record is created.
Webhooks let your application receive real-time HTTP callbacks when events happen in your Eurobase project — database changes, user signups, file uploads, and more.
Setting up a webhook
Create a webhook
Go to the Webhooks page and click "Create Webhook". Enter a name and your endpoint URL.
Select events
Choose which events trigger the webhook: db.insert, db.update, db.delete, auth.signup, auth.signin, storage.upload, and more. You can also filter by table name.
Copy the signing secret
Each webhook gets a signing secret. Use it to verify that incoming requests genuinely come from Eurobase.
Monitor delivery history
The webhook detail page shows every delivery attempt with status code, response time, and payload. Failed deliveries are retried automatically.
Verifying signatures (Node.js)
import crypto from 'crypto'
function verifyWebhook(payload, signature, secret) {\
const expected = crypto
.createHmac('sha256', secret)
.update(payload)
.digest('hex')
return crypto.timingSafeEqual(
Buffer.from(signature),
Buffer.from(expected)
)
}
// In your Express handler:
app.post('/webhooks/eurobase', express.raw({ type: 'application/json' }), (req, res) => {\
const sig = req.headers['x-eurobase-signature']
if (!verifyWebhook(req.body, sig, process.env.WEBHOOK_SECRET)) {\
return res.status(401).send('Invalid signature')
}
const event = JSON.parse(req.body)
console.log('Received:', event.type, event.data)
res.sendStatus(200)
})