Pro Features
Batch Publishing
Publish to multiple platforms simultaneously.
Batch Publishing
Pro
Batch publishing lets you publish a single post to multiple platforms in one API call with parallel execution on the server.
Basic usage
use OwlStack\Content\Post;
use OwlStack\Enums\Platform;
$post = Post::create('Launching our new product today!')
->withUrl('https://example.com/launch')
->withHashtags(['launch', 'product']);
$results = $client->publish($post, [
Platform::Twitter,
Platform::LinkedIn,
Platform::Facebook,
Platform::Telegram,
]);
foreach ($results as $result) {
echo "{$result->platform()->value}: {$result->status()->value}\n";
}How it works
- Your code sends a single API request to OwlStack
- OwlStack processes all platforms in parallel on the server
- Each platform gets its own formatted version of the content
- Results are returned as a collection, one per platform
Partial failures
Batch operations can partially succeed. If Twitter fails but LinkedIn succeeds, you get results for both:
foreach ($results as $result) {
if ($result->isPublished()) {
// Handle success
} else {
// Handle failure for this specific platform
echo $result->error();
}
}Multiple posts
To publish different content to different platforms, make separate calls:
$tweet = Post::create('Short tweet version');
$linkedInPost = Post::create('Longer LinkedIn version with more detail...');
$client->publish($tweet, [Platform::Twitter]);
$client->publish($linkedInPost, [Platform::LinkedIn]);