postiz 2.0.4 → 2.0.6

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.
package/README.md CHANGED
@@ -1,254 +1,493 @@
1
1
  # Postiz CLI
2
2
 
3
- > Command-line interface for the Postiz social media scheduling platform
3
+ **Social media automation CLI for AI agents** - Schedule posts across 28+ platforms programmatically.
4
4
 
5
- ## Overview
5
+ The Postiz CLI provides a command-line interface to the Postiz API, enabling developers and AI agents to automate social media posting, manage content, and handle media uploads across platforms like Twitter/X, LinkedIn, Reddit, YouTube, TikTok, Instagram, Facebook, and more.
6
6
 
7
- The Postiz CLI allows you to interact with the Postiz API from the command line, making it easy for developers and AI agents to automate social media scheduling, manage posts, and upload media.
7
+ ---
8
8
 
9
- ## Quick Start
9
+ ## Installation
10
10
 
11
- ### Installation
11
+ ### From npm (Recommended)
12
12
 
13
13
  ```bash
14
- # Install dependencies
15
- pnpm install
14
+ npm install -g postiz
15
+ # or
16
+ pnpm install -g postiz
17
+ ```
18
+
19
+ ### From Source
16
20
 
17
- # Build the CLI
21
+ ```bash
22
+ git clone https://github.com/gitroomhq/postiz-app.git
23
+ cd postiz-app/apps/cli
24
+ pnpm install
18
25
  pnpm run build
26
+ pnpm link --global
27
+ ```
19
28
 
20
- # Run locally (development)
21
- pnpm run start -- [command]
29
+ ### For Development
22
30
 
23
- # Or link globally
31
+ ```bash
32
+ pnpm install
33
+ pnpm run build
24
34
  pnpm link --global
35
+
36
+ # Or run directly without linking
37
+ pnpm run start -- posts:list
25
38
  ```
26
39
 
27
- ### Setup
40
+ ---
28
41
 
29
- Before using the CLI, you need to set your Postiz API key:
42
+ ## Setup
43
+
44
+ **Required:** Set your Postiz API key
30
45
 
31
46
  ```bash
32
47
  export POSTIZ_API_KEY=your_api_key_here
33
48
  ```
34
49
 
35
- Optionally, you can set a custom API URL:
50
+ **Optional:** Custom API endpoint
36
51
 
37
52
  ```bash
38
53
  export POSTIZ_API_URL=https://your-custom-api.com
39
54
  ```
40
55
 
41
- ## Usage
56
+ ---
57
+
58
+ ## Commands
59
+
60
+ ### Discovery & Settings
42
61
 
62
+ **List all connected integrations**
43
63
  ```bash
44
- postiz <command> [options]
64
+ postiz integrations:list
45
65
  ```
46
66
 
47
- ### Commands
67
+ Returns integration IDs, provider names, and metadata.
48
68
 
49
- #### Create a Post
69
+ **Get integration settings schema**
70
+ ```bash
71
+ postiz integrations:settings <integration-id>
72
+ ```
50
73
 
74
+ Returns character limits, required settings, and available tools for fetching dynamic data.
75
+
76
+ **Trigger integration tools**
51
77
  ```bash
52
- postiz posts:create -c "Your content here" -i "integration-id-1,integration-id-2"
78
+ postiz integrations:trigger <integration-id> <method-name>
79
+ postiz integrations:trigger <integration-id> <method-name> -d '{"key":"value"}'
53
80
  ```
54
81
 
55
- **Options:**
56
- - `-c, --content <text>` - Post/comment content (can be used multiple times)
57
- - `-m, --media <urls>` - Comma-separated media URLs for the corresponding `-c` (can be used multiple times)
58
- - `-i, --integrations <ids>` - Comma-separated integration IDs (required)
59
- - `-s, --schedule <date>` - Schedule date (ISO 8601)
60
- - `-d, --delay <ms>` - Delay between comments in milliseconds (default: 5000)
61
- - `-p, --provider-type <type>` - Provider type for platform-specific settings (e.g., reddit, youtube, x, tiktok)
62
- - `--settings <json>` - Provider-specific settings as JSON string
82
+ Fetch dynamic data like Reddit flairs, YouTube playlists, LinkedIn companies, etc.
63
83
 
64
84
  **Examples:**
