Skip to main content

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

  1. Lead captured → User triggers an automation
  2. Webhook triggered → Lazyspond sends an HTTP POST request to your webhook URL
  3. Data received → Your system receives the lead data as JSON
  4. 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

  1. Go to Settings in your dashboard
  2. Click Integrations
  3. Click "Add Webhook"
  4. Paste your webhook URL
  5. Click "Test Webhook" to verify it works
  6. 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

FieldTypeDescription
eventstringAlways "lead.captured"
data.idstringUnique lead ID
data.usernamestringInstagram handle (without @)
data.display_namestringInstagram display name
data.platformstringAlways "instagram"
data.trigger_keywordstringKeyword that was triggered
data.trigger_typestring"story_reply" or "comment"
data.captured_atstringISO 8601 timestamp
data.profile_picture_urlstringURL 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

  1. Go to zapier.com
  2. Click "Create Zap"
  3. Choose Trigger: Webhooks by Zapier > Catch Raw Hook
  4. Copy the webhook URL provided by Zapier

Step 2: Configure Lazyspond Webhook

  1. Go to Lazyspond Settings > Integrations
  2. Add the Zapier webhook URL
  3. Test the webhook
  4. 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

  1. Go to make.com
  2. Click "Create a new scenario"
  3. Choose Webhooks > Custom Webhook
  4. Copy the webhook URL

Step 2: Configure Lazyspond Webhook

  1. Go to Lazyspond Settings > Integrations
  2. Add the Make webhook URL
  3. Test the webhook
  4. 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:

  1. In Lazyspond, click "Test Webhook"
  2. Check your server logs
  3. Verify the data was processed correctly

Webhook Limits

Webhooks are available on:

PlanAvailable?
Free❌ No
Starter✅ Yes
Pro✅ Yes
Premium✅ Yes

Free plan users need to upgrade to use webhooks.

Troubleshooting

Webhook Not Firing?

  1. Verify the webhook URL is correct — Go to Settings > Integrations and check
  2. Verify your endpoint is accessible — Test it manually with curl
  3. Check your server logs — Look for incoming requests
  4. Verify your automations are active — Paused automations won't trigger webhooks
  5. Check your monthly limit — You may have hit your reply limit

Webhook Firing But Data Is Wrong?

  1. Verify the payload structure — Check the JSON format
  2. Verify field names — Make sure you're accessing the right fields
  3. Test with sample data — Use Lazyspond's test webhook feature
  4. 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:

  1. Allow 5-10 seconds — Don't assume instant delivery
  2. Implement retry logic — Handle cases where the webhook arrives late
  3. 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:

  1. Go to Settings > Integrations
  2. Add multiple webhook URLs
  3. 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