upload-post 1.0.1 → 2.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,45 @@
1
+ name: Publish to npm
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+ workflow_dispatch:
7
+ inputs:
8
+ dry_run:
9
+ description: 'Dry run (no publish)'
10
+ required: true
11
+ default: true
12
+ type: boolean
13
+
14
+ jobs:
15
+ publish:
16
+ runs-on: ubuntu-latest
17
+ permissions:
18
+ contents: read
19
+ id-token: write # Required for OIDC trusted publishing
20
+ steps:
21
+ - name: Checkout
22
+ uses: actions/checkout@v4
23
+
24
+ - name: Setup Node.js
25
+ uses: actions/setup-node@v4
26
+ with:
27
+ node-version: '22'
28
+ registry-url: 'https://registry.npmjs.org'
29
+
30
+ - name: Update npm to latest
31
+ run: npm install -g npm@latest && npm --version
32
+
33
+ - name: Install dependencies
34
+ run: npm ci
35
+
36
+ - name: Build (if needed)
37
+ run: npm run build --if-present
38
+
39
+ - name: Publish to npm (dry-run)
40
+ if: ${{ inputs.dry_run == true }}
41
+ run: npm publish --access public --dry-run
42
+
43
+ - name: Publish to npm
44
+ if: ${{ inputs.dry_run != true }}
45
+ run: npm publish --access public --provenance
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Upload-Post
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,13 +1,8 @@
1
- # Upload-Post Node.js Client
1
+ # Upload-Post SDK for Node.js
2
2
 
