@bernierllc/content-scheduler-suite
v1.0.4
Published
Complete enterprise-grade content scheduling and publishing solution with workflow orchestration, analytics, and multi-platform support
Downloads
417
Readme
@bernierllc/content-scheduler-suite
Complete enterprise-grade content scheduling and publishing solution with workflow orchestration, analytics, and multi-platform support.
🌟 Features
- 🔄 Complete Content Lifecycle Management - Create, schedule, approve, and publish content seamlessly
- 📋 Advanced Workflow Orchestration - Multi-stage approvals, escalations, and automated workflows
- 🚀 Multi-Platform Publishing - Twitter, LinkedIn, Facebook, Instagram, Blog, and custom platforms
- 📊 Real-time Analytics Dashboard - Comprehensive metrics, performance tracking, and insights
- 📅 Calendar Management - Visual scheduling with conflict detection and optimization
- 🔍 System Health Monitoring - Real-time service and platform health tracking
- ⚡ Batch Operations - High-performance bulk scheduling and publishing
- 🔌 NeverHub Integration - Event-driven architecture with service discovery
- 📈 Performance Optimization - Smart scheduling with optimal time recommendations
🚀 Installation
npm install @bernierllc/content-scheduler-suite📖 Quick Start
import { ContentSchedulerSuite } from '@bernierllc/content-scheduler-suite';
// Configure the suite
const scheduler = new ContentSchedulerSuite({
contentServiceConfig: {
endpoint: 'https://api.example.com/content',
apiKey: process.env.CONTENT_SERVICE_API_KEY
},
workflowServiceConfig: {
endpoint: 'https://api.example.com/workflow',
apiKey: process.env.WORKFLOW_SERVICE_API_KEY
},
publishingServiceConfig: {
endpoint: 'https://api.example.com/publishing',
apiKey: process.env.PUBLISHING_SERVICE_API_KEY,
platforms: {
twitter: { apiKey: process.env.TWITTER_API_KEY },
linkedin: { clientId: process.env.LINKEDIN_CLIENT_ID }
}
},
schedulerServiceConfig: {
endpoint: 'https://api.example.com/scheduler',
apiKey: process.env.SCHEDULER_SERVICE_API_KEY
},
defaultTimezone: 'America/New_York',
enableAnalytics: true
});
// Initialize
await scheduler.initialize();
// Schedule content
const result = await scheduler.scheduleContent({
content: {
title: 'Product Launch Announcement',
body: 'Exciting news! Our new product is now available...',
contentType: 'post',
tags: ['product-launch', 'announcement']
},
schedule: {
publishAt: new Date('2024-12-25T10:00:00Z'),
timezone: 'America/New_York',
priority: 'high'
},
platforms: ['twitter', 'linkedin', 'facebook']
});
console.log('Scheduled:', result.scheduleId);🔧 Core API
Content Scheduling
// Simple scheduling
const result = await scheduler.scheduleContent({
content: contentData,
schedule: { publishAt: new Date(), timezone: 'UTC' },
platforms: ['twitter', 'linkedin']
});
// With approval workflow
const result = await scheduler.scheduleContent({
content: contentData,
schedule: scheduleConfig,
platforms: ['twitter', 'linkedin'],
workflow: {
requiresApproval: true,
approvers: ['manager', 'legal-team'],
escalationRules: [{
afterHours: 24,
escalateTo: ['director'],
notificationChannels: ['email']
}]
}
});
// Batch scheduling
const batchResult = await scheduler.scheduleContentBatch([
{ content: content1, schedule: schedule1, platforms: platforms1 },
{ content: content2, schedule: schedule2, platforms: platforms2 }
]);Workflow Management
// Submit for approval
const workflowResult = await scheduler.submitForApproval(
contentId,
'content-creator'
);
// Approve content
const approvalResult = await scheduler.approveContent(
workflowId,
'manager',
'Looks good to publish'
);
// Reject content
const rejectionResult = await scheduler.rejectContent(
workflowId,
'legal-team',
'Needs compliance review'
);Publishing Control
// Immediate publishing
const publishResult = await scheduler.publishNow(
contentId,
['twitter', 'linkedin']
);
// Reschedule content
const rescheduled = await scheduler.rescheduleContent(contentId, {
publishAt: new Date('2024-12-26T15:00:00Z'),
platforms: ['twitter', 'facebook']
});
// Cancel scheduled publishing
const cancelled = await scheduler.cancelScheduledPublishing(contentId);Dashboard and Analytics
// Get dashboard data
const dashboard = await scheduler.getDashboard();
console.log('Summary:', dashboard.summary);
console.log('Recent Activity:', dashboard.recentActivity);
console.log('Upcoming:', dashboard.upcomingSchedules);
// Get calendar view
const calendar = await scheduler.getScheduleCalendar({
start: new Date('2024-12-01'),
end: new Date('2024-12-31')
});
// Get publishing metrics
const metrics = await scheduler.getPublishingMetrics({
start: new Date('2024-12-01'),
end: new Date('2024-12-31'),
period: 'day'
});
// System health
const health = await scheduler.getSystemHealth();
console.log('Status:', health.overall);📋 Configuration
Complete Configuration Example
const config: ContentSchedulerSuiteConfig = {
// Service endpoints
contentServiceConfig: {
endpoint: 'https://api.example.com/content',
apiKey: process.env.CONTENT_SERVICE_API_KEY,
timeout: 30000,
retryAttempts: 3
},
workflowServiceConfig: {
endpoint: 'https://api.example.com/workflow',
apiKey: process.env.WORKFLOW_SERVICE_API_KEY,
timeout: 30000,
defaultApprovers: ['manager']
},
publishingServiceConfig: {
endpoint: 'https://api.example.com/publishing',
apiKey: process.env.PUBLISHING_SERVICE_API_KEY,
timeout: 60000,
platforms: {
twitter: {
apiKey: process.env.TWITTER_API_KEY,
apiSecret: process.env.TWITTER_API_SECRET,
accessToken: process.env.TWITTER_ACCESS_TOKEN,
accessTokenSecret: process.env.TWITTER_ACCESS_TOKEN_SECRET
},
linkedin: {
clientId: process.env.LINKEDIN_CLIENT_ID,
clientSecret: process.env.LINKEDIN_CLIENT_SECRET,
accessToken: process.env.LINKEDIN_ACCESS_TOKEN
},
facebook: {
appId: process.env.FACEBOOK_APP_ID,
appSecret: process.env.FACEBOOK_APP_SECRET,
accessToken: process.env.FACEBOOK_ACCESS_TOKEN
}
}
},
schedulerServiceConfig: {
endpoint: 'https://api.example.com/scheduler',
apiKey: process.env.SCHEDULER_SERVICE_API_KEY,
maxScheduledJobs: 10000
},
// Suite settings
defaultTimezone: 'America/New_York',
maxScheduledItems: 5000,
dashboardRefreshInterval: 30000,
// Integrations
neverhubConfig: {
endpoint: 'https://neverhub.example.com',
apiKey: process.env.NEVERHUB_API_KEY,
enabled: true
},
loggerConfig: {
level: 'info',
format: 'json',
destinations: ['console']
},
// Features
enableAnalytics: true,
enableNotifications: true,
enableBatchOperations: true
};Environment Variables
# Service API Keys
CONTENT_SERVICE_API_KEY=your_content_service_key
WORKFLOW_SERVICE_API_KEY=your_workflow_service_key
PUBLISHING_SERVICE_API_KEY=your_publishing_service_key
SCHEDULER_SERVICE_API_KEY=your_scheduler_service_key
# Platform API Keys
TWITTER_API_KEY=your_twitter_api_key
TWITTER_API_SECRET=your_twitter_api_secret
TWITTER_ACCESS_TOKEN=your_twitter_access_token
TWITTER_ACCESS_TOKEN_SECRET=your_twitter_access_token_secret
LINKEDIN_CLIENT_ID=your_linkedin_client_id
LINKEDIN_CLIENT_SECRET=your_linkedin_client_secret
LINKEDIN_ACCESS_TOKEN=your_linkedin_access_token
FACEBOOK_APP_ID=your_facebook_app_id
FACEBOOK_APP_SECRET=your_facebook_app_secret
FACEBOOK_ACCESS_TOKEN=your_facebook_access_token
# Integration
NEVERHUB_API_KEY=your_neverhub_api_key🔌 Platform Support
Built-in Platforms
- Twitter/X - Posts, threads, media attachments
- LinkedIn - Posts, articles, company pages
- Facebook - Posts, stories, page publishing
- Instagram - Posts, stories, reels
- Blog - Custom blog/CMS publishing
Adding Custom Platforms
await scheduler.addPlatform({
name: 'custom-platform',
type: 'social',
config: {
apiEndpoint: 'https://api.custom-platform.com',
authentication: {
type: 'oauth',
credentials: { /* ... */ }
}
},
enabled: true,
publishingRules: ['high-priority-content']
});📊 Analytics & Reporting
Dashboard Metrics
const dashboard = await scheduler.getDashboard();
// Summary statistics
console.log(dashboard.summary.totalContent);
console.log(dashboard.summary.scheduledContent);
console.log(dashboard.summary.publishedToday);
console.log(dashboard.summary.pendingApprovals);
// Recent activity feed
dashboard.recentActivity.forEach(activity => {
console.log(`${activity.type}: ${activity.contentTitle}`);
});
// Platform health status
Object.entries(dashboard.platformStatus).forEach(([platform, status]) => {
console.log(`${platform}: ${status.status} (${status.successRate}%)`);
});Publishing Performance
const metrics = await scheduler.getPublishingMetrics({
start: new Date('2024-01-01'),
end: new Date('2024-12-31'),
period: 'month'
});
console.log(`Success Rate: ${metrics.successRate}%`);
console.log(`Average Publish Time: ${metrics.averagePublishTime} minutes`);
// Platform-specific metrics
Object.entries(metrics.platformMetrics).forEach(([platform, data]) => {
console.log(`${platform}: ${data.successRate}% success, ${data.totalPublished} posts`);
});
// Trend analysis
metrics.trendData.forEach(point => {
console.log(`${point.timestamp}: ${point.successful}/${point.published} successful`);
});🔄 Workflow Orchestration
Simple Approval Workflow
const result = await scheduler.scheduleContent({
content: contentData,
schedule: scheduleConfig,
platforms: ['twitter'],
workflow: {
requiresApproval: true,
approvers: ['content-manager']
}
});
// Later, approve the content
await scheduler.approveContent(result.workflowId, 'content-manager');Complex Multi-Stage Workflow
const result = await scheduler.scheduleContent({
content: sensitiveContent,
schedule: scheduleConfig,
platforms: ['twitter', 'linkedin'],
workflow: {
requiresApproval: true,
approvers: ['legal-team', 'compliance-officer', 'ceo'],
escalationRules: [
{
afterHours: 24,
escalateTo: ['vp-marketing'],
notificationChannels: ['email', 'slack']
},
{
afterHours: 48,
escalateTo: ['board-chair'],
notificationChannels: ['email', 'sms']
}
],
autoApproveAfter: 72 // 3 days
}
});📅 Calendar Management
Getting Calendar Data
// Week view
const weekCalendar = await scheduler.getScheduleCalendar({
start: startOfWeek(new Date()),
end: endOfWeek(new Date())
});
// Month view
const monthCalendar = await scheduler.getScheduleCalendar({
start: startOfMonth(new Date()),
end: endOfMonth(new Date())
});
// Custom range
const customCalendar = await scheduler.getScheduleCalendar({
start: new Date('2024-12-01'),
end: new Date('2024-12-31')
});Calendar Events
// Get events for specific date
const todayEvents = await scheduler.getEventsForDate(new Date());
// Check for scheduling conflicts
const conflicts = await scheduler.getConflictingEvents({
start: new Date(),
end: new Date(Date.now() + 7 * 24 * 60 * 60 * 1000)
});
// Get optimal scheduling times
const optimalTimes = await scheduler.getOptimalScheduleTimes(
'article',
['twitter', 'linkedin'],
{
start: new Date(),
end: new Date(Date.now() + 24 * 60 * 60 * 1000)
}
);🎯 Publishing Rules
Adding Custom Rules
await scheduler.addPublishingRule({
id: 'urgent-content-twitter',
name: 'Add Twitter for urgent content',
conditions: [
{
field: 'priority',
operator: 'equals',
value: 'urgent'
}
],
actions: [
{
type: 'add_platform',
config: { platform: 'twitter' }
}
],
enabled: true,
priority: 100
});Rule Examples
// Long content to blog
{
conditions: [
{ field: 'content_length', operator: 'greater_than', value: 2000 }
],
actions: [
{ type: 'add_platform', config: { platform: 'blog' } },
{ type: 'remove_platform', config: { platform: 'twitter' } }
]
}
// Video content to Instagram
{
conditions: [
{ field: 'content_type', operator: 'equals', value: 'video' }
],
actions: [
{ type: 'add_platform', config: { platform: 'instagram' } }
]
}🔍 System Health
const health = await scheduler.getSystemHealth();
console.log(`Overall Status: ${health.overall}`);
console.log(`Uptime: ${health.metrics.uptime}%`);
console.log(`Error Rate: ${health.metrics.errorRate}%`);
// Service health
health.services.forEach(service => {
console.log(`${service.service}: ${service.status} (${service.responseTime}ms)`);
});
// Platform health
health.platforms.forEach(platform => {
console.log(`${platform.platform}: ${platform.status} (${platform.successRate}% success)`);
});🧪 Testing
Running Tests
# Unit tests
npm test
# E2E tests
npm run test:e2e
# Coverage
npm run test:coverageExample E2E Test
import { getTestSuite } from './tests/e2e/setup';
test('should schedule content end-to-end', async () => {
const suite = await getTestSuite();
const result = await suite.scheduleContent({
content: {
title: 'Test Post',
body: 'This is a test post',
contentType: 'post'
},
schedule: {
publishAt: new Date(Date.now() + 60000),
timezone: 'UTC'
},
platforms: ['twitter']
});
expect(result.contentId).toBeDefined();
expect(result.scheduleId).toBeDefined();
expect(result.status).toBe('scheduled');
});🔗 Integration
NeverHub Events
The suite publishes these events to NeverHub:
content-scheduler.initialized- Suite startupcontent-scheduler.content.scheduled- Content scheduledcontent-scheduler.workflow.completed- Workflow finishedcontent-scheduler.publishing.completed- Publishing finishedcontent-scheduler.metrics.updated- Metrics refreshed
Event Handling
// Subscribe to events (if using NeverHub directly)
await neverhub.subscribe('content-scheduler.content.scheduled', (event) => {
console.log('Content scheduled:', event.data.contentId);
});
await neverhub.subscribe('content-scheduler.publishing.completed', (event) => {
console.log('Published to:', event.data.platforms);
});📈 Performance
- High Throughput - Handles 10,000+ scheduled items
- Batch Operations - Process up to 100 items per batch
- Caching - Intelligent caching for dashboard and metrics
- Concurrent Processing - Parallel publishing across platforms
- Rate Limiting - Built-in platform rate limit handling
🔧 Troubleshooting
Common Issues
Service Connection Errors
// Check service health const health = await scheduler.getSystemHealth(); console.log(health.services);Publishing Failures
// Check platform status const dashboard = await scheduler.getDashboard(); console.log(dashboard.platformStatus);Workflow Stuck in Approval
// Check workflow status const workflow = await scheduler.getWorkflowStatus(workflowId); console.log(workflow.currentStep, workflow.approvals);
Debug Logging
const scheduler = new ContentSchedulerSuite({
// ... other config
loggerConfig: {
level: 'debug',
format: 'json',
destinations: ['console']
}
});📚 Examples
See the /examples directory for complete usage examples:
- Basic Usage - Simple scheduling and publishing
- Advanced Workflows - Complex approval chains
- Analytics Dashboard - Metrics and reporting
- Custom Platforms - Adding new publishing targets
🔒 Security
- API Key Management - Secure credential handling
- Content Validation - Input sanitization and validation
- Rate Limiting - Platform-specific rate limit compliance
- Audit Logging - Complete activity audit trail
- Access Control - Role-based permissions (via workflow service)
📄 License
Copyright (c) 2025 Bernier LLC. All rights reserved.
This package is licensed under a limited-use license. See LICENSE for details.
🤝 Support
- 📧 Email: [email protected]
- 📖 Documentation: docs.bernierllc.com
- 🐛 Issues: GitHub Issues
🔗 Related Packages
- @bernierllc/content-service - Content management
- @bernierllc/workflow-service - Approval workflows
- @bernierllc/publishing-service - Multi-platform publishing
- @bernierllc/scheduler-service - Job scheduling
- @bernierllc/neverhub-adapter - Event bus integration
Made with ❤️ by Bernier LLC
