Webhooks turn your e-commerce events into triggers for automated workflows. Instead of polling an API to check if something happened, your system gets notified the moment it does. A cart is abandoned, a high-value order is placed, a fraud signal is detected: each of these events can kick off a workflow automatically, in real time.
This article covers event-driven architecture for e-commerce, the specific webhook events that matter, and how to build automation pipelines that connect your deep linking platform to email services, CRMs, Slack, and internal tools.
For webhook configuration basics, see the webhook event types documentation. For e-commerce analytics context, see the e-commerce analytics guide.
Why Webhooks for E-Commerce
The traditional approach to e-commerce automation is batch processing. Every hour (or every day), a job runs, queries your database for new events, and triggers actions. This works, but it introduces latency. A cart abandoned at 2:01 PM might not trigger a recovery email until the next batch at 3:00 PM.
Webhooks eliminate that latency. The event fires, your endpoint receives it, and the workflow starts. For time-sensitive e-commerce actions (cart recovery, fraud prevention, stock alerts), this difference matters.
The architecture is straightforward:
User Action → SDK Event → Analytics Pipeline → Webhook Delivery → Your Endpoint → Workflow
Your endpoint is an HTTP server that receives POST requests. It validates the payload, determines what action to take, and executes it. This is the standard webhooks pattern used by Stripe, GitHub, Shopify, and most modern platforms.
The Seven E-Commerce Webhook Events
Tolinku supports seven e-commerce webhook events. Each corresponds to a specific business scenario that benefits from automated handling.
1. purchase
Fires when a purchase event is tracked via the SDK.
Use cases:
- Send order confirmation via a secondary channel (Slack, SMS)
- Update inventory in external systems
- Trigger referral reward evaluation
- Sync purchase data to your CRM
Payload includes: order ID, total amount, currency, items purchased, user ID, attribution data (which deep link, campaign, and channel drove the purchase).
2. refund
Fires when a refund event is tracked.
Use cases:
- Alert customer support to follow up
- Adjust referral rewards (claw back if the referred purchase was refunded)
- Update financial dashboards
- Trigger a customer satisfaction survey
3. cart_abandoned
Fires when the platform detects a cart abandonment (configurable timeout, typically 30 to 60 minutes of inactivity after adding items to cart).
Use cases:
- Trigger a recovery email sequence
- Send a push notification with a deep link back to the cart
- Alert sales team for high-value abandoned carts
- Log abandonment patterns for analysis
This is the most actionable webhook for most e-commerce apps. Cart recovery campaigns with deep links see significantly higher conversion rates than generic reminders because the deep link returns the user directly to their cart.
4. high_value_order
Fires when a purchase exceeds a configurable threshold.
Use cases:
- Notify the sales or VIP team to send a personal thank-you
- Trigger enhanced fraud screening
- Add the customer to a high-value segment for future campaigns
- Route to a priority fulfillment queue
5. first_purchase
Fires when a user makes their first-ever purchase.
Use cases:
- Trigger an onboarding email sequence for new customers
- Send a welcome offer or loyalty program invitation
- Notify the team that a free user converted
- Update the user's segment from "prospect" to "customer"
This event is particularly valuable for measuring the effectiveness of deep link acquisition campaigns. If a user arrived through a specific campaign link and then made their first purchase, you have a clear attribution chain.
6. milestone_purchase
Fires when a user reaches a configured purchase milestone (e.g., 5th order, 10th order, $500 lifetime spend).
Use cases:
- Send a loyalty reward or discount code
- Trigger a referral program invitation (loyal customers make the best referrers)
- Update the customer's tier in your loyalty program
- Notify the account manager for B2B scenarios
7. fraud_flagged
Fires when the platform's fraud detection flags a suspicious transaction.
Use cases:
- Alert the fraud review team immediately
- Hold the order for manual review before fulfillment
- Block the user's account pending investigation
- Log the incident for compliance reporting
Tolinku's fraud detection looks for patterns like rapid repeat purchases, mismatched geo data (deep link clicked in one country, purchase from another), device fingerprint anomalies, and unusually high order values. See the e-commerce analytics features for details.
Webhook Payload Structure
All e-commerce webhooks share a common payload structure:
{
"event": "purchase",
"timestamp": "2026-08-21T14:32:00Z",
"appspace_id": "asp_abc123",
"data": {
"user_id": "usr_789",
"order_id": "ORD-2026-1234",
"amount": 12999,
"currency": "USD",
"items": [
{
"item_id": "SKU-001",
"name": "Premium Widget",
"quantity": 2,
"price": 4999
},
{
"item_id": "SKU-042",
"name": "Widget Case",
"quantity": 1,
"price": 3001
}
],
"attribution": {
"link_id": "lnk_456",
"campaign": "summer-sale",
"channel": "email",
"referrer_id": "usr_321"
}
},
"signature": "sha256=a1b2c3..."
}
Amounts are in the currency's smallest unit (12999 = $129.99 USD). The attribution object tells you which deep link, campaign, and channel drove this purchase. If the purchase resulted from a referral, the referrer's user ID is included.
HMAC Signature Verification
Every webhook includes an HMAC-SHA256 signature in the X-Tolinku-Signature header. Always verify this before processing the payload. Without verification, anyone who discovers your webhook URL can send fake events.
const crypto = require('crypto');
function verifyWebhookSignature(payload, signature, secret) {
const expected = 'sha256=' + crypto
.createHmac('sha256', secret)
.update(payload, 'utf-8')
.digest('hex');
return crypto.timingSafeEqual(
Buffer.from(signature),
Buffer.from(expected)
);
}
// In your webhook handler
app.post('/webhooks/tolinku', (req, res) => {
const signature = req.headers['x-tolinku-signature'];
const isValid = verifyWebhookSignature(
JSON.stringify(req.body),
signature,
process.env.TOLINKU_WEBHOOK_SECRET
);
if (!isValid) {
return res.status(401).json({ error: 'Invalid signature' });
}
// Process the event
handleEvent(req.body);
res.status(200).json({ received: true });
});
Use crypto.timingSafeEqual (not ===) to prevent timing attacks. This is a standard security practice for webhook signature verification.
Building Automation Pipelines
Cart Recovery Pipeline
The most common e-commerce webhook automation. When a cart_abandoned event fires:
- Receive the webhook with cart details and user info
- Check suppression rules (has the user already been contacted? did they opt out?)
- Determine the recovery channel (push notification if the app is installed, email otherwise)
- Generate a deep link to the user's cart using the Tolinku API
- Send the recovery message via your email service or push provider
- Track the outcome (did the user return? did they purchase?)
cart_abandoned webhook
→ Check: user contacted in last 24h?
→ Yes: skip
→ No: Generate deep link to cart
→ Send push notification (30 min delay)
→ If no action in 3h: Send email with deep link
→ If no action in 24h: Send final email with incentive
Fraud Alert Pipeline
When fraud_flagged fires, speed matters:
- Receive the webhook with transaction details and fraud signals
- Hold the order (call your fulfillment API to pause shipping)
- Alert the fraud team (Slack message with transaction details)
- Log the incident (for audit trail and pattern analysis)
- Auto-resolve or escalate based on the fraud score
Referral Milestone Pipeline
Combine first_purchase and milestone_purchase with your referral system:
- first_purchase fires for a referred user
- Check attribution (was there a referrer_id?)
- Credit the referrer (points, discount, or cash reward)
- Notify the referrer via push notification with a deep link to their referral dashboard
- If milestone_purchase fires for the referrer, unlock additional rewards
Integration Patterns
Email Services (SendGrid, AWS SES, Postmark)
Map webhook events to email templates:
| Webhook Event | Email Template | Timing |
|---|---|---|
| cart_abandoned | Cart recovery | 30 min delay |
| first_purchase | Welcome/onboarding | Immediate |
| purchase | Order confirmation | Immediate |
| milestone_purchase | Loyalty reward | Immediate |
| refund | Refund confirmation + survey | 1 hour delay |
CRM (HubSpot, Salesforce)
Sync webhook data to your CRM to maintain a complete customer profile:
first_purchase: Create/update contact, set lifecycle stage to "Customer"purchase: Update total spend, last purchase date, order counthigh_value_order: Set VIP flag, assign to account managermilestone_purchase: Update loyalty tier
Slack/Teams
Route alerts to the right channel:
fraud_flagged→ #fraud-alerts (immediate, @channel mention)high_value_order→ #vip-orders (immediate)milestone_purchase→ #customer-success (batched daily digest)
Internal Tools
Webhooks integrate with workflow automation platforms like n8n (self-hosted) or Pipedream (cloud). These tools let you build multi-step workflows with a visual editor, connecting your webhook events to any API without writing custom code.
Error Handling and Reliability
Webhooks can fail. Your endpoint might be down, return an error, or time out. Build your system to handle this:
Respond Quickly
Return a 200 status code as fast as possible. Do not process the event synchronously in the request handler. Instead, queue the event and process it asynchronously:
app.post('/webhooks/tolinku', (req, res) => {
// Verify signature (fast)
if (!verifySignature(req)) {
return res.status(401).end();
}
// Queue for async processing (fast)
eventQueue.push(req.body);
// Respond immediately
res.status(200).json({ received: true });
});
Idempotency
Webhooks may be delivered more than once. Use the event's unique ID to deduplicate:
async function handleEvent(event) {
const alreadyProcessed = await db.get(
'SELECT 1 FROM processed_events WHERE event_id = ?',
event.id
);
if (alreadyProcessed) return; // Skip duplicate
await processEvent(event);
await db.run(
'INSERT INTO processed_events (event_id) VALUES (?)',
event.id
);
}
Retry Logic
If your endpoint returns a non-2xx status code, Tolinku retries with exponential backoff. Make sure your endpoint is idempotent so retries are safe.
Testing Your Webhooks
Before going live:
- Use a request inspector like webhook.site to see the raw payloads
- Test signature verification with known good and bad signatures
- Simulate each event type to verify your routing logic
- Test failure scenarios (what happens when your email service is down?)
- Load test if you expect high event volumes (Black Friday, flash sales)
Conclusion
Webhooks turn your e-commerce events into real-time triggers for automated workflows. The seven e-commerce events (purchase, refund, cart_abandoned, high_value_order, first_purchase, milestone_purchase, fraud_flagged) cover the scenarios that matter most for revenue, retention, and fraud prevention.
The key to reliable webhook automation: verify signatures, process events asynchronously, handle duplicates with idempotency, and build workflows that degrade gracefully when downstream services are unavailable.
For webhook configuration and event type details, see the webhook documentation. For the e-commerce events that power these webhooks, see the e-commerce analytics documentation and e-commerce features overview.
Get deep linking tips in your inbox
One email per week. No spam.