85
+ ```bash
86
+ # Get Reddit flairs
87
+ postiz integrations:trigger reddit-123 getFlairs -d '{"subreddit":"programming"}'
88
+
89
+ # Get YouTube playlists
90
+ postiz integrations:trigger youtube-456 getPlaylists
91
+
92
+ # Get LinkedIn companies
93
+ postiz integrations:trigger linkedin-789 getCompanies
94
+ ```
95
+
96
+ ---
97
+
98
+ ### Creating Posts
65
99
 
100
+ **Simple scheduled post**
66
101
  ```bash
67
- # Simple post
68
- postiz posts:create -c "Hello World!" -i "twitter-123"
102
+ postiz posts:create -c "Content" -s "2024-12-31T12:00:00Z" -i "integration-id"
103
+ ```
69
104
 
70
- # Post with multiple images
71
- postiz posts:create \
72
- -c "Check these out!" \
73
- -m "img1.jpg,img2.jpg,img3.jpg" \
74
- -i "twitter-123"
105
+ **Draft post**
106
+ ```bash
107
+ postiz posts:create -c "Content" -s "2024-12-31T12:00:00Z" -t draft -i "integration-id"
108
+ ```
75
109
 
76
- # Post with comments, each having their own media
77
- postiz posts:create \
78
- -c "Main post 🚀" -m "main.jpg,main2.jpg" \
79
- -c "First comment 📸" -m "comment1.jpg" \
80
- -c "Second comment 🎨" -m "comment2.jpg" \
81
- -i "twitter-123"
110
+ **Post with media**
111
+ ```bash
112
+ postiz posts:create -c "Content" -m "img1.jpg,img2.jpg" -s "2024-12-31T12:00:00Z" -i "integration-id"
113
+ ```
82
114
 
83
- # Comments can contain semicolons!
115
+ **Post with comments** (each comment can have its own media)
116
+ ```bash
84
117
  postiz posts:create \
85
- -c "Main post" \
86
- -c "Comment with semicolon; see, it works!" \
87
- -c "Another comment; multiple; semicolons!" \
88
- -i "twitter-123"
118
+ -c "Main post" -m "main.jpg" \
119
+ -c "First comment" -m "comment1.jpg" \
120
+ -c "Second comment" -m "comment2.jpg,comment3.jpg" \
121
+ -s "2024-12-31T12:00:00Z" \
122
+ -i "integration-id"
123
+ ```
89
124
 
90
- # Twitter thread with custom delay
91
- postiz posts:create \
92
- -c "Thread 1/3" \
93
- -c "Thread 2/3" \
94
- -c "Thread 3/3" \
95
- -d 2000 \
96
- -i "twitter-123"
125
+ **Multi-platform post**
126
+ ```bash
127
+ postiz posts:create -c "Content" -s "2024-12-31T12:00:00Z" -i "twitter-id,linkedin-id,facebook-id"
128
+ ```
97
129
 
98
- # Scheduled post
130
+ **Platform-specific settings**
131
+ ```bash
99
132
  postiz posts:create \
100
- -c "Future post" \
133
+ -c "Content" \
101
134
  -s "2024-12-31T12:00:00Z" \
102
- -i "twitter-123"
135
+ --settings '{"subreddit":[{"value":{"subreddit":"programming","title":"Post Title","type":"text"}}]}' \
136
+ -i "reddit-id"
137
+ ```
103
138
 
104
- # With provider-specific settings
105
- postiz posts:create \
106
- -c "Video description" \
107
- -p youtube \
108
- --settings '{"title":"My Video","type":"public"}' \
109
- -i "youtube-123"
139
+ **Complex post from JSON file**
140
+ ```bash
141
+ postiz posts:create --json post.json
110
142
  ```
111
143
 
112
- ### Provider-Specific Settings
144
+ **Options:**
145
+ - `-c, --content` - Post/comment content (use multiple times for posts with comments)
146
+ - `-s, --date` - Schedule date in ISO 8601 format (REQUIRED)
147
+ - `-t, --type` - Post type: "schedule" or "draft" (default: "schedule")
148
+ - `-m, --media` - Comma-separated media URLs for corresponding `-c`
149
+ - `-i, --integrations` - Comma-separated integration IDs (required)
150
+ - `-d, --delay` - Delay between comments in milliseconds (default: 5000)
151
+ - `--settings` - Platform-specific settings as JSON string
152
+ - `-j, --json` - Path to JSON file with full post structure
153
+ - `--shortLink` - Use short links (default: true)
154
+
155
+ ---
113
156
 
