Webhooks
Webhooks allow Lazyspond to send real-time HTTP POST requests to your own backend or third-party services whenever a new lead is captured. This is perfect for integrating with your CRM, email list, or custom systems.
What Are Webhooks?
A webhook is a way for Lazyspond to automatically send data to another system in real-time.
How It Works
- Lead captured → User triggers an automation
- Webhook triggered → Lazyspond sends an HTTP POST request to your webhook URL
- Data received → Your system receives the lead data as JSON
- Action taken → Your system processes the data (add to CRM, send email, etc.)
All of this happens instantly, within seconds of the lead being captured.
Setting Up Webhooks
Step 1: Create a Webhook Endpoint
You need a URL that can receive HTTP POST requests. This could be:
- Your own backend server
- A third-party service like Zapier or Make
- A custom webhook service
Example webhook URL:
https://yourserver.com/lazyspond/webhook
Step 2: Configure Webhook in Lazyspond
- Go to Settings in your dashboard
- Click Integrations
- Click "Add Webhook"
- Paste your webhook URL
- Click "Test Webhook" to verify it works
- Click "Save"
Step 3: Start Receiving Data
Once configured, Lazyspond will automatically send lead data to your webhook URL whenever a lead is captured.
Webhook Payload
When a lead is captured, Lazyspond sends a POST request with this JSON payload:
{
"event": "lead.captured",
"data": {
"id": "ld_123456789",
"username": "sarah_fitness",
"display_name": "Sarah Johnson",
"platform": "instagram",
"trigger_keyword": "GUIDE",
"trigger_type": "story_reply",
"captured_at": "2024-03-22T14:30:00Z",
"profile_picture_url": "https://instagram.com/sarah_fitness/avatar.jpg"
}
}
Payload Fields
| Field | Type | Description |
|---|---|---|
event | string | Always "lead.captured" |
data.id | string | Unique lead ID |
data.username | string | Instagram handle (without @) |
data.display_name | string | Instagram display name |
data.platform | string | Always "instagram" |
data.trigger_keyword | string | Keyword that was triggered |
data.trigger_type | string | "story_reply" or "comment" |
data.captured_at | string | ISO 8601 timestamp |
data.profile_picture_url | string | URL to their profile picture |
Webhook Examples
Example 1: Add Lead to Email List
Webhook URL: https://yourserver.com/add-to-email-list
Your backend code (Node.js):
app.post('/add-to-email-list', (req, res) => {
const lead = req.body.data;
// Add to your email service
emailService.addContact({
email: lead.username + '@instagram.com',
name: lead.display_name,
source: 'lazyspond',
keyword: lead.trigger_keyword
});
res.json({ success: true });
});
Example 2: Create CRM Contact
Webhook URL: https://yourserver.com/create-contact
Your backend code (Python):
@app.route('/create-contact', methods=['POST'])
def create_contact():
lead = request.json['data']
# Create contact in your CRM
crm.create_contact({
'name': lead['display_name'],
'instagram_handle': lead['username'],
'source': 'lazyspond',
'keyword': lead['trigger_keyword'],
'captured_at': lead['captured_at']
})
return {'success': True}
Example 3: Send Slack Notification
Webhook URL: https://yourserver.com/notify-slack
Your backend code (Python):
@app.route('/notify-slack', methods=['POST'])
def notify_slack():
lead = request.json['data']
# Send Slack message
slack.send_message({
'channel': '#leads',
'text': f"New lead: {lead['display_name']} (@{lead['username']}) triggered {lead['trigger_keyword']}"
})
return {'success': True}
Using Webhooks with Zapier
Zapier makes it easy to connect Lazyspond to hundreds of apps without coding.
Step 1: Create a Zapier Zap
- Go to zapier.com
- Click "Create Zap"
- Choose Trigger: Webhooks by Zapier > Catch Raw Hook
- Copy the webhook URL provided by Zapier
Step 2: Configure Lazyspond Webhook
- Go to Lazyspond Settings > Integrations
- Add the Zapier webhook URL
- Test the webhook
- Save
Step 3: Set Up Zapier Actions
In your Zapier Zap, add actions like:
- Gmail: Send email to new leads
- Google Sheets: Add lead to spreadsheet
- Slack: Send notification to team
- HubSpot: Create contact in CRM
- Mailchimp: Add to email list
- Stripe: Create customer record
Example Zapier Zap
Trigger: Lazyspond webhook receives lead Action 1: Add to Google Sheets Action 2: Send email via Gmail Action 3: Send Slack notification
Using Webhooks with Make
Make (formerly Integromat) is another powerful automation platform.
Step 1: Create a Make Scenario
- Go to make.com
- Click "Create a new scenario"
- Choose Webhooks > Custom Webhook
- Copy the webhook URL
Step 2: Configure Lazyspond Webhook
- Go to Lazyspond Settings > Integrations
- Add the Make webhook URL
- Test the webhook
- Save
Step 3: Set Up Make Actions
Add actions to your scenario:
- Add to CRM
- Send email
- Create task
- Update spreadsheet
- Send notification
Webhook Best Practices
1. Verify Webhook Authenticity
Always verify that webhook requests are actually from Lazyspond:
// Check for Lazyspond signature header
const signature = req.headers['x-lazyspond-signature'];
if (!verifySignature(signature, req.body)) {
return res.status(401).json({ error: 'Unauthorized' });
}
2. Handle Errors Gracefully
Your webhook endpoint should return a 200 status code to confirm receipt:
app.post('/webhook', (req, res) => {
try {
// Process lead
processlead(req.body.data);
res.status(200).json({ success: true });
} catch (error) {
console.error(error);
res.status(500).json({ error: 'Internal server error' });
}
});
3. Implement Retry Logic
Lazyspond will retry failed webhooks up to 3 times. Make sure your endpoint is idempotent (safe to call multiple times):
// Use lead ID to prevent duplicates
const leadId = req.body.data.id;
if (await leadExists(leadId)) {
return res.status(200).json({ success: true }); // Already processed
}
4. Log All Webhooks
Keep a log of all webhook requests for debugging:
app.post('/webhook', (req, res) => {
console.log(`Webhook received: ${req.body.data.id}`);
// Process...
});
5. Test Before Going Live
Always test your webhook with sample data before deploying:
- In Lazyspond, click "Test Webhook"
- Check your server logs
- Verify the data was processed correctly
Webhook Limits
Webhooks are available on:
| Plan | Available? |
|---|---|
| Free | ❌ No |
| Starter | ✅ Yes |
| Pro | ✅ Yes |
| Premium | ✅ Yes |
Free plan users need to upgrade to use webhooks.
Troubleshooting
Webhook Not Firing?
- Verify the webhook URL is correct — Go to Settings > Integrations and check
- Verify your endpoint is accessible — Test it manually with curl
- Check your server logs — Look for incoming requests
- Verify your automations are active — Paused automations won't trigger webhooks
- Check your monthly limit — You may have hit your reply limit
Webhook Firing But Data Is Wrong?
- Verify the payload structure — Check the JSON format
- Verify field names — Make sure you're accessing the right fields
- Test with sample data — Use Lazyspond's test webhook feature
- Check your parsing code — Ensure you're parsing JSON correctly
Webhook Timing Issues?
Webhooks are sent within seconds of lead capture, but there can be slight delays:
- Allow 5-10 seconds — Don't assume instant delivery
- Implement retry logic — Handle cases where the webhook arrives late
- Use timestamps — Track when the lead was captured vs. when you received it
Advanced Webhook Usage
Multiple Webhooks
You can configure multiple webhook URLs to send data to different systems:
- Go to Settings > Integrations
- Add multiple webhook URLs
- Each URL will receive the same data
Use case: Send leads to both your CRM and your email service
Conditional Webhooks
Some webhook services (like Zapier) allow you to filter which leads trigger actions:
- Only send leads from specific keywords
- Only send leads from specific trigger types
- Only send leads during business hours
Custom Webhook Headers
Your webhook endpoint can include custom headers for authentication:
Authorization: Bearer YOUR_API_KEY
X-Custom-Header: custom-value
Contact support@lazyspond.com if you need to add custom headers.
Next Steps
- Integrate with Zapier: See Zapier Integration
- Integrate with Make: See Make Integration
- Track performance: Check Analytics & Metrics