Documentation Index Fetch the complete documentation index at: https://docs.ollie.shop/llms.txt
Use this file to discover all available pages before exploring further.
Task functions run on schedules or delays, not in response to user requests. Theyβre perfect for background work like sending emails, generating reports, data cleanup, and workflow automation.
When to Use
Daily/weekly reports and analytics
Scheduled email campaigns and notifications
Data cleanup and maintenance tasks
Background data processing and syncing
What They Do
Run on fixed schedules (cron-like)
Execute delayed tasks after events
Process queued work items
Maintain system health and data integrity
How Task Functions Work
Schedule triggers at specified intervals (cron expressions or rate limits)
Task function executes without user interaction
Background work runs (emails, reports, cleanup, data processing)
Task completes and returns execution summary
Task Function Examples
Abandoned Cart Recovery
Daily Sales Report
Data Cleanup
Weekly Newsletter
Send emails to users who left items in their cart: Schedule Trigger: cron(*/30 * * * *) - Every 30 minutes
Discovered Carts
Function Implementation
Standard Response
[
{
"id" : "cart_123" ,
"userId" : "user_456" ,
"items" : [
{ "productId" : "prod_789" , "quantity" : 1 , "price" : 199.99 }
],
"total" : 199.99 ,
"lastUpdated" : "2024-01-12T08:15:30Z"
}
]
π See Hub Enhancements
{
"message" : "Abandoned cart recovery task completed" ,
"timestamp" : "2024-01-12T10:30:45.123Z" ,
"summary" : {
"processed" : 25 ,
"emailsSent" : 18 ,
"errors" : 2 ,
"skipped" : 5
},
"details" : {
"discoveredCarts" : 25 ,
"eligibleForRecovery" : 23 ,
"duplicatesPrevented" : 5 ,
"totalCartValue" : 4750.00 ,
"averageCartValue" : 190.00 ,
"topCategories" : [ "electronics" , "clothing" , "home" ],
"emailTemplatesUsed" : {
"first_reminder" : 12 ,
"second_reminder" : 4 ,
"final_discount" : 2
}
},
"performance" : {
"executionTime" : "2.3s" ,
"cartsPerSecond" : 10.9 ,
"emailDeliveryTime" : "1.2s"
},
"nextRun" : "2024-01-12T11:00:00.000Z"
}
What Ollie Hub adds:
β
Intelligent cart discovery with time-based filtering
β
Personalized email content with user data
β
Duplicate email prevention system
β
Revenue impact tracking and analytics
β
Performance metrics and optimization data
β
Detailed error handling and reporting
β
Multi-stage recovery email campaigns
Generate and email daily sales reports: Schedule Trigger: cron(0 8 * * *) - Daily at 8:00 AM
Sales Data
Function Implementation
Standard Response
{
"date" : "2024-01-11" ,
"orders" : [
{
"id" : "ord_123" ,
"total" : 299.99 ,
"isNewCustomer" : true ,
"timestamp" : "2024-01-11T14:30:00Z"
}
],
"totalRevenue" : 15420.75 ,
"totalOrders" : 47
}
π See Hub Enhancements
{
"message" : "Daily sales report generated and sent" ,
"date" : "2024-01-11" ,
"metrics" : {
"totalRevenue" : 15420.75 ,
"totalOrders" : 47 ,
"averageOrderValue" : 328.10 ,
"newCustomers" : 12 ,
"returningCustomers" : 35
},
"reportDetails" : {
"reportId" : "sales-2024-01-11" ,
"recipients" : 3 ,
"emailsSent" : 3 ,
"attachmentSize" : "2.4MB" ,
"generationTime" : "4.2s"
},
"insights" : {
"topSellingProduct" : "MacBook Pro 14-inch" ,
"peakSalesHour" : "14:00-15:00" ,
"customerRetentionRate" : "74.5%" ,
"dayOverDayGrowth" : "+12.3%"
},
"nextReportDue" : "2024-01-13T08:00:00.000Z"
}
What Ollie Hub adds:
β
Comprehensive revenue and customer metrics
β
Top-performing products analysis
β
Customer acquisition and retention insights
β
Day-over-day growth comparisons
β
PDF attachment with charts and graphs
β
Historical data storage and trends
β
Executive dashboard integration
Clean up expired sessions and temporary data: Schedule Trigger: cron(0 */6 * * *) - Every 6 hours
Cleanup Targets
Function Implementation
Standard Response
{
"expiredSessions" : {
"cutoffHours" : 24 ,
"estimatedCount" : 1200
},
"temporaryFiles" : {
"cutoffHours" : 1 ,
"estimatedSizeMB" : 450
},
"oldLogs" : {
"cutoffDays" : 30 ,
"estimatedCount" : 50000
}
}
π See Hub Enhancements
{
"message" : "Data cleanup completed successfully" ,
"timestamp" : "2024-01-12T10:30:45.123Z" ,
"results" : {
"expiredSessions" : 1200 ,
"temporaryFiles" : 450 ,
"oldLogs" : 50000 ,
"failedUploads" : 75 ,
"totalSpaceFreed" : 524288000
},
"summary" : {
"totalItemsProcessed" : 51725 ,
"spaceFreedMB" : 500 ,
"executionTime" : "45.2s" ,
"performanceGain" : "15% faster DB queries"
},
"systemHealth" : {
"diskUsageAfterCleanup" : "68%" ,
"sessionTableSize" : "12.3MB" ,
"cacheHitRateImprovement" : "+5.2%" ,
"nextCleanupDue" : "2024-01-12T16:00:00.000Z"
}
}
What Ollie Hub adds:
β
Intelligent expired session detection and removal
β
Temporary file cleanup with size optimization
β
Log archival and rotation management
β
Failed upload cleanup and recovery
β
Storage space optimization tracking
β
System health metrics and performance impact
β
Database query performance improvements
Send personalized weekly newsletters to subscribers: Schedule Trigger: cron(0 9 * * MON) - Every Monday at 9:00 AM
Subscriber List
Function Implementation
Standard Response
[
{
"id" : "sub_123" ,
"email" : "john@example.com" ,
"preferences" : {
"categories" : [ "tech" , "business" ],
"frequency" : "weekly"
},
"unsubscribeToken" : "tok_abc123"
}
]
π See Hub Enhancements
{
"message" : "Weekly newsletter campaign completed" ,
"campaignId" : "newsletter-2024-w02" ,
"weekOf" : "2024-01-08" ,
"results" : {
"emailsSent" : 5420 ,
"errors" : 12 ,
"unsubscribes" : 3 ,
"bounces" : 8
},
"performance" : {
"totalSubscribers" : 5435 ,
"successRate" : "99.7%" ,
"deliveryTime" : "12.4 minutes" ,
"batchesProcessed" : 55
},
"engagement" : {
"expectedOpenRate" : "24.5%" ,
"expectedClickRate" : "4.2%" ,
"topContent" : "Weekly Tech Roundup" ,
"personalizationScore" : "High"
},
"nextCampaign" : "2024-01-15T09:00:00.000Z"
}
What Ollie Hub adds:
β
Batch processing for scalability and deliverability
β
Personalized content based on subscriber preferences
β
Unsubscribe link management and tracking
β
Campaign performance metrics and analytics
β
Error handling with detailed reporting
β
Rate limiting to prevent spam flags
β
Engagement prediction and optimization
Best Practices
Keep Tasks Idempotent Design tasks to handle being run multiple times safely. Check for existing work before processing.
Process in Batches For large datasets, process items in small batches to avoid timeouts and memory issues.
Monitor and Alert Set up monitoring for task failures and send notifications when critical tasks fail.
Handle Failures Gracefully Implement retry logic with exponential backoff. Store failed items for manual review.
Next Steps
Best Practices Task patterns, error handling, and scheduling tips
Request Functions Learn to handle user requests and API calls
Response Functions Customize responses with analytics and enhancements
Pro Tip: Task functions can trigger Request functions to process data, and Response functions can enhance the results. They work great together! Check out our Best Practices guide for implementation patterns.