114
- Many platforms support specific settings (Reddit subreddits, YouTube visibility, TikTok privacy, etc.):
157
+ ### Managing Posts
115
158
 
159
+ **List posts**
116
160
  ```bash
117
- # Reddit with subreddit settings
118
- postiz posts:create \
119
- -c "Post content" \
120
- -p reddit \
121
- --settings '{"subreddit":[{"value":{"subreddit":"programming","title":"My Title","type":"text","url":"","is_flair_required":false}}]}' \
122
- -i "reddit-123"
161
+ postiz posts:list
162
+ postiz posts:list --startDate "2024-01-01T00:00:00Z" --endDate "2024-12-31T23:59:59Z"
163
+ postiz posts:list --customer "customer-id"
164
+ ```
123
165
 
124
- # YouTube with title and visibility
125
- postiz posts:create \
126
- -c "Video description" \
127
- -p youtube \
128
- --settings '{"title":"My Video","type":"public","tags":[{"value":"tech","label":"Tech"}]}' \
129
- -i "youtube-123"
166
+ Defaults to last 30 days to next 30 days if dates not specified.
130
167
 
131
- # X (Twitter) with reply settings
132
- postiz posts:create \
133
- -c "Tweet" \
134
- -p x \
135
- --settings '{"who_can_reply_post":"everyone"}' \
136
- -i "twitter-123"
168
+ **Delete post**
169
+ ```bash
170
+ postiz posts:delete <post-id>
137
171
  ```
138
172
 
139
- See **[PROVIDER_SETTINGS.md](./PROVIDER_SETTINGS.md)** for complete documentation on all platform-specific settings.
173
+ ---
174
+
175
+ ### Media Upload
176
+
177
+ **Upload file and get URL**
178
+ ```bash
179
+ postiz upload <file-path>
140
180
  ```
141
181
 
142
- #### List Posts
182
+ **⚠️ IMPORTANT: Upload Files Before Posting**
183
+
184
+ You **must** upload media files to Postiz before using them in posts. Many platforms (especially TikTok, Instagram, and YouTube) require verified/trusted URLs and will reject external links.
185
+
186
+ **Workflow:**
187
+ 1. Upload your file using `postiz upload`
188
+ 2. Extract the returned URL
189
+ 3. Use that URL in your post's `-m` parameter
190
+
191
+ **Supported formats:**
192
+ - **Images:** PNG, JPG, JPEG, GIF, WEBP, SVG, BMP, ICO
193
+ - **Videos:** MP4, MOV, AVI, MKV, WEBM, FLV, WMV, M4V, MPEG, MPG, 3GP
194
+ - **Audio:** MP3, WAV, OGG, AAC, FLAC, M4A
195
+ - **Documents:** PDF, DOC, DOCX
143
196
 
197
+ **Example:**
144
198
  ```bash
145
- postiz posts:list [options]
199
+ # 1. Upload the file first
200
+ RESULT=$(postiz upload video.mp4)
201
+ PATH=$(echo "$RESULT" | jq -r '.path')
202
+
203
+ # 2. Use the Postiz URL in your post
204
+ postiz posts:create -c "Check out my video!" -s "2024-12-31T12:00:00Z" -m "$PATH" -i "tiktok-id"
146
205
  ```
147
206
 
148
- **Options:**
149
- - `-p, --page <number>` - Page number (default: 1)
150
- - `-l, --limit <number>` - Posts per page (default: 10)
151
- - `-s, --search <query>` - Search query
207
+ **Why this is required:**
208
+ - **TikTok, Instagram, YouTube** only accept URLs from trusted domains
209
+ - **Security:** Platforms verify media sources to prevent abuse
210
+ - **Reliability:** Postiz ensures your media is always accessible
152
211
 
153
- **Examples:**
212
+ ---
213
+
214
+ ## Platform-Specific Features
154
215
 
