Webhook Documentation
Learn how to integrate AllFives review notifications with your systems
Webhooks allow you to receive real-time notifications when customers leave reviews. This enables you to build integrations with your other systems like CRM, support desks, or custom applications.
How to Set Up
- Go to Settings and find the "Webhook Notifications" section
- Enter your webhook URL - this should be an endpoint on your server that can receive POST requests
- Save your settings
- Your server will now receive notifications whenever a new review is submitted
Webhook Payload Format
When a review is submitted, AllFives will send a POST request to your webhook URL with a JSON payload like this:
{
"event": "review.created",
"data": {
"id": "submission_123abc",
"timestamp": "2023-05-15T14:32:21Z",
"name": "John Smith",
"email": "john@example.com",
"rating": 5,
"feedback": "Great service! I really enjoyed working with your team.",
"business": {
"id": "business_456def",
"name": "ACME Corporation"
},
"link": {
"id": "link_789ghi",
"title": "Customer Feedback Survey"
}
}
}Implementation Examples
Node.js Example
// Express webhook handler
const express = require('express');
const app = express();
app.use(express.json());
app.post('/webhooks/allfives', (req, res) => {
try {
const { event, data } = req.body;
if (event === 'review.created') {
console.log('New review received:', data);
// Handle the review data
// For example, save to database, send notifications, etc.
// For demo purposes, let's log the rating and feedback
const { name, rating, feedback } = data;
console.log(`${name} rated you ${rating}/5: "${feedback}"`);
}
// Respond with success to acknowledge receipt
res.status(200).json({ success: true });
} catch (error) {
console.error('Error processing webhook:', error);
res.status(500).json({ error: 'Failed to process webhook' });
}
});
app.listen(3000, () => console.log('Webhook server running on port 3000'));PHP Example
<?php
// webhook-handler.php
header('Content-Type: application/json');
// Get the webhook payload
$payload = file_get_contents('php://input');
$data = json_decode($payload, true);
// Verify it's a review event
if ($data['event'] === 'review.created') {
$review = $data['data'];
// Log the review
error_log('New review received: ' . print_r($review, true));
// Process the review data
// For example, save to database, send notification emails, etc.
$name = $review['name'] ?? 'Anonymous';
$rating = $review['rating'] ?? 'No rating';
$feedback = $review['feedback'] ?? 'No feedback';
// In a real application, you would save this data to a database
// Example: saveReviewToDatabase($review);
// Return a success response
echo json_encode(['success' => true]);
} else {
http_response_code(400);
echo json_encode(['error' => 'Unsupported event type']);
}
?>Webhook Security Best Practices
- Verify the webhook source by checking for the
X-AllFives-Webhookheader - Use HTTPS for your webhook endpoint to ensure data is transmitted securely
- Implement retry logic in your webhook handler to handle temporary failures
- Add rate limiting to protect against potential abuse
- Keep your webhook URL private and regenerate it if it's ever exposed
Need Help?
If you need assistance setting up webhooks or have questions about integrating with your systems, please contact our support team. We're here to help you make the most of your AllFives subscription.
Note: Webhook notifications are a premium feature available only on Pro and Agency plans.