Notification
Email tracking and delivery statistics
The Notification module provides email tracking and delivery analytics.
Track Email Open
GET
/v1/notifications/track/email/{trackingPixelId} SDK:
sdk.notification.trackEmailOpen() Track when an email is opened using a tracking pixel.
Note
This endpoint is typically called automatically when the tracking pixel image loads in an email client. You rarely need to call this directly.
const result = await sdk.notification.trackEmailOpen({
trackingPixelId: 'pixel_abc123'
});
Get Delivery Statistics
GET
/v1/notifications/track/stats/{businessId} SDK:
sdk.notification.getDeliveryStats() Get email delivery statistics for your business.
const result = await sdk.notification.getDeliveryStats({
businessId: 'biz_abc123'
});
if (result.ok) {
const stats = result.val;
console.log('Total sent:', stats.sent);
console.log('Delivered:', stats.delivered);
console.log('Opened:', stats.opened);
console.log('Clicked:', stats.clicked);
console.log('Bounced:', stats.bounced);
console.log('Open rate:', (stats.opened / stats.delivered * 100).toFixed(1) + '%');
}Statistics Response
| Field | Type | Description |
|---|---|---|
sent | number | Total emails sent |
delivered | number | Successfully delivered |
opened | number | Unique opens |
clicked | number | Unique clicks |
bounced | number | Failed deliveries |
unsubscribed | number | Unsubscribe count |
complained | number | Spam complaints |
Email Types
Arky sends several types of transactional emails:
Authentication Emails
- Confirmation: Sent when user registers
- Password Reset: Sent via
forgotPassword - Welcome: Sent after email confirmation
Business Emails
- Team Invitation: Sent via
inviteUser - Order Confirmation: Sent after successful checkout
- Reservation Confirmation: Sent after booking
Email Templates
Customize email templates in your business settings:
await sdk.business.updateBusiness({
id: 'biz_abc123',
settings: {
emailTemplates: {
orderConfirmation: {
subject: 'Your order #{{orderId}} is confirmed!',
fromName: 'My Store',
replyTo: '[email protected]'
},
reservationConfirmation: {
subject: 'Booking confirmed for {{serviceName}}',
fromName: 'My Salon'
}
}
}
});
Template Variables
Order emails:
{{orderId}}- Order ID{{customerName}}- Customer full name{{orderTotal}}- Formatted total{{orderItems}}- List of items
Reservation emails:
{{reservationId}}- Reservation ID{{serviceName}}- Service name{{providerName}}- Provider name{{dateTime}}- Formatted date/time
Webhooks for Email Events
Configure webhooks to receive real-time email events:
await sdk.business.updateBusiness({
id: 'biz_abc123',
settings: {
webhookUrl: 'https://yourapp.com/webhooks',
webhookEvents: [
'email.sent',
'email.delivered',
'email.opened',
'email.clicked',
'email.bounced',
'email.unsubscribed'
]
}
});
Webhook Payload
{
"event": "email.opened",
"timestamp": 1704067200,
"data": {
"messageId": "msg_abc123",
"recipient": "[email protected]",
"type": "order_confirmation",
"orderId": "ord_abc123"
}
}
Best Practices
Tip
Improve Deliverability
- Configure SPF, DKIM, and DMARC records for your domain
- Use consistent “From” addresses
- Include clear unsubscribe links
- Maintain list hygiene by removing bounced addresses
Monitor Metrics
async function checkEmailHealth() {
const result = await sdk.notification.getDeliveryStats({
businessId: 'biz_abc123'
});
if (result.ok) {
const stats = result.val;
const bounceRate = stats.bounced / stats.sent;
const complaintRate = stats.complained / stats.sent;
if (bounceRate > 0.05) {
console.warn('High bounce rate:', bounceRate);
}
if (complaintRate > 0.001) {
console.warn('High complaint rate:', complaintRate);
}
}
}