Call Tracking Metrics - Webhooks
📖 Overview
Webhook integration enables real-time call event notifications from Call Tracking Metrics. The system supports webhook creation and processes incoming call update events for campaign tracking.
Source Files:
- Controller:
external/Integrations/CallTrackingMetrics/Controllers/webhooks.js - Provider:
external/Integrations/CallTrackingMetrics/Providers/call-webhook.js - Routes:
external/Integrations/CallTrackingMetrics/Routes/webhooks.js
External API: CTM Webhook Management API
🔧 Key Functions
createWebhook(req, res, next)
Purpose: Create webhook for call event notifications
Endpoint: POST /v1/e/calltrackingmetrics/:tokenId/webhook
Parameters:
req.body.campaign_id(String) - DashClicks campaign IDreq.body.calltracking_account_id(String) - CTM account IDreq.tokenId(String) - Credential document ID
Returns: Webhook configuration
{
"success": true,
"message": "SUCCESS",
"data": {
"webhook_id": "web_123",
"url": "https://dashclicks.com/api/webhooks/ctm",
"events": ["call.completed"],
"status": "active"
}
}
Business Logic:
- Validate account access
- Retrieve CTM credentials
- Call provider to create webhook in CTM
- Link webhook to DashClicks campaign
- Return webhook details
Webhook Event Processing
Public Endpoint: POST /v1/e/calltrackingmetrics/webhook/call-update
Purpose: Receive and process call update events from CTM
Webhook Payload Example:
{
"event": "call.completed",
"call": {
"id": "call_123",
"tracking_number": "+15559876543",
"caller_number": "+15551234567",
"duration": 180,
"status": "answered",
"start_time": "2023-10-01T14:30:00Z",
"source": "google",
"campaign": "Fall Promotion"
}
}
Processing Steps:
- Validate webhook signature (if configured)
- Extract call data from payload
- Update DashClicks campaign metrics
- Store call data for reporting
- Trigger notifications if configured
🔄 Webhook Event Types
| Event | Description |
|---|---|
call.completed | Call has ended and data is final |
call.received | New call received (real-time) |
call.updated | Call data updated |
🔐 Webhook Security
Authentication: Optional webhook signatures for verification
URL Pattern: https://dashclicks.com/api/v1/e/calltrackingmetrics/webhook/call-update
IP Whitelist: Consider whitelisting CTM webhook IPs
⚠️ Important Notes
- 🔔 Real-time Events: Webhooks provide immediate call notifications
- 📊 Campaign Attribution: Links calls to DashClicks campaigns
- 🔐 Public Endpoint: Webhook receiver is publicly accessible
- ⚡ Performance: Process webhooks asynchronously for reliability
- 🔄 Retry Logic: CTM retries failed webhook deliveries
- 📝 Event Logging: Store webhook events for debugging
🔗 Related Documentation
- Integration Overview: Call Tracking Metrics
- Authentication: Credential Management
- Calls: Call Tracking & Analytics
- CTM Webhooks: CTM Webhook Documentation