Skip to main content

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 ID
  • req.body.calltracking_account_id (String) - CTM account ID
  • req.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:

  1. Validate account access
  2. Retrieve CTM credentials
  3. Call provider to create webhook in CTM
  4. Link webhook to DashClicks campaign
  5. 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:

  1. Validate webhook signature (if configured)
  2. Extract call data from payload
  3. Update DashClicks campaign metrics
  4. Store call data for reporting
  5. Trigger notifications if configured

🔄 Webhook Event Types

EventDescription
call.completedCall has ended and data is final
call.receivedNew call received (real-time)
call.updatedCall 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

💬

Documentation Assistant

Ask me anything about the docs

Hi! I'm your documentation assistant. Ask me anything about the docs!

I can help you with:
- Code examples
- Configuration details
- Troubleshooting
- Best practices

Try asking: How do I configure the API?
09:30 AM