Webhooks Guide
Receive real-time event notifications from Drop Cowboy. Learn how to set up webhooks for message delivery, opt-outs, and campaign updates.
What Are Webhooks?
Webhooks allow Drop Cowboy to send real-time notifications to your application when events occur.
Real-Time Updates
Get instant notifications when messages are delivered, fail, or contacts opt out.
Automated Workflows
Trigger actions in your system automatically based on Drop Cowboy events.
Better Tracking
Keep your CRM and systems in sync with the latest message status.
Supported Events
Choose which events you want to receive webhooks for
Message Delivered
Sent when a message is successfully delivered to the recipient.
Message Failed
Sent when a message fails to deliver due to error or invalid number.
Opt-Out
Sent when a contact opts out or requests to be removed.
Campaign Paused
Sent when a campaign is paused or stopped by the system.
Campaign Scheduled
Sent when a campaign is scheduled for future delivery.
Campaign Completed
Sent when a campaign finishes sending all messages.
Setting Up Webhooks
Follow these steps to configure webhooks in your Drop Cowboy account
Create an Endpoint
Set up a publicly accessible URL in your application to receive webhook events. Your endpoint should accept POST requests and return a 200 status code.
Configure in Dashboard
Go to Settings > Webhooks in your Drop Cowboy dashboard. Enter your webhook URL and select which events you want to receive.
Verify Requests
Validate webhook signatures to ensure requests are coming from Drop Cowboy. Use your webhook secret key for verification.
Process Events
Handle incoming webhook events in your application. Update your database, trigger workflows, or send notifications based on event types.
Example Webhook Handler
Sample code for processing webhook events
import express from 'express';
import crypto from 'crypto';
const app = express();
app.use(express.json());
app.post('/webhook', (req, res) => {
const signature = req.headers['x-dropcowboy-signature'];
const payload = JSON.stringify(req.body);
// Verify webhook signature
const hash = crypto
.createHmac('sha256', process.env.WEBHOOK_SECRET)
.update(payload)
.digest('hex');
if (hash !== signature) {
return res.status(401).send('Invalid signature');
}
// Process event
const event = req.body;
switch (event.type) {
case 'message.delivered':
console.log('Message delivered:', event.data);
break;
case 'message.failed':
console.log('Message failed:', event.data);
break;
case 'contact.opted_out':
console.log('Contact opted out:', event.data);
break;
}
res.status(200).send('OK');
});
app.listen(3000); Additional Resources
Ready to set up webhooks?
Configure webhooks in your dashboard and start receiving real-time event notifications.