posterly-mcp-server 0.55.0 → 0.56.1
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 +11 -4
- package/dist/index.js +9 -1
- package/dist/lib/api-client.d.ts +21 -3
- package/dist/lib/api-client.js +26 -7
- package/dist/lib/id-schema.js +7 -1
- package/dist/lib/idempotency.d.ts +45 -0
- package/dist/lib/idempotency.js +83 -0
- package/dist/lib/version.d.ts +1 -1
- package/dist/lib/version.js +1 -1
- package/dist/tools/create-api-key.d.ts +3 -0
- package/dist/tools/create-api-key.js +3 -1
- package/dist/tools/create-post.d.ts +27 -0
- package/dist/tools/create-post.js +27 -8
- package/dist/tools/create-posts-batch.d.ts +16 -0
- package/dist/tools/create-posts-batch.js +25 -5
- package/dist/tools/generate-image.js +1 -1
- package/dist/tools/get-subscription.js +1 -1
- package/dist/tools/list-posts.js +1 -1
- package/dist/tools/manage-google-business-location.js +2 -2
- package/dist/tools/manage-plan.d.ts +21 -0
- package/dist/tools/manage-plan.js +65 -0
- package/dist/tools/manage-workspace-member.d.ts +4 -0
- package/dist/tools/manage-workspace-member.js +14 -1
- package/dist/tools/trigger-platform-helper.js +4 -1
- package/dist/tools/update-post.d.ts +8 -0
- package/dist/tools/update-post.js +8 -1
- package/dist/tools/validate-post.d.ts +16 -0
- package/package.json +2 -2
- package/server.json +2 -2
- package/tool-annotations.json +2 -0
- package/tool-registry.json +37 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { resolveMcpIdempotencyKey } from '../lib/idempotency.js';
|
|
2
3
|
import { dashboardUrlForPost, formatLocalDateTime } from '../lib/format.js';
|
|
3
4
|
import { SUPPORTED_PLATFORM_INPUTS, SUPPORTED_PLATFORM_IDS } from '../generated/platform-manifest.js';
|
|
4
5
|
const mediaAccessibilitySchema = z.array(z.object({
|
|
@@ -99,8 +100,9 @@ export const platformSettingsSchema = z.object({
|
|
|
99
100
|
thumbnail_method: z.string().optional(),
|
|
100
101
|
content_call_to_action_label: z.enum(['APPLY', 'DOWNLOAD', 'VIEW_QUOTE', 'LEARN_MORE', 'SIGN_UP', 'SUBSCRIBE', 'REGISTER', 'JOIN', 'ATTEND', 'REQUEST_DEMO', 'SEE_MORE', 'BUY_NOW', 'SHOP_NOW']).optional(),
|
|
101
102
|
content_landing_page: z.string().optional(),
|
|
102
|
-
// TikTok
|
|
103
|
-
privacy_level: z.string().optional(),
|
|
103
|
+
// TikTok. With no privacy_level the post publishes directly using the account's saved audience, else public (tiktok_audience_defaulted).
|
|
104
|
+
privacy_level: z.string().optional().describe('Who can see this TikTok when post_mode is auto. PUBLIC_TO_EVERYONE, MUTUAL_FOLLOW_FRIENDS, FOLLOWER_OF_CREATOR, or SELF_ONLY. Optional: the saved default or public is used when omitted.'),
|
|
105
|
+
post_mode: z.enum(['auto', 'inbox']).optional().describe('TikTok delivery. auto publishes directly (default, unless the account is set to Finish in TikTok app). inbox sends the post to the TikTok app.'),
|
|
104
106
|
allow_comment: z.boolean().optional(),
|
|
105
107
|
allow_duet: z.boolean().optional(),
|
|
106
108
|
allow_stitch: z.boolean().optional(),
|
|
@@ -199,6 +201,11 @@ export const createPostPayloadInputSchema = z.object({
|
|
|
199
201
|
.string()
|
|
200
202
|
.optional()
|
|
201
203
|
.describe('Workspace ID to assign the post to (from whoami). If omitted, uses the account\'s workspace or the caller\'s default workspace.'),
|
|
204
|
+
idempotency_key: z
|
|
205
|
+
.string()
|
|
206
|
+
.max(255)
|
|
207
|
+
.optional()
|
|
208
|
+
.describe('Optional retry key (printable ASCII, 255 characters or fewer). Reuse it when a create errors, times out, or the response is lost. If omitted, an identical create within about 10 minutes returns the original post.'),
|
|
202
209
|
});
|
|
203
210
|
export const createPostInputSchema = createPostPayloadInputSchema.extend({
|
|
204
211
|
confirm: z.literal(true).describe('Must be true after explicit user confirmation of the post/account/workspace/schedule.'),
|
|
@@ -250,7 +257,7 @@ export function createAccountPlatformResolver(client) {
|
|
|
250
257
|
};
|
|
251
258
|
}
|
|
252
259
|
export async function buildCreatePostPayload(input, resolvePlatform) {
|
|
253
|
-
const { confirm: _confirm, thread_posts, caption, post_type, instagram_settings, platform_settings, ...rest } = input;
|
|
260
|
+
const { confirm: _confirm, thread_posts, caption, post_type, instagram_settings, platform_settings, idempotency_key: _idempotencyKey, ...rest } = input;
|
|
254
261
|
if (thread_posts && thread_posts.length > 0) {
|
|
255
262
|
if (thread_posts.length < 2) {
|
|
256
263
|
throw new Error('thread_posts must contain at least 2 entries');
|
|
@@ -329,7 +336,9 @@ export const createPostTool = {
|
|
|
329
336
|
'THREADS: Pass `thread_posts` (an array of 2+ strings) to schedule a multi-post thread on X (Twitter) or Threads (Meta). The first entry is the lead post; the rest are published as replies in the same chain. X entries are capped at 280 characters each (4000 for verified, 25000 for organization accounts); Threads entries are capped at 500 characters each. When `thread_posts` is set, `caption` is ignored.\n\n' +
|
|
330
337
|
'X ARTICLES: To publish on X as a long-form Article, pass `platform_settings.article` ({ title, cover?: "first_image" | "none" }) for an X account. The caption becomes the Article body and is written as Markdown (headings, bold, italic, lists, quotes, code blocks, tables, dividers). Reference attached images with ``. Needs an X Premium account; polls, threads, paid partnership, video, and GIFs are not allowed with an Article.\n\n' +
|
|
331
338
|
'PLATFORM SETTINGS: Pass `platform_settings` for composer-equivalent controls: Facebook story/reel/backgrounds, YouTube title/privacy/thumbnail/brandPartner, LinkedIn document titles/mentions/polls/content_call_to_action_label (including BUY_NOW and SHOP_NOW), TikTok direct-post privacy/toggles/commercial disclosure, Pinterest board/title/link/product_tags, GBP event/offer/CTA/recurrence, X reply settings/polls/paid_partnership, Threads reply controls/text attachments/ghost posts/spoilers/reply approvals/GIPHY, Telegram polls/buttons/video cover/live photo, Slack markdown/blocks, Mastodon visibility/quote/poll (media+poll allowed), and Instagram feed/story/reel/carousel/native media tags/collaborators/first comments/trial Reels/is_ai_generated/audio_id/caption add-ons. Instagram caption add-ons (`caption_addon`, or `poll_attachment` / `is_comment_prompt_used`) need a Facebook Login account, a non-empty caption, and a feed photo, Reel, or carousel parent. Stories are rejected. A poll and a comment prompt cannot be combined. For Instagram, @username in caption is only a caption mention; `user_tags` creates native media tags and `collaborators` sends co-author invitations only when the selected Meta-linked account reports those capabilities. Call `list_platforms` with `view: "schema"` and the account ID first. `instagram_settings` remains as a backwards-compatible alias.\n\n' +
|
|
332
|
-
'TIKTOK
|
|
339
|
+
'TIKTOK AUDIENCE: TikTok posts publish directly, unless the account is set to Finish in TikTok app. With no `platform_settings.privacy_level` the account\'s saved audience is used, else public, and the response says which (`tiktok_audience_defaulted`): tell the person. `post_mode: "inbox"` sends the post to the TikTok app instead.\n\n' +
|
|
340
|
+
'TIKTOK MEDIA: TikTok supports a single video or a photo slideshow of 1 to 35 images, never multiple videos. Image media auto-detects as a slideshow, so you usually do not set post_type or media_type for photos and every image is posted. Pass `platform_settings.media_type: "PHOTO"` to force a slideshow explicitly.\n\n' +
|
|
341
|
+
'IDEMPOTENCY: If this call errors, times out, or the response is lost, retry with the same idempotency_key. If you omit it, an identical create within about 10 minutes returns the original post instead of a second one (deduplicated: true, original post id). When a result is unclear, call get_post or list_posts before creating again.',
|
|
333
342
|
inputSchema: createPostInputSchema,
|
|
334
343
|
async execute(client, input) {
|
|
335
344
|
if (input.confirm !== true) {
|
|
@@ -337,15 +346,20 @@ export const createPostTool = {
|
|
|
337
346
|
}
|
|
338
347
|
const payload = await buildCreatePostPayload(input, createAccountPlatformResolver(client));
|
|
339
348
|
const { thread_posts, instagram_settings, platform_settings } = input;
|
|
340
|
-
const
|
|
349
|
+
const idempotencyKey = resolveMcpIdempotencyKey(input.idempotency_key, payload);
|
|
350
|
+
const result = await client.createPost(payload, { idempotencyKey });
|
|
341
351
|
const p = result.post;
|
|
342
352
|
const ws = result.workspace;
|
|
353
|
+
const replayed = result.deduplicated === true || result.replayed === true;
|
|
343
354
|
const when = p.scheduled_at ? formatLocalDateTime(p.scheduled_at) : 'now';
|
|
344
355
|
const dashboardUrl = dashboardUrlForPost({ id: p.id, scheduled_at: p.scheduled_at });
|
|
345
|
-
const createdLine =
|
|
356
|
+
const createdLine = replayed
|
|
357
|
+
? 'This post already exists. Nothing new was created.'
|
|
358
|
+
: p.scheduled_at ? 'Post scheduled successfully.' : 'Post created successfully.';
|
|
346
359
|
const lines = [
|
|
347
360
|
createdLine,
|
|
348
361
|
`• ID: ${p.id}`,
|
|
362
|
+
...(replayed ? ['• deduplicated: true', `• original post id: ${p.id}`] : []),
|
|
349
363
|
`• Platform: ${p.platform || input.platform || 'unknown'}`,
|
|
350
364
|
`• Type: ${p.post_type}`,
|
|
351
365
|
`• Status: ${p.status}`,
|
|
@@ -388,9 +402,14 @@ export const createPostTool = {
|
|
|
388
402
|
if (ws) {
|
|
389
403
|
lines.push(`• Workspace: ${ws.name} (${ws.id}) - resolved from ${ws.resolved_from}`);
|
|
390
404
|
}
|
|
391
|
-
|
|
405
|
+
const warnings = result.warnings || [];
|
|
406
|
+
for (const notice of warnings.filter((warning) => warning.code === 'tiktok_audience_defaulted')) {
|
|
407
|
+
lines.push(`• ${notice.message}`);
|
|
408
|
+
}
|
|
409
|
+
const otherWarnings = warnings.filter((warning) => warning.code !== 'tiktok_audience_defaulted');
|
|
410
|
+
if (otherWarnings.length > 0) {
|
|
392
411
|
lines.push('• Warnings:');
|
|
393
|
-
for (const warning of
|
|
412
|
+
for (const warning of otherWarnings) {
|
|
394
413
|
lines.push(` - ${warning.message || warning.code}`);
|
|
395
414
|
}
|
|
396
415
|
}
|
|
@@ -318,6 +318,7 @@ export declare const createPostsBatchTool: {
|
|
|
318
318
|
content_call_to_action_label: z.ZodOptional<z.ZodEnum<["APPLY", "DOWNLOAD", "VIEW_QUOTE", "LEARN_MORE", "SIGN_UP", "SUBSCRIBE", "REGISTER", "JOIN", "ATTEND", "REQUEST_DEMO", "SEE_MORE", "BUY_NOW", "SHOP_NOW"]>>;
|
|
319
319
|
content_landing_page: z.ZodOptional<z.ZodString>;
|
|
320
320
|
privacy_level: z.ZodOptional<z.ZodString>;
|
|
321
|
+
post_mode: z.ZodOptional<z.ZodEnum<["auto", "inbox"]>>;
|
|
321
322
|
allow_comment: z.ZodOptional<z.ZodBoolean>;
|
|
322
323
|
allow_duet: z.ZodOptional<z.ZodBoolean>;
|
|
323
324
|
allow_stitch: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -467,6 +468,7 @@ export declare const createPostsBatchTool: {
|
|
|
467
468
|
content_call_to_action_label: z.ZodOptional<z.ZodEnum<["APPLY", "DOWNLOAD", "VIEW_QUOTE", "LEARN_MORE", "SIGN_UP", "SUBSCRIBE", "REGISTER", "JOIN", "ATTEND", "REQUEST_DEMO", "SEE_MORE", "BUY_NOW", "SHOP_NOW"]>>;
|
|
468
469
|
content_landing_page: z.ZodOptional<z.ZodString>;
|
|
469
470
|
privacy_level: z.ZodOptional<z.ZodString>;
|
|
471
|
+
post_mode: z.ZodOptional<z.ZodEnum<["auto", "inbox"]>>;
|
|
470
472
|
allow_comment: z.ZodOptional<z.ZodBoolean>;
|
|
471
473
|
allow_duet: z.ZodOptional<z.ZodBoolean>;
|
|
472
474
|
allow_stitch: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -616,6 +618,7 @@ export declare const createPostsBatchTool: {
|
|
|
616
618
|
content_call_to_action_label: z.ZodOptional<z.ZodEnum<["APPLY", "DOWNLOAD", "VIEW_QUOTE", "LEARN_MORE", "SIGN_UP", "SUBSCRIBE", "REGISTER", "JOIN", "ATTEND", "REQUEST_DEMO", "SEE_MORE", "BUY_NOW", "SHOP_NOW"]>>;
|
|
617
619
|
content_landing_page: z.ZodOptional<z.ZodString>;
|
|
618
620
|
privacy_level: z.ZodOptional<z.ZodString>;
|
|
621
|
+
post_mode: z.ZodOptional<z.ZodEnum<["auto", "inbox"]>>;
|
|
619
622
|
allow_comment: z.ZodOptional<z.ZodBoolean>;
|
|
620
623
|
allow_duet: z.ZodOptional<z.ZodBoolean>;
|
|
621
624
|
allow_stitch: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -686,6 +689,7 @@ export declare const createPostsBatchTool: {
|
|
|
686
689
|
ai_generated: z.ZodOptional<z.ZodBoolean>;
|
|
687
690
|
}, z.ZodTypeAny, "passthrough">>>;
|
|
688
691
|
workspace_id: z.ZodOptional<z.ZodString>;
|
|
692
|
+
idempotency_key: z.ZodOptional<z.ZodString>;
|
|
689
693
|
}, "strip", z.ZodTypeAny, {
|
|
690
694
|
platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "bluesky" | "telegram" | "discord" | "wordpress" | "devto" | "hashnode" | "lemmy" | "slack" | "mastodon" | "gmb" | "google-business" | "google_business_profile" | undefined;
|
|
691
695
|
account_id?: string | undefined;
|
|
@@ -696,6 +700,7 @@ export declare const createPostsBatchTool: {
|
|
|
696
700
|
media_url?: string | undefined;
|
|
697
701
|
media_urls?: string[] | undefined;
|
|
698
702
|
post_type?: string | undefined;
|
|
703
|
+
idempotency_key?: string | undefined;
|
|
699
704
|
thread_posts?: string[] | undefined;
|
|
700
705
|
instagram_settings?: {
|
|
701
706
|
post_type?: "post" | "feed" | "story" | "reel" | "carousel" | undefined;
|
|
@@ -828,6 +833,7 @@ export declare const createPostsBatchTool: {
|
|
|
828
833
|
content_call_to_action_label: z.ZodOptional<z.ZodEnum<["APPLY", "DOWNLOAD", "VIEW_QUOTE", "LEARN_MORE", "SIGN_UP", "SUBSCRIBE", "REGISTER", "JOIN", "ATTEND", "REQUEST_DEMO", "SEE_MORE", "BUY_NOW", "SHOP_NOW"]>>;
|
|
829
834
|
content_landing_page: z.ZodOptional<z.ZodString>;
|
|
830
835
|
privacy_level: z.ZodOptional<z.ZodString>;
|
|
836
|
+
post_mode: z.ZodOptional<z.ZodEnum<["auto", "inbox"]>>;
|
|
831
837
|
allow_comment: z.ZodOptional<z.ZodBoolean>;
|
|
832
838
|
allow_duet: z.ZodOptional<z.ZodBoolean>;
|
|
833
839
|
allow_stitch: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -907,6 +913,7 @@ export declare const createPostsBatchTool: {
|
|
|
907
913
|
media_url?: string | undefined;
|
|
908
914
|
media_urls?: string[] | undefined;
|
|
909
915
|
post_type?: string | undefined;
|
|
916
|
+
idempotency_key?: string | undefined;
|
|
910
917
|
thread_posts?: string[] | undefined;
|
|
911
918
|
instagram_settings?: {
|
|
912
919
|
post_type?: "post" | "feed" | "story" | "reel" | "carousel" | undefined;
|
|
@@ -1039,6 +1046,7 @@ export declare const createPostsBatchTool: {
|
|
|
1039
1046
|
content_call_to_action_label: z.ZodOptional<z.ZodEnum<["APPLY", "DOWNLOAD", "VIEW_QUOTE", "LEARN_MORE", "SIGN_UP", "SUBSCRIBE", "REGISTER", "JOIN", "ATTEND", "REQUEST_DEMO", "SEE_MORE", "BUY_NOW", "SHOP_NOW"]>>;
|
|
1040
1047
|
content_landing_page: z.ZodOptional<z.ZodString>;
|
|
1041
1048
|
privacy_level: z.ZodOptional<z.ZodString>;
|
|
1049
|
+
post_mode: z.ZodOptional<z.ZodEnum<["auto", "inbox"]>>;
|
|
1042
1050
|
allow_comment: z.ZodOptional<z.ZodBoolean>;
|
|
1043
1051
|
allow_duet: z.ZodOptional<z.ZodBoolean>;
|
|
1044
1052
|
allow_stitch: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -1109,6 +1117,7 @@ export declare const createPostsBatchTool: {
|
|
|
1109
1117
|
ai_generated: z.ZodOptional<z.ZodBoolean>;
|
|
1110
1118
|
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1111
1119
|
}>, "many">;
|
|
1120
|
+
idempotency_key: z.ZodOptional<z.ZodString>;
|
|
1112
1121
|
confirm: z.ZodLiteral<true>;
|
|
1113
1122
|
}, "strip", z.ZodTypeAny, {
|
|
1114
1123
|
confirm: true;
|
|
@@ -1122,6 +1131,7 @@ export declare const createPostsBatchTool: {
|
|
|
1122
1131
|
media_url?: string | undefined;
|
|
1123
1132
|
media_urls?: string[] | undefined;
|
|
1124
1133
|
post_type?: string | undefined;
|
|
1134
|
+
idempotency_key?: string | undefined;
|
|
1125
1135
|
thread_posts?: string[] | undefined;
|
|
1126
1136
|
instagram_settings?: {
|
|
1127
1137
|
post_type?: "post" | "feed" | "story" | "reel" | "carousel" | undefined;
|
|
@@ -1254,6 +1264,7 @@ export declare const createPostsBatchTool: {
|
|
|
1254
1264
|
content_call_to_action_label: z.ZodOptional<z.ZodEnum<["APPLY", "DOWNLOAD", "VIEW_QUOTE", "LEARN_MORE", "SIGN_UP", "SUBSCRIBE", "REGISTER", "JOIN", "ATTEND", "REQUEST_DEMO", "SEE_MORE", "BUY_NOW", "SHOP_NOW"]>>;
|
|
1255
1265
|
content_landing_page: z.ZodOptional<z.ZodString>;
|
|
1256
1266
|
privacy_level: z.ZodOptional<z.ZodString>;
|
|
1267
|
+
post_mode: z.ZodOptional<z.ZodEnum<["auto", "inbox"]>>;
|
|
1257
1268
|
allow_comment: z.ZodOptional<z.ZodBoolean>;
|
|
1258
1269
|
allow_duet: z.ZodOptional<z.ZodBoolean>;
|
|
1259
1270
|
allow_stitch: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -1324,6 +1335,7 @@ export declare const createPostsBatchTool: {
|
|
|
1324
1335
|
ai_generated: z.ZodOptional<z.ZodBoolean>;
|
|
1325
1336
|
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1326
1337
|
}[];
|
|
1338
|
+
idempotency_key?: string | undefined;
|
|
1327
1339
|
}, {
|
|
1328
1340
|
confirm: true;
|
|
1329
1341
|
posts: {
|
|
@@ -1336,6 +1348,7 @@ export declare const createPostsBatchTool: {
|
|
|
1336
1348
|
media_url?: string | undefined;
|
|
1337
1349
|
media_urls?: string[] | undefined;
|
|
1338
1350
|
post_type?: string | undefined;
|
|
1351
|
+
idempotency_key?: string | undefined;
|
|
1339
1352
|
thread_posts?: string[] | undefined;
|
|
1340
1353
|
instagram_settings?: {
|
|
1341
1354
|
post_type?: "post" | "feed" | "story" | "reel" | "carousel" | undefined;
|
|
@@ -1468,6 +1481,7 @@ export declare const createPostsBatchTool: {
|
|
|
1468
1481
|
content_call_to_action_label: z.ZodOptional<z.ZodEnum<["APPLY", "DOWNLOAD", "VIEW_QUOTE", "LEARN_MORE", "SIGN_UP", "SUBSCRIBE", "REGISTER", "JOIN", "ATTEND", "REQUEST_DEMO", "SEE_MORE", "BUY_NOW", "SHOP_NOW"]>>;
|
|
1469
1482
|
content_landing_page: z.ZodOptional<z.ZodString>;
|
|
1470
1483
|
privacy_level: z.ZodOptional<z.ZodString>;
|
|
1484
|
+
post_mode: z.ZodOptional<z.ZodEnum<["auto", "inbox"]>>;
|
|
1471
1485
|
allow_comment: z.ZodOptional<z.ZodBoolean>;
|
|
1472
1486
|
allow_duet: z.ZodOptional<z.ZodBoolean>;
|
|
1473
1487
|
allow_stitch: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -1538,9 +1552,11 @@ export declare const createPostsBatchTool: {
|
|
|
1538
1552
|
ai_generated: z.ZodOptional<z.ZodBoolean>;
|
|
1539
1553
|
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1540
1554
|
}[];
|
|
1555
|
+
idempotency_key?: string | undefined;
|
|
1541
1556
|
}>;
|
|
1542
1557
|
execute(client: PosterlyClient, input: {
|
|
1543
1558
|
posts: CreatePostPayloadInput[];
|
|
1559
|
+
idempotency_key?: string;
|
|
1544
1560
|
confirm: true;
|
|
1545
1561
|
}): Promise<string>;
|
|
1546
1562
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { dashboardUrlForPostList, formatLocalDateTime } from '../lib/format.js';
|
|
3
|
+
import { resolveBatchIdempotency } from '../lib/idempotency.js';
|
|
3
4
|
import { buildCreatePostPayload, createAccountPlatformResolver, createPostPayloadInputSchema } from './create-post.js';
|
|
4
5
|
export const createPostsBatchTool = {
|
|
5
6
|
name: 'create_posts_batch',
|
|
@@ -9,13 +10,19 @@ export const createPostsBatchTool = {
|
|
|
9
10
|
'2. Show the user a preview of EVERY post: account/platform, final caption or thread text, scheduled time in their timezone, media, platform settings, and workspace.\n' +
|
|
10
11
|
'3. Get explicit confirmation for the whole batch before calling. Do not infer consent from an earlier content plan.\n\n' +
|
|
11
12
|
'AFTER CALLING: Summarize the batch result in natural language, include the posterly dashboard link returned by the tool, and avoid narrating raw HTTP, curl, or API plumbing.\n\n' +
|
|
12
|
-
'Each item accepts the same fields as `create_post`, including `thread_posts`, `platform_settings`, `instagram_settings`, media URLs, and
|
|
13
|
+
'Each item accepts the same fields as `create_post`, including `thread_posts`, `platform_settings`, `instagram_settings`, media URLs, workspace_id, and idempotency_key. For TikTok, an item with no `platform_settings.privacy_level` publishes directly using the saved audience, else public, and returns `tiktok_audience_defaulted` (tell the person); `post_mode: "inbox"` sends it to the app. The endpoint may partially succeed; failed items are returned with their index.\n\n' +
|
|
14
|
+
'IDEMPOTENCY: If this call errors, times out, or the response is lost, retry with the same idempotency_key (and the same per-item keys). If you omit them, an identical batch within about 10 minutes returns the original posts instead of creating them again (deduplicated: true, original post id). When a result is unclear, call get_post or list_posts before creating again.',
|
|
13
15
|
inputSchema: z.object({
|
|
14
16
|
posts: z
|
|
15
17
|
.array(createPostPayloadInputSchema)
|
|
16
18
|
.min(1)
|
|
17
19
|
.max(25)
|
|
18
|
-
.describe('Posts to create. Each item uses the same schema as create_post.'),
|
|
20
|
+
.describe('Posts to create. Each item uses the same schema as create_post, including an optional idempotency_key.'),
|
|
21
|
+
idempotency_key: z
|
|
22
|
+
.string()
|
|
23
|
+
.max(255)
|
|
24
|
+
.optional()
|
|
25
|
+
.describe('Optional retry key for the whole batch. Reuse it when the batch errors or the response is lost. Per-item idempotency_key wins for that item. If both are omitted, each item gets its own key for about 10 minutes.'),
|
|
19
26
|
confirm: z.literal(true).describe('Must be true after explicit user confirmation of every post in the batch.'),
|
|
20
27
|
}),
|
|
21
28
|
async execute(client, input) {
|
|
@@ -35,7 +42,18 @@ export const createPostsBatchTool = {
|
|
|
35
42
|
throw new Error(`Item ${index}: ${error?.message || 'invalid post input'}`);
|
|
36
43
|
}
|
|
37
44
|
}));
|
|
38
|
-
const
|
|
45
|
+
const plan = resolveBatchIdempotency({
|
|
46
|
+
batchKey: input.idempotency_key,
|
|
47
|
+
items: input.posts.map((post, index) => ({
|
|
48
|
+
explicitKey: post.idempotency_key,
|
|
49
|
+
payload: payloads[index],
|
|
50
|
+
})),
|
|
51
|
+
});
|
|
52
|
+
const posts = payloads.map((payload, index) => {
|
|
53
|
+
const itemKey = plan.itemKeys[index];
|
|
54
|
+
return itemKey ? { ...payload, idempotency_key: itemKey } : payload;
|
|
55
|
+
});
|
|
56
|
+
const result = await client.createPostsBatch({ posts }, { idempotencyKey: plan.headerKey });
|
|
39
57
|
const createdPosts = result.posts.map((item) => item.post);
|
|
40
58
|
const dashboardUrl = dashboardUrlForPostList(createdPosts);
|
|
41
59
|
const lines = [
|
|
@@ -49,7 +67,7 @@ export const createPostsBatchTool = {
|
|
|
49
67
|
for (const item of result.posts.slice(0, 25)) {
|
|
50
68
|
const post = item.post;
|
|
51
69
|
const when = post.scheduled_at ? formatLocalDateTime(post.scheduled_at) : 'now';
|
|
52
|
-
lines.push(`• [${item.index}] ID ${post.id} ${post.platform || 'unknown'} ${post.post_type || 'post'} ${post.status || 'created'} at ${when}${item.replayed ?
|
|
70
|
+
lines.push(`• [${item.index}] ID ${post.id} ${post.platform || 'unknown'} ${post.post_type || 'post'} ${post.status || 'created'} at ${when}${item.replayed ? ` (deduplicated: true, original post id: ${post.id})` : ''}`);
|
|
53
71
|
}
|
|
54
72
|
for (const error of result.errors.slice(0, 25)) {
|
|
55
73
|
lines.push(`• [${error.index}] ERROR ${error.status}: ${error.error}`);
|
|
@@ -57,7 +75,9 @@ export const createPostsBatchTool = {
|
|
|
57
75
|
for (const item of result.posts.slice(0, 25)) {
|
|
58
76
|
const warnings = item.warnings || [];
|
|
59
77
|
for (const warning of warnings) {
|
|
60
|
-
lines.push(
|
|
78
|
+
lines.push(warning.code === 'tiktok_audience_defaulted'
|
|
79
|
+
? `• [${item.index}] ${warning.message}`
|
|
80
|
+
: `• [${item.index}] WARNING ${warning.message || warning.code}`);
|
|
61
81
|
}
|
|
62
82
|
}
|
|
63
83
|
lines.push('', 'Next step for the AI agent: tell the user which posts were created, share the dashboard link above, and ask whether they want to review the queue, adjust anything, or create the next post.');
|
|
@@ -56,7 +56,7 @@ export const generateImageTool = {
|
|
|
56
56
|
thinking_level: z
|
|
57
57
|
.enum(['minimal', 'high'])
|
|
58
58
|
.optional()
|
|
59
|
-
.describe('Google flash/lite only. Gemini image quality control. minimal is fastest; high is for infographics, grounded scenes, and harder layouts. Pro reasons automatically. Overrides quality when both are set.'),
|
|
59
|
+
.describe('Google flash/lite only. Gemini image quality control. minimal is fastest; high is for infographics, grounded scenes, and harder layouts. Pro reasons automatically. Overrides quality when both are set. Thinking high does not change the credit price.'),
|
|
60
60
|
reference_image_urls: z
|
|
61
61
|
.array(z.string().url())
|
|
62
62
|
.max(14)
|
|
@@ -80,7 +80,7 @@ function formatSubscription(result, options_) {
|
|
|
80
80
|
}
|
|
81
81
|
export const getSubscriptionTool = {
|
|
82
82
|
name: 'get_subscription',
|
|
83
|
-
description: "Get the
|
|
83
|
+
description: "Get the posterly subscription: status, tier, cancel-at-period-end, period end, trial end, pause state, connected accounts in use and the account limit for this workspace (tier plus extra slots). Call FIRST for \"upgrade\", \"change plan\", \"add accounts\" or \"how many accounts\": it returns the plans above this one with prices, limits and credits, the Agency extra-accounts state (owners) and next steps. On a trial, limits stay until the paid plan starts: see manage_plan. Read-only. Requires the billing:read scope.",
|
|
84
84
|
inputSchema: z.object({}),
|
|
85
85
|
async execute(client) {
|
|
86
86
|
const result = await client.getSubscription();
|
package/dist/tools/list-posts.js
CHANGED
|
@@ -3,7 +3,7 @@ import { dashboardUrlForPostList, formatPostCounts, formatPostListPage } from '.
|
|
|
3
3
|
import { validateArgs } from '../lib/tool-runtime.js';
|
|
4
4
|
import { SUPPORTED_PLATFORM_INPUTS, SUPPORTED_PLATFORM_IDS } from '../generated/platform-manifest.js';
|
|
5
5
|
export const LIST_POSTS_DESCRIPTION = 'Posts in your workspaces, teammates\' too, per your role there (brand-locked seats only see their assigned brands). If workspace_id is omitted, this searches every workspace you belong to. ' +
|
|
6
|
-
'view=list (default): posts filtered by status
|
|
6
|
+
'view=list (default): posts filtered by status, platform, account_id, workspace_id, brand_id, group_id, release_id, approval_status, approval_waiting_on, and a scheduled date range: scheduled_from (inclusive) and scheduled_to (a plain date includes that whole day), read in timezone (IANA, default UTC; also the zone times are shown in). Returns limit posts (default 20, max 200) starting at offset; with a date range the order defaults to oldest first (order=asc|desc). ' +
|
|
7
7
|
'The output always says whether every matching post was shown. If it says more are available, call again with the offset it gives and keep paging until all are shown before drawing any conclusion about totals, gaps, or how busy a client is. ' +
|
|
8
8
|
'view=counts (scheduled_from and scheduled_to required, up to 366 days): exact totals per day, status, account, and brand for the same filters (limit, offset, and order are ignored); use it for "how many" or "is this month full" questions. ' +
|
|
9
9
|
'Each post includes approval.pending_client_approval.';
|
|
@@ -63,7 +63,7 @@ export const manageGoogleBusinessLocationTool = {
|
|
|
63
63
|
return [
|
|
64
64
|
mdSection('Current values', current ? gbpAttributeLines(current, 'None of these attributes is set now.') : locationReadNote(read.ok ? 'no attributes returned' : read.error)),
|
|
65
65
|
mdSection('Attributes to set', [gbpAttributeLines(call.attributes, 'No attributes were sent.'), '', mdKeyValue(locationRows(call))].join('\n')),
|
|
66
|
-
'This replaces those attributes on the public Google Business profile. Other attributes are left as they are. Nothing is sent until you confirm
|
|
66
|
+
'This replaces those attributes on the public Google Business profile. Other attributes are left as they are. Nothing is sent until you confirm.',
|
|
67
67
|
].join('\n\n');
|
|
68
68
|
},
|
|
69
69
|
run: async () => {
|
|
@@ -85,7 +85,7 @@ export const manageGoogleBusinessLocationTool = {
|
|
|
85
85
|
return [
|
|
86
86
|
mdSection('Current regular hours', current ? gbpPeriodLines(current, 'No regular hours are saved now.') : locationReadNote(read.ok ? 'no hours returned' : read.error)),
|
|
87
87
|
mdSection('Regular hours to set', [gbpPeriodLines(call.regular_hours?.periods, 'No opening periods were sent.'), '', GBP_CLOSED_DAYS_NOTE, '', mdKeyValue(locationRows(call))].join('\n')),
|
|
88
|
-
'This replaces the regular opening hours on the public Google Business profile. Nothing is sent until you confirm
|
|
88
|
+
'This replaces the regular opening hours on the public Google Business profile. Nothing is sent until you confirm.',
|
|
89
89
|
].join('\n\n');
|
|
90
90
|
},
|
|
91
91
|
run: async () => {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { PosterlyClient } from '../lib/api-client.js';
|
|
3
|
+
import { type ToolContext } from '../lib/tool-runtime.js';
|
|
4
|
+
export declare const managePlanTool: {
|
|
5
|
+
name: string;
|
|
6
|
+
description: string;
|
|
7
|
+
inputSchema: z.ZodObject<{
|
|
8
|
+
action: z.ZodEnum<["list", "confirm_link"]>;
|
|
9
|
+
tier: z.ZodOptional<z.ZodEnum<["starter", "pro", "power_user", "agency"]>>;
|
|
10
|
+
interval: z.ZodOptional<z.ZodEnum<["week", "month", "year"]>>;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
action: "list" | "confirm_link";
|
|
13
|
+
tier?: "starter" | "pro" | "power_user" | "agency" | undefined;
|
|
14
|
+
interval?: "week" | "month" | "year" | undefined;
|
|
15
|
+
}, {
|
|
16
|
+
action: "list" | "confirm_link";
|
|
17
|
+
tier?: "starter" | "pro" | "power_user" | "agency" | undefined;
|
|
18
|
+
interval?: "week" | "month" | "year" | undefined;
|
|
19
|
+
}>;
|
|
20
|
+
execute(client: PosterlyClient, input: unknown, ctx: ToolContext): Promise<string>;
|
|
21
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { mdBullets, mdKeyValue, mdSection, mdTitle } from '../lib/format.js';
|
|
3
|
+
import { validateArgs } from '../lib/tool-runtime.js';
|
|
4
|
+
const TIERS = ['starter', 'pro', 'power_user', 'agency'];
|
|
5
|
+
const INTERVALS = ['week', 'month', 'year'];
|
|
6
|
+
function formatPlans(data) {
|
|
7
|
+
const current = data?.current || {};
|
|
8
|
+
const start = data?.start_paid_now;
|
|
9
|
+
const plans = Array.isArray(data?.plans) ? data.plans : [];
|
|
10
|
+
const lines = plans.map((plan) => {
|
|
11
|
+
const unlocks = Array.isArray(plan.unlocks_vs_trial) && plan.unlocks_vs_trial.length
|
|
12
|
+
? ` Unlocks: ${plan.unlocks_vs_trial.join('; ')}.`
|
|
13
|
+
: '';
|
|
14
|
+
return `${plan.name} (${plan.relationship}): $${plan.monthly_price}/month or $${plan.yearly_price}/year, ${plan.max_accounts} connected accounts, ${plan.included_credits} AI credits a month.${unlocks}`;
|
|
15
|
+
});
|
|
16
|
+
const startLine = start?.available
|
|
17
|
+
? `Starting the paid plan ends the trial today and charges ${start.amount || 'the saved card'} today${start.breakdown ? ` (${start.breakdown})` : ''}. Renewal: ${start.renewal_line || 'shown on the confirm page'}.`
|
|
18
|
+
: 'Starting the paid plan now is not available on this subscription.';
|
|
19
|
+
return [
|
|
20
|
+
mdTitle('posterly plans'),
|
|
21
|
+
mdSection('Current plan', mdKeyValue([
|
|
22
|
+
['Tier', current.tier || 'unknown'],
|
|
23
|
+
['Status', current.status || 'unknown'],
|
|
24
|
+
['Billing cycle', current.interval || 'unknown'],
|
|
25
|
+
])),
|
|
26
|
+
startLine,
|
|
27
|
+
lines.length ? mdSection('Plans', mdBullets(lines)) : '',
|
|
28
|
+
data?.how_to_confirm || 'Call manage_plan with action confirm_link. That call does not charge the card.',
|
|
29
|
+
].filter(Boolean).join('\n\n');
|
|
30
|
+
}
|
|
31
|
+
function formatConfirm(data) {
|
|
32
|
+
return [
|
|
33
|
+
mdTitle('Confirm link, nothing charged'),
|
|
34
|
+
data?.instructions || 'Send this link to the human. They confirm the price. You cannot charge the card.',
|
|
35
|
+
mdSection('Link', mdKeyValue([
|
|
36
|
+
['Confirm URL', data?.confirm_url || 'n/a'],
|
|
37
|
+
['Expires', data?.expires_at || 'n/a'],
|
|
38
|
+
['Single use', data?.single_use ? 'yes' : 'no'],
|
|
39
|
+
['Bound to this account', data?.bound_to_account ? 'yes' : 'no'],
|
|
40
|
+
['Charges on this call', 'no'],
|
|
41
|
+
])),
|
|
42
|
+
].filter(Boolean).join('\n\n');
|
|
43
|
+
}
|
|
44
|
+
export const managePlanTool = {
|
|
45
|
+
name: 'manage_plan',
|
|
46
|
+
description: 'Plans and the paid-plan link. action=list: plans, prices and the charge today to start the paid plan. action=confirm_link: a single-use 30-minute link for the human to confirm the price; omit tier and interval to start the current plan. Never charges the card. billing:read.',
|
|
47
|
+
inputSchema: z.object({
|
|
48
|
+
action: z.enum(['list', 'confirm_link']),
|
|
49
|
+
tier: z.enum(TIERS).optional(),
|
|
50
|
+
interval: z.enum(INTERVALS).optional(),
|
|
51
|
+
}),
|
|
52
|
+
async execute(client, input, ctx) {
|
|
53
|
+
const { args } = validateArgs(ctx, 'manage_plan', input);
|
|
54
|
+
if (args.action === 'list') {
|
|
55
|
+
return formatPlans(await client.listPlans());
|
|
56
|
+
}
|
|
57
|
+
if (Boolean(args.tier) !== Boolean(args.interval)) {
|
|
58
|
+
throw new Error('Pass both tier and interval to choose a plan, or neither to start the current plan.');
|
|
59
|
+
}
|
|
60
|
+
const result = await client.createPlanConfirmLink(args.tier
|
|
61
|
+
? { intent: 'change_plan', tier: args.tier, interval: args.interval }
|
|
62
|
+
: { intent: 'start_paid_now' });
|
|
63
|
+
return formatConfirm(result);
|
|
64
|
+
},
|
|
65
|
+
};
|
|
@@ -13,6 +13,7 @@ export type ManageWorkspaceMemberInput = {
|
|
|
13
13
|
api_access?: boolean;
|
|
14
14
|
confirm?: boolean;
|
|
15
15
|
preview_id?: string;
|
|
16
|
+
idempotency_key?: string;
|
|
16
17
|
};
|
|
17
18
|
/** Per-action validation with clear errors. Exported for tests. */
|
|
18
19
|
export declare function validateManageWorkspaceMemberInput(input: ManageWorkspaceMemberInput): string | null;
|
|
@@ -31,6 +32,7 @@ export declare const manageWorkspaceMemberTool: {
|
|
|
31
32
|
api_access: z.ZodOptional<z.ZodBoolean>;
|
|
32
33
|
confirm: z.ZodOptional<z.ZodBoolean>;
|
|
33
34
|
preview_id: z.ZodOptional<z.ZodString>;
|
|
35
|
+
idempotency_key: z.ZodOptional<z.ZodString>;
|
|
34
36
|
}, "strip", z.ZodTypeAny, {
|
|
35
37
|
workspace_id: string;
|
|
36
38
|
action: "remove" | "invite" | "update";
|
|
@@ -43,6 +45,7 @@ export declare const manageWorkspaceMemberTool: {
|
|
|
43
45
|
invite_id?: string | undefined;
|
|
44
46
|
resend?: boolean | undefined;
|
|
45
47
|
api_access?: boolean | undefined;
|
|
48
|
+
idempotency_key?: string | undefined;
|
|
46
49
|
}, {
|
|
47
50
|
workspace_id: string;
|
|
48
51
|
action: "remove" | "invite" | "update";
|
|
@@ -55,6 +58,7 @@ export declare const manageWorkspaceMemberTool: {
|
|
|
55
58
|
invite_id?: string | undefined;
|
|
56
59
|
resend?: boolean | undefined;
|
|
57
60
|
api_access?: boolean | undefined;
|
|
61
|
+
idempotency_key?: string | undefined;
|
|
58
62
|
}>;
|
|
59
63
|
execute(client: PosterlyClient, input: ManageWorkspaceMemberInput): Promise<string>;
|
|
60
64
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { resolveInviteIdempotencyKey } from '../lib/idempotency.js';
|
|
2
3
|
import { code, mdKeyValue, mdSection, mdTitle } from '../lib/format.js';
|
|
3
4
|
import { formatApiAccess, formatBrandIds } from './list-workspace-members.js';
|
|
4
5
|
const ACTIONS = ['invite', 'update', 'remove'];
|
|
@@ -94,7 +95,7 @@ export function validateManageWorkspaceMemberInput(input) {
|
|
|
94
95
|
}
|
|
95
96
|
export const manageWorkspaceMemberTool = {
|
|
96
97
|
name: 'manage_workspace_member',
|
|
97
|
-
description: 'Invite, update, or remove a workspace colleague. This SENDS EMAILS and CHANGES WHO CAN ACCESS the workspace. Needs an API key with the Manage team permission, and the caller must be a workspace owner or admin. ALWAYS preview first: call without confirm, show the preview to the user, and only call again with confirm: true plus the returned preview_id after the user explicitly approves. action=invite: email and role required (publisher, editor or viewer), optional brand_ids and resend; always sends a pending invite email, never adds anyone instantly. action=update: member_id or invite_id (from list_workspace_members) plus role and/or brand_ids; or member_id plus api_access (true or false, on its own) to turn API and AI app access on or off for that teammate, which lets them use the workspace API plan from their own keys and AI apps (off by default; you cannot change your own; only the owner can change it for an admin; turning it off stops their keys, AI app connections and webhooks for this workspace). action=remove: member_id (removes the teammate and revokes their API keys for this workspace) or invite_id (cancels a pending invite). Admin seats can only be granted in the posterly dashboard. The workspace owner is emailed about every change.',
|
|
98
|
+
description: 'Invite, update, or remove a workspace colleague. This SENDS EMAILS and CHANGES WHO CAN ACCESS the workspace. Needs an API key with the Manage team permission, and the caller must be a workspace owner or admin. ALWAYS preview first: call without confirm, show the preview to the user, and only call again with confirm: true plus the returned preview_id after the user explicitly approves. action=invite: email and role required (publisher, editor or viewer), optional brand_ids and resend; always sends a pending invite email, never adds anyone instantly. action=update: member_id or invite_id (from list_workspace_members) plus role and/or brand_ids; or member_id plus api_access (true or false, on its own) to turn API and AI app access on or off for that teammate, which lets them use the workspace API plan from their own keys and AI apps (off by default; you cannot change your own; only the owner can change it for an admin; turning it off stops their keys, AI app connections and webhooks for this workspace). action=remove: member_id (removes the teammate and revokes their API keys for this workspace) or invite_id (cancels a pending invite). Admin seats can only be granted in the posterly dashboard. The workspace owner is emailed about every change. For action=invite with confirm, reuse idempotency_key if the response is lost.',
|
|
98
99
|
inputSchema: z.object({
|
|
99
100
|
action: z.enum(ACTIONS).describe('invite, update, or remove.'),
|
|
100
101
|
workspace_id: z.string().describe('Workspace ID (from whoami).'),
|
|
@@ -107,6 +108,7 @@ export const manageWorkspaceMemberTool = {
|
|
|
107
108
|
api_access: z.boolean().optional().describe('action=update with member_id only, on its own: true turns API and AI app access on; false turns it off.'),
|
|
108
109
|
confirm: z.boolean().optional().describe('Leave out to get a preview. Set true only after the user explicitly approved it, with the preview_id.'),
|
|
109
110
|
preview_id: z.string().optional().describe('The preview_id returned by the preview call. Required with confirm: true.'),
|
|
111
|
+
idempotency_key: z.string().max(255).optional().describe('action=invite with confirm: reuse this key if the response is lost. If omitted, an identical confirm within about 10 minutes replays the first result.'),
|
|
110
112
|
}),
|
|
111
113
|
async execute(client, input) {
|
|
112
114
|
const problem = validateManageWorkspaceMemberInput(input);
|
|
@@ -126,6 +128,17 @@ export const manageWorkspaceMemberTool = {
|
|
|
126
128
|
...(input.brand_ids !== undefined ? { brand_ids: input.brand_ids } : {}),
|
|
127
129
|
...(input.resend !== undefined ? { resend: input.resend } : {}),
|
|
128
130
|
...confirmFields,
|
|
131
|
+
}, {
|
|
132
|
+
idempotencyKey: resolveInviteIdempotencyKey({
|
|
133
|
+
explicit: input.idempotency_key,
|
|
134
|
+
confirm: input.confirm === true,
|
|
135
|
+
workspaceId,
|
|
136
|
+
email: input.email,
|
|
137
|
+
role: input.role,
|
|
138
|
+
brandIds: input.brand_ids,
|
|
139
|
+
resend: input.resend,
|
|
140
|
+
previewId: input.preview_id,
|
|
141
|
+
}),
|
|
129
142
|
});
|
|
130
143
|
}
|
|
131
144
|
else if (input.action === 'update') {
|
|
@@ -13,7 +13,10 @@ export const triggerPlatformHelperTool = {
|
|
|
13
13
|
.enum(SUPPORTED_PLATFORM_INPUTS)
|
|
14
14
|
.optional()
|
|
15
15
|
.describe(`Platform hint when no account_id is supplied. Supported: ${SUPPORTED_PLATFORM_IDS.join(', ')}.`),
|
|
16
|
-
params: z
|
|
16
|
+
params: z
|
|
17
|
+
.record(z.string(), z.unknown())
|
|
18
|
+
.optional()
|
|
19
|
+
.describe('Helper inputs. linkedin.company_lookup needs { vanity: the company vanity name or company page URL }.'),
|
|
17
20
|
}),
|
|
18
21
|
async execute(client, input) {
|
|
19
22
|
const result = await client.triggerPlatformHelper(input);
|
|
@@ -308,6 +308,7 @@ declare const platformSettingsSchema: z.ZodObject<{
|
|
|
308
308
|
content_call_to_action_label: z.ZodOptional<z.ZodEnum<["APPLY", "DOWNLOAD", "VIEW_QUOTE", "LEARN_MORE", "SIGN_UP", "SUBSCRIBE", "REGISTER", "JOIN", "ATTEND", "REQUEST_DEMO", "SEE_MORE", "BUY_NOW", "SHOP_NOW"]>>;
|
|
309
309
|
content_landing_page: z.ZodOptional<z.ZodString>;
|
|
310
310
|
privacy_level: z.ZodOptional<z.ZodString>;
|
|
311
|
+
post_mode: z.ZodOptional<z.ZodEnum<["auto", "inbox"]>>;
|
|
311
312
|
allow_comment: z.ZodOptional<z.ZodBoolean>;
|
|
312
313
|
allow_duet: z.ZodOptional<z.ZodBoolean>;
|
|
313
314
|
allow_stitch: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -457,6 +458,7 @@ declare const platformSettingsSchema: z.ZodObject<{
|
|
|
457
458
|
content_call_to_action_label: z.ZodOptional<z.ZodEnum<["APPLY", "DOWNLOAD", "VIEW_QUOTE", "LEARN_MORE", "SIGN_UP", "SUBSCRIBE", "REGISTER", "JOIN", "ATTEND", "REQUEST_DEMO", "SEE_MORE", "BUY_NOW", "SHOP_NOW"]>>;
|
|
458
459
|
content_landing_page: z.ZodOptional<z.ZodString>;
|
|
459
460
|
privacy_level: z.ZodOptional<z.ZodString>;
|
|
461
|
+
post_mode: z.ZodOptional<z.ZodEnum<["auto", "inbox"]>>;
|
|
460
462
|
allow_comment: z.ZodOptional<z.ZodBoolean>;
|
|
461
463
|
allow_duet: z.ZodOptional<z.ZodBoolean>;
|
|
462
464
|
allow_stitch: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -606,6 +608,7 @@ declare const platformSettingsSchema: z.ZodObject<{
|
|
|
606
608
|
content_call_to_action_label: z.ZodOptional<z.ZodEnum<["APPLY", "DOWNLOAD", "VIEW_QUOTE", "LEARN_MORE", "SIGN_UP", "SUBSCRIBE", "REGISTER", "JOIN", "ATTEND", "REQUEST_DEMO", "SEE_MORE", "BUY_NOW", "SHOP_NOW"]>>;
|
|
607
609
|
content_landing_page: z.ZodOptional<z.ZodString>;
|
|
608
610
|
privacy_level: z.ZodOptional<z.ZodString>;
|
|
611
|
+
post_mode: z.ZodOptional<z.ZodEnum<["auto", "inbox"]>>;
|
|
609
612
|
allow_comment: z.ZodOptional<z.ZodBoolean>;
|
|
610
613
|
allow_duet: z.ZodOptional<z.ZodBoolean>;
|
|
611
614
|
allow_stitch: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -1017,6 +1020,7 @@ export declare const updatePostTool: {
|
|
|
1017
1020
|
content_call_to_action_label: z.ZodOptional<z.ZodEnum<["APPLY", "DOWNLOAD", "VIEW_QUOTE", "LEARN_MORE", "SIGN_UP", "SUBSCRIBE", "REGISTER", "JOIN", "ATTEND", "REQUEST_DEMO", "SEE_MORE", "BUY_NOW", "SHOP_NOW"]>>;
|
|
1018
1021
|
content_landing_page: z.ZodOptional<z.ZodString>;
|
|
1019
1022
|
privacy_level: z.ZodOptional<z.ZodString>;
|
|
1023
|
+
post_mode: z.ZodOptional<z.ZodEnum<["auto", "inbox"]>>;
|
|
1020
1024
|
allow_comment: z.ZodOptional<z.ZodBoolean>;
|
|
1021
1025
|
allow_duet: z.ZodOptional<z.ZodBoolean>;
|
|
1022
1026
|
allow_stitch: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -1166,6 +1170,7 @@ export declare const updatePostTool: {
|
|
|
1166
1170
|
content_call_to_action_label: z.ZodOptional<z.ZodEnum<["APPLY", "DOWNLOAD", "VIEW_QUOTE", "LEARN_MORE", "SIGN_UP", "SUBSCRIBE", "REGISTER", "JOIN", "ATTEND", "REQUEST_DEMO", "SEE_MORE", "BUY_NOW", "SHOP_NOW"]>>;
|
|
1167
1171
|
content_landing_page: z.ZodOptional<z.ZodString>;
|
|
1168
1172
|
privacy_level: z.ZodOptional<z.ZodString>;
|
|
1173
|
+
post_mode: z.ZodOptional<z.ZodEnum<["auto", "inbox"]>>;
|
|
1169
1174
|
allow_comment: z.ZodOptional<z.ZodBoolean>;
|
|
1170
1175
|
allow_duet: z.ZodOptional<z.ZodBoolean>;
|
|
1171
1176
|
allow_stitch: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -1315,6 +1320,7 @@ export declare const updatePostTool: {
|
|
|
1315
1320
|
content_call_to_action_label: z.ZodOptional<z.ZodEnum<["APPLY", "DOWNLOAD", "VIEW_QUOTE", "LEARN_MORE", "SIGN_UP", "SUBSCRIBE", "REGISTER", "JOIN", "ATTEND", "REQUEST_DEMO", "SEE_MORE", "BUY_NOW", "SHOP_NOW"]>>;
|
|
1316
1321
|
content_landing_page: z.ZodOptional<z.ZodString>;
|
|
1317
1322
|
privacy_level: z.ZodOptional<z.ZodString>;
|
|
1323
|
+
post_mode: z.ZodOptional<z.ZodEnum<["auto", "inbox"]>>;
|
|
1318
1324
|
allow_comment: z.ZodOptional<z.ZodBoolean>;
|
|
1319
1325
|
allow_duet: z.ZodOptional<z.ZodBoolean>;
|
|
1320
1326
|
allow_stitch: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -1539,6 +1545,7 @@ export declare const updatePostTool: {
|
|
|
1539
1545
|
content_call_to_action_label: z.ZodOptional<z.ZodEnum<["APPLY", "DOWNLOAD", "VIEW_QUOTE", "LEARN_MORE", "SIGN_UP", "SUBSCRIBE", "REGISTER", "JOIN", "ATTEND", "REQUEST_DEMO", "SEE_MORE", "BUY_NOW", "SHOP_NOW"]>>;
|
|
1540
1546
|
content_landing_page: z.ZodOptional<z.ZodString>;
|
|
1541
1547
|
privacy_level: z.ZodOptional<z.ZodString>;
|
|
1548
|
+
post_mode: z.ZodOptional<z.ZodEnum<["auto", "inbox"]>>;
|
|
1542
1549
|
allow_comment: z.ZodOptional<z.ZodBoolean>;
|
|
1543
1550
|
allow_duet: z.ZodOptional<z.ZodBoolean>;
|
|
1544
1551
|
allow_stitch: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -1759,6 +1766,7 @@ export declare const updatePostTool: {
|
|
|
1759
1766
|
content_call_to_action_label: z.ZodOptional<z.ZodEnum<["APPLY", "DOWNLOAD", "VIEW_QUOTE", "LEARN_MORE", "SIGN_UP", "SUBSCRIBE", "REGISTER", "JOIN", "ATTEND", "REQUEST_DEMO", "SEE_MORE", "BUY_NOW", "SHOP_NOW"]>>;
|
|
1760
1767
|
content_landing_page: z.ZodOptional<z.ZodString>;
|
|
1761
1768
|
privacy_level: z.ZodOptional<z.ZodString>;
|
|
1769
|
+
post_mode: z.ZodOptional<z.ZodEnum<["auto", "inbox"]>>;
|
|
1762
1770
|
allow_comment: z.ZodOptional<z.ZodBoolean>;
|
|
1763
1771
|
allow_duet: z.ZodOptional<z.ZodBoolean>;
|
|
1764
1772
|
allow_stitch: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -88,7 +88,8 @@ const platformSettingsSchema = z.object({
|
|
|
88
88
|
thumbnail_method: z.string().optional(),
|
|
89
89
|
content_call_to_action_label: z.enum(['APPLY', 'DOWNLOAD', 'VIEW_QUOTE', 'LEARN_MORE', 'SIGN_UP', 'SUBSCRIBE', 'REGISTER', 'JOIN', 'ATTEND', 'REQUEST_DEMO', 'SEE_MORE', 'BUY_NOW', 'SHOP_NOW']).optional(),
|
|
90
90
|
content_landing_page: z.string().optional(),
|
|
91
|
-
privacy_level: z.string().optional(),
|
|
91
|
+
privacy_level: z.string().optional().describe('Who can see this TikTok when post_mode is auto. Optional: the saved default or public is used when omitted.'),
|
|
92
|
+
post_mode: z.enum(['auto', 'inbox']).optional().describe('TikTok delivery. auto publishes directly. inbox sends the post to the TikTok app.'),
|
|
92
93
|
allow_comment: z.boolean().optional(),
|
|
93
94
|
allow_duet: z.boolean().optional(),
|
|
94
95
|
allow_stitch: z.boolean().optional(),
|
|
@@ -251,6 +252,10 @@ async function editPost(client, input) {
|
|
|
251
252
|
const failure = postFailureText(p);
|
|
252
253
|
const platformPostId = platformPostIdText(p);
|
|
253
254
|
const groups = groupReleaseIds(p);
|
|
255
|
+
// PATCH /posts/:id can return warnings, such as the TikTok audience notice.
|
|
256
|
+
const warnings = (result.warnings) || [];
|
|
257
|
+
const notices = warnings.filter((warning) => warning.code === 'tiktok_audience_defaulted').map((warning) => warning.message);
|
|
258
|
+
const otherWarnings = warnings.filter((warning) => warning.code !== 'tiktok_audience_defaulted');
|
|
254
259
|
return [
|
|
255
260
|
mdTitle(`✅ Post ${code(p.id)} updated`),
|
|
256
261
|
mdKeyValue([
|
|
@@ -269,6 +274,8 @@ async function editPost(client, input) {
|
|
|
269
274
|
...(p.youtube_thumbnail_url ? [['YouTube thumbnail', p.youtube_thumbnail_url]] : []),
|
|
270
275
|
]),
|
|
271
276
|
mdSection('Caption', p.content ? mdQuote(p.content) : '_(empty)_'),
|
|
277
|
+
...notices,
|
|
278
|
+
...(otherWarnings.length > 0 ? [mdSection('Warnings', otherWarnings.map((warning) => `- ${warning.message || warning.code}`).join('\n'))] : []),
|
|
272
279
|
].join('\n\n');
|
|
273
280
|
}
|
|
274
281
|
async function updateStatus(client, input) {
|