planvortex 0.3.0 → 0.5.0

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.
@@ -349,7 +349,7 @@ interface paths {
349
349
  put?: never;
350
350
  /**
351
351
  * Create an AI publication plan
352
- * @description Create a weekly AI publication plan. The plan is queued in state 'pending' and generated asynchronously by the generate-ai-plans job; poll GET by id while state is pending or generating. Validations at creation: the client plan allows AI (artificial_inteligence), the accounts belong to the organization, there are enough AI credits for the deterministic base cost (orchestration + target texts), and there is room in the organization's monthly publication limit. Returns the created plan together with the deterministic cost estimate. Requires the ai_plans:create permission.
352
+ * @description Create a weekly AI publication plan. The plan is queued in state 'pending' and generated asynchronously by the generate-ai-plans job; poll GET by id while state is pending or generating. Validations at creation: the client plan allows AI (artificial_inteligence), the accounts belong to the organization, there are enough AI credits for the deterministic base cost (orchestration + target texts), and there is room in the organization's monthly publication limit. Returns the created plan together with the deterministic cost estimate. Requires the ai_plans:create permission. Since the plan can be generated from a SOURCE (`template` + `source`), part of that validation is the source itself: the article is downloaded, the catalogue is read live and the product pictures are copied — all of it inside this request, so what does not work fails with the user in front of it. A plan whose source did not fit in the week is still created, and says so in ai_plan.warnings (2117).
353
353
  */
354
354
  post: operations["addAiPlan"];
355
355
  delete?: never;
@@ -398,6 +398,8 @@ interface paths {
398
398
  * **It costs credits, and they are charged per use.** The balance is checked before the call and the real cost is charged afterwards, accumulating in the plan's `credits_spent`. As a reference: regenerating a text is billed around 2 credits and an image around 70, but what is actually charged is the provider's real cost.
399
399
  *
400
400
  * It only works **while the plan is under review** (state `generated`) and on its drafts: a publication already validated or published is not a draft any more.
401
+ *
402
+ * **What can be regenerated depends on the plan template**, and it is published in `regenerate` (`GET /planner_templates`). `from_images` and `from_catalog` cannot regenerate the image: nobody regenerates the photo they took themselves, and offering the button anyway charges the user 70 credits to replace their own photo with an invented one. Asking for it anyway is a 2102.
401
403
  */
402
404
  post: operations["regenerateAiPlanPublication"];
403
405
  delete?: never;
@@ -700,6 +702,8 @@ interface paths {
700
702
  * **An app cannot call this** — it needs a user token or a temporal connect token (error 519 otherwise). See `GET /organizations/{id_organization}/temporal_connect_token`.
701
703
  *
702
704
  * **A temporal connect token is spent here.** Once this call succeeds, that token cannot connect anything else and answers error 543; the `enable` calls that finish the same connection still work until it expires. And if the token was issued for one network, calling this for another answers error 544.
705
+ *
706
+ * **Telegram does not come through here, and cannot be made to.** That network has no callback: the account is created by PlanVortex when the bot is added to a channel, and what authorizes it is a single-use voucher minted at that moment and spent in the same breath — it never leaves the server, so calling this endpoint for `telegram` answers error 700. It is deliberate: the bot is shared, so without it anyone could hang any channel where that bot is an admin off their own organization by passing a chat id by hand. What an integration listens for instead is the `new_account` webhook notification.
703
707
  */
704
708
  get: operations["connectAccount"];
705
709
  put?: never;
@@ -1179,7 +1183,9 @@ interface paths {
1179
1183
  * The inbox: first-level comments across the whole organization
1180
1184
  * @description Served from PlanVortex's database, so it costs nothing and calls no social network. It is a **snapshot**: `collected_date` says when each row was last read. Open a thread to see what the network says right now.
1181
1185
  *
1182
- * Ordered by `creation_date` descending — the date on the network, not the date we collected it — so rows from six networks interleave correctly.
1186
+ * Ordered by `creation_date` descending — the date on the network, not the date we collected it — so rows from nine networks interleave correctly.
1187
+ *
1188
+ * **On `telegram` the inbox starts the day the channel was connected.** The Bot API has no way to read the past: a bot only learns what happens while it is inside, so nothing written before the connection exists here and never will. Say so in your UI — an inbox that opens empty on a busy channel reads like a failure.
1183
1189
  *
1184
1190
  * **Your own replies are not in here.** Anything with `author.is_own: true` is filtered out: what you wrote is not incoming mail. They are still stored, and they do show up in the thread.
1185
1191
  *
@@ -1221,6 +1227,8 @@ interface paths {
1221
1227
  *
1222
1228
  * On X this costs credits.
1223
1229
  *
1230
+ * On `telegram` both are allowed by the network and both depend on a permission the customer controls: the bot has to be an administrator of the discussion group with the right to delete. When it is not, the answer is error 969 — which is the difference between "this network cannot" and "this particular channel cannot".
1231
+ *
1224
1232
  * Requires the `comments:delete` permission (`client_organization_comments:delete` for apps) and a paid plan.
1225
1233
  */
1226
1234
  delete: operations["deleteComment"];
@@ -1276,6 +1284,8 @@ interface paths {
1276
1284
  *
1277
1285
  * **On X this costs credits**: 15, or 200 if the text contains a link, charged only on success.
1278
1286
  *
1287
+ * **On `telegram` the reply is signed by the PlanVortex bot**, not by the channel. It is written in the channel's linked discussion group, which is where Telegram keeps the comments on a channel post — and a channel with no discussion group has no comments at all, which is error 965. Publishing is not affected: a channel post is signed by the channel.
1288
+ *
1279
1289
  * Requires the `comments:create` permission (`client_organization_comments:create` for apps) and a paid plan.
1280
1290
  */
1281
1291
  post: operations["replyComment"];
@@ -1300,7 +1310,10 @@ interface paths {
1300
1310
  *
1301
1311
  * **An app cannot call this.** Connecting a social account is an OAuth flow with a person in front of it, so this endpoint only accepts a user token or a temporal connect token; with app credentials it answers error 519. The way an integration does it is to issue a temporal connect token with `GET /organizations/{id_organization}/temporal_connect_token` and hand it to its end user.
1302
1312
  *
1303
- * **Read `authorization`, not `link`.** Nine of the ten networks are `redirect` and you send the person to `link`. **WhatsApp is not a URL at all**: its sign-up is Meta's Embedded Signup, a popup you raise with the Facebook JavaScript SDK, so its `link` is an empty string and everything you need to open that popup travels in `authorization`. A client that loops over the list and redirects to `link` sends its user to its own page.
1313
+ * **Read `authorization`, not `link`.** Nine of the eleven networks are `redirect` and you send the person to `link`. Two are not, and neither of them fails visibly if you treat it as one:
1314
+ *
1315
+ * • **WhatsApp is not a URL at all.** Its sign-up is Meta's Embedded Signup, a popup you raise with the Facebook JavaScript SDK, so its `link` is an empty string and everything you need to open that popup travels in `authorization`. A client that loops over the list and redirects to `link` sends its user to its own page.
1316
+ * • **Telegram has a link and still is not a redirect.** It opens a chat with the PlanVortex bot, and nobody comes back from it: the account is born minutes later, from the bot being added to a channel, and it is announced over the WebSocket. Open it in another tab and keep listening; redirect to it and there is nobody left to tell.
1304
1317
  */
1305
1318
  get: operations["getConnectLinks"];
1306
1319
  put?: never;
@@ -1738,6 +1751,8 @@ interface paths {
1738
1751
  /**
1739
1752
  * Delete publication by identifier
1740
1753
  * @description Delete publication by identifier. It stops being readable by identifier afterwards, so deleting twice answers error 917. For an already-sent X (Twitter) publication, removing the tweet on X is a paid action that consumes 15 X credits; it is only removed on X when there are enough credits. Returns error 940 when the X credit pool is exhausted.
1754
+ *
1755
+ * **On Telegram there is a 48-hour window.** Past it the Bot API refuses to delete a message whatever the bot's role is, and the answer is error 966 with `published_date` and `max_hours` in `data` — so the sensible thing is to grey the button out rather than offer it and fail. Error 969 is the other case: the bot is no longer allowed to delete there. And an album is several messages: all of them go, or the post would be left half-published in the channel.
1741
1756
  */
1742
1757
  delete: operations["deletePublication"];
1743
1758
  options?: never;
@@ -1760,6 +1775,8 @@ interface paths {
1760
1775
  *
1761
1776
  * Use this one when the comment has an `id_publication`. When it does not — a review hangs off a listing — use the per-account endpoint instead.
1762
1777
  *
1778
+ * **On `telegram` it is not live**, and that is the one exception to everything above: there is no endpoint in the Bot API that lists the replies to a post, so this returns PlanVortex's own inbox — what the bot has seen since the channel was connected. Nothing is reconciled and nothing is swept as deleted, because there is nothing to compare against.
1779
+ *
1763
1780
  * Requires the `comments:read` permission (`client_organization_comments:read` for apps) and a paid plan.
1764
1781
  */
1765
1782
  get: operations["getPublicationComments"];
@@ -2219,6 +2236,35 @@ interface paths {
2219
2236
  patch?: never;
2220
2237
  trace?: never;
2221
2238
  };
2239
+ "/planner_templates": {
2240
+ parameters: {
2241
+ query?: never;
2242
+ header?: never;
2243
+ path?: never;
2244
+ cookie?: never;
2245
+ };
2246
+ /**
2247
+ * AI planner templates
2248
+ * @description What an AI plan can be generated FROM, and what each source allows.
2249
+ *
2250
+ * A template is the **source** of the content, not the wizard's flow: sharing, publish days, language, tone and images stay cross-cutting options, and every template declares which of them it accepts. Send the chosen one as `template` when creating a plan (`POST /ai_plans`), together with its `source`.
2251
+ *
2252
+ * • **`generates_images: false` means the pictures come from the source** — your own photos, your catalogue — so the plan spends **no image credits at all**. A week of 7 publications with a picture on each goes from 519 credits to 48, and it is worth saying out loud before the plan is created.
2253
+ * • **`regenerate` is per template.** A template that did not generate the image cannot regenerate it: offer that button anyway and the user pays 70 credits to replace their own photo with an invented one.
2254
+ * • **`orchestration_cost` is an ESTIMATE, not the bill.** The real charge is per use (what the provider reports). `orchestration_cost_per_source_item` is what each unit of the source adds on top — one vision pass per image.
2255
+ * • **A plan is WEEKLY, and the source does not extend it.** With `max_source_items` photos but fewer slots left in the week, the extra ones are dropped and the plan carries warning 2117 in `ai_plan.warnings`. Say it in your UI *before* creating the plan, not after charging for it.
2256
+ * • **`source_fields` is what the source step is made of.** The simple types are ordinary controls; `uploads_with_description` and `catalog_products` are the signal that the step needs a component of its own.
2257
+ * • **The fields carry their own limits.** `max` and `min` are in the field's own units — characters of a text, items of a list, **days** for a date — and `source_requires_any` names the fields of which at least one is needed (`from_text`: the URL or the pasted text). Read them from here; hardcoding them is how a wizard ends up rejecting at a number the server does not use.
2258
+ */
2259
+ get: operations["getPlannerTemplates"];
2260
+ put?: never;
2261
+ post?: never;
2262
+ delete?: never;
2263
+ options?: never;
2264
+ head?: never;
2265
+ patch?: never;
2266
+ trace?: never;
2267
+ };
2222
2268
  "/publication_limits": {
2223
2269
  parameters: {
2224
2270
  query?: never;
@@ -2254,7 +2300,9 @@ interface paths {
2254
2300
  *
2255
2301
  * `comments` is the coarse gate — whether the network has comments at all. Which *actions* it allows on one is a finer question and lives in `GET /social_comment_actions`, because the shape here is `{[capability]: boolean}` and nesting an object inside would break it.
2256
2302
  *
2257
- * Today six networks answer `comments: true`: Facebook, Instagram, LinkedIn, X, YouTube and Google Business. TikTok and WhatsApp answer `false`, for reasons of theirs and not ours.
2303
+ * Today nine networks answer `comments: true`: Facebook, Instagram, LinkedIn, X, YouTube, Google Business, Bluesky, Discord and Telegram. TikTok and WhatsApp answer `false`, for reasons of theirs and not ours.
2304
+ *
2305
+ * A `true` here is about the **network**, not about one account of it: a Telegram channel with no linked discussion group answers 965 on its comments even though the network has them.
2258
2306
  *
2259
2307
  * Only needs authentication.
2260
2308
  */
@@ -2290,6 +2338,7 @@ interface paths {
2290
2338
  * | `google_business` | yes | **no** | yes — **your reply**, never the review | **no** |
2291
2339
  * | `bluesky` | yes | yes — through the post's `threadgate` | yes | **no** — the reply lives in somebody else's repository |
2292
2340
  * | `discord` | yes | **no** — Discord has no hide, only delete | yes | yes |
2341
+ * | `telegram` | yes | **no** — Telegram has no hide either | yes | yes — with the bot as an admin of the discussion group, otherwise error 969 |
2293
2342
  * | `tiktok`, `whatsapp` | no | no | no | no |
2294
2343
  *
2295
2344
  * Only needs authentication.
@@ -2319,6 +2368,7 @@ interface paths {
2319
2368
  * • **`characters` is not always the only text limit.** Bluesky counts 300 *graphemes* **and** 3.000 *bytes*; the second one travels in `max_post_bytes`, where `0` means "this network does not measure text in bytes". A family emoji is one grapheme and eleven UTF-16 units, so counting with `String.length` is wrong in both directions.
2320
2369
  * • **`0` in `title_characters` means the network has no title field**, not a title of zero length.
2321
2370
  * • **`comment_characters` is a different limit from `characters`.** Facebook takes 63.206 in a post and 8.000 in a comment.
2371
+ * • **`characters` is not one number per network either.** Telegram takes 4.096 in a text post and **1.024** in the caption of a photo or a video, and it is the same composer field: the second number is the key `telegram_media`. Over the limit the publication is created in state `withErrors` with `publication_errors[].code = 967`, which carries `characters`, `max_characters` and `has_media`.
2322
2372
  * • Every network in `/social_networks` appears in every map. A missing key is a bug, and the backend's conformance suite fails on it.
2323
2373
  */
2324
2374
  get: operations["getSocialLimits"];
@@ -2403,9 +2453,9 @@ interface components {
2403
2453
  /**
2404
2454
  * @description A social account connected to an organization.
2405
2455
  *
2406
- * On `discord` an account is a **channel**, not a profile: publishing to two channels of the same server costs two accounts of the plan.
2456
+ * On `discord` and on `telegram` an account is a **channel**, not a profile: publishing to two Discord channels of the same server — or to two Telegram channels of the same brand — costs two accounts of the plan.
2407
2457
  *
2408
- * `error_code` other than `0` means the connection is broken — an expired token, a permission taken away — and the account has to be connected again.
2458
+ * `error_code` other than `0` means the connection is broken — an expired token, a permission taken away — and the account has to be connected again. On `telegram` nothing expires, because there is no account token: what breaks the connection is the bot being removed from the channel or losing its permission to post there (error 968).
2409
2459
  */
2410
2460
  Account: {
2411
2461
  _id: string;
@@ -2413,7 +2463,7 @@ interface components {
2413
2463
  creation_date: string;
2414
2464
  /** @description `0` is a healthy account. Anything else is a PlanVortex error code explaining why the connection stopped working; the account keeps its data but cannot be used until it is reconnected. */
2415
2465
  error_code: number;
2416
- /** @description Followers the network reports. Absent on an account that has never been measured. */
2466
+ /** @description Followers the network reports. Absent on an account that has never been measured. On `telegram` it is the channel's member count, and it is the **only** audience figure that network publishes: there are no views, no impressions and no reach anywhere in the Bot API. */
2417
2467
  followers_count?: number;
2418
2468
  /** @description The client the organization hangs from. Denormalized here for the plan checks. */
2419
2469
  id_client: string;
@@ -2436,7 +2486,7 @@ interface components {
2436
2486
  private_message_link?: string;
2437
2487
  /** @description Network this account belongs to. **Not every network publishes**: `whatsapp` is a messaging channel with no feed, and `google_business` is a local business listing that receives reviews — both can be connected and both appear here, but neither accepts publications (see `GET /social_capabilities`). */
2438
2488
  social_network: components["schemas"]["SocialNetwork"];
2439
- /** @description The handle, when the network has one. Absent on the networks that do not (a Discord channel, a WhatsApp number, a Google Business listing). */
2489
+ /** @description The handle, when the network has one. Absent on the networks that do not (a Discord channel, a WhatsApp number, a Google Business listing) and on a **private** Telegram channel, which has no `@name` at all — only public ones do. That is also why a private channel's publications come back with no `url`. */
2440
2490
  username?: string;
2441
2491
  };
2442
2492
  AccountsAccountList: {
@@ -2482,13 +2532,20 @@ interface components {
2482
2532
  /**
2483
2533
  * @description **How** an account of this network is authorized, which is not always "send the user to this URL".
2484
2534
  *
2485
- * Nine of the ten networks are `redirect`: open `link` and the network sends the person back to PlanVortex with a code. **WhatsApp is not.** Its sign-up is Meta's *Embedded Signup*: a popup raised by the Facebook JavaScript SDK from your own page, which returns — over `postMessage` — session data (`waba_id`, `phone_number_id`) that no query string carries. Its `link` is therefore an empty string.
2535
+ * Nine of the eleven networks are `redirect`: open `link` and the network sends the person back to PlanVortex with a code. Two are not:
2536
+ *
2537
+ * • **WhatsApp.** Its sign-up is Meta's *Embedded Signup*: a popup raised by the Facebook JavaScript SDK from your own page, which returns — over `postMessage` — session data (`waba_id`, `phone_number_id`) that no query string carries. Its `link` is therefore an empty string.
2538
+ * • **Telegram.** There is no OAuth here: no consent screen, no `code`, no account token. `link` opens a private chat with the PlanVortex bot, the person then adds that bot to their channel, and **the account is created from that event**, not from any request of yours. Which means the connection cannot be finished by calling `GET /organizations/{id_organization}/account-connect/telegram` — see that endpoint.
2486
2539
  *
2487
2540
  * Branch on `authorization.type`, never on whether `link` is empty.
2488
2541
  */
2489
2542
  AccountsSocialAuthorizationMethod: {
2543
+ /** @description `telegram_bot` only. The **second** step, and it does not follow from the first: `link` opens the list of channels and this one opens the list of groups. It adds the bot to the channel's linked discussion group, which is what turns comments on — a Telegram channel with no discussion group has no comment inbox at all (error 965). Optional for the user: publishing and statistics work without it. */
2544
+ add_to_group_link?: string;
2490
2545
  /** @description `meta_embedded_signup` only. Goes to `FB.init({appId})`. It is the same Meta app whose secret PlanVortex uses to exchange the code afterwards. */
2491
2546
  app_id?: string;
2547
+ /** @description `telegram_bot` only. The bot's `@name`, **without the at sign**. Published here so you never have to write it by hand: it is the name the person will see in Telegram, and it changes with the deployment. */
2548
+ bot_username?: string;
2492
2549
  /** @description `meta_embedded_signup` only. Goes to `FB.login(cb, {config_id})` — the Embedded Signup configuration. */
2493
2550
  config_id?: string;
2494
2551
  /** @description `meta_embedded_signup` only. Goes to `extras.featureType`. */
@@ -2498,16 +2555,20 @@ interface components {
2498
2555
  /** @description `meta_embedded_signup` only. Goes to `extras.sessionInfoVersion`. */
2499
2556
  session_info_version?: string;
2500
2557
  /**
2501
- * @description `redirect`: send the user to `link`. `meta_embedded_signup`: open the Meta popup with the fields below.
2558
+ * @description `redirect`: send the user to `link`. `meta_embedded_signup`: open the Meta popup with the fields below. `telegram_bot`: open `link` in another tab and wait for the account to show up.
2502
2559
  * @enum {string}
2503
2560
  */
2504
- type: "redirect" | "meta_embedded_signup";
2561
+ type: "redirect" | "meta_embedded_signup" | "telegram_bot";
2505
2562
  };
2506
2563
  AccountsSocialLinksList: {
2507
2564
  /** @description One entry per network that can be connected right now. */
2508
2565
  links: {
2509
2566
  authorization: components["schemas"]["AccountsSocialAuthorizationMethod"];
2510
- /** @description The network's authorization URL. Send the user there. **Empty when `authorization.type` is not `redirect`** — WhatsApp has no URL to give. */
2567
+ /**
2568
+ * @description The network's authorization URL. Send the user there. **Empty when `authorization.type` is `meta_embedded_signup`** — WhatsApp has no URL to give at all.
2569
+ *
2570
+ * On `telegram_bot` it is filled in, and it still is not somewhere to redirect: it opens a Telegram chat, not an authorization screen. Open it in another tab.
2571
+ */
2511
2572
  link: string;
2512
2573
  social_network: components["schemas"]["SocialNetwork"];
2513
2574
  }[];
@@ -2549,14 +2610,8 @@ interface components {
2549
2610
  creation_date: string;
2550
2611
  /** @description AI credits actually consumed by the generation. */
2551
2612
  credits_spent: number;
2552
- /** @description Last generation error, in the same shape as an API error. Present only in state `failed`. */
2553
- error?: {
2554
- code: number;
2555
- data?: {
2556
- [key: string]: unknown;
2557
- };
2558
- message: string;
2559
- };
2613
+ /** @description Last generation error. Present only in state `failed`. */
2614
+ error?: components["schemas"]["AiPlansAiPlanNotice"];
2560
2615
  /** Format: date-time */
2561
2616
  generation_end_date?: string;
2562
2617
  id_client: string;
@@ -2575,19 +2630,33 @@ interface components {
2575
2630
  * **It is not always the same shape.** Reading one plan (`GET`, `validate`, `retry`) returns whole publications with their files resolved; the LISTING returns their identifiers as strings. Check before using them.
2576
2631
  */
2577
2632
  publications: (string | components["schemas"]["Publication"])[];
2633
+ /** @description The source snapshot. Absent on a `standard` plan, which has no source. */
2634
+ source?: components["schemas"]["AiPlansAiPlanSource"];
2578
2635
  /**
2579
2636
  * @description State machine: pending -> generating -> generated -> validated | failed | cancelled. Poll the plan while state is pending or generating.
2580
2637
  * @enum {string}
2581
2638
  */
2582
2639
  state: "pending" | "generating" | "generated" | "validated" | "failed" | "cancelled";
2640
+ /**
2641
+ * @description What this plan was generated from. Always present: a plan created before templates existed reads `standard`.
2642
+ * @enum {string}
2643
+ */
2644
+ template?: "standard" | "from_images" | "from_text" | "from_catalog" | "campaign";
2645
+ /**
2646
+ * @description Non-blocking notices about the LAST attempt (they are cleared when a new one starts). The plan is generated and perfectly usable; your UI just has to say what happened.
2647
+ *
2648
+ * Today there is one: **2117 — some source items did not fit in the plan week.** A plan is weekly and the source does not extend it, so 12 photos with 6 slots left publish 6 and the rest are dropped. `data` carries `{ source_items, capacity }`. Better said BEFORE creating the plan (the slots are the publish days x the accounts) than after charging for it.
2649
+ */
2650
+ warnings?: components["schemas"]["AiPlansAiPlanNotice"][];
2583
2651
  };
2584
2652
  /** @description Deterministic cost estimate computed by the backend (never by the model). BYOK scopes cost 0 credits. */
2585
2653
  AiPlansAiPlanCostEstimate: {
2586
2654
  available_credits: number;
2587
- /** @description Mandatory cost (orchestration + target texts). The plan is rejected if this exceeds the available credits. */
2655
+ /** @description Mandatory cost (orchestration + target texts). The orchestration half depends on the TEMPLATE and on the size of its source: `orchestration_cost` + `orchestration_cost_per_source_item` x units, both published in `GET /planner_templates`. The plan is rejected if this exceeds the available credits. */
2588
2656
  base_cost: number;
2589
2657
  /** @description Total estimated cost including the financeable images (upper bound). */
2590
2658
  estimated_cost: number;
2659
+ /** @description How many images the plan will generate. **0 when the template does not generate them** (`from_images`, `from_catalog`): the pictures come from the source, so the plan spends no image credits at all — a week of 7 publications with a picture on each goes from 519 credits to 48. That is worth saying out loud before the plan is created. */
2591
2660
  images_target: number;
2592
2661
  texts_target: number;
2593
2662
  };
@@ -2597,6 +2666,17 @@ interface components {
2597
2666
  options?: components["schemas"]["AiPlansAiPlanOptionsInput"];
2598
2667
  /** @description Theme prompt written by the user. */
2599
2668
  prompt: string;
2669
+ /** @description The source itself. Which fields it carries depends on `template`. Required for every template except `standard`, and validated at creation — 2112, 2113, 2114, 2115 or 2116 come back while the user is still there. */
2670
+ source?: components["schemas"]["AiPlansAiPlanSourceInput"];
2671
+ /**
2672
+ * @description What the plan is generated FROM. Optional; defaults to `standard`, which is exactly what every plan did before templates existed — send nothing and nothing changes.
2673
+ *
2674
+ * A template is the **source** of the content, not a different flow: `shared`, `publish_days`, `language`, `tone` and the images stay cross-cutting options, and each template declares which of them it accepts. Sending one it does not accept is a 2106, not a silent ignore.
2675
+ *
2676
+ * Read the list, the costs and the fields from `GET /planner_templates`; do not hardcode them.
2677
+ * @enum {string}
2678
+ */
2679
+ template?: "standard" | "from_images" | "from_text" | "from_catalog" | "campaign";
2600
2680
  };
2601
2681
  AiPlansAiPlanCreateResponse: {
2602
2682
  ai_plan: components["schemas"]["AiPlansAiPlan"];
@@ -2608,6 +2688,14 @@ interface components {
2608
2688
  ai_plans: components["schemas"]["AiPlansAiPlan"][];
2609
2689
  total: number;
2610
2690
  };
2691
+ /** @description Something the plan has to say about itself, in the same shape as an API error. */
2692
+ AiPlansAiPlanNotice: {
2693
+ code: number;
2694
+ data?: {
2695
+ [key: string]: unknown;
2696
+ };
2697
+ message: string;
2698
+ };
2611
2699
  AiPlansAiPlanOne: {
2612
2700
  ai_plan: components["schemas"]["AiPlansAiPlan"];
2613
2701
  };
@@ -2665,9 +2753,9 @@ interface components {
2665
2753
  };
2666
2754
  /** @description Generation options, as you SEND them: every one is optional and the server fills in its default. Optimal publish slots are chosen deterministically by the backend from a fixed table per network, converted to this timezone; the model never invents times. */
2667
2755
  AiPlansAiPlanOptionsInput: {
2668
- /** @description Whether images may be generated. Each image costs 70 AI credits. Optional; defaults to `true`. */
2756
+ /** @description Whether images may be generated. Each image costs 70 AI credits. Optional; defaults to `true`. Forced to `false` when the template does not generate images (`generates_images: false`), where the picture comes from the source and costs nothing. */
2669
2757
  allow_images?: boolean;
2670
- /** @description Upload ids from the organization's gallery used as visual reference for the generated images. */
2758
+ /** @description Upload ids from the organization's gallery used as visual reference for the generated images. They are references for the images the model GENERATES, so a template that does not generate them does not accept them either (`allows_gallery`): sending them to `from_images` or `from_catalog` is a 2106. */
2671
2759
  gallery_uploads?: string[];
2672
2760
  /** @description Language of the generated texts. Optional; defaults to `"es"`. */
2673
2761
  language?: string;
@@ -2675,7 +2763,7 @@ interface components {
2675
2763
  max_images?: number;
2676
2764
  /** @description Days of the week the plan publishes on, in ISO 8601 numbering (1 = Monday ... 7 = Sunday). Defaults to the whole week. There is still at most ONE publication per day and account, so this is what bounds the size and the cost of the plan: the number of generated posts is (selected days x accounts). Must be a non-empty array of unique integers between 1 and 7, or the request is rejected with 2106. The 7-day window starts at week_start, so each ISO day appears exactly once: with a week_start in mid-week, day 1 (Monday) is the FOLLOWING Monday. If the selected days leave no future slot at all, the request is rejected with 2108. Optional; defaults to `[1,2,3,4,5,6,7]`. */
2677
2765
  publish_days?: number[];
2678
- /** @description Generate ONE piece of content per day and replicate it across every account, each scheduled at the best hour for ITS network, instead of one publication per account and day. Cheaper — one text and one image per day — and it caps images at 7. Optional; defaults to `false`. */
2766
+ /** @description Generate ONE piece of content per day and replicate it across every account, each scheduled at the best hour for ITS network, instead of one publication per account and day. Cheaper — one text and one image per day — and it caps images at 7. Optional; defaults to `false`. **Not every template accepts it** (`allows_shared` in `GET /planner_templates`): `from_images` and `from_catalog` do not, because each of their publications carries a photo of its own, and sending `true` to them is rejected with 2106. */
2679
2767
  shared?: boolean;
2680
2768
  /** @description IANA timezone for the optimal publish slots (typically the user's browser timezone). publish_date is stored in UTC. Optional; defaults to `"Europe/Madrid"`. */
2681
2769
  timezone?: string;
@@ -2689,6 +2777,83 @@ interface components {
2689
2777
  */
2690
2778
  week_start?: string;
2691
2779
  };
2780
+ /** @description The plan source as it was STORED: a snapshot taken when the plan was created, not a live reference. It is what makes a retry reproduce the same plan even if the article went offline or the product left the catalogue — same reason as `organization_context`. */
2781
+ AiPlansAiPlanSource: {
2782
+ /** @description `campaign`. The event and its date, already normalised to the start of ITS day in the plan timezone. */
2783
+ event?: {
2784
+ /** Format: date-time */
2785
+ date?: string;
2786
+ name?: string;
2787
+ };
2788
+ /** @description `from_catalog`. The account whose catalogue was read. */
2789
+ id_account_catalog?: string;
2790
+ /** @description `from_images`. The chosen photos with their descriptions, in the order they were sent — the position IS the `source_index` of the publication that uses it. */
2791
+ images?: {
2792
+ description?: string;
2793
+ id_upload?: string;
2794
+ }[];
2795
+ /** @description `from_catalog`. Snapshot of the chosen products. */
2796
+ products?: components["schemas"]["AiPlansAiPlanSourceProduct"][];
2797
+ /** @description `from_text`. The article, already downloaded and truncated. It is never downloaded again. */
2798
+ text?: string;
2799
+ /** @description `from_text`. The original address, kept for the record and to show where the plan came from. */
2800
+ url?: string;
2801
+ };
2802
+ /** @description One photo of `from_images`. */
2803
+ AiPlansAiPlanSourceImageInput: {
2804
+ /** @description What is in the photo. **Mandatory on purpose**: without it the model writes about what it believes it sees, and with a product photo it gets the product wrong about half the time. */
2805
+ description: string;
2806
+ /** @description An upload of the organization. It has to be an image: a video or an audio is rejected here, not later at publish time. */
2807
+ id_upload: string;
2808
+ };
2809
+ /**
2810
+ * @description The plan's source, as you SEND it. **One shape per template**: send only the fields of the template you chose — what it does not read is ignored, and what it needs and does not get is a 2112.
2811
+ *
2812
+ * It is validated when the plan is **created**, not when it is generated: the article is downloaded, the catalogue is read live and the product pictures are copied. So a source that does not work fails while the user is still there and can fix it, and what gets stored is a SNAPSHOT — a retry three days later does not depend on the article still being online or the product still being in the catalogue.
2813
+ *
2814
+ * | Template | Fields |
2815
+ * | --- | --- |
2816
+ * | `standard` | none — no source |
2817
+ * | `from_images` | `images` |
2818
+ * | `from_text` | `url` **or** `text` |
2819
+ * | `from_catalog` | `id_account_catalog`, `product_catalog_id`, `products` |
2820
+ * | `campaign` | `event_name`, `event_date` |
2821
+ */
2822
+ AiPlansAiPlanSourceInput: {
2823
+ /**
2824
+ * Format: date
2825
+ * @description `campaign`. The day of the event. **Send a calendar day, `YYYY-MM-DD` — never an ISO instant.** A bare date is read in the plan's `options.timezone`, which is the whole point: `2026-09-15T00:00:00Z` is midnight UTC, that is the 14th in the afternoon in New York — a whole day off in a countdown, for half of America, with no error anywhere. It cannot fall before the plan week (`options.week_start`) nor more than 60 days after it (2112). And it does **not** move `publish_days`: if the event lands on a day you did not choose, the plan respects your choice and it is up to you to say so.
2826
+ */
2827
+ event_date?: string;
2828
+ /** @description `campaign`. What the countdown is towards ("Rebajas de verano", "Apertura del local"). Over 120 characters it is **rejected, not truncated**: a name cut mid-word would come out that way in all seven publications, and whatever else needs saying goes in `prompt`. */
2829
+ event_name?: string;
2830
+ /** @description `from_catalog`. Which account's catalogue the products come from. It has to belong to the organization (2103) and be on a network that supports products (2115). It only chooses the catalogue: the publications still go to every account in `accounts` — a LinkedIn account can publish a product from a Facebook catalogue. */
2831
+ id_account_catalog?: string;
2832
+ /** @description `from_images`. Your own photos, each with its own description, **in the order that tells the story**: the orchestrator picks one per publication and keeps its position in `source_index`, so photo 3 can be the "before" and photo 7 the "after". Up to 20 (`max_source_items`), and each one has to be an image upload of this organization (806 otherwise). */
2833
+ images?: components["schemas"]["AiPlansAiPlanSourceImageInput"][];
2834
+ /** @description `from_catalog`. The catalogue itself, as the network identifies it. */
2835
+ product_catalog_id?: string;
2836
+ /** @description `from_catalog`. Ids of the chosen products, **in the order they should tell the week**. Up to 12 — a unit here is not an id already in the database: it is a live read plus a real download inside this request, with the user waiting. Repeated ids are deduplicated. They are ALL checked against the catalogue before a single picture is downloaded (2112 naming the missing one), and each picture is copied into an upload of the organization: the network CDN URL expires, and a plan published weeks later would carry a broken file. Those uploads count against the storage quota. */
2837
+ products?: string[];
2838
+ /** @description `from_text`. The article pasted by hand. **It wins over `url`** when both come: pasting is what a user does when the download did not work (a paywall, a page that needs JavaScript), so re-downloading to ignore what they wrote would take away their only way out. Truncated to 12.000 characters — the cap is what keeps the estimate honest, since the real charge is per use. Under 200 characters it is not an article, it is the theme, which is `prompt` and another field (2116). */
2839
+ text?: string;
2840
+ /**
2841
+ * Format: uri
2842
+ * @description `from_text`. The article the plan is written from. It is downloaded at creation, and only `http`/`https` addresses that resolve to a **public** IP are accepted — checked again before every redirect (2114). A page that answers something that is not text or HTML, or that carries no usable text once stripped, is a 2113: paste the text in `text` instead.
2843
+ */
2844
+ url?: string;
2845
+ };
2846
+ /** @description A product of the catalogue, copied when the plan was created. */
2847
+ AiPlansAiPlanSourceProduct: {
2848
+ description?: string;
2849
+ /** @description The id it has in the network catalogue. */
2850
+ external_id?: string;
2851
+ /** @description The product picture, copied into an upload of the organization. The network CDN URL expires; this one does not. */
2852
+ id_upload?: string;
2853
+ name?: string;
2854
+ /** @description The price **exactly as the network returned it** ("9,99 €"). It is never converted: the same field is a number in other paths of Meta's API and there is no way to tell units from cents, and dividing by 100 "just in case" is precisely how a 10 € product gets advertised at 0,10 €. The prompt is told to copy it verbatim or to say nothing. */
2855
+ price?: string;
2856
+ };
2692
2857
  /**
2693
2858
  * @description An app: the credentials a third-party integration authenticates with.
2694
2859
  *
@@ -2766,8 +2931,62 @@ interface components {
2766
2931
  /** @description The ratio as a number (width divided by height), which is what validation compares against. */
2767
2932
  values: number[];
2768
2933
  };
2934
+ CatalogPlannerTemplate: {
2935
+ /** @description Does it accept `options.gallery_uploads` (visual references for the generated images)? */
2936
+ allows_gallery?: boolean;
2937
+ /** @description Does it accept `options.shared` (one content replicated across every account)? */
2938
+ allows_shared?: boolean;
2939
+ /** @description false = the pictures come from the source, and the plan spends no image credits. */
2940
+ generates_images?: boolean;
2941
+ /** @description Hard cap of source units accepted. 0 = this template has no unit-based source. */
2942
+ max_source_items?: number;
2943
+ /** @description Estimated credits for this template's orchestration pass. The real charge is per use. */
2944
+ orchestration_cost?: number;
2945
+ /** @description Extra estimated credits per unit of source (per image, in `from_images`). 0 when the source does not scale the prompt. */
2946
+ orchestration_cost_per_source_item?: number;
2947
+ /** @description What can be regenerated on a publication of this plan. */
2948
+ regenerate?: {
2949
+ image?: boolean;
2950
+ text?: boolean;
2951
+ };
2952
+ source_fields?: components["schemas"]["CatalogPlannerTemplateField"][];
2953
+ /**
2954
+ * @description Fields of which AT LEAST ONE is needed, even though none of them is required on its own. Today it is `from_text`: either the URL or the pasted text, never both empty (2116).
2955
+ *
2956
+ * It exists because a field's `required` cannot say "one or the other", and without it your UI would have to hardcode that rule — exactly the copy this catalogue exists to avoid. Absent = there is nothing of the sort to resolve.
2957
+ */
2958
+ source_requires_any?: string[];
2959
+ /**
2960
+ * @description What the plan is generated FROM, and what you send as `template` when creating it:
2961
+ *
2962
+ * • **`standard`** — a theme prompt, images generated by the model. What every plan was before templates existed.
2963
+ * • **`from_images`** — the user's own photos, each with its own description. One vision pass over ALL of them at once, so the model can sequence a narrative (photo 3 the "before", photo 7 the "after") instead of writing seven independent posts. It generates no images.
2964
+ * • **`from_text`** — an article: a URL that is downloaded at creation, or the text pasted by hand.
2965
+ * • **`from_catalog`** — products read LIVE from a connected catalogue, with their name, their price and their picture. The one template that cannot be copied by a generic AI tool, because it needs the catalogue connection.
2966
+ * • **`campaign`** — a countdown towards a date, with a narrative arc: teaser, announcement, reminder, today, thank you. The only plan that is a story instead of seven loose posts.
2967
+ * @enum {string}
2968
+ */
2969
+ template?: "standard" | "from_images" | "from_text" | "from_catalog" | "campaign";
2970
+ };
2971
+ /** @description One field of the source step. `uploads_with_description` (photos, each with its own description) and `catalog_products` (products read live from a connected catalogue) need a dedicated component; the rest are ordinary controls. */
2972
+ CatalogPlannerTemplateField: {
2973
+ default?: unknown;
2974
+ /** @description Cap in the field's **own units**: characters of a text, items of a list, and **days** of a `date` — the `event_date` of `campaign` carries 60, which is how far ahead of the plan week the countdown may point. */
2975
+ max?: number;
2976
+ /** @description Floor in the field's own units. Today only `from_text`: under 200 characters it is not an article, it is the theme, which is `prompt` and another field. Published for the same reason as `max` — without it your UI hardcodes the 200 and the user gets a 2116 AFTER pasting the text instead of while pasting it. */
2977
+ min?: number;
2978
+ name?: string;
2979
+ options?: string[];
2980
+ required?: boolean;
2981
+ /** @enum {string} */
2982
+ type?: "text" | "textarea" | "url" | "boolean" | "select" | "date" | "uploads_with_description" | "catalog_products";
2983
+ };
2769
2984
  CatalogSocialLimits: {
2770
- /** @description Maximum length of a publication's text. Bluesky counts graphemes, everyone else counts characters. */
2985
+ /**
2986
+ * @description Maximum length of a publication's text. Bluesky counts graphemes, everyone else counts characters — Telegram included, where `String.length` is exactly the right unit.
2987
+ *
2988
+ * On Telegram there are **two numbers for the same field**: `telegram` (4.096) while the publication is text only, and `telegram_media` (1.024) the moment it carries an image or a video, because then the text is a media caption and not a message. Switch the counter when the file is attached, not when publish is pressed.
2989
+ */
2771
2990
  characters: components["schemas"]["CatalogSocialLimitsMap"];
2772
2991
  /** @description Maximum length of a reply to a comment. `0` means the network has no comments. */
2773
2992
  comment_characters: components["schemas"]["CatalogSocialLimitsMap"];
@@ -2782,7 +3001,11 @@ interface components {
2782
3001
  /** @description Maximum video duration. A network that limits weight instead of duration is not here but in `max_file_size_mb`. */
2783
3002
  video_duration_in_seconds: components["schemas"]["CatalogSocialLimitsMap"];
2784
3003
  };
2785
- /** @description One number per network. Every network in `/social_networks` is present. */
3004
+ /**
3005
+ * @description One number per network. Every network in `/social_networks` is present.
3006
+ *
3007
+ * **And a few keys are not a network.** Some limits depend on the *kind* of publication rather than on the network alone, and those get a compound key next to the plain one: `instagram_story`, `facebook_reel`, `telegram_media`. Read the plain key by default and the compound one when it applies.
3008
+ */
2786
3009
  CatalogSocialLimitsMap: {
2787
3010
  [key: string]: number;
2788
3011
  };
@@ -2936,7 +3159,10 @@ interface components {
2936
3159
  /**
2937
3160
  * @description The comment's id on the network. Unique per account, and what makes repeated webhook deliveries idempotent.
2938
3161
  *
2939
- * One exception worth knowing: a Google Business reply has no id of its own — it is a *field* of the review — so PlanVortex fabricates a stable one, `{reviewId}/reply`.
3162
+ * Two exceptions worth knowing, and both are composite ids you should treat as opaque:
3163
+ *
3164
+ * • A Google Business reply has no id of its own — it is a *field* of the review — so PlanVortex fabricates a stable one, `{reviewId}/reply`.
3165
+ * • A Telegram comment lives in a **different chat** from the post it answers (the channel's linked discussion group), so it needs two ids at once and travels as `{thread}/{message}`: replying wants the first, deleting wants the second.
2940
3166
  */
2941
3167
  external_id: string;
2942
3168
  /** @description Hidden on the network. A hidden comment is never swept as deleted: on YouTube, hiding one makes the API stop returning it forever, and without that exception hiding would be indistinguishable from deleting. */
@@ -2960,7 +3186,7 @@ interface components {
2960
3186
  our_reply_external_id?: string;
2961
3187
  /** @description Present only when this is a reply to another comment */
2962
3188
  parent_external_id?: string;
2963
- /** @description What the comment hangs off, on the network: the post/video id in five networks, and the **listing** (`locations/{id}`) for a Google Business review. */
3189
+ /** @description What the comment hangs off, on the network: the post/video id in most networks, the **listing** (`locations/{id}`) for a Google Business review, and the published message's id on Telegram — where the thread that holds the comments *is* the forwarded post. */
2964
3190
  publication_external_id: string;
2965
3191
  /**
2966
3192
  * @description Star rating of a **review**. Present only on review networks — today Google Business. Its absence means "this network has no such thing", never zero.
@@ -3001,7 +3227,7 @@ interface components {
3001
3227
  * @description A network that has comments. Treat it as an open list: a new one is added before your integration hears about it.
3002
3228
  * @enum {string}
3003
3229
  */
3004
- CommentsCommentNetworkName: "facebook" | "instagram" | "twitter" | "linkedin" | "youtube" | "google_business" | "bluesky" | "discord";
3230
+ CommentsCommentNetworkName: "facebook" | "instagram" | "twitter" | "linkedin" | "youtube" | "google_business" | "bluesky" | "discord" | "telegram";
3005
3231
  /** @description A live read: asked of the network and reconciled with what was stored. */
3006
3232
  CommentsCommentThread: {
3007
3233
  comments: components["schemas"]["CommentsComment"][];
@@ -3047,7 +3273,7 @@ interface components {
3047
3273
  /**
3048
3274
  * @description What kind of change this is. **Treat it as an open list** and ignore what you do not handle: it grows with the product.
3049
3275
  *
3050
- * - `new_account` / `change_state_account`: an account was connected, or its state changed — it stopped working, its token was refreshed, it was disconnected.
3276
+ * - `new_account` / `change_state_account`: an account was connected, or its state changed — it stopped working, its token was refreshed, it was disconnected. On `telegram` this is the **only** way to hear about a connection: there is no callback there, so no request of yours ever returns that account.
3051
3277
  * - `messages`: a message came in. It travels in `messageObj`.
3052
3278
  * - `messaging_postbacks`: the contact pressed a button or a quick reply. Also in `messageObj`.
3053
3279
  * - `messaging_seen`: the contact read the conversation. `messageObj` carries the message they read, when we still have it.
@@ -3821,8 +4047,16 @@ interface components {
3821
4047
  * @enum {string}
3822
4048
  */
3823
4049
  engagement_base?: "reach" | "impressions" | "followers";
3824
- /** @description The network's own identifier, once published. */
4050
+ /** @description The network's own identifier, once published. On `telegram` an album is one publication that is **several messages**, and this holds the first one; the rest travel in `extra_data.telegram_message_ids`. */
3825
4051
  external_identifier?: string;
4052
+ /**
4053
+ * @description What one network needs to remember about **this** publication and that has no common field. Absent on a publication whose network needs nothing, which is almost all of them.
4054
+ *
4055
+ * Today only `telegram` writes here, and only `telegram_message_ids`: the ids of every message an album turned into, because deleting the album means deleting all of them.
4056
+ */
4057
+ extra_data?: {
4058
+ [key: string]: unknown;
4059
+ };
3826
4060
  /** @description The attached files, **already resolved**: every read and write path returns full uploads, not identifiers. Identifiers are what you SEND (see `PublicationInput.files`). */
3827
4061
  files: components["schemas"]["Upload"][];
3828
4062
  /**
@@ -3871,7 +4105,7 @@ interface components {
3871
4105
  text?: string;
3872
4106
  /** @description Only the networks that have a title field use it. */
3873
4107
  title?: string;
3874
- /** @description Link to the publication on the network, when there is one. */
4108
+ /** @description Link to the publication on the network, when there is one. A **private** Telegram channel has no public URL, so it comes back empty even though the post went out. */
3875
4109
  url?: string;
3876
4110
  };
3877
4111
  /** @description Body accepted when creating or updating a publication. Only these properties are read; anything else in the payload is ignored. */
@@ -3896,13 +4130,17 @@ interface components {
3896
4130
  * Not every connectable network publishes — a local business listing receives reviews, not posts — so this list is shorter than the one in `GET /social_networks`. Ask `GET /allowed_social_publications` rather than hardcoding it, because it grows.
3897
4131
  * @enum {string}
3898
4132
  */
3899
- social_network?: "facebook" | "instagram" | "twitter" | "linkedin" | "tiktok" | "whatsapp" | "youtube" | "bluesky" | "discord";
4133
+ social_network?: "facebook" | "instagram" | "twitter" | "linkedin" | "tiktok" | "whatsapp" | "youtube" | "bluesky" | "discord" | "telegram";
3900
4134
  /**
3901
4135
  * @description Send `draft` to store the publication without publishing it. If omitted, the state is resolved automatically: `ready` when everything validates, `withErrors` otherwise. Forcing `sended` marks it as published without actually sending it.
3902
4136
  * @enum {string}
3903
4137
  */
3904
4138
  state?: "ready" | "withErrors" | "sended" | "draft" | "publishing";
3905
- /** @description Body text of the publication. Either `text` or at least one entry in `files` is required: if both are empty the publication is still created, but in state `withErrors` with `publication_errors[].code = 915`. Maximum length depends on the network. On YouTube this is the video **description** (5,000 characters), and the publication must carry exactly one video file and no images — otherwise it is created in state `withErrors` with `publication_errors[].code = 943`. For X (Twitter), a text containing a link costs 200 credits instead of 15. */
4139
+ /**
4140
+ * @description Body text of the publication. Either `text` or at least one entry in `files` is required: if both are empty the publication is still created, but in state `withErrors` with `publication_errors[].code = 915`. Maximum length depends on the network. On YouTube this is the video **description** (5,000 characters), and the publication must carry exactly one video file and no images — otherwise it is created in state `withErrors` with `publication_errors[].code = 943`. For X (Twitter), a text containing a link costs 200 credits instead of 15.
4141
+ *
4142
+ * **On Telegram the limit depends on what else the publication carries**: 4.096 characters while it is text only, and **1.024** the moment it has an image or a video, because then the text is the caption of a photo, a video or an album and no longer a message. Over the limit it is created in state `withErrors` with `publication_errors[].code = 967`, whose `data` carries `characters`, `max_characters` and `has_media`. Both numbers are published, as `characters.telegram` and `characters.telegram_media` in `GET /social_limits`.
4143
+ */
3906
4144
  text?: string;
3907
4145
  /** @description Title for the publication. Only some networks use it: optional on LinkedIn, and **required on YouTube**, where it is the video title and must be 100 characters or fewer — a publication without it, or with a longer one, is created in state `withErrors` with `publication_errors[].code = 944`. */
3908
4146
  title?: string;
@@ -4003,6 +4241,8 @@ interface components {
4003
4241
  * On `discord` there are only two: `likes` (the reactions on the message) and `comments` (the messages in its thread). There is no impressions figure anywhere in Discord's API, so engagement is computed over the server's member count.
4004
4242
  *
4005
4243
  * On `bluesky` there are no impressions and no reach either — only the public counters — so engagement is computed over followers.
4244
+ *
4245
+ * On `telegram` there are two as well, and **neither of them is asked for**: the Bot API has no method that returns a message's metrics, so `reactions` arrives on its own through the bot and `comments` is counted in PlanVortex's own inbox. There are no impressions, no reach, no views and no forwards to be had anywhere in it, so engagement is computed over followers.
4006
4246
  */
4007
4247
  PublicationStats: {
4008
4248
  angers?: number;
@@ -4033,6 +4273,12 @@ interface components {
4033
4273
  profile_visits?: number;
4034
4274
  quotes?: number;
4035
4275
  reach?: number;
4276
+ /** @description Telegram. Every reaction on the post, all emoji together. It is the **complete state and not an increment**: it goes down when somebody takes theirs back. Normalised as `likes`. */
4277
+ reactions?: number;
4278
+ /** @description Telegram. The same total broken down by emoji. Reactions with a custom emoji are grouped under a single key: their identifier means nothing outside the server that created it. */
4279
+ reactions_by_emoji?: {
4280
+ [key: string]: number;
4281
+ };
4036
4282
  replys?: number;
4037
4283
  retwets?: number;
4038
4284
  saved?: number;
@@ -4081,7 +4327,7 @@ interface components {
4081
4327
  * **This list grows.** Treat it as an open enumeration: a client that rejects an unknown value breaks the day a network is added, which happens several times a year. Not every network does everything — ask `GET /social_capabilities`.
4082
4328
  * @enum {string}
4083
4329
  */
4084
- SocialNetwork: "facebook" | "instagram" | "linkedin" | "tiktok" | "twitter" | "whatsapp" | "youtube" | "google_business" | "bluesky" | "discord";
4330
+ SocialNetwork: "facebook" | "instagram" | "linkedin" | "tiktok" | "twitter" | "whatsapp" | "youtube" | "google_business" | "bluesky" | "discord" | "telegram";
4085
4331
  /** @description Statistics collection settings. Only `auto_refresh_twitter` is read; any other key is ignored. */
4086
4332
  StatsSettings: {
4087
4333
  /**
@@ -4165,6 +4411,9 @@ interface components {
4165
4411
  * | `948` | The reply is empty or longer than the network allows. Carries the limit in `data.max`; the same number is published in `comment_characters` of `GET /social_limits`. |
4166
4412
  * | `951` | The Google Business listing is not verified, so it cannot reply to its reviews. It is the state of the customer's profile, not of your token. |
4167
4413
  * | `952` | PlanVortex's Google Cloud project has no approved access to the Google Business API yet. Until it does, reviews cannot be read or replied to. |
4414
+ * | `965` | This Telegram channel has no linked discussion group, so it has no comments. The network gate says `true`; what is missing is a setting of **that channel**, which its owner fixes in two taps. Carries `chat_id` in `data`. |
4415
+ * | `969` | The PlanVortex bot is not allowed to delete messages in this Telegram discussion group. The network allows it; this installation does not. Carries `chat_id` in `data`. |
4416
+ * | `970` | Telegram is rate limiting the bot and the wait was longer than PlanVortex is willing to hold the request for. Carries `retry_after_seconds` in `data`: retry after it. |
4168
4417
  * | `1101` | Invalid organization. |
4169
4418
  * | `1501` | The comment's account could not be resolved. |
4170
4419
  */
@@ -5191,14 +5440,20 @@ interface operations {
5191
5440
  * | Code | Meaning |
5192
5441
  * | --- | --- |
5193
5442
  * | `1101` | Invalid organization |
5194
- * | `806` | Invalid upload identifier. One of the gallery_uploads does not belong to the organization. |
5443
+ * | `806` | Invalid upload identifier. One of the gallery_uploads, or one of the `source.images`, does not belong to the organization. |
5195
5444
  * | `924` | Max publications reached per month. There is no room in the organization's monthly publication limit for the generated posts. |
5196
5445
  * | `941` | AI credits exhausted for this month. The base cost of the plan exceeds the remaining AI credits. The response data carries { used, limit, cost }. |
5197
5446
  * | `2101` | This functionality requires a plan with artificial intelligence (available from the basic plan). |
5198
- * | `2103` | All accounts must belong to the organization. |
5447
+ * | `2103` | All accounts must belong to the organization. Also when `source.id_account_catalog` is not one of them. |
5199
5448
  * | `2105` | AI plan requires at least one account. |
5200
- * | `2106` | Invalid AI plan options (missing prompt, invalid timezone, invalid week_start, invalid max_images or invalid publish_days). |
5449
+ * | `2106` | Invalid AI plan options (missing prompt, invalid timezone, invalid week_start, invalid max_images or invalid publish_days). Also when an option is not accepted by the chosen template: `shared` on one whose `allows_shared` is false, or `gallery_uploads` on one whose `allows_gallery` is false. |
5201
5450
  * | `2108` | The selected publish days leave no available slot in the plan week: every slot of the chosen days is already in the past. Pick more days or a later week_start. The response data carries { publish_days, week_start, timezone }. |
5451
+ * | `2111` | Invalid planner template: `template` is not one of the ones published by `GET /planner_templates`. |
5452
+ * | `2112` | Invalid or missing `source` for the chosen template: a field is missing, an id is not valid, there are more units than `max_source_items`, an image has no description, a product is no longer in the catalogue, or the event date falls before the plan week or more than 60 days after it. `data` says which one and why. |
5453
+ * | `2113` | Could not read the source URL (`from_text`): the download failed, answered something that is not text or HTML, or the page carried no usable text. Paste the article in `source.text` instead. |
5454
+ * | `2114` | The source URL points to a non-public address (`from_text`): loopback, private, link-local or CGNAT. Checked before every redirect and again when the socket opens. |
5455
+ * | `2115` | The selected account has no usable product catalogue (`from_catalog`): its network has no products, or the catalogue could not be read — expired token, deleted catalogue, missing permission — or came back empty. |
5456
+ * | `2116` | The source has no usable items: no images, no products, or no text at all (neither `url` nor `text`, or a pasted text under 200 characters). |
5202
5457
  * | `521` | Invalid client. The identifier is invalid or doesn't exist |
5203
5458
  */
5204
5459
  400: {
@@ -5367,7 +5622,7 @@ interface operations {
5367
5622
  *
5368
5623
  * | Code | Meaning |
5369
5624
  * | --- | --- |
5370
- * | `2102` | The plan is not under review: only a `generated` plan can be regenerated |
5625
+ * | `2102` | The plan is not under review (only a `generated` plan can be regenerated), or this plan template does not allow regenerating that target — read `regenerate` in `GET /planner_templates` |
5371
5626
  * | `2106` | Invalid `target`: it has to be `text` or `image` |
5372
5627
  * | `935` | That publication does not belong to this plan, or is no longer a draft |
5373
5628
  * | `941` | AI credits exhausted for this month |
@@ -6286,6 +6541,7 @@ interface operations {
6286
6541
  * | `519` | This endpoint does not accept app credentials |
6287
6542
  * | `543` | This temporal connect token has already connected an account. Issue a new one |
6288
6543
  * | `544` | This temporal connect token was issued for a different social network |
6544
+ * | `700` | The connection cannot be completed through this endpoint. It is what `telegram` always answers here: that network's accounts are created from the bot being added to a channel, never from a call of yours |
6289
6545
  * | `1101` | Invalid organization, or a temporal token for a different one |
6290
6546
  */
6291
6547
  400: {
@@ -8872,6 +9128,8 @@ interface operations {
8872
9128
  * | `917` | Publication doesn't exists |
8873
9129
  * | `935` | Invalid publication |
8874
9130
  * | `940` | X (Twitter) credits exhausted. Deleting the tweet on X could not be charged. Response data: { used, limit }. |
9131
+ * | `966` | The Telegram message is older than 48 hours and the Bot API will not delete it any more. Response data: { published_date, max_hours }. |
9132
+ * | `969` | The PlanVortex bot is not allowed to delete messages in that Telegram chat. Response data: { chat_id }. |
8875
9133
  * | `523` | Invalid application |
8876
9134
  */
8877
9135
  400: {
@@ -10246,6 +10504,37 @@ interface operations {
10246
10504
  };
10247
10505
  };
10248
10506
  };
10507
+ getPlannerTemplates: {
10508
+ parameters: {
10509
+ query?: never;
10510
+ header?: never;
10511
+ path?: never;
10512
+ cookie?: never;
10513
+ };
10514
+ requestBody?: never;
10515
+ responses: {
10516
+ /** @description Available planner templates */
10517
+ 200: {
10518
+ headers: {
10519
+ [name: string]: unknown;
10520
+ };
10521
+ content: {
10522
+ "application/json": {
10523
+ templates?: components["schemas"]["CatalogPlannerTemplate"][];
10524
+ };
10525
+ };
10526
+ };
10527
+ /** @description Error */
10528
+ 400: {
10529
+ headers: {
10530
+ [name: string]: unknown;
10531
+ };
10532
+ content: {
10533
+ "application/json": components["schemas"]["Error"];
10534
+ };
10535
+ };
10536
+ };
10537
+ };
10249
10538
  getPublicationLimits: {
10250
10539
  parameters: {
10251
10540
  query?: never;
@@ -10436,7 +10725,8 @@ interface operations {
10436
10725
  * "youtube",
10437
10726
  * "google_business",
10438
10727
  * "bluesky",
10439
- * "discord"
10728
+ * "discord",
10729
+ * "telegram"
10440
10730
  * ]
10441
10731
  */
10442
10732
  "application/json": components["schemas"]["SocialNetwork"][];
@@ -10599,8 +10889,9 @@ type FileFormat = OpenEnum<Schemas["Upload"]["file_format"]>;
10599
10889
  * Sobre que se divide el engagement de una publicacion.
10600
10890
  *
10601
10891
  * No todas las redes dan alcance, asi que se cae en cascada: `reach`, si no `impressions`, si no
10602
- * `followers` (que es lo unico que hay en Bluesky y en Discord). **Dos filas con base distinta no
10603
- * son comparables**: si las pones en la misma tabla, di cual es.
10892
+ * `followers` (que es lo unico que hay en Bluesky, en Discord y en Telegram — la Bot API no
10893
+ * publica impresiones, ni alcance, ni siquiera las vistas de un post). **Dos filas con base
10894
+ * distinta no son comparables**: si las pones en la misma tabla, di cual es.
10604
10895
  */
10605
10896
  type EngagementBase = OpenEnum<NonNullable<Schemas["PublicationsPublicationStatsPoint"]["engagement_base"]>>;
10606
10897
  /**
@@ -10608,11 +10899,20 @@ type EngagementBase = OpenEnum<NonNullable<Schemas["PublicationsPublicationStats
10608
10899
  *
10609
10900
  * Los publica el servidor, que es quien los valida. Bluesky lleva **dos** cuentas distintas del
10610
10901
  * mismo texto —300 grafemas en `characters` y 3.000 bytes en `max_post_bytes`— porque `.length`
10611
- * miente en las dos direcciones. Un `0` en `max_post_bytes`, `comment_characters` o
10902
+ * miente en las dos direcciones. Telegram lleva **dos numeros para el mismo campo**, y ese si se
10903
+ * cuenta con `.length`: `characters.telegram` (4.096) mientras la publicacion es solo texto y
10904
+ * `characters.telegram_media` (1.024) en cuanto lleva imagen o video, porque entonces el texto es
10905
+ * el pie de un medio y no un mensaje. Un `0` en `max_post_bytes`, `comment_characters` o
10612
10906
  * `title_characters` significa "esta red no mide eso", no "cero".
10613
10907
  */
10614
10908
  type SocialLimits = Schemas["CatalogSocialLimits"];
10615
- /** Un numero por red, con TODAS las redes presentes. Lo obliga el conformance del servidor. */
10909
+ /**
10910
+ * Un numero por red, con TODAS las redes presentes. Lo obliga el conformance del servidor.
10911
+ *
10912
+ * **Y alguna clave no es una red**: cuando el tope depende del TIPO de publicacion y no solo de la
10913
+ * red, aparece una clave compuesta al lado de la simple —`instagram_story`, `facebook_reel`,
10914
+ * `telegram_media`—. Lee la simple por defecto y la compuesta cuando toque.
10915
+ */
10616
10916
  type SocialLimitsMap = Schemas["CatalogSocialLimitsMap"];
10617
10917
  /** Los recortes que acepta una red, como numero y como se escribe. Indices paralelos. */
10618
10918
  type AspectRatios = Schemas["CatalogAspectRatios"];
@@ -10631,10 +10931,47 @@ type SocialCapabilities = Schemas["CommentsSocialCapabilities"];
10631
10931
  * Que se puede hacer con los comentarios de una red, una a una.
10632
10932
  *
10633
10933
  * No basta con saber que la red tiene comentarios: Instagram, X y Bluesky no dejan borrar el de
10634
- * otro, LinkedIn no tiene "ocultar" y Google Business solo deja borrar **nuestra propia**
10635
- * respuesta. Se pide en `GET /social_comment_actions`, y es lo que decide que botones se pintan.
10934
+ * otro, LinkedIn no tiene "ocultar" —ni Discord ni Telegram tampoco— y Google Business solo deja
10935
+ * borrar **nuestra propia** respuesta. Se pide en `GET /social_comment_actions`, y es lo que
10936
+ * decide que botones se pintan.
10937
+ *
10938
+ * OJO: es de la RED, no de una cuenta suya. Un canal de Telegram sin grupo de debate contesta 965
10939
+ * en sus comentarios aunque la red los tenga, y borrar alli necesita ademas que el bot sea
10940
+ * administrador de ese grupo (error 969 si no).
10636
10941
  */
10637
10942
  type CommentActions = Schemas["CommentsCommentActions"];
10943
+ /**
10944
+ * De QUE se genera un plan: la fuente del contenido, no un flujo distinto del asistente.
10945
+ *
10946
+ * `shared`, `publish_days`, `language`, `tone` y las imagenes siguen siendo opciones transversales,
10947
+ * y cada plantilla declara cuales admite. Es una enumeracion ABIERTA por lo mismo que las redes: la
10948
+ * lista crece, y una plantilla nueva en el servidor no puede dejar de compilar el codigo de quien
10949
+ * no ha actualizado el paquete.
10950
+ */
10951
+ type PlannerTemplateName = OpenEnum<NonNullable<Schemas["CatalogPlannerTemplate"]["template"]>>;
10952
+ /**
10953
+ * Una plantilla del planificador, tal y como la publica `GET /planner_templates`.
10954
+ *
10955
+ * **`generates_images: false` significa que las fotos las pone la FUENTE** —las del usuario, las
10956
+ * del catalogo— y el plan no gasta ni un credito de imagen: la misma semana de 7 publicaciones con
10957
+ * foto pasa de 519 creditos a 48. Es lo que hay que decir ANTES de crear el plan, no despues.
10958
+ *
10959
+ * Y `regenerate` es por plantilla: la que no genero la imagen tampoco puede regenerarla. Ofrecer
10960
+ * ese boton igualmente es cobrarle al usuario 70 creditos por sustituir su propia foto por una
10961
+ * inventada.
10962
+ */
10963
+ type PlannerTemplate = Schemas["CatalogPlannerTemplate"];
10964
+ /**
10965
+ * Un campo del paso de fuente.
10966
+ *
10967
+ * `max` y `min` van en las unidades DEL CAMPO: caracteres de un texto, elementos de una lista y
10968
+ * **dias** de una fecha —los 60 de `event_date` son cuanto puede alejarse el evento de la semana
10969
+ * del plan—. `uploads_with_description` y `catalog_products` son la senal de que ese campo
10970
+ * necesita un componente propio; los demas son controles corrientes.
10971
+ */
10972
+ type PlannerTemplateField = Schemas["CatalogPlannerTemplateField"];
10973
+ /** El control de un campo de fuente. Abierto: el catalogo de tipos ya se ha ampliado antes. */
10974
+ type PlannerTemplateFieldType = OpenEnum<NonNullable<PlannerTemplateField["type"]>>;
10638
10975
  /**
10639
10976
  * Los recursos que reparte un plan. En un cliente es lo contratado; en una organizacion, la
10640
10977
  * porcion que se le asigno.
@@ -10680,9 +11017,14 @@ type ClientWithOrganizations = Operations["getClientsWithOrganizations"]["respon
10680
11017
  /**
10681
11018
  * Una cuenta social conectada a una organizacion.
10682
11019
  *
10683
- * En Discord una cuenta es un **canal**, no un perfil: publicar en dos canales del mismo servidor
10684
- * gasta dos cuentas del plan. `error_code` distinto de 0 significa que la conexion se rompio —
10685
- * token caducado, permisos retirados— y hay que reconectarla.
11020
+ * En Discord y en Telegram una cuenta es un **canal**, no un perfil: publicar en dos canales del
11021
+ * mismo servidor —o en dos canales de la misma marca— gasta dos cuentas del plan. `error_code`
11022
+ * distinto de 0 significa que la conexion se rompio —token caducado, permisos retirados— y hay que
11023
+ * reconectarla; en Telegram no caduca nada, porque no hay token de cuenta, y lo que la rompe es que
11024
+ * saquen al bot del canal o le quiten el permiso de publicar (error 968).
11025
+ *
11026
+ * Y un canal de Telegram **privado** no trae `username`: solo los publicos tienen `@nombre`, que es
11027
+ * tambien por lo que sus publicaciones vuelven sin `url`.
10686
11028
  */
10687
11029
  type Account = Override<Schemas["Account"], {
10688
11030
  social_network: SocialNetwork;
@@ -10712,16 +11054,35 @@ type ConnectToken = Operations["createTemporalConnectToken"]["responses"][200]["
10712
11054
  * Como se conecta UNA red. Casi siempre es un enlace: se manda al usuario ahi y la red lo devuelve
10713
11055
  * al panel de PlanVortex, que es quien completa la conexion.
10714
11056
  *
10715
- * **Casi. Mira `authorization.type` y no si `link` esta vacio.** WhatsApp no tiene URL de
10716
- * autorizacion: su alta es el Embedded Signup de Meta, un popup que levanta el SDK de JavaScript de
10717
- * Facebook desde tu pagina y que devuelve por `postMessage` datos —el `waba_id`, el
10718
- * `phone_number_id`— que no caben en una query string. Su `link` es cadena vacia y los parametros
10719
- * del popup (`app_id`, `config_id`, `graph_version`...) viajan en `authorization`.
11057
+ * **Casi. Mira `authorization.type` y no si `link` esta vacio.** Hay DOS excepciones, y ninguna de
11058
+ * las dos falla de forma visible si se tratan como una redireccion:
11059
+ *
11060
+ * - **WhatsApp no tiene URL de autorizacion.** Su alta es el Embedded Signup de Meta, un popup que
11061
+ * levanta el SDK de JavaScript de Facebook desde tu pagina y que devuelve por `postMessage`
11062
+ * datos —el `waba_id`, el `phone_number_id`— que no caben en una query string. Su `link` es
11063
+ * cadena vacia y los parametros del popup (`app_id`, `config_id`, `graph_version`...) viajan en
11064
+ * `authorization`.
11065
+ * - **Telegram tiene enlace y aun asi no es una redireccion.** Ese `link` abre un chat con el bot
11066
+ * de PlanVortex, y de ahi no vuelve nadie: no hay OAuth, no hay `code` y no hay `redirect_uri`.
11067
+ * La cuenta nace minutos despues, cuando la persona mete el bot en su canal, y se anuncia por el
11068
+ * WebSocket. Abrelo en otra pestana y sigue escuchando; redirige a el y no queda a quien avisar.
10720
11069
  */
10721
11070
  type ConnectLink = Schemas["AccountsSocialLinksList"]["links"][number];
10722
11071
  /**
10723
- * Con que se autoriza una red: `redirect` (las otras nueve) o `meta_embedded_signup` (WhatsApp).
10724
- * Se saca de {@link ConnectLink} y esta aqui para poder nombrarlo en un `switch`.
11072
+ * Con que se autoriza una red: `redirect` (nueve de las once), `meta_embedded_signup` (WhatsApp) o
11073
+ * `telegram_bot` (Telegram). Se saca de {@link ConnectLink} y esta aqui para poder nombrarlo en un
11074
+ * `switch`.
11075
+ *
11076
+ * **Es una union disfrazada de un solo tipo**: OpenAPI no sabe decir "estos campos solo cuando
11077
+ * `type` vale tal", asi que todos llegan opcionales y hay que ramificar por `type` antes de
11078
+ * leerlos. En `telegram_bot` los dos que vienen son `bot_username` —el `@nombre` del bot, sin la
11079
+ * arroba— y `add_to_group_link`, que es el SEGUNDO paso y no se deduce del primero: `link` abre la
11080
+ * lista de canales y este la de grupos, y es el que enciende los comentarios metiendo al bot en el
11081
+ * grupo de debate del canal. Ese paso es opcional para el usuario —publicar y medir funcionan sin
11082
+ * el—, pero sin darlo el canal no tiene bandeja (error 965).
11083
+ *
11084
+ * Y **la lista crece**: un `type` que esta version no conozca se salta, que es una respuesta
11085
+ * honesta. Mandar a alguien a un `link` porque el `if/else` no cubria su caso, no.
10725
11086
  */
10726
11087
  type SocialAuthorizationMethod = ConnectLink["authorization"];
10727
11088
  /**
@@ -10772,6 +11133,11 @@ type FileProperties = Schemas["FileProperties"];
10772
11133
  *
10773
11134
  * Si `state` es `withErrors`, el motivo esta en `publication_errors` —que es un ARRAY— y su `code`
10774
11135
  * es un codigo del catalogo de PlanVortex, nunca un status HTTP.
11136
+ *
11137
+ * Y OJO EN TELEGRAM: un album es UNA publicacion que son VARIOS mensajes. `external_identifier` es
11138
+ * el primero y el resto viajan en `extra_data.telegram_message_ids`, que es el unico sitio donde
11139
+ * hoy escribe nadie ese campo. En un canal privado ademas no hay `url`, porque no hay `@nombre` que
11140
+ * poner en ella, y eso no significa que la publicacion fallara.
10775
11141
  */
10776
11142
  type Publication = Override<Schemas["Publication"], {
10777
11143
  social_network: SocialNetwork;
@@ -10801,7 +11167,14 @@ type PublicationInput = Override<Schemas["PublicationsPublicationInput"], {
10801
11167
  publication_type: PublicationType;
10802
11168
  publish_date: string | Date;
10803
11169
  }>;
10804
- /** El desglose crudo de metricas que da la red, que no es el mismo en dos redes cualesquiera. */
11170
+ /**
11171
+ * El desglose crudo de metricas que da la red, que no es el mismo en dos redes cualesquiera.
11172
+ *
11173
+ * En Telegram son dos, y **ninguna de las dos se pide**: la Bot API no tiene ningun metodo que
11174
+ * devuelva las metricas de un mensaje. `reactions` llega sola por el bot —y es el ESTADO COMPLETO,
11175
+ * no un incremento, asi que baja cuando alguien retira la suya—, y `comments` se cuenta en la
11176
+ * bandeja de PlanVortex. No hay impresiones, ni alcance, ni vistas, ni reenvios en ninguna parte.
11177
+ */
10805
11178
  type PublicationStats = Schemas["PublicationStats"];
10806
11179
  /** Las metricas comparables entre redes: las que se pueden sumar en una grafica. */
10807
11180
  type PublicationMetrics = Schemas["NormalizedMetrics"];
@@ -10831,7 +11204,14 @@ type PublicationStatsPoint = Override<Schemas["PublicationsPublicationStatsPoint
10831
11204
  * asi que se pinta el `rating` al lado en vez de dar la fila por rota.
10832
11205
  *
10833
11206
  * De lo nuestro solo son `read` y `replied`. Todo lo demas lo manda la red, y una lectura en vivo
10834
- * pisa lo guardado.
11207
+ * pisa lo guardado — menos en Telegram, que no tiene lectura en vivo (§ {@link
11208
+ * CommentsResource.thread}).
11209
+ *
11210
+ * Y `external_id` **es opaco**: no siempre es el identificador de la red a secas. Una respuesta de
11211
+ * Google Business no tiene identificador propio —es un CAMPO de la resena— y viaja como
11212
+ * `{reviewId}/reply`; un comentario de Telegram vive en OTRO chat que el post que contesta (el
11213
+ * grupo de debate del canal), asi que necesita dos identificadores a la vez y viaja como
11214
+ * `{thread}/{message}`. No lo partas: pasalo tal cual.
10835
11215
  */
10836
11216
  type Comment = Override<Schemas["CommentsComment"], {
10837
11217
  social_network: CommentNetwork;
@@ -11009,6 +11389,13 @@ type IntegrationPickerConfig = Operations["getIntegrationPickerConfig"]["respons
11009
11389
  * plan lo devuelve con las publicaciones enteras y sus ficheros, y el LISTADO devuelve sus
11010
11390
  * identificadores. `organization_context` es una FOTO del contexto de marca de la organizacion en
11011
11391
  * el momento de crear el plan, no el de ahora: es lo que hace que un reintento sea reproducible.
11392
+ *
11393
+ * `template` viene SIEMPRE —un plan anterior a las plantillas se lee `standard`— y `source` es la
11394
+ * misma clase de foto que `organization_context`: el articulo ya descargado, las fotos elegidas o
11395
+ * los productos copiados, no una referencia viva. Por eso un reintento tres dias despues no depende
11396
+ * de que el articulo siga en linea ni de que el producto siga en el catalogo.
11397
+ *
11398
+ * Y `warnings` no es un error: son avisos del ULTIMO intento sobre un plan que se genero bien.
11012
11399
  */
11013
11400
  type AiPlan = Schemas["AiPlansAiPlan"];
11014
11401
  /** El estado de un plan. `pending` y `generating` son los dos que hay que sondear. */
@@ -11017,8 +11404,60 @@ type AiPlanState = OpenEnum<AiPlan["state"]>;
11017
11404
  type AiPlanOptions = Schemas["AiPlansAiPlanOptions"];
11018
11405
  /** Las opciones tal y como se MANDAN: todas opcionales, los defaults los pone el servidor. */
11019
11406
  type AiPlanOptionsInput = Schemas["AiPlansAiPlanOptionsInput"];
11020
- /** Lo que se manda para encolar un plan. */
11407
+ /**
11408
+ * Lo que se manda para encolar un plan.
11409
+ *
11410
+ * `template` y `source` son OPCIONALES: sin ellos el plan es `standard`, que es exactamente lo que
11411
+ * hacia cualquier plan antes de que existieran las plantillas. Mandar una opcion que la plantilla
11412
+ * elegida no admite —un `shared` en `from_images`— es un 2106, no un silencio.
11413
+ */
11021
11414
  type AiPlanCreateRequest = Schemas["AiPlansAiPlanCreateRequest"];
11415
+ /**
11416
+ * La fuente del plan, tal y como se MANDA. **Una forma por plantilla**: manda solo los campos de la
11417
+ * que elegiste —lo que no lee se ignora, y lo que necesita y no recibe es un 2112—.
11418
+ *
11419
+ * | Plantilla | Campos |
11420
+ * | --- | --- |
11421
+ * | `standard` | ninguno: no tiene fuente |
11422
+ * | `from_images` | `images` |
11423
+ * | `from_text` | `url` **o** `text` |
11424
+ * | `from_catalog` | `id_account_catalog`, `product_catalog_id`, `products` |
11425
+ * | `campaign` | `event_name`, `event_date` |
11426
+ *
11427
+ * Se valida al CREAR el plan, no al generarlo: el articulo se descarga, el catalogo se lee en vivo
11428
+ * y las fotos de los productos se copian, asi que una fuente que no funciona falla mientras el
11429
+ * usuario sigue delante. Dos trampas que el tipo no puede decir: `text` GANA sobre `url` cuando
11430
+ * llegan los dos —pegar el texto es lo que hace quien no consiguio que se descargara—, y
11431
+ * `event_date` es un DIA DE CALENDARIO (`YYYY-MM-DD`), nunca un instante ISO.
11432
+ */
11433
+ type AiPlanSourceInput = Schemas["AiPlansAiPlanSourceInput"];
11434
+ /** Una foto de `from_images`. La descripcion es obligatoria a proposito: sin ella el modelo escribe sobre lo que cree ver. */
11435
+ type AiPlanSourceImageInput = Schemas["AiPlansAiPlanSourceImageInput"];
11436
+ /**
11437
+ * La fuente tal y como quedo GUARDADA: una foto del momento de crear el plan, no una referencia
11438
+ * viva. Es lo que hace que un reintento reproduzca el mismo plan.
11439
+ */
11440
+ type AiPlanSource = Schemas["AiPlansAiPlanSource"];
11441
+ /**
11442
+ * Un producto del catalogo, copiado al crear el plan.
11443
+ *
11444
+ * `price` viene **exactamente como lo devolvio la red** (`"9,99 €"`) y no se convierte nunca: el
11445
+ * mismo campo es un numero en otros caminos de la API de Meta y no hay forma de saber si son
11446
+ * unidades o centimos. Dividir por 100 "por si acaso" es como se anuncia un producto de 10 € a
11447
+ * 0,10 €. Y `id_upload` es la foto ya copiada a un fichero de la organizacion, porque la URL del
11448
+ * CDN de la red caduca.
11449
+ */
11450
+ type AiPlanSourceProduct = Schemas["AiPlansAiPlanSourceProduct"];
11451
+ /**
11452
+ * Algo que el plan tiene que decir de si mismo, con la forma de un error de la API. Lo comparten
11453
+ * `error` (solo en estado `failed`) y `warnings` (en un plan que se genero bien).
11454
+ *
11455
+ * Hoy hay un aviso: **2117 — parte de la fuente no cabia en la semana del plan**. Un plan es
11456
+ * SEMANAL y la fuente no lo alarga, asi que 12 fotos con 6 huecos libres publican 6 y las demas se
11457
+ * quedan fuera; `data` trae `{source_items, capacity}`. Se dice mejor ANTES de crear el plan —los
11458
+ * huecos son los dias de publicacion por las cuentas— que despues de haberlo cobrado.
11459
+ */
11460
+ type AiPlanNotice = Schemas["AiPlansAiPlanNotice"];
11022
11461
  /**
11023
11462
  * El presupuesto DETERMINISTA de un plan, calculado por el servidor y nunca por el modelo.
11024
11463
  *
@@ -11577,4 +12016,4 @@ interface PlanVortexWebhooksOptions {
11577
12016
  */
11578
12017
  declare function planvortexWebhooks(options: PlanVortexWebhooksOptions): (request: WebhookRequestLike, response: WebhookResponseLike, next: (error?: unknown) => void) => void;
11579
12018
 
11580
- export { type Product as $, type Account as A, type IntegrationProvider as B, type ConnectLink as C, type Dashboard as D, type EnableResult as E, type Integration as F, type IntegrationConnectRequest as G, type IntegrationUpdate as H, type IntegrationProviderName as I, type IntegrationPickerConfig as J, type MessageTemplate as K, type Conversation as L, type MetricName as M, type ConversationTotals as N, type Message as O, type Paginated as P, type MessageInput as Q, type Client as R, type SocialNetwork as S, type TopPublicationsResult as T, type Organization as U, type AiSettings as V, type ClientWithOrganizations as W, type PlanData as X, type ConnectToken as Y, type AiContext as Z, type SocialCredentialsInput as _, type ConnectResult as a, type RssConfig as a$, type ProductInput as a0, type ProductCatalog as a1, type ProductCatalogInput as a2, type PublicationInput as a3, type PublicationState as a4, type PublicationStats as a5, type PublicationStatsHistory as a6, type Upload as a7, AccountError as a8, type AccountMetricRow as a9, type MessageChange as aA, type MessageOptions as aB, type MessageType as aC, MessagingError as aD, type MetricRow as aE, NO_ERROR_CODE as aF, type components as aG, type operations as aH, type paths as aI, type webhooks as aJ, type OpenEnum as aK, OrganizationError as aL, PLANVORTEX_ERROR_RANGES as aM, PlanLimitError as aN, PlanVortexAuthenticationError as aO, PlanVortexConfigError as aP, PlanVortexConnectionError as aQ, PlanVortexError as aR, type PlanVortexErrorOptions as aS, type PlanVortexErrorRange as aT, ProductError as aU, PublicationError as aV, type PublicationErrorDetail as aW, type PublicationMetrics as aX, type PublicationStatsPoint as aY, type PublicationType as aZ, type PublicationsSummary as a_, type AccountStateChange as aa, type AccountWebhookChangeBase as ab, type AccountWithError as ac, type AiPlanCostEstimate as ad, AiPlanError as ae, type AiPlanOptions as af, type AiPlanOptionsInput as ag, type AiPlanState as ah, type ApiErrorBody as ai, type AspectRatios as aj, AuthError as ak, type ClientPlan as al, type CommentAuthor as am, type CommentChange as an, type ContactChannel as ao, ContactError as ap, type DashboardAiPlanRef as aq, type DashboardPublicationRef as ar, type DashboardRange as as, type EngagementBase as at, FileError as au, type FileFormat as av, type FileProperties as aw, type FileType as ax, IntegrationError as ay, type IntegrationErrorChange as az, type AccountMetrics as b, type SocialAuthorizationMethod as b0, type SocialCredentials as b1, type SocialIdentifier as b2, type SocialIdentifierInput as b3, type SocialLimitsMap as b4, TOKEN_ERROR_CODES as b5, type TopPublication as b6, type UnknownWebhookChange as b7, UserError as b8, type WebhookAlgorithm as b9, WebhookSignatureError as bA, handleWebhookRequest as bB, isAccountStateChange as bC, isCommentChange as bD, isIntegrationErrorChange as bE, isMessageChange as bF, parseWebhookPayload as bG, planvortexWebhooks as bH, verifyWebhookSignature as bI, type WebhookChange as ba, type WebhookEvent as bb, type WithAccount as bc, type WithPublication as bd, account as be, accountId as bf, errorFamilyForCode as bg, isPlanVortexError as bh, isTokenError as bi, messageContact as bj, messageContactId as bk, messageDirection as bl, messageFileIds as bm, messageFiles as bn, publication as bo, publicationId as bp, type HandleWebhookRequestOptions as bq, type PlanVortexWebhooksOptions as br, type RawWebhookBody as bs, type VerifyWebhookSignatureOptions as bt, WEBHOOK_EVENTS as bu, WEBHOOK_SIGNATURE_HEADERS as bv, WebhookBodyError as bw, type WebhookHeaders as bx, type WebhookRequestLike as by, type WebhookResponseLike as bz, type PersistentMenu as c, type Publication as d, type AiPlanCreateRequest as e, type AiPlanCreateResult as f, type AiPlan as g, type ClientApp as h, type ClientAppInput as i, type SocialCapabilities as j, type CommentActions as k, type SocialLimits as l, type PublicationLimits as m, type AspectRatiosByNetwork as n, type CommentNetwork as o, type Comment as p, type CommentThread as q, type CommentReplyResult as r, type ContactExtraData as s, type Contact as t, type ContactCreate as u, type ContactUpdate as v, type DashboardMetricsResult as w, type PublicationsSummaryResult as x, type PublicationsStatsResult as y, type PlanUse as z };
12019
+ export { type SocialCredentialsInput as $, type Account as A, type PlanUse as B, type ConnectLink as C, type Dashboard as D, type EnableResult as E, type IntegrationProvider as F, type Integration as G, type IntegrationConnectRequest as H, type IntegrationProviderName as I, type IntegrationUpdate as J, type IntegrationPickerConfig as K, type MessageTemplate as L, type MetricName as M, type Conversation as N, type ConversationTotals as O, type Paginated as P, type Message as Q, type MessageInput as R, type SocialNetwork as S, type TopPublicationsResult as T, type Client as U, type Organization as V, type AiSettings as W, type ClientWithOrganizations as X, type PlanData as Y, type ConnectToken as Z, type AiContext as _, type ConnectResult as a, type PlannerTemplateFieldType as a$, type Product as a0, type ProductInput as a1, type ProductCatalog as a2, type ProductCatalogInput as a3, type PublicationInput as a4, type PublicationState as a5, type PublicationStats as a6, type PublicationStatsHistory as a7, type Upload as a8, AccountError as a9, FileError as aA, type FileFormat as aB, type FileProperties as aC, type FileType as aD, IntegrationError as aE, type IntegrationErrorChange as aF, type MessageChange as aG, type MessageOptions as aH, type MessageType as aI, MessagingError as aJ, type MetricRow as aK, NO_ERROR_CODE as aL, type components as aM, type operations as aN, type paths as aO, type webhooks as aP, type OpenEnum as aQ, OrganizationError as aR, PLANVORTEX_ERROR_RANGES as aS, PlanLimitError as aT, PlanVortexAuthenticationError as aU, PlanVortexConfigError as aV, PlanVortexConnectionError as aW, PlanVortexError as aX, type PlanVortexErrorOptions as aY, type PlanVortexErrorRange as aZ, type PlannerTemplateField as a_, type AccountMetricRow as aa, type AccountStateChange as ab, type AccountWebhookChangeBase as ac, type AccountWithError as ad, type AiPlanCostEstimate as ae, AiPlanError as af, type AiPlanNotice as ag, type AiPlanOptions as ah, type AiPlanOptionsInput as ai, type AiPlanSource as aj, type AiPlanSourceImageInput as ak, type AiPlanSourceInput as al, type AiPlanSourceProduct as am, type AiPlanState as an, type ApiErrorBody as ao, type AspectRatios as ap, AuthError as aq, type ClientPlan as ar, type CommentAuthor as as, type CommentChange as at, type ContactChannel as au, ContactError as av, type DashboardAiPlanRef as aw, type DashboardPublicationRef as ax, type DashboardRange as ay, type EngagementBase as az, type AccountMetrics as b, type PlannerTemplateName as b0, ProductError as b1, PublicationError as b2, type PublicationErrorDetail as b3, type PublicationMetrics as b4, type PublicationStatsPoint as b5, type PublicationType as b6, type PublicationsSummary as b7, type RssConfig as b8, type SocialAuthorizationMethod as b9, type PlanVortexWebhooksOptions as bA, type RawWebhookBody as bB, type VerifyWebhookSignatureOptions as bC, WEBHOOK_EVENTS as bD, WEBHOOK_SIGNATURE_HEADERS as bE, WebhookBodyError as bF, type WebhookHeaders as bG, type WebhookRequestLike as bH, type WebhookResponseLike as bI, WebhookSignatureError as bJ, handleWebhookRequest as bK, isAccountStateChange as bL, isCommentChange as bM, isIntegrationErrorChange as bN, isMessageChange as bO, parseWebhookPayload as bP, planvortexWebhooks as bQ, verifyWebhookSignature as bR, type SocialCredentials as ba, type SocialIdentifier as bb, type SocialIdentifierInput as bc, type SocialLimitsMap as bd, TOKEN_ERROR_CODES as be, type TopPublication as bf, type UnknownWebhookChange as bg, UserError as bh, type WebhookAlgorithm as bi, type WebhookChange as bj, type WebhookEvent as bk, type WithAccount as bl, type WithPublication as bm, account as bn, accountId as bo, errorFamilyForCode as bp, isPlanVortexError as bq, isTokenError as br, messageContact as bs, messageContactId as bt, messageDirection as bu, messageFileIds as bv, messageFiles as bw, publication as bx, publicationId as by, type HandleWebhookRequestOptions as bz, type PersistentMenu as c, type Publication as d, type AiPlanCreateRequest as e, type AiPlanCreateResult as f, type AiPlan as g, type ClientApp as h, type ClientAppInput as i, type SocialCapabilities as j, type CommentActions as k, type SocialLimits as l, type PublicationLimits as m, type AspectRatiosByNetwork as n, type PlannerTemplate as o, type CommentNetwork as p, type Comment as q, type CommentThread as r, type CommentReplyResult as s, type ContactExtraData as t, type Contact as u, type ContactCreate as v, type ContactUpdate as w, type DashboardMetricsResult as x, type PublicationsSummaryResult as y, type PublicationsStatsResult as z };