216
+ ### Reddit
155
217
  ```bash
156
- # List all posts
157
- postiz posts:list
218
+ # Get available flairs
219
+ postiz integrations:trigger reddit-id getFlairs -d '{"subreddit":"programming"}'
158
220
 
159
- # With pagination
160
- postiz posts:list -p 2 -l 20
221
+ # Post with subreddit and flair
222
+ postiz posts:create \
223
+ -c "Content" \
224
+ -s "2024-12-31T12:00:00Z" \
225
+ --settings '{"subreddit":[{"value":{"subreddit":"programming","title":"My Post","type":"text","is_flair_required":true,"flair":{"id":"flair-123","name":"Discussion"}}}]}' \
226
+ -i "reddit-id"
227
+ ```
228
+
229
+ ### YouTube
230
+ ```bash
231
+ # Get playlists
232
+ postiz integrations:trigger youtube-id getPlaylists
161
233
 
162
- # Search posts
163
- postiz posts:list -s "keyword"
234
+ # Upload video FIRST (required!)
235
+ VIDEO=$(postiz upload video.mp4)
236
+ VIDEO_URL=$(echo "$VIDEO" | jq -r '.path')
237
+
238
+ # Post with uploaded video URL
239
+ postiz posts:create \
240
+ -c "Video description" \
241
+ -s "2024-12-31T12:00:00Z" \
242
+ --settings '{"title":"Video Title","type":"public","tags":[{"value":"tech","label":"Tech"}],"playlistId":"playlist-id"}' \
243
+ -m "$VIDEO_URL" \
244
+ -i "youtube-id"
164
245
  ```
165
246
 
166
- #### Delete a Post
247
+ ### TikTok
248
+ ```bash
249
+ # Upload video FIRST (TikTok only accepts verified URLs!)
250
+ VIDEO=$(postiz upload video.mp4)
251
+ VIDEO_URL=$(echo "$VIDEO" | jq -r '.path')
252
+
253
+ # Post with uploaded video URL
254
+ postiz posts:create \
255
+ -c "Video caption #fyp" \
256
+ -s "2024-12-31T12:00:00Z" \
257
+ --settings '{"privacy":"PUBLIC_TO_EVERYONE","duet":true,"stitch":true}' \
258
+ -m "$VIDEO_URL" \
259
+ -i "tiktok-id"
260
+ ```
167
261
 
262
+ ### LinkedIn
168
263
  ```bash
169
- postiz posts:delete <post-id>
264
+ # Get companies you can post to
265
+ postiz integrations:trigger linkedin-id getCompanies
266
+
267
+ # Post as company
268
+ postiz posts:create \
269
+ -c "Company announcement" \
270
+ -s "2024-12-31T12:00:00Z" \
271
+ --settings '{"companyId":"company-123"}' \
272
+ -i "linkedin-id"
170
273
  ```
171
274
 
172
- **Example:**
275
+ ### X (Twitter)
276
+ ```bash
277
+ # Create thread
278
+ postiz posts:create \
279
+ -c "Thread 1/3 🧵" \
280
+ -c "Thread 2/3" \
281
+ -c "Thread 3/3" \
282
+ -s "2024-12-31T12:00:00Z" \
283
+ -d 2000 \
284
+ -i "twitter-id"
285
+
286
+ # With reply settings
287
+ postiz posts:create \
288
+ -c "Tweet content" \
289
+ -s "2024-12-31T12:00:00Z" \
290
+ --settings '{"who_can_reply_post":"everyone"}' \
291
+ -i "twitter-id"
292
+ ```
173
293
 
294
+ ### Instagram
174
295
  ```bash
175
- postiz posts:delete abc123xyz
296
+ # Upload image FIRST (Instagram requires verified URLs!)
297
+ IMAGE=$(postiz upload image.jpg)
298
+ IMAGE_URL=$(echo "$IMAGE" | jq -r '.path')
299
+
300
+ # Regular post
301
+ postiz posts:create \
302
+ -c "Caption #hashtag" \
303
+ -s "2024-12-31T12:00:00Z" \
304
+ --settings '{"post_type":"post"}' \
305
+ -m "$IMAGE_URL" \
306
+ -i "instagram-id"
307
+
308
+ # Story (upload first)
309
+ STORY=$(postiz upload story.jpg)
310
+ STORY_URL=$(echo "$STORY" | jq -r '.path')
311
+
312
+ postiz posts:create \
313
+ -c "" \
314
+ -s "2024-12-31T12:00:00Z" \
315
+ --settings '{"post_type":"story"}' \
316
+ -m "$STORY_URL" \
317
+ -i "instagram-id"
176
318
  ```
