G
SkunkGlobal
/Docs/CRM/Send Events to External Services

Send Events to External Services

Outgoing webhooks automatically notify external systems when important events happen in your SkunkCRM. Perfect for triggering automations, updating analytics, or syncing with other tools.

Quick Setup

1. Create a Webhook Subscription

  1. Go to SkunkCRM → Webhooks in your WordPress admin
  2. Click "Add Webhook"
  3. Configure:
    • Name: "n8n Lead Processing"
    • URL: Your webhook URL from n8n/Zapier/etc
    • Events: Select which CRM events to send
    • Authentication: Configure if needed

2. Choose Your Events

Select which SkunkCRM events should trigger the webhook:

Available Events

Contact Events

  • contact_created - New contact added to CRM
  • contact_updated - Contact information changed
  • contact_status_changed - Status changed (lead → customer, etc.)

Deal Events

  • deal_created - New deal created
  • deal_stage_changed - Deal moved between pipeline stages
  • deal_won - Deal marked as won
  • deal_lost - Deal marked as lost

Activity Events

  • email_sent - Email sent from CRM
  • email_opened - Email opened by recipient
  • email_clicked - Link clicked in email

Automation Events

  • automation_triggered - Automation workflow started
  • automation_completed - Automation workflow finished

Task Events

  • task_created - New task created
  • task_completed - Task marked complete

Webhook Payload Format

All outgoing webhooks send JSON in this standardized format:

{
  "event": "contact_created",
  "timestamp": "2025-01-09 14:30:00",
  "data": {
    "contact": {
      "id": 123,
      "name": "John Doe",
      "email": "john@example.com",
      "company": "Acme Corp",
      "status": "lead",
      "created_at": "2025-01-09 14:30:00"
    },
    "source": "api"
  },
  "context": {
    "request_source": "api",
    "user_id": 1
  },
  "source": {
    "system": "SkunkCRM",
    "version": "1.0",
    "url": "https://yoursite.com"
  }
}

Deal Won Example

{
  "event": "deal_won",
  "timestamp": "2025-01-09 15:45:00",
  "data": {
    "deal": {
      "id": 67,
      "title": "Website Redesign Project",
      "value": "15000.00",
      "status": "won",
      "contact_id": 123
    },
    "contact": {
      "id": 123,
      "name": "John Doe",
      "email": "john@example.com",
      "company": "Acme Corp"
    }
  },
  "source": {
    "system": "SkunkCRM",
    "version": "1.0",
    "url": "https://yoursite.com"
  }
}

Authentication Options

No Authentication

Simple webhooks without authentication headers.

Bearer Token

Header: Authorization: Bearer your-secret-token

API Key Header

Header: X-API-Key: your-api-key

Basic Authentication

Header: Authorization: Basic base64(username:password)

n8n Automation Platform

  1. Create Webhook Node in n8n:

    • Add "Webhook" trigger node
    • Copy the webhook URL
  2. Configure in SkunkCRM:

    • Name: "n8n Workflow"
    • URL: https://your-n8n.com/webhook/abc123
    • Events: contact_created, deal_won
  3. Process in n8n:

    // n8n JavaScript node example
    const webhookData = $input.json;
    
    if (webhookData.event === 'contact_created') {
      // Send welcome email
      // Add to mailing list
      // Notify sales team
    }
    
    if (webhookData.event === 'deal_won') {
      // Send to accounting system
      // Update customer success platform
    }
    

Zapier Integration

  1. Create Zap with "Webhooks by Zapier" trigger
  2. Copy webhook URL from Zapier
  3. Add to SkunkCRM webhooks with desired events
  4. Test and activate the integration

Make.com (formerly Integromat)

  1. Create Scenario with webhook trigger
  2. Configure webhook endpoint in Make.com
  3. Add webhook URL to SkunkCRM
  4. Map SkunkCRM events to Make.com actions

Custom Applications

For your own applications, simply create an endpoint that accepts POST requests:

// PHP example
$payload = json_decode(file_get_contents('php://input'), true);

if ($payload['event'] === 'contact_created') {
    $contact = $payload['data']['contact'];
    // Process new contact data
    syncToOtherSystem($contact);
}
// Node.js example
app.post('/skunkcrm-webhook', (req, res) => {
    const { event, data } = req.body;
    
    switch(event) {
        case 'contact_created':
            handleNewContact(data.contact);
            break;
        case 'deal_won':
            handleDealWon(data.deal, data.contact);
            break;
    }
    
    res.json({ received: true });
});

Testing Webhooks

Built-in Test Feature

  1. Go to your webhook in SkunkCRM admin
  2. Click "Test Webhook"
  3. SkunkCRM sends a test payload to verify connectivity

Sample test payload:

{
  "event": "webhook_test",
  "timestamp": "2025-01-09 14:30:00",
  "data": {
    "test": true,
    "webhook_id": 123,
    "webhook_name": "n8n Integration",
    "message": "This is a test webhook from SkunkCRM"
  },
  "source": {
    "system": "SkunkCRM",
    "version": "1.0",
    "url": "https://yoursite.com"
  }
}

Manual Testing with cURL

# Test your endpoint manually
curl -X POST "https://your-webhook-endpoint.com" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer your-token" \
  -d '{
    "event": "contact_created",
    "data": {
      "contact": {
        "name": "Test Contact",
        "email": "test@example.com"
      }
    }
  }'

Delivery & Reliability

Retry Logic

  • Failed deliveries are automatically retried
  • 3 retry attempts with exponential backoff
  • Permanent failure after 3 failed attempts

Delivery Logs

  • View delivery history in SkunkCRM admin
  • See success/failure status for each webhook
  • Debug failed deliveries with error messages

Monitoring

  • Webhook health dashboard shows delivery statistics
  • Alerts for consistently failing webhooks
  • Performance metrics for response times

Security Best Practices

Webhook Security

  1. Use HTTPS - Always use secure webhook URLs
  2. Validate signatures - Implement webhook signature validation if available
  3. IP allowlisting - Restrict to known IP addresses where possible
  4. Monitor logs - Watch for suspicious activity

Rate Limiting

  • Built-in rate limiting prevents spam
  • Webhooks are queued during high-traffic periods
  • Contact support for enterprise rate limits

Troubleshooting

Webhook Not Firing?

  1. Check webhook status - Ensure it's active in admin
  2. Verify events - Make sure selected events match actual CRM activity
  3. Review logs - Check WordPress error logs for issues
  4. Test manually - Use the built-in test feature

Authentication Failing?

  1. Double-check credentials - Verify tokens/passwords are correct
  2. Header format - Ensure authentication headers match expected format
  3. Test with curl - Manually test your endpoint

Timeout Issues?

  1. Optimize endpoint - Ensure your webhook endpoint responds quickly
  2. Increase timeout - Contact support for longer timeout limits
  3. Async processing - Process webhook data asynchronously in your application

Next Steps

  • Set up monitoring - Watch webhook delivery logs regularly
  • Implement error handling - Build robust error handling in your receiving systems
  • Scale your integrations - Connect multiple external systems as your business grows

::rest-api-banner::

Ready to get technical? For complete technical reference and advanced configuration options, consult the REST API section of your SkunkCRM WordPress plugin.

Was this page helpful?