@bernierllc/social-publishing-suite
v0.3.0
Published
Social media publishing orchestration suite combining content creation, scheduling, and multi-platform distribution
Downloads
175
Readme
@bernierllc/social-publishing-suite
Social media publishing orchestration suite combining content creation, scheduling, and multi-platform distribution.
Features
- Multi-Platform Publishing: Publish to Twitter, LinkedIn, and other social media platforms simultaneously
- Advanced Scheduling: Schedule posts for future publication with recurring schedules
- AI-Powered Content: Generate optimized content for each platform using AI
- Workflow Management: Create and manage publishing workflows
- NeverHub Integration: Optional integration with NeverHub for event tracking and monitoring
Installation
npm install @bernierllc/social-publishing-suiteDependencies
This package requires:
@bernierllc/social-publisher- Multi-platform social media publishing@bernierllc/scheduler-service- Advanced job scheduling (optional)@bernierllc/ai-social-generator- AI-powered content generation (optional)@bernierllc/logger- Logging functionality@bernierllc/neverhub-adapter- NeverHub integration (optional)
Usage
Basic Setup
import { SocialPublishingSuite } from '@bernierllc/social-publishing-suite';
const suite = new SocialPublishingSuite({
publisher: {
platforms: [
{
platform: 'twitter',
enabled: true,
credentials: {
accessToken: process.env.TWITTER_ACCESS_TOKEN
},
serviceConfig: {
apiUrl: 'https://api.twitter.com'
}
}
]
},
scheduler: {
maxConcurrentJobs: 5,
defaultTimezone: 'UTC',
jobRetention: { completedJobs: 7, failedJobs: 30 },
retryDefaults: { attempts: 3, delay: 1000, exponentialBackoff: true },
events: { enabled: true, publishToNeverHub: true },
logging: { enabled: true, level: 'info' }
},
aiGenerator: {
contentGenerator: {
provider: 'openai',
apiKey: process.env.OPENAI_API_KEY,
model: 'gpt-4'
}
}
});
await suite.initialize();Publish Content Immediately
const result = await suite.publishNow(
{
text: 'Check out our new product launch! #innovation',
hashtags: ['#innovation', '#tech'],
media: []
},
['twitter', 'linkedin']
);
console.log('Published:', result.data?.overallStatus);Create a Workflow
const workflow = await suite.createWorkflow({
name: 'Product Launch Campaign',
content: {
text: 'Exciting news coming soon!'
},
platforms: ['twitter', 'linkedin'],
priority: 'high',
useAI: true,
aiOptions: {
tone: 'professional',
includeHashtags: true,
includeEmojis: false
}
});
console.log('Workflow ID:', workflow.data?.id);Schedule a Workflow
const scheduled = await suite.scheduleWorkflow(workflow.data!.id, {
workflowId: workflow.data!.id,
scheduledFor: new Date(Date.now() + 24 * 60 * 60 * 1000) // 24 hours from now
});
console.log('Scheduled job:', scheduled.data);Generate AI Content
const aiContent = await suite.generateAIContent({
prompt: 'Write an engaging post about our new AI-powered features',
platforms: ['twitter', 'linkedin'],
options: {
tone: 'professional',
includeHashtags: true,
maxHashtags: 3,
includeCTA: true
},
publishImmediately: false
});
for (const [platform, result] of aiContent.data!.entries()) {
console.log(`${platform}:`, result.content);
}Manage Workflows
// Get workflow status
const status = suite.getWorkflowStatus(workflowId);
console.log('Status:', status.data?.status);
// Get all workflows
const workflows = suite.getWorkflows();
console.log('Total workflows:', workflows.length);
// Cancel a workflow
await suite.cancelWorkflow(workflowId);Graceful Shutdown
await suite.shutdown();API Reference
SocialPublishingSuite
Methods
initialize(): Promise<SuiteResult<void>>- Initialize the suite and all servicescreateWorkflow(options: WorkflowOptions): Promise<SuiteResult<Workflow>>- Create a publishing workflowpublishNow(content: SocialPost, platforms: SocialPlatform[]): Promise<SuiteResult<PublishResult>>- Publish content immediatelyscheduleWorkflow(workflowId: string, schedule: ScheduleConfig): Promise<SuiteResult<string>>- Schedule a workflowgenerateAIContent(request: AIContentRequest): Promise<SuiteResult<Map<SocialPlatform, GeneratedSocialPost>>>- Generate AI-powered contentgetWorkflowStatus(workflowId: string): SuiteResult<Workflow>- Get workflow statuscancelWorkflow(workflowId: string): Promise<SuiteResult<void>>- Cancel a workflowgetWorkflows(): Workflow[]- Get all workflowsshutdown(): Promise<void>- Gracefully shutdown the suite
Types
interface SuiteConfig {
publisher: SocialPublisherConfig;
scheduler?: Partial<SchedulerServiceConfig>;
aiGenerator?: AISocialGeneratorConfig;
enableNeverHub?: boolean;
}
interface WorkflowOptions {
name?: string;
content: SocialPost;
platforms: SocialPlatform[];
scheduledFor?: Date;
priority?: 'high' | 'normal' | 'low';
useAI?: boolean;
aiOptions?: SocialGenerationOptions;
}
interface SuiteResult<T> {
success: boolean;
data?: T;
error?: string;
metadata?: Record<string, unknown>;
}Quality Standards
- Test Coverage: 95.31% statements, 72% branches, 100% functions
- TypeScript: Strict mode enabled
- Linting: ESLint with TypeScript rules
- License: Bernier LLC Limited-Use License
Development
# Install dependencies
pnpm install
# Run tests
npm test
# Run tests with coverage
npm run test:run
# Build
npm run build
# Lint
npm run lintLicense
Copyright (c) 2025 Bernier LLC
This file is licensed to the client under a limited-use license. The client may use and modify this code only within the scope of the project it was delivered for. Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