177
319
 
178
- #### List Integrations
320
+ **See [PROVIDER_SETTINGS.md](./PROVIDER_SETTINGS.md) for all 28+ platforms.**
321
+
322
+ ---
323
+
324
+ ## Features for AI Agents
325
+
326
+ ### Discovery Workflow
327
+ The CLI enables dynamic discovery of integration capabilities:
328
+
329
+ 1. **List integrations** - Get available social media accounts
330
+ 2. **Get settings** - Retrieve character limits, required fields, and available tools
331
+ 3. **Trigger tools** - Fetch dynamic data (flairs, playlists, boards, etc.)
332
+ 4. **Create posts** - Use discovered data in posts
333
+
334
+ This allows AI agents to adapt to different platforms without hardcoded knowledge.
335
+
336
+ ### JSON Mode
337
+ For complex posts with multiple platforms and settings:
179
338
 
180
339
  ```bash
181
- postiz integrations:list
340
+ postiz posts:create --json complex-post.json
182
341
  ```
183
342
 
184
- Shows all connected social media accounts.
343
+ JSON structure:
344
+ ```json
345
+ {
346
+ "integrations": ["twitter-123", "linkedin-456"],
347
+ "posts": [
348
+ {
349
+ "provider": "twitter",
350
+ "post": [
351
+ {
352
+ "content": "Tweet version",
353
+ "image": ["twitter-image.jpg"]
354
+ }
355
+ ]
356
+ },
357
+ {
358
+ "provider": "linkedin",
359
+ "post": [
360
+ {
361
+ "content": "LinkedIn version with more context...",
362
+ "image": ["linkedin-image.jpg"]
363
+ }
364
+ ],
365
+ "settings": {
366
+ "__type": "linkedin",
367
+ "companyId": "company-123"
368
+ }
369
+ }
370
+ ]
371
+ }
372
+ ```
185
373
 
186
- #### Upload a File
374
+ ### All Output is JSON
375
+ Every command outputs JSON for easy parsing:
187
376
 
188
377
  ```bash
189
- postiz upload <file-path>
378
+ INTEGRATIONS=$(postiz integrations:list | jq -r '.')
379
+ REDDIT_ID=$(echo "$INTEGRATIONS" | jq -r '.[] | select(.identifier=="reddit") | .id')
190
380
  ```
191
381
 
192
- **Example:**
382
+ ### Threading Support
383
+ Comments are automatically converted to threads/replies based on platform:
384
+ - **Twitter/X**: Thread of tweets
385
+ - **Reddit**: Comment replies
386
+ - **LinkedIn**: Comment on post
387
+ - **Instagram**: First comment
193
388
 
194
389
  ```bash
195
- postiz upload ./images/photo.png
390
+ postiz posts:create \
391
+ -c "Main post" \
392
+ -c "Comment 1" \
393
+ -c "Comment 2" \
394
+ -i "integration-id"
196
395
  ```
197
396
 
198
- ## Development
397
+ ---
199
398
 
200
- ### Project Structure
399
+ ## Common Workflows
201
400
 
202
- ```
203
- apps/cli/
204
- ├── src/
205
- │ ├── index.ts # CLI entry point
206
- │ ├── api.ts # API client
207
- │ ├── config.ts # Configuration handler
208
- │ └── commands/
209
- │ ├── posts.ts # Post commands
210
- │ ├── integrations.ts # Integration commands
211
- │ └── upload.ts # Upload commands
212
- ├── package.json
213
- ├── tsconfig.json
214
- ├── tsup.config.ts
215
- ├── README.md
216
- └── SKILL.md # AI agent usage guide
217
- ```
401
+ ### Reddit Post with Flair
402
+ ```bash
403
+ #!/bin/bash
404
+ REDDIT_ID=$(postiz integrations:list | jq -r '.[] | select(.identifier=="reddit") | .id')
405
+ FLAIRS=$(postiz integrations:trigger "$REDDIT_ID" getFlairs -d '{"subreddit":"programming"}')
406
+ FLAIR_ID=$(echo "$FLAIRS" | jq -r '.output[0].id')
218
407
 
219
- ### Scripts
408
+ postiz posts:create \
409
+ -c "My post content" \
410
+ -s "2024-12-31T12:00:00Z" \
411
+ --settings "{\"subreddit\":[{\"value\":{\"subreddit\":\"programming\",\"title\":\"Post Title\",\"type\":\"text\",\"is_flair_required\":true,\"flair\":{\"id\":\"$FLAIR_ID\",\"name\":\"Discussion\"}}}]}" \
412
+ -i "$REDDIT_ID"
413
+ ```
220
414
 
221
- - `pnpm run dev` - Watch mode for development
222
- - `pnpm run build` - Build the CLI
223
- - `pnpm run start` - Run the built CLI
415
+ ### YouTube Video Upload
416
+ ```bash
417
+ #!/bin/bash
418
+ VIDEO=$(postiz upload video.mp4)
419
+ VIDEO_PATH=$(echo "$VIDEO" | jq -r '.path')
224
420
 
225
- ### Building
421
+ postiz posts:create \
422
+ -c "Video description..." \
423
+ -s "2024-12-31T12:00:00Z" \
424
+ --settings '{"title":"My Video","type":"public","tags":[{"value":"tech","label":"Tech"}]}' \
425
+ -m "$VIDEO_PATH" \
426
+ -i "youtube-id"
427
+ ```
226
428
 
227
- The CLI uses `tsup` for building:
429
+ ### Multi-Platform Campaign
430
+ ```bash
431
+ #!/bin/bash
432
+ postiz posts:create \
433
+ -c "Same content everywhere" \
434
+ -s "2024-12-31T12:00:00Z" \
435
+ -m "image.jpg" \
436
+ -i "twitter-id,linkedin-id,facebook-id"
437
+ ```
228
438
 
439
+ ### Batch Scheduling
229
440
  ```bash
230
- pnpm run build
441
+ #!/bin/bash
442
+ DATES=("2024-02-14T09:00:00Z" "2024-02-15T09:00:00Z" "2024-02-16T09:00:00Z")
443
+ CONTENT=("Monday motivation 💪" "Tuesday tips 💡" "Wednesday wisdom 🧠")
444
+
445
+ for i in "${!DATES[@]}"; do
446
+ postiz posts:create \
447
+ -c "${CONTENT[$i]}" \
448
+ -s "${DATES[$i]}" \
449
+ -i "twitter-id"
450
+ done
231
451
  ```
232
452
 
233
- This creates a `dist/` directory with:
234
- - Compiled JavaScript
235
- - Type declarations
236
- - Source maps
237
- - Executable shebang for Node.js
453
+ ---
238
454
 
239
- ## For AI Agents
455
+ ## Documentation
240
456
 
241
- See [SKILL.md](./SKILL.md) for detailed usage patterns and examples for AI agents.
457
+ **For AI Agents:**
458
+ - **[SKILL.md](./SKILL.md)** - Complete skill reference with patterns and examples
242
459
 
243
- ## API Reference
460
+ **Deep-Dive Guides:**
461
+ - **[HOW_TO_RUN.md](./HOW_TO_RUN.md)** - Installation and setup methods
462
+ - **[COMMAND_LINE_GUIDE.md](./COMMAND_LINE_GUIDE.md)** - Complete command syntax reference
463
+ - **[PROVIDER_SETTINGS.md](./PROVIDER_SETTINGS.md)** - All platform settings schemas
464
+ - **[INTEGRATION_TOOLS_WORKFLOW.md](./INTEGRATION_TOOLS_WORKFLOW.md)** - Tools workflow guide
465
+ - **[INTEGRATION_SETTINGS_DISCOVERY.md](./INTEGRATION_SETTINGS_DISCOVERY.md)** - Settings discovery
466
+ - **[SUPPORTED_FILE_TYPES.md](./SUPPORTED_FILE_TYPES.md)** - Media format reference
467
+ - **[PROJECT_STRUCTURE.md](./PROJECT_STRUCTURE.md)** - Code architecture
468
+ - **[PUBLISHING.md](./PUBLISHING.md)** - npm publishing guide
469
+
470
+ **Examples:**
471
+ - **[examples/EXAMPLES.md](./examples/EXAMPLES.md)** - Comprehensive examples
472
+ - **[examples/](./examples/)** - Ready-to-use scripts and JSON files
473
+
474
+ ---
475
+
476
+ ## API Endpoints
244
477
 
245
478
  The CLI interacts with these Postiz API endpoints:
246
479
 
247
- - `POST /public/v1/posts` - Create a post
248
- - `GET /public/v1/posts` - List posts
249
- - `DELETE /public/v1/posts/:id` - Delete a post
250
- - `GET /public/v1/integrations` - List integrations
251
- - `POST /public/v1/upload` - Upload media
480
+ | Endpoint | Method | Purpose |
481
+ |----------|--------|---------|
482
+ | `/public/v1/posts` | POST | Create a post |
483
+ | `/public/v1/posts` | GET | List posts |
484
+ | `/public/v1/posts/:id` | DELETE | Delete a post |
485
+ | `/public/v1/integrations` | GET | List integrations |
486
+ | `/public/v1/integration-settings/:id` | GET | Get integration settings |
487
+ | `/public/v1/integration-trigger/:id` | POST | Trigger integration tool |
488
+ | `/public/v1/upload` | POST | Upload media |
489
+
490
+ ---
252
491
 
253
492
  ## Environment Variables
254
493
 
@@ -257,65 +496,146 @@ The CLI interacts with these Postiz API endpoints:
257
496
  | `POSTIZ_API_KEY` | ✅ Yes | - | Your Postiz API key |
258
497
  | `POSTIZ_API_URL` | No | `https://api.postiz.com` | Custom API endpoint |
259
498
 
499
+ ---
500
+
260
501
  ## Error Handling
261
502
 
262
- The CLI provides user-friendly error messages:
503
+ The CLI provides clear error messages with exit codes:
263
504
 
264
- - Success messages with green checkmarks
265
- - Error messages with red X marks
266
- - 📋 Info messages with emojis
267
- - Exit code 0 for success, 1 for errors
505
+ - **Exit code 0**: Success
506
+ - **Exit code 1**: Error occurred
268
507
 
269
- ## Examples
508
+ **Common errors:**
270
509
 
271
- ### Basic Workflow
510
+ | Error | Solution |
511
+ |-------|----------|
512
+ | `POSTIZ_API_KEY is not set` | Set environment variable: `export POSTIZ_API_KEY=key` |
513
+ | `Integration not found` | Run `integrations:list` to get valid IDs |
514
+ | `startDate/endDate required` | Use ISO 8601 format: `"2024-12-31T12:00:00Z"` |
515
+ | `Invalid settings` | Check `integrations:settings` for required fields |
516
+ | `Tool not found` | Check available tools in `integrations:settings` output |
517
+ | `Upload failed` | Verify file exists and format is supported |
272
518
 
273
- ```bash
274
- # 1. Set API key
275
- export POSTIZ_API_KEY=your_key
519
+ ---
276
520
 
277
- # 2. Check connected integrations
278
- postiz integrations:list
521
+ ## Development
279
522
 
280
- # 3. Create a post
281
- postiz posts:create -c "Hello from CLI!" -i "twitter-123"
523
+ ### Project Structure
282
524
 
283
- # 4. List posts
284
- postiz posts:list
525
+ ```
526
+ src/
527
+ ├── index.ts # CLI entry point with yargs
528
+ ├── api.ts # PostizAPI client class
529
+ ├── config.ts # Environment configuration
530
+ └── commands/
531
+ ├── posts.ts # Post management commands
532
+ ├── integrations.ts # Integration commands
533
+ └── upload.ts # Media upload command
534
+ examples/ # Example scripts and JSON files
535
+ package.json
536
+ tsconfig.json
537
+ tsup.config.ts # Build configuration
538
+ README.md # This file
539
+ SKILL.md # AI agent reference
540
+ ```
285
541
 
286
- # 5. Delete a post
287
- postiz posts:delete post-id-123
542
+ ### Scripts
543
+
544
+ ```bash
545
+ pnpm run dev # Watch mode for development
546
+ pnpm run build # Build the CLI
547
+ pnpm run start # Run the built CLI
288
548
  ```
289
549
 
290
- ### Scheduled Posting
550
+ ### Building
551
+
552
+ The CLI uses `tsup` for bundling:
291
553
 
292
554
  ```bash
