Webhooks
Overview
Webhooks allow external services to be notified when certain events occur in our system. This documentation covers how to set up a webhook to receive notifications when a lead is saved.
Webhook Configuration
Basic Setup
-
Name your webhook
Provide a unique name for your webhook (e.g., "Lead Tracking Webhook") -
Notification URL
Enter the URL where we should send notifications (e.g.,https://your-service.com/webhooks/leads
) -
HTTP Method
Select the HTTP method used to send the webhook (typically POST) -
Headers (Optional)
Add any required headers as key/value pairs (e.g., Authorization tokens) -
Webhook Status
Enable or disable the webhook as needed
Supported Events
Currently, we support the following event:
save_lead
: Triggered when a new lead is saved or an existing lead is updated
Notification Payload
When a save_lead
event occurs, your webhook will receive a POST request with the following JSON payload:
{ "data": { "email": "", "company": "", "first_name": "", "last_name": "", "phone": "", "website": "", "position": "", "twitter": "", "linkedin": "", "notes": "", "score": 0 } }json
Field Descriptions
Field | Type | Description |
---|---|---|
string | Lead's email address | |
website | string | Website URL |
company | *string | Company name |
first_name | *string | Lead's first name |
last_name | *string | Lead's last name |
phone | *string | Phone number |
position | *string | Job position |
*string | Twitter handle | |
*string | LinkedIn profile URL | |
notes | *string | Additional notes about the lead |
score | integer | Lead score (numeric value) |
Example Implementation
Here's an example of how you might handle the webhook in a Node.js application:
const express = require("express"); const app = express(); app.post("/webhooks/leads", express.json(), (req, res) => { const leadData = req.body.data; console.log("Received new lead:", leadData); // Process the lead data here res.status(200).send("Webhook received"); }); app.listen(3000, () => { console.log("Webhook server listening on port 3000"); });javascript
Best Practices
- Always validate the incoming webhook data
- Implement proper error handling
- Consider adding authentication (e.g., via headers)
- Respond quickly (within a few seconds) to avoid timeout issues
- Implement retry logic for failed webhook deliveries