Brevo Unsubscribe Webhook
Process unsubscribe requests from Brevo email campaigns to automatically revoke contact consents.
Endpoint
POST /api/v1/brevo/unsubscribe
Authentication
Requires bearer token authentication. See Authentication.
Request Format
Headers
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
Request Body
At least one of email or phone must be provided.
{
email?: string;
phone?: string;
}
Response Format
Success Response
{
"success": true,
"message": "Unsubscribe processed successfully"
}
HTTP Status: 200 OK
Error Response
{
"error": "ValidationError",
"message": "At least one of email or phone must be provided"
}
HTTP Status: 400 Bad Request
Behavior
When an unsubscribe request is processed:
- The system searches for all form submissions matching the provided email or phone number
- General contact consent is revoked for all matching submissions
- The user will not receive future email or phone communications based on general contact consent
Important: This endpoint only revokes general contact consent. It does not affect:
- Primary purpose consent
- Event-specific consents
- Other specialized consent types
Brevo Webhook Setup
To automatically process unsubscribes from Brevo:
- Log in to your Brevo account
- Navigate to Settings → Webhooks
- Create a new webhook with:
- URL:
https://api.statelessapp.com/api/v1/brevo/unsubscribe - Events: Select "Unsubscribed"
- Headers: Add
Authorization: Bearer YOUR_API_KEY
- URL:
- Save and test the webhook
Examples
Unsubscribe by Email
curl -X POST https://api.statelessapp.com/api/v1/brevo/unsubscribe \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"email": "user@example.com"
}'
Unsubscribe by Phone
curl -X POST https://api.statelessapp.com/api/v1/brevo/unsubscribe \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"phone": "+15551234567"
}'
Unsubscribe by Both
curl -X POST https://api.statelessapp.com/api/v1/brevo/unsubscribe \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"email": "user@example.com",
"phone": "+15551234567"
}'
Use Cases
- Email Unsubscribes: Automatically process unsubscribe requests from Brevo campaigns
- Phone Opt-Outs: Handle phone number opt-out requests
- Multi-Channel Unsubscribes: Process unsubscribes across both email and phone channels
- GDPR Compliance: Ensure immediate consent revocation in response to user requests
Notes
- Phone numbers should be in E.164 format (e.g.,
+15551234567) - The endpoint is idempotent - processing the same unsubscribe multiple times has no additional effect
- Unsubscribe actions are logged for audit purposes
- Processing is synchronous and completes before returning the response