293
- # Schedule posts for different times
294
- postiz posts:create -c "Morning post" -s "2024-01-15T09:00:00Z"
295
- postiz posts:create -c "Afternoon post" -s "2024-01-15T15:00:00Z"
296
- postiz posts:create -c "Evening post" -s "2024-01-15T20:00:00Z"
555
+ pnpm run build
297
556
  ```
298
557
 
299
- ### Media Upload Workflow
558
+ Output in `dist/`:
559
+ - `index.js` - Bundled executable with shebang
560
+ - `index.js.map` - Source map
561
+
562
+ ---
563
+
564
+ ## Quick Reference
300
565
 
301
566
  ```bash
302
- # Upload an image
303
- postiz upload ./image.png
567
+ # Environment setup
568
+ export POSTIZ_API_KEY=your_key
304
569
 
305
- # The response includes the URL, use it in a post
306
- postiz posts:create -c "Check this out!" --image "url-from-upload"
570
+ # Discovery
571
+ postiz integrations:list # List integrations
572
+ postiz integrations:settings <id> # Get settings
573
+ postiz integrations:trigger <id> <method> -d '{}' # Fetch data
574
+
575
+ # Posting (date is required)
576
+ postiz posts:create -c "text" -s "2024-12-31T12:00:00Z" -i "id" # Simple
577
+ postiz posts:create -c "text" -s "2024-12-31T12:00:00Z" -t draft -i "id" # Draft
578
+ postiz posts:create -c "text" -m "img.jpg" -s "2024-12-31T12:00:00Z" -i "id" # With media
579
+ postiz posts:create -c "main" -c "comment" -s "2024-12-31T12:00:00Z" -i "id" # With comment
580
+ postiz posts:create -c "text" -s "2024-12-31T12:00:00Z" --settings '{}' -i "id" # Platform-specific
581
+ postiz posts:create --json file.json # Complex
582
+
583
+ # Management
584
+ postiz posts:list # List posts
585
+ postiz posts:delete <id> # Delete post
586
+ postiz upload <file> # Upload media
587
+
588
+ # Help
589
+ postiz --help # Show help
590
+ postiz posts:create --help # Command help
307
591
  ```
308
592
 
593
+ ---
594
+
309
595
  ## Contributing
310
596
 
311
597
  This CLI is part of the [Postiz monorepo](https://github.com/gitroomhq/postiz-app).
312
598
 
599
+ To contribute:
600
+ 1. Fork the repository
601
+ 2. Create a feature branch
602
+ 3. Make your changes in `apps/cli/`
603
+ 4. Run tests: `pnpm run build`
604
+ 5. Submit a pull request
605
+
606
+ ---
607
+
313
608
  ## License
314
609
 
315
610
  AGPL-3.0
316
611
 
612
+ ---
613
+
317
614
  ## Links
318
615
 
319
- - [Postiz Website](https://postiz.com)
320
- - [API Documentation](https://postiz.com/api-docs)
321
- - [GitHub Repository](https://github.com/gitroomhq/postiz-app)
616
+ - **Website:** [postiz.com](https://postiz.com)
617
+ - **API Docs:** [postiz.com/api-docs](https://postiz.com/api-docs)
618
+ - **GitHub:** [gitroomhq/postiz-app](https://github.com/gitroomhq/postiz-app)
619
+ - **Issues:** [Report bugs](https://github.com/gitroomhq/postiz-app/issues)
620
+
621
+ ---
622
+
623
+ ## Supported Platforms
624
+
625
+ 28+ platforms including:
626
+
627
+ | Platform | Integration Tools | Settings |
628
+ |----------|------------------|----------|
629
+ | Twitter/X | getLists, getCommunities | who_can_reply_post |
630
+ | LinkedIn | getCompanies | companyId, carousel |
631
+ | Reddit | getFlairs, searchSubreddits | subreddit, title, flair |
632
+ | YouTube | getPlaylists, getCategories | title, type, tags, playlistId |
633
+ | TikTok | - | privacy, duet, stitch |
634
+ | Instagram | - | post_type (post/story) |
635
+ | Facebook | getPages | - |
636
+ | Pinterest | getBoards, getBoardSections | - |
637
+ | Discord | getChannels | - |
638
+ | Slack | getChannels | - |
639
+ | And 18+ more... | | |
640
+
641
+ **See [PROVIDER_SETTINGS.md](./PROVIDER_SETTINGS.md) for complete documentation.**