Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bundlesocial

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bundlesocial

Node.js library for the bundle.social API

  • 1.5.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
22
decreased by-71.43%
Maintainers
1
Weekly downloads
 
Created
Source

bundle.social SDK

Node.js SDK for bundle.social API.

Installation

npm install bundlesocial
yarn add bundlesocial
pnpm add bundlesocial

!!! Make sure you have created a team on bundle.social and have an generated API key. !!!

Setup

import { BundleSocial } from 'bundlesocial';

const bundleSocial = new BundleSocial('YOUR_API_KEY');
// Get the API key from the bundle.social dashboard

Usage

Get the team information

const team = await bundlesocial.team.teamGetTeam();

Upload a file

const video = await fs.readFile('./video.mp4');
const createdUpload = await bundlesocial.upload.uploadCreate({
  formData: {
    file: new Blob([video], { type: 'video/mp4' }),
  }
});

const jpgImage = await fs.readFile('./image.jpg');
const createdUpload = await bundlesocial.upload.uploadCreate({
  formData: {
    file: new Blob([jpgImage], { type: 'image/jpeg' }),
  }
});

Create a post

// Make sure you have uploaded the file before creating a post.
// Make sure you have connected a social account to the team.
const createdPost = await bundlesocial.post.postCreate({
  requestBody: {
    data: {
      INSTAGRAM: {
        text: 'Test Post',
        type: 'REEL',
        uploadIds: [
          videoUpload?.id
        ]
      },
      YOUTUBE: {
        text: 'Test Post',
        type: 'SHORT',
        madeForKids: false,
        uploadIds: [
          videoUpload?.id
        ],
        privacyStatus: 'PUBLIC',
      },
      TIKTOK: {
        text: 'Test Post',
        uploadIds: [
          videoUpload?.id
        ],
        privacy: 'PUBLIC_TO_EVERYONE',
      },
    },
    postDate: new Date().toISOString(),
    socialAccountTypes: ['INSTAGRAM', 'YOUTUBE', 'TIKTOK'],
    status: 'SCHEDULED',
    title: 'Test Post',
  }
});

Get the post information

const post = await bundlesocial.post.postGet({
  id: createdPost.id,
});

Handling errors

try {
  const team = await bundlesocial.team.teamGetTeam();
} catch (error) {
  if (error instanceof ApiError) {
    // Handle the error
    console.log(error?.status, error?.statusText, error?.body);
  } else {
    throw error;
  }
}

License

MIT

Keywords

FAQs

Package last updated on 07 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc