planvortex 0.3.0 → 0.4.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.
@@ -700,6 +700,8 @@ interface paths {
700
700
  * **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
701
  *
702
702
  * **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.
703
+ *
704
+ * **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
705
  */
704
706
  get: operations["connectAccount"];
705
707
  put?: never;
@@ -1179,7 +1181,9 @@ interface paths {
1179
1181
  * The inbox: first-level comments across the whole organization
1180
1182
  * @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
1183
  *
1182
- * Ordered by `creation_date` descending — the date on the network, not the date we collected it — so rows from six networks interleave correctly.
1184
+ * Ordered by `creation_date` descending — the date on the network, not the date we collected it — so rows from nine networks interleave correctly.
1185
+ *
1186
+ * **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
1187
  *
1184
1188
  * **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
1189
  *
@@ -1221,6 +1225,8 @@ interface paths {
1221
1225
  *
1222
1226
  * On X this costs credits.
1223
1227
  *
1228
+ * 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".
1229
+ *
1224
1230
  * Requires the `comments:delete` permission (`client_organization_comments:delete` for apps) and a paid plan.
1225
1231
  */
1226
1232
  delete: operations["deleteComment"];
@@ -1276,6 +1282,8 @@ interface paths {
1276
1282
  *
1277
1283
  * **On X this costs credits**: 15, or 200 if the text contains a link, charged only on success.
1278
1284
  *
1285
+ * **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.
1286
+ *
1279
1287
  * Requires the `comments:create` permission (`client_organization_comments:create` for apps) and a paid plan.
1280
1288
  */
1281
1289
  post: operations["replyComment"];
@@ -1300,7 +1308,10 @@ interface paths {
1300
1308
  *
1301
1309
  * **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
1310
  *
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.
1311
+ * **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:
1312
+ *
1313
+ * • **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.
1314
+ * • **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
1315
  */
1305
1316
  get: operations["getConnectLinks"];
1306
1317
  put?: never;
@@ -1738,6 +1749,8 @@ interface paths {
1738
1749
  /**
1739
1750
  * Delete publication by identifier
1740
1751
  * @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.
1752
+ *
1753
+ * **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
1754
  */
1742
1755
  delete: operations["deletePublication"];
1743
1756
  options?: never;
@@ -1760,6 +1773,8 @@ interface paths {
1760
1773
  *
1761
1774
  * 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
1775
  *
1776
+ * **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.
1777
+ *
1763
1778
  * Requires the `comments:read` permission (`client_organization_comments:read` for apps) and a paid plan.
1764
1779
  */
1765
1780
  get: operations["getPublicationComments"];
@@ -2254,7 +2269,9 @@ interface paths {
2254
2269
  *
2255
2270
  * `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
2271
  *
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.
2272
+ * 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.
2273
+ *
2274
+ * 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
2275
  *
2259
2276
  * Only needs authentication.
2260
2277
  */
@@ -2290,6 +2307,7 @@ interface paths {
2290
2307
  * | `google_business` | yes | **no** | yes — **your reply**, never the review | **no** |
2291
2308
  * | `bluesky` | yes | yes — through the post's `threadgate` | yes | **no** — the reply lives in somebody else's repository |
2292
2309
  * | `discord` | yes | **no** — Discord has no hide, only delete | yes | yes |
2310
+ * | `telegram` | yes | **no** — Telegram has no hide either | yes | yes — with the bot as an admin of the discussion group, otherwise error 969 |
2293
2311
  * | `tiktok`, `whatsapp` | no | no | no | no |
2294
2312
  *
2295
2313
  * Only needs authentication.
@@ -2319,6 +2337,7 @@ interface paths {
2319
2337
  * • **`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
2338
  * • **`0` in `title_characters` means the network has no title field**, not a title of zero length.
2321
2339
  * • **`comment_characters` is a different limit from `characters`.** Facebook takes 63.206 in a post and 8.000 in a comment.
2340
+ * • **`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
2341
  * • 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
2342
  */
2324
2343
  get: operations["getSocialLimits"];
@@ -2403,9 +2422,9 @@ interface components {
2403
2422
  /**
2404
2423
  * @description A social account connected to an organization.
2405
2424
  *
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.
2425
+ * 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
2426
  *
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.
2427
+ * `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
2428
  */
2410
2429
  Account: {
2411
2430
  _id: string;
@@ -2413,7 +2432,7 @@ interface components {
2413
2432
  creation_date: string;
2414
2433
  /** @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
2434
  error_code: number;
2416
- /** @description Followers the network reports. Absent on an account that has never been measured. */
2435
+ /** @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
2436
  followers_count?: number;
2418
2437
  /** @description The client the organization hangs from. Denormalized here for the plan checks. */
2419
2438
  id_client: string;
@@ -2436,7 +2455,7 @@ interface components {
2436
2455
  private_message_link?: string;
2437
2456
  /** @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
2457
  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). */
2458
+ /** @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
2459
  username?: string;
2441
2460
  };
2442
2461
  AccountsAccountList: {
@@ -2482,13 +2501,20 @@ interface components {
2482
2501
  /**
2483
2502
  * @description **How** an account of this network is authorized, which is not always "send the user to this URL".
2484
2503
  *
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.
2504
+ * Nine of the eleven networks are `redirect`: open `link` and the network sends the person back to PlanVortex with a code. Two are not:
2505
+ *
2506
+ * • **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.
2507
+ * • **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
2508
  *
2487
2509
  * Branch on `authorization.type`, never on whether `link` is empty.
2488
2510
  */
2489
2511
  AccountsSocialAuthorizationMethod: {
2512
+ /** @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. */
2513
+ add_to_group_link?: string;
2490
2514
  /** @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
2515
  app_id?: string;
2516
+ /** @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. */
2517
+ bot_username?: string;
2492
2518
  /** @description `meta_embedded_signup` only. Goes to `FB.login(cb, {config_id})` — the Embedded Signup configuration. */
2493
2519
  config_id?: string;
2494
2520
  /** @description `meta_embedded_signup` only. Goes to `extras.featureType`. */
@@ -2498,16 +2524,20 @@ interface components {
2498
2524
  /** @description `meta_embedded_signup` only. Goes to `extras.sessionInfoVersion`. */
2499
2525
  session_info_version?: string;
2500
2526
  /**
2501
- * @description `redirect`: send the user to `link`. `meta_embedded_signup`: open the Meta popup with the fields below.
2527
+ * @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
2528
  * @enum {string}
2503
2529
  */
2504
- type: "redirect" | "meta_embedded_signup";
2530
+ type: "redirect" | "meta_embedded_signup" | "telegram_bot";
2505
2531
  };
2506
2532
  AccountsSocialLinksList: {
2507
2533
  /** @description One entry per network that can be connected right now. */
2508
2534
  links: {
2509
2535
  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. */
2536
+ /**
2537
+ * @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.
2538
+ *
2539
+ * 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.
2540
+ */
2511
2541
  link: string;
2512
2542
  social_network: components["schemas"]["SocialNetwork"];
2513
2543
  }[];
@@ -2767,7 +2797,11 @@ interface components {
2767
2797
  values: number[];
2768
2798
  };
2769
2799
  CatalogSocialLimits: {
2770
- /** @description Maximum length of a publication's text. Bluesky counts graphemes, everyone else counts characters. */
2800
+ /**
2801
+ * @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.
2802
+ *
2803
+ * 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.
2804
+ */
2771
2805
  characters: components["schemas"]["CatalogSocialLimitsMap"];
2772
2806
  /** @description Maximum length of a reply to a comment. `0` means the network has no comments. */
2773
2807
  comment_characters: components["schemas"]["CatalogSocialLimitsMap"];
@@ -2782,7 +2816,11 @@ interface components {
2782
2816
  /** @description Maximum video duration. A network that limits weight instead of duration is not here but in `max_file_size_mb`. */
2783
2817
  video_duration_in_seconds: components["schemas"]["CatalogSocialLimitsMap"];
2784
2818
  };
2785
- /** @description One number per network. Every network in `/social_networks` is present. */
2819
+ /**
2820
+ * @description One number per network. Every network in `/social_networks` is present.
2821
+ *
2822
+ * **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.
2823
+ */
2786
2824
  CatalogSocialLimitsMap: {
2787
2825
  [key: string]: number;
2788
2826
  };
@@ -2936,7 +2974,10 @@ interface components {
2936
2974
  /**
2937
2975
  * @description The comment's id on the network. Unique per account, and what makes repeated webhook deliveries idempotent.
2938
2976
  *
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`.
2977
+ * Two exceptions worth knowing, and both are composite ids you should treat as opaque:
2978
+ *
2979
+ * • 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`.
2980
+ * • 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
2981
  */
2941
2982
  external_id: string;
2942
2983
  /** @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 +3001,7 @@ interface components {
2960
3001
  our_reply_external_id?: string;
2961
3002
  /** @description Present only when this is a reply to another comment */
2962
3003
  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. */
3004
+ /** @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
3005
  publication_external_id: string;
2965
3006
  /**
2966
3007
  * @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 +3042,7 @@ interface components {
3001
3042
  * @description A network that has comments. Treat it as an open list: a new one is added before your integration hears about it.
3002
3043
  * @enum {string}
3003
3044
  */
3004
- CommentsCommentNetworkName: "facebook" | "instagram" | "twitter" | "linkedin" | "youtube" | "google_business" | "bluesky" | "discord";
3045
+ CommentsCommentNetworkName: "facebook" | "instagram" | "twitter" | "linkedin" | "youtube" | "google_business" | "bluesky" | "discord" | "telegram";
3005
3046
  /** @description A live read: asked of the network and reconciled with what was stored. */
3006
3047
  CommentsCommentThread: {
3007
3048
  comments: components["schemas"]["CommentsComment"][];
@@ -3047,7 +3088,7 @@ interface components {
3047
3088
  /**
3048
3089
  * @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
3090
  *
3050
- * - `new_account` / `change_state_account`: an account was connected, or its state changed — it stopped working, its token was refreshed, it was disconnected.
3091
+ * - `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
3092
  * - `messages`: a message came in. It travels in `messageObj`.
3052
3093
  * - `messaging_postbacks`: the contact pressed a button or a quick reply. Also in `messageObj`.
3053
3094
  * - `messaging_seen`: the contact read the conversation. `messageObj` carries the message they read, when we still have it.
@@ -3821,8 +3862,16 @@ interface components {
3821
3862
  * @enum {string}
3822
3863
  */
3823
3864
  engagement_base?: "reach" | "impressions" | "followers";
3824
- /** @description The network's own identifier, once published. */
3865
+ /** @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
3866
  external_identifier?: string;
3867
+ /**
3868
+ * @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.
3869
+ *
3870
+ * 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.
3871
+ */
3872
+ extra_data?: {
3873
+ [key: string]: unknown;
3874
+ };
3826
3875
  /** @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
3876
  files: components["schemas"]["Upload"][];
3828
3877
  /**
@@ -3871,7 +3920,7 @@ interface components {
3871
3920
  text?: string;
3872
3921
  /** @description Only the networks that have a title field use it. */
3873
3922
  title?: string;
3874
- /** @description Link to the publication on the network, when there is one. */
3923
+ /** @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
3924
  url?: string;
3876
3925
  };
3877
3926
  /** @description Body accepted when creating or updating a publication. Only these properties are read; anything else in the payload is ignored. */
@@ -3896,13 +3945,17 @@ interface components {
3896
3945
  * 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
3946
  * @enum {string}
3898
3947
  */
3899
- social_network?: "facebook" | "instagram" | "twitter" | "linkedin" | "tiktok" | "whatsapp" | "youtube" | "bluesky" | "discord";
3948
+ social_network?: "facebook" | "instagram" | "twitter" | "linkedin" | "tiktok" | "whatsapp" | "youtube" | "bluesky" | "discord" | "telegram";
3900
3949
  /**
3901
3950
  * @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
3951
  * @enum {string}
3903
3952
  */
3904
3953
  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. */
3954
+ /**
3955
+ * @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.
3956
+ *
3957
+ * **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`.
3958
+ */
3906
3959
  text?: string;
3907
3960
  /** @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
3961
  title?: string;
@@ -4003,6 +4056,8 @@ interface components {
4003
4056
  * 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
4057
  *
4005
4058
  * On `bluesky` there are no impressions and no reach either — only the public counters — so engagement is computed over followers.
4059
+ *
4060
+ * 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
4061
  */
4007
4062
  PublicationStats: {
4008
4063
  angers?: number;
@@ -4033,6 +4088,12 @@ interface components {
4033
4088
  profile_visits?: number;
4034
4089
  quotes?: number;
4035
4090
  reach?: number;
4091
+ /** @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`. */
4092
+ reactions?: number;
4093
+ /** @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. */
4094
+ reactions_by_emoji?: {
4095
+ [key: string]: number;
4096
+ };
4036
4097
  replys?: number;
4037
4098
  retwets?: number;
4038
4099
  saved?: number;
@@ -4081,7 +4142,7 @@ interface components {
4081
4142
  * **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
4143
  * @enum {string}
4083
4144
  */
4084
- SocialNetwork: "facebook" | "instagram" | "linkedin" | "tiktok" | "twitter" | "whatsapp" | "youtube" | "google_business" | "bluesky" | "discord";
4145
+ SocialNetwork: "facebook" | "instagram" | "linkedin" | "tiktok" | "twitter" | "whatsapp" | "youtube" | "google_business" | "bluesky" | "discord" | "telegram";
4085
4146
  /** @description Statistics collection settings. Only `auto_refresh_twitter` is read; any other key is ignored. */
4086
4147
  StatsSettings: {
4087
4148
  /**
@@ -4165,6 +4226,9 @@ interface components {
4165
4226
  * | `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
4227
  * | `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
4228
  * | `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. |
4229
+ * | `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`. |
4230
+ * | `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`. |
4231
+ * | `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
4232
  * | `1101` | Invalid organization. |
4169
4233
  * | `1501` | The comment's account could not be resolved. |
4170
4234
  */
@@ -6286,6 +6350,7 @@ interface operations {
6286
6350
  * | `519` | This endpoint does not accept app credentials |
6287
6351
  * | `543` | This temporal connect token has already connected an account. Issue a new one |
6288
6352
  * | `544` | This temporal connect token was issued for a different social network |
6353
+ * | `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
6354
  * | `1101` | Invalid organization, or a temporal token for a different one |
6290
6355
  */
6291
6356
  400: {
@@ -8872,6 +8937,8 @@ interface operations {
8872
8937
  * | `917` | Publication doesn't exists |
8873
8938
  * | `935` | Invalid publication |
8874
8939
  * | `940` | X (Twitter) credits exhausted. Deleting the tweet on X could not be charged. Response data: { used, limit }. |
8940
+ * | `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 }. |
8941
+ * | `969` | The PlanVortex bot is not allowed to delete messages in that Telegram chat. Response data: { chat_id }. |
8875
8942
  * | `523` | Invalid application |
8876
8943
  */
8877
8944
  400: {
@@ -10436,7 +10503,8 @@ interface operations {
10436
10503
  * "youtube",
10437
10504
  * "google_business",
10438
10505
  * "bluesky",
10439
- * "discord"
10506
+ * "discord",
10507
+ * "telegram"
10440
10508
  * ]
10441
10509
  */
10442
10510
  "application/json": components["schemas"]["SocialNetwork"][];
@@ -10599,8 +10667,9 @@ type FileFormat = OpenEnum<Schemas["Upload"]["file_format"]>;
10599
10667
  * Sobre que se divide el engagement de una publicacion.
10600
10668
  *
10601
10669
  * 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.
10670
+ * `followers` (que es lo unico que hay en Bluesky, en Discord y en Telegram — la Bot API no
10671
+ * publica impresiones, ni alcance, ni siquiera las vistas de un post). **Dos filas con base
10672
+ * distinta no son comparables**: si las pones en la misma tabla, di cual es.
10604
10673
  */
10605
10674
  type EngagementBase = OpenEnum<NonNullable<Schemas["PublicationsPublicationStatsPoint"]["engagement_base"]>>;
10606
10675
  /**
@@ -10608,11 +10677,20 @@ type EngagementBase = OpenEnum<NonNullable<Schemas["PublicationsPublicationStats
10608
10677
  *
10609
10678
  * Los publica el servidor, que es quien los valida. Bluesky lleva **dos** cuentas distintas del
10610
10679
  * 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
10680
+ * miente en las dos direcciones. Telegram lleva **dos numeros para el mismo campo**, y ese si se
10681
+ * cuenta con `.length`: `characters.telegram` (4.096) mientras la publicacion es solo texto y
10682
+ * `characters.telegram_media` (1.024) en cuanto lleva imagen o video, porque entonces el texto es
10683
+ * el pie de un medio y no un mensaje. Un `0` en `max_post_bytes`, `comment_characters` o
10612
10684
  * `title_characters` significa "esta red no mide eso", no "cero".
10613
10685
  */
10614
10686
  type SocialLimits = Schemas["CatalogSocialLimits"];
10615
- /** Un numero por red, con TODAS las redes presentes. Lo obliga el conformance del servidor. */
10687
+ /**
10688
+ * Un numero por red, con TODAS las redes presentes. Lo obliga el conformance del servidor.
10689
+ *
10690
+ * **Y alguna clave no es una red**: cuando el tope depende del TIPO de publicacion y no solo de la
10691
+ * red, aparece una clave compuesta al lado de la simple —`instagram_story`, `facebook_reel`,
10692
+ * `telegram_media`—. Lee la simple por defecto y la compuesta cuando toque.
10693
+ */
10616
10694
  type SocialLimitsMap = Schemas["CatalogSocialLimitsMap"];
10617
10695
  /** Los recortes que acepta una red, como numero y como se escribe. Indices paralelos. */
10618
10696
  type AspectRatios = Schemas["CatalogAspectRatios"];
@@ -10631,8 +10709,13 @@ type SocialCapabilities = Schemas["CommentsSocialCapabilities"];
10631
10709
  * Que se puede hacer con los comentarios de una red, una a una.
10632
10710
  *
10633
10711
  * 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.
10712
+ * otro, LinkedIn no tiene "ocultar" —ni Discord ni Telegram tampoco— y Google Business solo deja
10713
+ * borrar **nuestra propia** respuesta. Se pide en `GET /social_comment_actions`, y es lo que
10714
+ * decide que botones se pintan.
10715
+ *
10716
+ * OJO: es de la RED, no de una cuenta suya. Un canal de Telegram sin grupo de debate contesta 965
10717
+ * en sus comentarios aunque la red los tenga, y borrar alli necesita ademas que el bot sea
10718
+ * administrador de ese grupo (error 969 si no).
10636
10719
  */
10637
10720
  type CommentActions = Schemas["CommentsCommentActions"];
10638
10721
  /**
@@ -10680,9 +10763,14 @@ type ClientWithOrganizations = Operations["getClientsWithOrganizations"]["respon
10680
10763
  /**
10681
10764
  * Una cuenta social conectada a una organizacion.
10682
10765
  *
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.
10766
+ * En Discord y en Telegram una cuenta es un **canal**, no un perfil: publicar en dos canales del
10767
+ * mismo servidor —o en dos canales de la misma marca— gasta dos cuentas del plan. `error_code`
10768
+ * distinto de 0 significa que la conexion se rompio —token caducado, permisos retirados— y hay que
10769
+ * reconectarla; en Telegram no caduca nada, porque no hay token de cuenta, y lo que la rompe es que
10770
+ * saquen al bot del canal o le quiten el permiso de publicar (error 968).
10771
+ *
10772
+ * Y un canal de Telegram **privado** no trae `username`: solo los publicos tienen `@nombre`, que es
10773
+ * tambien por lo que sus publicaciones vuelven sin `url`.
10686
10774
  */
10687
10775
  type Account = Override<Schemas["Account"], {
10688
10776
  social_network: SocialNetwork;
@@ -10712,16 +10800,35 @@ type ConnectToken = Operations["createTemporalConnectToken"]["responses"][200]["
10712
10800
  * Como se conecta UNA red. Casi siempre es un enlace: se manda al usuario ahi y la red lo devuelve
10713
10801
  * al panel de PlanVortex, que es quien completa la conexion.
10714
10802
  *
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`.
10803
+ * **Casi. Mira `authorization.type` y no si `link` esta vacio.** Hay DOS excepciones, y ninguna de
10804
+ * las dos falla de forma visible si se tratan como una redireccion:
10805
+ *
10806
+ * - **WhatsApp no tiene URL de autorizacion.** Su alta es el Embedded Signup de Meta, un popup que
10807
+ * levanta el SDK de JavaScript de Facebook desde tu pagina y que devuelve por `postMessage`
10808
+ * datos —el `waba_id`, el `phone_number_id`— que no caben en una query string. Su `link` es
10809
+ * cadena vacia y los parametros del popup (`app_id`, `config_id`, `graph_version`...) viajan en
10810
+ * `authorization`.
10811
+ * - **Telegram tiene enlace y aun asi no es una redireccion.** Ese `link` abre un chat con el bot
10812
+ * de PlanVortex, y de ahi no vuelve nadie: no hay OAuth, no hay `code` y no hay `redirect_uri`.
10813
+ * La cuenta nace minutos despues, cuando la persona mete el bot en su canal, y se anuncia por el
10814
+ * WebSocket. Abrelo en otra pestana y sigue escuchando; redirige a el y no queda a quien avisar.
10720
10815
  */
10721
10816
  type ConnectLink = Schemas["AccountsSocialLinksList"]["links"][number];
10722
10817
  /**
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`.
10818
+ * Con que se autoriza una red: `redirect` (nueve de las once), `meta_embedded_signup` (WhatsApp) o
10819
+ * `telegram_bot` (Telegram). Se saca de {@link ConnectLink} y esta aqui para poder nombrarlo en un
10820
+ * `switch`.
10821
+ *
10822
+ * **Es una union disfrazada de un solo tipo**: OpenAPI no sabe decir "estos campos solo cuando
10823
+ * `type` vale tal", asi que todos llegan opcionales y hay que ramificar por `type` antes de
10824
+ * leerlos. En `telegram_bot` los dos que vienen son `bot_username` —el `@nombre` del bot, sin la
10825
+ * arroba— y `add_to_group_link`, que es el SEGUNDO paso y no se deduce del primero: `link` abre la
10826
+ * lista de canales y este la de grupos, y es el que enciende los comentarios metiendo al bot en el
10827
+ * grupo de debate del canal. Ese paso es opcional para el usuario —publicar y medir funcionan sin
10828
+ * el—, pero sin darlo el canal no tiene bandeja (error 965).
10829
+ *
10830
+ * Y **la lista crece**: un `type` que esta version no conozca se salta, que es una respuesta
10831
+ * honesta. Mandar a alguien a un `link` porque el `if/else` no cubria su caso, no.
10725
10832
  */
10726
10833
  type SocialAuthorizationMethod = ConnectLink["authorization"];
10727
10834
  /**
@@ -10772,6 +10879,11 @@ type FileProperties = Schemas["FileProperties"];
10772
10879
  *
10773
10880
  * Si `state` es `withErrors`, el motivo esta en `publication_errors` —que es un ARRAY— y su `code`
10774
10881
  * es un codigo del catalogo de PlanVortex, nunca un status HTTP.
10882
+ *
10883
+ * Y OJO EN TELEGRAM: un album es UNA publicacion que son VARIOS mensajes. `external_identifier` es
10884
+ * el primero y el resto viajan en `extra_data.telegram_message_ids`, que es el unico sitio donde
10885
+ * hoy escribe nadie ese campo. En un canal privado ademas no hay `url`, porque no hay `@nombre` que
10886
+ * poner en ella, y eso no significa que la publicacion fallara.
10775
10887
  */
10776
10888
  type Publication = Override<Schemas["Publication"], {
10777
10889
  social_network: SocialNetwork;
@@ -10801,7 +10913,14 @@ type PublicationInput = Override<Schemas["PublicationsPublicationInput"], {
10801
10913
  publication_type: PublicationType;
10802
10914
  publish_date: string | Date;
10803
10915
  }>;
10804
- /** El desglose crudo de metricas que da la red, que no es el mismo en dos redes cualesquiera. */
10916
+ /**
10917
+ * El desglose crudo de metricas que da la red, que no es el mismo en dos redes cualesquiera.
10918
+ *
10919
+ * En Telegram son dos, y **ninguna de las dos se pide**: la Bot API no tiene ningun metodo que
10920
+ * devuelva las metricas de un mensaje. `reactions` llega sola por el bot —y es el ESTADO COMPLETO,
10921
+ * no un incremento, asi que baja cuando alguien retira la suya—, y `comments` se cuenta en la
10922
+ * bandeja de PlanVortex. No hay impresiones, ni alcance, ni vistas, ni reenvios en ninguna parte.
10923
+ */
10805
10924
  type PublicationStats = Schemas["PublicationStats"];
10806
10925
  /** Las metricas comparables entre redes: las que se pueden sumar en una grafica. */
10807
10926
  type PublicationMetrics = Schemas["NormalizedMetrics"];
@@ -10831,7 +10950,14 @@ type PublicationStatsPoint = Override<Schemas["PublicationsPublicationStatsPoint
10831
10950
  * asi que se pinta el `rating` al lado en vez de dar la fila por rota.
10832
10951
  *
10833
10952
  * De lo nuestro solo son `read` y `replied`. Todo lo demas lo manda la red, y una lectura en vivo
10834
- * pisa lo guardado.
10953
+ * pisa lo guardado — menos en Telegram, que no tiene lectura en vivo (§ {@link
10954
+ * CommentsResource.thread}).
10955
+ *
10956
+ * Y `external_id` **es opaco**: no siempre es el identificador de la red a secas. Una respuesta de
10957
+ * Google Business no tiene identificador propio —es un CAMPO de la resena— y viaja como
10958
+ * `{reviewId}/reply`; un comentario de Telegram vive en OTRO chat que el post que contesta (el
10959
+ * grupo de debate del canal), asi que necesita dos identificadores a la vez y viaja como
10960
+ * `{thread}/{message}`. No lo partas: pasalo tal cual.
10835
10961
  */
10836
10962
  type Comment = Override<Schemas["CommentsComment"], {
10837
10963
  social_network: CommentNetwork;