1.0.1 • Published 5 months ago

posto-sdk v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

Posto JavaScript SDK

A powerful JavaScript SDK for interacting with the Posto social media management platform. This SDK allows you to automate social media posting, scheduling, and management across multiple platforms.

Installation

npm install posto-sdk

Features

  • Multi-platform Support: Post to Instagram, Facebook, Twitter, LinkedIn, and more
  • Media Management: Upload images, videos, and other media types
  • Scheduling: Schedule posts for future publication
  • Analytics: Access engagement metrics and performance data
  • Channel Management: Manage multiple social media accounts
  • Custom Settings: Configure network-specific settings
  • Profile Management: Save and reuse posting profiles

Quick Start

import { PostoSDK } from 'posto-sdk';

// Initialize with username and password
const sdk = PostoSDK.fromCredentials('your_username', 'your_password', 'your_api_url');

// Or initialize with an auth token
// const sdk = PostoSDK.fromToken('your_auth_token', 'your_api_url');

// Get all available channels
const channels = await sdk.getChannels();
console.log(`Found ${channels.length} channels`);

// Post to a specific channel
const result = await sdk.post('Hello from Posto SDK!', {
  to: channels[0].id,
  media: ['path/to/image.jpg'],
  when: null // Post immediately
});

if (result.success) {
  console.log('Post successful!');
} else {
  console.error('Post failed:', result.errorMessage);
}

Scheduling Posts

// Schedule a post for tomorrow at 10:00 AM
const tomorrow = new Date();
tomorrow.setDate(tomorrow.getDate() + 1);
tomorrow.setHours(10, 0, 0, 0);

const scheduledResult = await sdk.post('Scheduled post from Posto SDK', {
  to: channelId,
  media: ['path/to/image.jpg'],
  when: tomorrow
});

console.log(`Post scheduled with ID: ${scheduledResult.scheduleGroupId}`);

Network Settings

// Get available networks
const networks = await sdk.getNetworks();

// Get settings for a specific network
const networkSettings = await sdk.getNetworkSettings('instagram');

// Save custom settings for a network
await sdk.saveNetworkSettings('instagram', {
  post_text: '{post_title}',
  include_link: true,
  media_type_to_upload: 'featured_image'
});

Error Handling

try {
  const result = await sdk.post('Test post', {
    to: channelId,
    media: ['path/to/image.jpg']
  });
  
  if (!result.success) {
    console.error('Post failed:', result.errorMessage);
  }
} catch (error) {
  console.error('API error:', error.message);
}

Documentation

For complete documentation, API reference, and examples, visit: https://docs.viralxmachine.com

License

MIT

1.0.1

5 months ago

1.0.0

5 months ago