Webhooks
Receive real-time notifications about events in your LeadNest account.
Overview
Webhooks allow you to receive HTTP callbacks when specific events occur, enabling real-time integrations with your systems.
Setting Up Webhooks
- Go to Settings → Webhooks
- Click "Add Webhook"
- Enter your endpoint URL
- Select events to subscribe to
- Save and test
Available Events
Email Events
email.sent- Email sent successfullyemail.delivered- Email delivered to inboxemail.opened- Email opened by recipientemail.clicked- Link clicked in emailemail.bounced- Email bouncedemail.unsubscribed- User unsubscribedemail.spam- Marked as spam
SMS Events
sms.sent- SMS sentsms.delivered- SMS deliveredsms.failed- SMS delivery failedsms.replied- User replied to SMS
WhatsApp Events
whatsapp.sent- Message sentwhatsapp.delivered- Message deliveredwhatsapp.read- Message readwhatsapp.replied- User replied
Subscriber Events
subscriber.created- New subscriber addedsubscriber.updated- Subscriber data updatedsubscriber.deleted- Subscriber removed
Webhook Payload
Example webhook payload:
{
"event": "email.opened",
"timestamp": "2024-01-15T10:30:00Z",
"data": {
"message_id": "msg_abc123",
"campaign_id": "camp_xyz789",
"email": "user@example.com",
"opened_at": "2024-01-15T10:30:00Z",
"user_agent": "Mozilla/5.0...",
"ip_address": "192.168.1.1"
}
}
Security
Verify webhook authenticity:
- Check the
X-LeadNest-Signatureheader - Use HMAC SHA256 with your webhook secret
- Verify timestamp to prevent replay attacks
Signature Verification (Node.js)
const crypto = require('crypto');
function verifyWebhook(payload, signature, secret) {
const hmac = crypto.createHmac('sha256', secret);
const digest = hmac.update(payload).digest('hex');
return crypto.timingSafeEqual(
Buffer.from(signature),
Buffer.from(digest)
);
}
Best Practices
- Respond with 200 OK quickly (process async)
- Implement retry logic for failed webhooks
- Use HTTPS endpoints only
- Verify webhook signatures
- Log all webhook events
- Handle duplicate events (idempotency)
Testing Webhooks
Test your webhook endpoint:
- Use the "Send Test" button in dashboard
- Check webhook logs for delivery status
- View request/response details
- Retry failed deliveries
Coming Soon Features
We're constantly working on new features to help you scale your communications. Here's what's currently in development:
AI Lead Scoring
Predictive Optimization
Multi-language Bots
Expanded CRM Sync
Need Help Getting Started?
Book a personalized demo with our team and discover how LeadNest can transform your communication strategy.