3
- Official client library for [Upload-Post](https://www.upload-post.com) API - cross-platform social media video upload.
3
+ Official Node.js client for the [Upload-Post API](https://www.upload-post.com) - Cross-platform social media upload.
4
4
 
5
- ## Features
6
-
7
- - 🚀 Simple video upload to multiple platforms
8
- - 🔒 Secure API key authentication
9
- - 📁 Supports all major video formats
10
- - 📝 Automatic form data handling
5
+ Upload videos, photos, text posts, and documents to **TikTok, Instagram, YouTube, LinkedIn, Facebook, Pinterest, Threads, Reddit, Bluesky, and X (Twitter)** with a single API.
11
6
 
12
7
  ## Installation
13
8
 
@@ -15,43 +10,317 @@ Official client library for [Upload-Post](https://www.upload-post.com) API - cro
15
10
  npm install upload-post
16
11
  ```
17
12
 
18
- ## Usage
13
+ ## Quick Start
19
14
 
20
15
  ```javascript
21
16
  import { UploadPost } from 'upload-post';
22
17
 
23
- const uploader = new UploadPost('your-api-key-here');
18
+ const client = new UploadPost('YOUR_API_KEY');
19
+
20
+ // Upload a video to multiple platforms
21
+ const response = await client.upload('./video.mp4', {
22
+ title: 'Check out this awesome video! 🎬',
23
+ user: 'my-profile',
24
+ platforms: ['tiktok', 'instagram', 'youtube']
25
+ });
26
+
27
+ console.log(response);
28
+ ```
29
+
30
+ ## Features
31
+
32
+ - ✅ **Video Upload** - TikTok, Instagram, YouTube, LinkedIn, Facebook, Pinterest, Threads, Bluesky, X
33
+ - ✅ **Photo Upload** - TikTok, Instagram, LinkedIn, Facebook, Pinterest, Threads, Reddit, Bluesky, X
34
+ - ✅ **Text Posts** - X, LinkedIn, Facebook, Threads, Reddit, Bluesky
35
+ - ✅ **Document Upload** - LinkedIn (PDF, PPT, PPTX, DOC, DOCX)
36
+ - ✅ **Scheduling** - Schedule posts for later
37
+ - ✅ **Posting Queue** - Add posts to your configured queue
38
+ - ✅ **First Comments** - Auto-post first comment after publishing
39
+ - ✅ **Analytics** - Get engagement metrics
40
+ - ✅ **Full TypeScript Support**
41
+
42
+ ## API Reference
43
+
44
+ ### Upload Video
45
+
46
+ ```javascript
47
+ const response = await client.upload('./video.mp4', {
48
+ title: 'My awesome video',
49
+ user: 'my-profile',
50
+ platforms: ['tiktok', 'instagram', 'youtube'],
51
+
52
+ // Optional: Schedule for later
53
+ scheduledDate: '2024-12-25T10:00:00Z',
54
+ timezone: 'Europe/Madrid',
55
+
56
+ // Optional: Add first comment
57
+ firstComment: 'Thanks for watching! 🙏',
58
+
59
+ // Optional: Platform-specific settings
60
+ tiktokPrivacyLevel: 'PUBLIC_TO_EVERYONE',
61
+ instagramMediaType: 'REELS',
62
+ youtubePrivacyStatus: 'public',
63
+ youtubeTags: ['tutorial', 'coding'],
64
+ });
65
+ ```
66
+
67
+ ### Upload Photos
68
+
69
+ ```javascript
70
+ // Upload single or multiple photos
71
+ const response = await client.uploadPhotos(
72
+ ['./photo1.jpg', './photo2.jpg', 'https://example.com/photo3.jpg'],
73
+ {
74
+ title: 'Check out these photos! 📸',
75
+ user: 'my-profile',
76
+ platforms: ['instagram', 'facebook', 'x'],
77
+
78
+ // Optional: Add to queue instead of posting immediately
79
+ addToQueue: true,
80
+
81
+ // Platform-specific
82
+ instagramMediaType: 'IMAGE', // or 'STORIES'
83
+ facebookPageId: 'your-page-id',
84
+ }
85
+ );
86
+ ```
87
+
88
+ ### Upload Text Posts
89
+
90
+ ```javascript
91
+ const response = await client.uploadText({
92
+ title: 'Just shipped a new feature! 🚀 Check it out at example.com',
93
+ user: 'my-profile',
94
+ platforms: ['x', 'linkedin', 'threads'],
95
+
96
+ // Optional: Create a poll on X
97
+ xPollOptions: ['Option A', 'Option B', 'Option C'],
98
+ xPollDuration: 1440, // 24 hours in minutes
99
+
100
+ // Optional: Post to a LinkedIn company page
101
+ targetLinkedinPageId: 'company-page-id',
102
+ });
103
+ ```
24
104
 
25
- // Upload video with options
26
- const result = await uploader.upload('/path/to/video.mp4', {
27
- title: 'My Awesome Video',
28
- user: 'test-user',
29
- platforms: ['tiktok'] // Currently supported platforms
105
+ ### Upload Documents (LinkedIn)
106
+
107
+ ```javascript
108
+ const response = await client.uploadDocument('./presentation.pdf', {
109
+ title: 'Q4 2024 Report',
110
+ user: 'my-profile',
111
+ description: 'Check out our latest quarterly results!',
112
+ linkedinVisibility: 'PUBLIC',
113
+ targetLinkedinPageId: 'company-page-id', // Optional: post to company page
30
114
  });
115
+ ```
31
116
 
32
- console.log('Upload successful:', result);
117
+ ### Check Upload Status
118
+
119
+ For async uploads, check the status using the request_id:
120
+
121
+ ```javascript
122
+ const status = await client.getStatus('request_id_from_upload');
123
+ console.log(status);
33
124
  ```
34
125
 
35
- ## API Documentation
126
+ ### Get Upload History
36
127
 
37
- ### Constructor
38
- `new UploadPost(apiKey: string)`
128
+ ```javascript
129
+ const history = await client.getHistory({ page: 1, limit: 20 });
130
+ console.log(history.uploads);
131
+ ```
132
+
133
+ ### Scheduled Posts
134
+
135
+ ```javascript
136
+ // List all scheduled posts
137
+ const scheduled = await client.listScheduled();
138
+
139
+ // Edit a scheduled post
140
+ await client.editScheduled('job-id', {
141
+ scheduledDate: '2024-12-26T15:00:00Z',
142
+ timezone: 'America/New_York',
143
+ });
144
+
145
+ // Cancel a scheduled post
146
+ await client.cancelScheduled('job-id');
147
+ ```
148
+
149
+ ### User Management
150
+
151
+ ```javascript
152
+ // List all profiles
153
+ const users = await client.listUsers();
39
154
 
40
- ### upload()
41
- `upload(videoPath: string, options: UploadOptions): Promise<object>`
155
+ // Create a new profile
156
+ await client.createUser('new-profile');
42
157
 
43
- #### Options
44
- - `videoPath`: Path to video file (MP4, MOV, AVI, etc.)
45
- - `options.title`: Video title
46
- - `options.user`: User identifier
47
- - `options.platforms`: Array of target platforms (currently supports 'tiktok')
158
+ // Delete a profile
159
+ await client.deleteUser('old-profile');
160
+
161
+ // Generate JWT for platform integration (white-label)
162
+ const jwt = await client.generateJwt('my-profile', {
163
+ redirectUrl: 'https://yourapp.com/callback',
164
+ platforms: ['tiktok', 'instagram'],
165
+ });
166
+ ```
167
+
168
+ ### Get Analytics
169
+
170
+ ```javascript
171
+ const analytics = await client.getAnalytics('my-profile', {
172
+ platforms: ['instagram', 'tiktok'],
173
+ });
174
+ console.log(analytics);
175
+ ```
176
+
177
+ ### Helper Methods
178
+
179
+ ```javascript
180
+ // Get Facebook pages for a profile
181
+ const fbPages = await client.getFacebookPages('my-profile');
182
+
183
+ // Get LinkedIn pages for a profile
184
+ const liPages = await client.getLinkedinPages('my-profile');
185
+
186
+ // Get Pinterest boards for a profile
187
+ const boards = await client.getPinterestBoards('my-profile');
188
+ ```
189
+
190
+ ## Platform-Specific Options
191
+
192
+ ### TikTok (Video)
193
+ - `tiktokPrivacyLevel` - PUBLIC_TO_EVERYONE, MUTUAL_FOLLOW_FRIENDS, FOLLOWER_OF_CREATOR, SELF_ONLY
194
+ - `tiktokDisableDuet` - Disable duet
195
+ - `tiktokDisableComment` - Disable comments
196
+ - `tiktokDisableStitch` - Disable stitch
197
+ - `tiktokCoverTimestamp` - Timestamp in ms for cover
198
+ - `tiktokIsAigc` - AI-generated content flag
199
+ - `tiktokPostMode` - DIRECT_POST or MEDIA_UPLOAD
200
+ - `brandContentToggle` - Branded content toggle
201
+ - `brandOrganicToggle` - Brand organic toggle
202
+
203
+ ### TikTok (Photos)
204
+ - `tiktokAutoAddMusic` - Auto add music
205
+ - `tiktokPhotoCoverIndex` - Index of photo for cover (0-based)
206
+ - `tiktokDisableComment` - Disable comments
207
+
208
+ ### Instagram
209
+ - `instagramMediaType` - REELS, STORIES, IMAGE
210
+ - `instagramShareToFeed` - Share to feed (for Reels/Stories)
211
+ - `instagramCollaborators` - Comma-separated collaborator usernames
212
+ - `instagramCoverUrl` - Custom cover URL
213
+ - `instagramAudioName` - Audio track name
214
+ - `instagramUserTags` - Comma-separated user tags
215
+ - `instagramLocationId` - Location ID
216
+ - `instagramThumbOffset` - Thumbnail offset
217
+
218
+ ### YouTube
219
+ - `youtubeTags` - Array or comma-separated tags
220
+ - `youtubeCategoryId` - Category ID (default: "22" People & Blogs)
221
+ - `youtubePrivacyStatus` - public, unlisted, private
222
+ - `youtubeEmbeddable` - Allow embedding
223
+ - `youtubeLicense` - youtube, creativeCommon
224
+ - `youtubePublicStatsViewable` - Show public stats
225
+ - `youtubeThumbnailUrl` - Custom thumbnail URL
226
+ - `youtubeSelfDeclaredMadeForKids` - Made for kids (COPPA)
227
+ - `youtubeContainsSyntheticMedia` - AI/synthetic content flag
228
+ - `youtubeDefaultLanguage` - Title/description language (BCP-47)
229
+ - `youtubeDefaultAudioLanguage` - Audio language (BCP-47)
230
+ - `youtubeAllowedCountries` / `youtubeBlockedCountries` - Country restrictions
231
+ - `youtubeHasPaidProductPlacement` - Paid placement flag
232
+ - `youtubeRecordingDate` - Recording date (ISO 8601)
233
+
234
+ ### LinkedIn
235
+ - `linkedinVisibility` - PUBLIC, CONNECTIONS, LOGGED_IN, CONTAINER
236
+ - `targetLinkedinPageId` - Page ID for organization posts
237
+
238
+ ### Facebook
239
+ - `facebookPageId` - Facebook Page ID (required)
240
+ - `facebookVideoState` - PUBLISHED, DRAFT
241
+ - `facebookMediaType` - REELS, STORIES
242
+ - `facebookLinkUrl` - URL for text posts
243
+
244
+ ### Pinterest
245
+ - `pinterestBoardId` - Board ID
246
+ - `pinterestLink` - Destination link
247
+ - `pinterestAltText` - Alt text for photos
248
+ - `pinterestCoverImageUrl` - Cover image URL (video)
249
+ - `pinterestCoverImageKeyFrameTime` - Key frame time in ms
250
+
251
+ ### X (Twitter)
252
+ - `xReplySettings` - everyone, following, mentionedUsers, subscribers, verified
253
+ - `xNullcast` - Promoted-only post
254
+ - `xTaggedUserIds` - User IDs to tag
255
+ - `xPlaceId` / `xGeoPlaceId` - Location place ID
256
+ - `xQuoteTweetId` - Tweet ID to quote
257
+ - `xPollOptions` - Poll options (2-4)
258
+ - `xPollDuration` - Poll duration in minutes (5-10080)
259
+ - `xForSuperFollowersOnly` - Exclusive for super followers
260
+ - `xCommunityId` - Community ID
261
+ - `xShareWithFollowers` - Share community post with followers
262
+ - `xCardUri` - Card URI for Twitter Cards
263
+ - `xLongTextAsPost` - Post long text as single post
264
+
265
+ ### Threads
266
+ - `threadsLongTextAsPost` - Post long text as single post (vs thread)
267
+
268
+ ### Reddit
269
+ - `redditSubreddit` - Subreddit name (without r/)
270
+ - `redditFlairId` - Flair template ID
271
+
272
+ ## Common Options
273
+
274
+ These options work across all upload methods:
275
+
276
+ | Option | Description |
277
+ |--------|-------------|
278
+ | `title` | Post title/caption (required) |
279
+ | `user` | Profile name (required) |
280
+ | `platforms` | Target platforms array (required) |
281
+ | `firstComment` | First comment to post |
282
+ | `altText` | Alt text for accessibility |
283
+ | `scheduledDate` | ISO date for scheduling |
284
+ | `timezone` | Timezone for scheduled date |
285
+ | `addToQueue` | Add to posting queue |
286
+ | `asyncUpload` | Process asynchronously (default: true) |
287
+
288
+ ## TypeScript Support
289
+
290
+ Full TypeScript support with comprehensive type definitions:
291
+
292
+ ```typescript
293
+ import { UploadPost, UploadVideoOptions, UploadResponse } from 'upload-post';
294
+
295
+ const client = new UploadPost('YOUR_API_KEY');
296
+
297
+ const options: UploadVideoOptions = {
298
+ title: 'My video',
299
+ user: 'my-profile',
300
+ platforms: ['tiktok', 'instagram'],
301
+ tiktokPrivacyLevel: 'PUBLIC_TO_EVERYONE',
302
+ };
303
+
304
+ const response: UploadResponse = await client.upload('./video.mp4', options);
305
+ ```
48
306
 
49
307
  ## Error Handling
50
- The library throws errors for:
51
- - Missing required parameters
52
- - File not found
53
- - API request failures
54
- - Invalid platform specifications
308
+
309
+ ```javascript
310
+ try {
311
+ const response = await client.upload('./video.mp4', options);
312
+ console.log('Upload successful:', response);
313
+ } catch (error) {
314
+ console.error('Upload failed:', error.message);
315
+ }
316
+ ```
317
+
318
+ ## Links
319
+
320
+ - [Upload-Post Website](https://www.upload-post.com)
321
+ - [API Documentation](https://docs.upload-post.com)
322
+ - [Dashboard](https://app.upload-post.com)
55
323
 
56
324
  ## License
325
+
57
326
  MIT