Webhook setup: receive real-time events
Webhook setup guide: configure webhooks to receive real-time notifications for messages, delivery status updates and campaign events in your own system.
Definition
What are Webhooks?
Before you start
Before you start
Make sure you have the following ready before configuring webhooks.
How it works
Open webhook settings
Navigate to Settings > Webhooks in your SendSeven dashboard and click "Add Endpoint" to create a new webhook configuration. Settings → Webhooks.

Add endpoint URL
Enter your HTTPS endpoint URL where SendSeven will POST webhook events. Select which event types you want to receive.
- URL: Your public HTTPS endpoint
- Events: Select which events to receive (16 available)
- Description: Optional note about this webhook
- Authorization Header (optional): Custom auth header sent with every delivery
Via the API you can also configure: retry_strategy (exponential/linear/none), max_retries (default 8, range 0–15), and timeout_seconds (default 10, can only be shortened)

Copy your secret key — shown only once
After saving, your webhook secret key appears immediately. This is the only time it will be displayed — copy it now and store it securely.

Keep This Secret!
Done!
Your webhook is now active. The detail page shows the endpoint URL, subscribed events, delivery history, and health status. From here you can re-verify the endpoint, send a test event, regenerate the secret, or delete the webhook at any time.

Set Up Your Webhook Endpoint
Express.js (Node.js)
// Express.js webhook handler
const express = require('express');
const crypto = require('crypto');
const app = express();
// Parse JSON bodies
app.use(express.json());
// Webhook endpoint
app.post('/webhooks/sendseven', (req, res) => {
// Handle verification challenge
if (req.body.type === 'sendseven_verification') {
console.log('Verification challenge received');
return res.status(200).json({ challenge: req.body.challenge });
}
// Verify signature (recommended)
const signature = req.headers['x-webhook-signature'];
const isValid = verifySignature(req.body, signature);
if (!isValid) {
return res.status(401).json({ error: 'Invalid signature' });
}
// Process the event envelope
const { type, data, id: eventId } = req.body;
switch (type) {
case 'message.received':
console.log('New message from:', data.message.from_id);
console.log('Text:', data.message.text);
break;
case 'message.sent':
case 'message.delivered':
case 'message.read':
console.log('Status update:', type, data.message.id);
break;
case 'message.failed':
console.log('Message failed:', data.message.meta);
break;
case 'email.opened':
case 'email.bounced':
case 'email.complained':
console.log('Email event:', type, data.email.id);
break;
case 'conversation.created':
case 'conversation.closed':
console.log('Conversation event:', type, data.conversation.id);
break;
case 'contact.created':
case 'contact.updated':
console.log('Contact event:', type, data.contact.id);
break;
case 'link.clicked':
console.log('Link clicked:', data.url);
break;
}
// Always respond with 200 OK
res.status(200).json({ received: true });
});
// Signature verification
function verifySignature(payload, signature) {
const secret = process.env.WEBHOOK_SECRET;
const expected = 'sha256=' + crypto
.createHmac('sha256', secret)
.update(JSON.stringify(payload))
.digest('hex');
return crypto.timingSafeEqual(
Buffer.from(signature || ''),
Buffer.from(expected)
);
}
app.listen(3000);Show Python (Flask) example
# Flask webhook handler
from flask import Flask, request, jsonify
import hmac
import hashlib
import os
app = Flask(__name__)
@app.route('/webhooks/sendseven', methods=['POST'])
def webhook():
payload = request.json
# Handle verification challenge
if payload.get('type') == 'sendseven_verification':
return jsonify({'challenge': payload['challenge']}), 200
# Verify signature (recommended)
signature = request.headers.get('X-Webhook-Signature')
if not verify_signature(request.data, signature):
return jsonify({'error': 'Invalid signature'}), 401
# Process the event envelope
event_type = payload.get('type')
data = payload.get('data')
if event_type == 'message.received':
msg = data.get('message', {})
print(f"New message from: {msg.get('from_id')}")
print(f"Text: {msg.get('text')}")
elif event_type in ('message.sent', 'message.delivered', 'message.read'):
msg = data.get('message', {})
print(f"Status update: {event_type} {msg.get('id')}")
elif event_type == 'message.failed':
msg = data.get('message', {})
print(f"Message failed: {msg.get('meta')}")
# Handle failure
# Always respond with 200 OK
return jsonify({'received': True}), 200
def verify_signature(payload, signature):
secret = os.environ.get('WEBHOOK_SECRET', '').encode()
expected = 'sha256=' + hmac.new(secret, payload, hashlib.sha256).hexdigest()
return hmac.compare_digest(signature or '', expected)
if __name__ == '__main__':
app.run(port=3000)Always Respond with 200
Webhook Verification
When you create a webhook or change its URL, SendSeven sends a verification challenge to confirm your endpoint is reachable and under your control. Your server must respond correctly before the webhook becomes active.
When Verification Happens
- Automatically when creating a webhook via the dashboard
- Automatically when creating a webhook via the API (POST /api/v1/webhook-endpoints)
- Automatically when the webhook URL is updated
- On-demand via the verify endpoint (POST /api/v1/webhook-endpoints/{id}/verify)
What Your Server Receives
SendSeven sends a POST request to your webhook URL with a verification challenge. The request includes an X-Sendseven-Event: verification header and a JSON body containing a unique challenge string.
// Verification challenge sent by SendSeven
// POST to your webhook URL
// Headers:
// Content-Type: application/json
// X-Sendseven-Event: verification
// Authorization: <your_configured_auth_header> (if set)
{
"type": "sendseven_verification",
"challenge": "a1b2c3d4e5f6789012345678abcdef01",
"webhook_id": "wh_abc123",
"timestamp": "2026-03-05T10:30:00Z"
}How Your Server Must Respond
Your server must respond with HTTP 200 and a JSON body that echoes back the challenge value. The challenge is a 32-character hex string.
// Your server must respond with HTTP 200
// and echo back the challenge value
{
"challenge": "a1b2c3d4e5f6789012345678abcdef01"
}5-Minute Expiry
No Signature Verification Needed
After Successful Verification
Once your server responds correctly, the webhook is automatically activated (is_active: true, is_verified: true) and will begin receiving events for the subscribed event types.
Programmatic Re-Verification
If you change the webhook URL or need to re-verify an endpoint, you can trigger verification programmatically via the API. This is useful for CI/CD pipelines or automated infrastructure setup.
# Manually trigger re-verification for a webhook
curl -X POST https://api.sendseven.com/api/v1/webhook-endpoints/{id}/verify \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"Test Verification Locally
Before deploying, you can simulate a verification challenge locally using cURL to make sure your handler responds correctly:
# Simulate a verification challenge locally
curl -X POST https://your-server.com/webhooks/sendseven \
-H "Content-Type: application/json" \
-H "X-Sendseven-Event: verification" \
-d '{
"type": "sendseven_verification",
"challenge": "a1b2c3d4e5f6789012345678abcdef01",
"webhook_id": "wh_test123",
"timestamp": "2026-03-05T10:30:00Z"
}'
# Expected response: {"challenge":"a1b2c3d4e5f6789012345678abcdef01"}Event Payload Reference
Below are complete payload examples for every webhook event type, organized by category. Each example shows the full envelope and data structure your endpoint will receive.
Full Schema Reference
Event Envelope
All webhook events share this wrapper structure. The data field contains the event-specific payload.
id — Unique event ID (use for deduplication)
type — Event type string (e.g., message.received)
created_at — ISO 8601 timestamp when the event occurred
tenant_id — Your tenant identifier
event_id — ID of the resource that triggered the event
data — Event-specific payload (varies by event type)
Message Events▼
message.received
Fired when an inbound message arrives from a customer on any messaging channel. Includes the full contact_methods[] array with all of the contact's identifiers.
{
"id": "evt_a1b2c3d4e5f67890",
"type": "message.received",
"created_at": "2026-03-05T10:30:00Z",
"tenant_id": "tenant_abc123",
"event_id": "msg_abc123",
"data": {
"message": {
"id": "msg_abc123",
"conversation_id": "conv_xyz789",
"platform": "whatsapp",
"channel_id": "ch_123",
"contact_id": "ct_456",
"contact_method_id": "cm_789",
"contact_method": {
"id": "cm_789",
"method_type": "whatsapp_id",
"value": "+1234567890",
"display_name": "+1234567890",
"is_primary": true
},
"direction": "inbound",
"message_type": "text",
"text": "Hello, I need help with my order",
"status": "received",
"created_at": "2026-03-05T10:30:00Z",
"from_id": "+1234567890",
"to_id": null,
"external_id": "wamid.abc123",
"meta": {}
},
"conversation": {
"id": "conv_xyz789",
"channel_id": "ch_123",
"contact_id": "ct_456",
"status": "open",
"created_at": "2026-03-05T10:29:00Z"
},
"contact": {
"id": "ct_456",
"name": "John Doe",
"email": "john@example.com",
"phone": "+1234567890",
"contact_methods": [
{ "id": "cm_789", "method_type": "whatsapp_id", "value": "1234567890", "is_primary": true },
{ "id": "cm_790", "method_type": "phone", "value": "+1234567890", "phone_type": "mobile", "is_primary": true },
{ "id": "cm_791", "method_type": "email", "value": "john@example.com", "is_primary": true }
]
}
}
}Show example with media attachment
The attachments array is only present when the message includes media. Each attachment includes a unique id, content_type, file_size, and two download URLs. Supported types: image, video, audio, document, sticker.
// When an image, video, or document is included,
// the "attachments" array contains structured objects.
{
"message_type": "image",
"text": "Check this out",
"attachments": [
{
"id": "att_abc123",
"type": "image",
"filename": "whatsapp_image_abc123.jpg",
"content_type": "image/jpeg",
"file_size": 245000,
"url": "https://api.sendseven.com/api/v1/attachments/att_abc123/download",
"signed_url": "https://storage.googleapis.com/...?X-Goog-Signature=..."
}
]
}Attachment URL types
- url — Stable API endpoint. Requires authentication (API key or session token). Never expires.
- signed_url — Pre-signed GCS URL. No authentication required. Expires after 24 hours.
- If the platform media download fails, the raw platform data is passed through with a "source": "platform" marker instead of the enriched fields. Non-file types (location, contacts, reactions) are not affected.
message.sent
Fired when an outbound message is successfully sent to the channel provider. The sent_at timestamp is populated and direction is outbound. When the message includes file attachments, the attachments array is included with the same enriched schema as inbound messages.
{
"id": "evt_b2c3d4e5f6a78901",
"type": "message.sent",
"created_at": "2026-03-05T10:31:00Z",
"tenant_id": "tenant_abc123",
"event_id": "msg_def456",
"data": {
"message": {
"id": "msg_def456",
"conversation_id": "conv_xyz789",
"platform": "whatsapp",
"direction": "outbound",
"message_type": "image",
"text": "Here is the invoice for your order.",
"status": "sent",
"sent_at": "2026-03-05T10:31:00Z",
"from_id": "+1987654321",
"to_id": "+1234567890",
"attachments": [
{
"id": "att_def456",
"type": "document",
"filename": "invoice_12345.pdf",
"content_type": "application/pdf",
"file_size": 184320,
"url": "https://api.sendseven.com/api/v1/attachments/att_def456/download"
}
]
},
"conversation": { "id": "conv_xyz789", "status": "open" },
"contact": { "id": "ct_456", "name": "John Doe" }
}
}Outbound messages that include file attachments contain the same enriched attachment schema (id, url, signed_url, content_type, file_size) as inbound messages.
message.failed
Fired when message delivery fails. Includes a separate error field at the data level with the failure reason.
{
"id": "evt_e5f6a7b8c9d01234",
"type": "message.failed",
"created_at": "2026-03-05T10:31:00Z",
"tenant_id": "tenant_abc123",
"event_id": "msg_ghi789",
"data": {
"message": {
"id": "msg_ghi789",
"conversation_id": "conv_xyz789",
"platform": "whatsapp",
"direction": "outbound",
"message_type": "text",
"text": "Your order #1234 has been shipped!",
"status": "failed",
"from_id": "+1987654321",
"to_id": "+1234567890"
},
"error": "Message undeliverable",
"conversation": { "id": "conv_xyz789", "status": "open" },
"contact": { "id": "ct_456", "name": "John Doe" }
}
}The error field is at the data level (not inside message.meta). The full conversation and contact objects are also included.
Email Events▼
Different Schema
email.received
Fired when an inbound email is received. Includes full email headers, body content (text and HTML), threading info, and any attachments.
{
"id": "evt_f6a7b8c9d0e12345",
"type": "email.received",
"created_at": "2026-03-05T10:29:00Z",
"tenant_id": "tenant_abc123",
"event_id": "em_abc123",
"data": {
"email": {
"id": "em_abc123",
"conversation_id": "conv_email_456",
"direction": "inbound",
"status": "delivered",
"subject": "Re: Order #12345",
"from_email": "john@example.com",
"from_name": "John Doe",
"to_emails": [
{ "email": "support@yourcompany.com", "name": "Support" }
],
"body_text": "Hi, I have a question about my order...",
"body_html": "<p>Hi, I have a question about my order...</p>",
"message_id": "<abc123@mail.example.com>",
"thread_id": "thread_xyz",
"integration_type": "aws_ses",
"attachment_count": 1,
"attachments": [
{ "filename": "invoice.pdf", "size": 245000 }
]
},
"conversation": {
"id": "conv_email_456",
"channel_id": "ch_email_01",
"contact_id": "ct_456",
"status": "open"
},
"contact": { "id": "ct_456", "name": "John Doe", "email": "john@example.com" }
}
}Email conversation objects include additional fields: email_integration_id and email_thread_id for threading context.
email.bounced
Fired when an outbound email bounces. Includes bounce_type (Permanent/Transient), bounce_subtype, and the list of bounced recipient addresses.
{
"id": "evt_a7b8c9d0e1f23456",
"type": "email.bounced",
"created_at": "2026-03-05T10:30:00Z",
"tenant_id": "tenant_abc123",
"data": {
"email": {
"id": "em_def456",
"direction": "outbound",
"status": "bounced",
"subject": "Your order confirmation",
"from_email": "support@yourcompany.com"
},
"bounce_type": "Permanent",
"bounce_subtype": "General",
"bounced_recipients": ["invalid@example.com"]
}
}email.opened
Fired when a recipient opens an email (via tracking pixel). Includes open_count with the cumulative number of opens.
{
"id": "evt_b8c9d0e1f2a34567",
"type": "email.opened",
"created_at": "2026-03-05T10:45:00Z",
"tenant_id": "tenant_abc123",
"data": {
"email": {
"id": "em_def456",
"direction": "outbound",
"subject": "Your order confirmation"
},
"open_count": 3,
"contact": { "id": "ct_456", "name": "John Doe" }
}
}Conversation Events▼
conversation.created
Fired when a new conversation is created. Includes the full conversation object with tags array and the associated contact.
{
"id": "evt_d0e1f2a3b4c56789",
"type": "conversation.created",
"created_at": "2026-03-05T10:29:00Z",
"tenant_id": "tenant_abc123",
"data": {
"conversation": {
"id": "conv_xyz789",
"channel_id": "ch_123",
"contact_id": "ct_456",
"status": "open",
"tags": []
},
"contact": { "id": "ct_456", "name": "John Doe" }
}
}conversation.closed
Fired when a conversation is closed. Includes closed_by with the user ID, a closed_at timestamp on the conversation, and the associated contact.
{
"id": "evt_f2a3b4c5d6e78901",
"type": "conversation.closed",
"created_at": "2026-03-05T11:00:00Z",
"tenant_id": "tenant_abc123",
"data": {
"conversation": {
"id": "conv_xyz789",
"status": "closed",
"closed_at": "2026-03-05T11:00:00Z"
},
"closed_by": { "id": "user_789" },
"contact": { "id": "ct_456", "name": "John Doe" }
}
}Contact Events▼
contact.created / contact.updated
Fired when a contact is created or updated. Both events share the same payload structure.
{
"id": "evt_b4c5d6e7f8a90123",
"type": "contact.created",
"created_at": "2026-03-05T10:29:00Z",
"tenant_id": "tenant_abc123",
"data": {
"contact": {
"id": "ct_456",
"name": "John Doe",
"email": "john@example.com",
"phone": "+1234567890",
"contact_methods": [
{ "method_type": "phone", "value": "+1234567890", "is_primary": true },
{ "method_type": "email", "value": "john@example.com", "is_primary": true }
]
}
}
}contact.updated uses the same structure as contact.created. The event type field distinguishes between them.
Link Tracking Events▼
link.clicked
Fired when a tracked link is clicked. Includes the original link details, click metadata (IP, device type, timestamp), and the associated contact.
{
"id": "evt_d6e7f8a9b0c12345",
"type": "link.clicked",
"created_at": "2026-03-05T10:50:00Z",
"tenant_id": "tenant_abc123",
"data": {
"link": {
"id": "lnk_abc123",
"short_code": "abc123",
"original_url": "https://example.com/offer"
},
"click": {
"ip_address": "203.0.113.42",
"device_type": "mobile",
"clicked_at": "2026-03-05T10:50:00Z"
},
"contact": { "id": "ct_456", "name": "John Doe" }
}
}Verify Webhook Signatures
Every webhook request includes an X-Webhook-Signature header in the format sha256=<hex>. This is a HMAC-SHA256 hash of the raw request body using your webhook secret (prefixed with whsec_).
Verification Steps:
- Get the raw request body (before parsing JSON)
- Compute HMAC-SHA256 using your webhook secret
- Prepend sha256= and compare with the X-Webhook-Signature header
- Use timing-safe comparison to prevent timing attacks
Security Best Practice
Retry Policy
If your endpoint doesn't respond with a 2xx status code within 10 seconds, we retry the delivery. Default schedule with exponential backoff:
| Attempt | Delay | Time from First Attempt |
|---|---|---|
| Attempt 2 | 5 s | 5 s |
| Attempt 3 | 10 s | 15 s |
| Attempt 4 | 30 s | 45 s |
| Attempt 5 | 2 min | 2 min 45 s |
| Attempt 6 | 5 min | 7 min 45 s |
| Attempt 7 | 10 min | 17 min 45 s |
| Attempt 8 | 30 min | ~48 min |
Failed Webhooks
Circuit Breaker
Configurable Options
Testing Your Webhook
Test your webhook endpoint locally using cURL:
# Test your webhook endpoint
curl -X POST https://your-server.com/webhooks/sendseven \
-H "Content-Type: application/json" \
-H "X-Webhook-Signature: sha256=test-signature" \
-d '{
"id": "evt_test123",
"type": "message.received",
"created_at": "2026-03-05T10:30:00Z",
"tenant_id": "tenant_test",
"event_id": "msg_test123",
"data": {
"message": {
"id": "msg_test123",
"conversation_id": "conv_test456",
"platform": "whatsapp",
"direction": "inbound",
"message_type": "text",
"text": "Test message",
"status": "received",
"from_id": "+1234567890"
},
"contact": {
"id": "ct_test",
"name": "Test User",
"phone": "+1234567890"
}
}
}'Troubleshooting
Webhook not receiving events▼
Check that:
- Your URL is publicly accessible (not localhost)
- Your SSL certificate is valid (not self-signed)
- Your server allows POST requests
- There's no firewall blocking SendSeven's IPs
Signature verification failing▼
Common issues:
- Using parsed JSON instead of raw body
- Wrong webhook secret (copy again from settings)
- Middleware modifying the request body
- Encoding issues (ensure UTF-8)
Receiving duplicate events▼
This can happen if your server responds slowly. To handle duplicates:
- Store the event ID and check for duplicates before processing
- Make your event handlers idempotent
- Respond with 200 as quickly as possible (process async)
What you can do
Real-Time Events
Instant HTTP notifications when messages arrive, conversations close, or contacts change.
HMAC-SHA256 Signed
Every webhook request is cryptographically signed so you can verify it came from SendSeven.
Automatic Retry
Failed deliveries are retried automatically with exponential backoff: up to 8 attempts within about 48 minutes.
Delivery Logs
Full delivery history with status codes, timestamps, and retry details for every webhook event.
Frequently Asked Questions
What events can I subscribe to?
How does webhook retry work?
How do I verify webhook signatures?
What's the webhook payload format?
Can I configure multiple webhook endpoints?
How do I test my webhook endpoint?
What if my endpoint is temporarily unavailable?
Ready to get started?
Start with 100 test messages. Full access during the trial. No credit card required.