Getting Started
Learn how to set up and use webhooks for order notifications
Webhooks allow your application to receive real-time notifications when events occur in the order management system. When an event is triggered, we send an HTTP POST request to your configured endpoint with event details.
Prerequisites
Before you begin, ensure you have:
- A publicly accessible HTTPS endpoint
- Ability to verify HMAC-SHA256 signatures
- A webhook secret key (provided when you create a webhook)
Step 1: Create a Webhook Endpoint
Your webhook endpoint should accept POST requests and return a 200 status code quickly (within 30 seconds).
Example Endpoint (Node.js/Express)
const express = require('express');
const crypto = require('crypto');
const app = express();
app.use(express.json());
app.post('/webhooks/orders', (req, res) => {
// Verify signature (see Step 2)
const signature = req.headers['x-webhook-signature'];
if (!verifySignature(req.body, signature)) {
return res.status(401).json({ error: 'Invalid signature' });
}
// Process webhook
const { event, data } = req.body;
console.log(`Received ${event} event:`, data);
// Respond quickly
res.status(200).json({ received: true });
// Process asynchronously
processWebhook(event, data).catch(console.error);
});
app.listen(3000);Example Endpoint (Python/Flask)
from flask import Flask, request, jsonify
import hmac
import hashlib
import json
app = Flask(__name__)
@app.route('/webhooks/orders', methods=['POST'])
def webhook():
# Verify signature
signature = request.headers.get('X-Webhook-Signature')
if not verify_signature(request.json, signature):
return jsonify({'error': 'Invalid signature'}), 401
# Process webhook
payload = request.json
event = payload['event']
data = payload['data']
print(f'Received {event} event')
# Respond quickly
return jsonify({'received': True}), 200
if __name__ == '__main__':
app.run(port=3000)Step 2: Verify Webhook Signatures
Every webhook request includes an X-Webhook-Signature header containing an HMAC-SHA256 signature. You must verify this signature to ensure the request came from our servers.
Signature Verification (Node.js)
function verifySignature(payload, signature, secret) {
const expectedSignature = crypto
.createHmac('sha256', secret)
.update(JSON.stringify(payload))
.digest('hex');
return crypto.timingSafeEqual(
Buffer.from(signature),
Buffer.from(expectedSignature)
);
}Signature Verification (Python)
import hmac
import hashlib
import json
def verify_signature(payload, signature, secret):
expected = hmac.new(
secret.encode(),
json.dumps(payload, separators=(',', ':')).encode(),
hashlib.sha256
).hexdigest()
return hmac.compare_digest(signature, expected)Step 3: Register Your Webhook
Settings › Webhooks Open Webhooks-
Click Create Webhook.
-
Enter your webhook details:
- Name: A descriptive name for your webhook
- Webhook URL: Your HTTPS endpoint URL
- Events: Select which events to receive:
order.created- New ordersorder.updated- Order modificationsorder.deleted- Order deletionsmessage.received- Customer messages on any channelmessage.sent- Messages sent to customers on any channelmessage.postback,message.reaction,conversation.referral,message.read- Button taps, reactions, ad / link referrals and read receiptsticket.tagged,conversation.tagged- Tags added to a ticket or a conversation
-
Click Create Webhook. We generate the webhook's signing secret for you.
-
Copy the secret with Copy Secret in the webhook list, or open the webhook and copy its Signing Secret. This is the
secretyour code from Step 2 uses.
Step 4: Handle Webhook Events
Your endpoint will receive POST requests with this structure:
{
"event": "order.created",
"timestamp": "2026-02-15T10:30:00.000Z",
"data": {
// Order data (see event documentation)
}
}Event Types
-
order.created - Triggered when a new order is created
-
order.updated - Triggered when an order is modified
-
order.deleted - Triggered when an order is deleted
-
message.received - Triggered when a customer sends a message on any channel. See Message Received
-
message.sent - Triggered when a message is sent to a customer on any channel. See Message Sent
-
message.postback - Triggered when a customer taps Get Started, a menu item or a postback button. See Button Tapped
-
message.reaction - Triggered when a customer reacts to a message. See Message Reaction
-
conversation.referral - Triggered when a customer opens a conversation from an ad or link without a message. See Ad or Link Referral
-
message.read - Triggered when a customer sees a message you sent. See Message Seen
-
ticket.tagged - Triggered when a tag is added to a ticket by the tags API or a team member. See Ticket and Conversation Tagged
-
conversation.tagged - Triggered when a team member adds a tag to a conversation. See Ticket and Conversation Tagged
See the individual event documentation for detailed payload structures.
Best Practices
1. Respond Quickly
Return a 200 status code within 30 seconds. If you need to perform time-consuming operations, do them asynchronously after responding.
app.post('/webhook', async (req, res) => {
// Verify signature
// ...
// Respond immediately
res.status(200).json({ received: true });
// Process asynchronously
processWebhook(req.body).catch(console.error);
});2. Handle Idempotency
The same webhook may be sent multiple times. Use the order ID or timestamp to detect and handle duplicates.
const processedEvents = new Set();
async function processWebhook(payload) {
const eventId = `${payload.event}-${payload.data.orderGroupId}-${payload.timestamp}`;
if (processedEvents.has(eventId)) {
console.log('Duplicate event, skipping');
return;
}
processedEvents.add(eventId);
// Process the event
}3. Implement Retries
If your endpoint is temporarily unavailable, implement exponential backoff:
async function processWithRetry(fn, maxRetries = 3) {
for (let i = 0; i < maxRetries; i++) {
try {
return await fn();
} catch (error) {
if (i === maxRetries - 1) throw error;
await new Promise(resolve => setTimeout(resolve, Math.pow(2, i) * 1000));
}
}
}4. Log Everything
Keep detailed logs of all webhook events for debugging:
app.post('/webhook', (req, res) => {
const eventId = generateEventId();
console.log({
eventId,
event: req.body.event,
timestamp: req.body.timestamp,
orderId: req.body.data.orderGroupId,
signature: req.headers['x-webhook-signature']
});
// Process webhook
// ...
});5. Monitor Webhook Health
Track webhook delivery success rates and set up alerts for failures:
- Monitor response times
- Track success/failure rates
- Set up alerts for consecutive failures
- Review logs regularly
Testing Your Webhook
Using the Dashboard
- Go to your webhook settings
- Click "Test Webhook"
- Select an event type
- Review the response
Using cURL
curl -X POST https://your-domain.com/webhooks/orders \\
-H "Content-Type: application/json" \\
-H "X-Webhook-Signature: your-signature" \\
-d '{
"event": "order.created",
"timestamp": "2026-02-15T10:30:00.000Z",
"data": {
"orderGroupId": "test-order-123",
"status": "PENDING"
}
}'Troubleshooting
Webhook Not Receiving Events
- Verify your endpoint is publicly accessible
- Check your firewall allows incoming requests
- Ensure you're using HTTPS (HTTP is not supported)
- Review the delivery logs: open the webhook in Settings › Webhooks and go to its Logs tab
Signature Verification Failing
- Ensure you're using the correct secret
- Verify you're computing the HMAC on the raw JSON body
- Check you're comparing signatures using constant-time comparison
- Make sure JSON serialization matches (no extra whitespace)
Timeouts
- Your endpoint must respond within 30 seconds
- Move long-running operations to a background queue
- Return success immediately, process asynchronously
Next Steps
Now that you've set up webhooks, learn about the specific event payloads: