planvortex 0.22.0 → 0.23.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.
@@ -1083,7 +1083,9 @@ interface paths {
1083
1083
  * Messages exchanged with one contact
1084
1084
  * @description The thread with one contact, newest first.
1085
1085
  *
1086
- * **Reading the first page marks the thread as read** (`offset=0` only), which is what makes `unread_messages` go down. If PlanVortex has nothing stored for that contact it imports the thread from the network first.
1086
+ * **Reading the first page marks the thread as read in PlanVortex** (`offset=0` only), which is what makes `unread_messages` go down. **It does not tell the network**, so the contact still sees their messages as unread (grey ticks on WhatsApp, no "Seen" on Messenger or Instagram). That is on purpose: an assistant or an automation that reads the inbox should not tell your customers that somebody saw their message. When a person has seen it, call `POST .../messages/{id_contact}/read`.
1087
+ *
1088
+ * If PlanVortex has nothing stored for that contact it imports the thread from the network first.
1087
1089
  */
1088
1090
  get: operations["getMessages"];
1089
1091
  put?: never;
@@ -1091,6 +1093,8 @@ interface paths {
1091
1093
  * Send a message to a contact
1092
1094
  * @description Writes to the contact through the account's network.
1093
1095
  *
1096
+ * **Replying also marks the contact's messages as read on the network**, just before sending, so they see the blue ticks (WhatsApp) or "Seen" (Messenger, Instagram) and then your reply. If marking fails, the message is sent anyway.
1097
+ *
1094
1098
  * What is valid depends on `message_type` and on the network:
1095
1099
  *
1096
1100
  * • `simple_message` needs `text`, and it is validated against `characters` in `GET /social_limits`.
@@ -1107,6 +1111,34 @@ interface paths {
1107
1111
  patch?: never;
1108
1112
  trace?: never;
1109
1113
  };
1114
+ "/organizations/{id_organization}/accounts/{id_account}/messages/{id_contact}/read": {
1115
+ parameters: {
1116
+ query?: never;
1117
+ header?: never;
1118
+ path?: never;
1119
+ cookie?: never;
1120
+ };
1121
+ get?: never;
1122
+ put?: never;
1123
+ /**
1124
+ * Mark a conversation as read, on the network too
1125
+ * @description Marks the thread with this contact as read in PlanVortex, as reading its first page does, **and tells the network, so the contact sees it**: blue ticks on WhatsApp, "Seen" on Messenger and Instagram, and the conversation marked read in the Bluesky app.
1126
+ *
1127
+ * Call it when a person has actually seen the conversation. Reading messages with `GET` never does this, and replying with `POST .../messages/{id_contact}` does it on its own.
1128
+ *
1129
+ * • It marks the contact's **latest** message; the network marks everything before it.
1130
+ * • Calling it again is free: once the network has the latest message as read, no request goes to the network until the contact writes again.
1131
+ * • `network_read` says whether the network has the conversation as read when the call ends. It is `false` when the network has no read receipts, when the network refused the request (calling again retries it), or on WhatsApp when the latest message is more than 30 days old, which WhatsApp does not let anyone mark. The read state in PlanVortex is updated either way.
1132
+ *
1133
+ * Requires `messages:read` (`client_organization_messages:read` for apps), the same as reading the conversation, and a paid plan like the rest of messaging. On a network without conversations it answers error 1502.
1134
+ */
1135
+ post: operations["markConversationRead"];
1136
+ delete?: never;
1137
+ options?: never;
1138
+ head?: never;
1139
+ patch?: never;
1140
+ trace?: never;
1141
+ };
1110
1142
  "/organizations/{id_organization}/accounts/{id_account}/messages/{id_message}/files/{index}": {
1111
1143
  parameters: {
1112
1144
  query?: never;
@@ -1406,7 +1438,7 @@ interface paths {
1406
1438
  * The inbox: first-level comments across the whole organization
1407
1439
  * @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.
1408
1440
  *
1409
- * Ordered by `creation_date` descending — the date on the network, not the date we collected it — so rows from ten networks interleave correctly.
1441
+ * Ordered by `creation_date` descending — the date on the network, not the date we collected it — so rows from every network interleave correctly.
1410
1442
  *
1411
1443
  * **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.
1412
1444
  *
@@ -1436,7 +1468,7 @@ interface paths {
1436
1468
  * @description Two different kinds of change, accepted together because a panel changes them from the same place:
1437
1469
  *
1438
1470
  * - `read` is **yours**. It touches no social network, costs nothing and can always be set.
1439
- * - `hidden` **touches the network**, and not every network allows it — LinkedIn and Google Business have no hide endpoint at all and return error `946`. Check `GET /social_comment_actions` before offering the control.
1471
+ * - `hidden` **touches the network**, and not every network allows it — LinkedIn and Google Business have no hide endpoint at all and return error `946`. Check `GET /social_comment_actions` before offering the control. Hiding is moderating what **others** write: your own comments cannot be hidden on any network (error `2603`), only deleted. On TikTok, showing a comment that TikTok's moderation or its author's privacy settings keep hidden does not work, and the answer is error `2809`.
1440
1472
  *
1441
1473
  * Setting `read` requires the `comments:read` permission (`client_organization_comments:read` for apps): marking a comment read is part of reading it, as opening a conversation is in the chat. Setting `hidden` also requires `comments:create` (`client_organization_comments:create`), the same as replying, and without it the whole request is refused with `520` and nothing changes, `read` included. Both need a paid plan.
1442
1474
  */
@@ -1446,7 +1478,7 @@ interface paths {
1446
1478
  * Delete the comment on the social network
1447
1479
  * @description Deletes it **on the network** and marks the row `deleted: true` here. The row is kept on purpose rather than removed: if it were removed, the next read of the thread — or the webhook, which repeats — would create it again.
1448
1480
  *
1449
- * Which comments you may delete depends on the network and on whose comment it is, and the two cases use different permissions of the network's own: `delete_own` for yours, `delete_others` for somebody else's. Instagram and X refuse the second; **on Google Business the only thing that can be deleted is your own reply**, never a review. Reading `GET /social_comment_actions` first is the difference between a button that works and one that always errors.
1481
+ * Which comments you may delete depends on the network and on whose comment it is, and the two cases use different permissions of the network's own: `delete_own` for yours, `delete_others` for somebody else's. Instagram, X and TikTok refuse the second; **on Google Business the only thing that can be deleted is your own reply**, never a review. Reading `GET /social_comment_actions` first is the difference between a button that works and one that always errors.
1450
1482
  *
1451
1483
  * On X this costs credits.
1452
1484
  *
@@ -2668,7 +2700,7 @@ interface paths {
2668
2700
  *
2669
2701
  * `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.
2670
2702
  *
2671
- * Today ten networks answer `comments: true`: Facebook, Instagram, Threads, LinkedIn, X, YouTube, Google Business, Bluesky, Discord and Telegram. TikTok, WhatsApp, Slack and Pinterest answer `false`, for reasons of theirs and not ours — on Pinterest the API *counts* a pin's comments and offers no way to read them, so the figure shows up in the publication's statistics and there is still no inbox.
2703
+ * Today `comments: true` is the answer of Facebook, Instagram, Threads, LinkedIn, TikTok, X, YouTube, Google Business, Bluesky, Discord and Telegram. WhatsApp, Slack and Pinterest answer `false`, for reasons of theirs and not ours — on Pinterest the API *counts* a pin's comments and offers no way to read them, so the figure shows up in the publication's statistics and there is still no inbox.
2672
2704
  *
2673
2705
  * **Three of the keys are about publishing, not about reading.** `destinations` says the network publishes into places inside the account and every publication has to name one — a Pinterest board, read with `GET /organizations/{id_organization}/accounts/{id_account}/destinations`. `link` says a publication carries a destination link of its own, separate from its text. Both are `false` everywhere but `pinterest` today. `reply_control` says a publication can choose who can reply to it, and is `true` only on `threads`. The three are the reason to ask this matrix instead of keeping a list of your own: a composer with its own copy of which network has which field is exactly what drifted with the character limits.
2674
2706
  *
@@ -2676,7 +2708,7 @@ interface paths {
2676
2708
  *
2677
2709
  * **`statistics` says whether PlanVortex reads any metric of that network.** It is `true` on every network but `whatsapp`, which does not publish and has no metrics to read. Use it to decide which accounts to offer on a statistics screen (or filter the account list with `capability=statistics`) instead of finding out from an empty series.
2678
2710
  *
2679
- * 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.
2711
+ * 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, and a TikTok account answers 2600 until comments are turned on for it in the dashboard.
2680
2712
  *
2681
2713
  * Only needs authentication.
2682
2714
  */
@@ -2714,7 +2746,8 @@ interface paths {
2714
2746
  * | `discord` | yes | **no** — Discord has no hide, only delete | yes | yes |
2715
2747
  * | `telegram` | yes | **no** — Telegram has no hide either | yes | yes — with the bot as an admin of the discussion group, otherwise error 969 |
2716
2748
  * | `threads` | yes | yes | yes | **no** — deleting somebody else's reply is not a permission you lack, it is a call that does not exist in the API |
2717
- * | `tiktok`, `whatsapp` | no | no | no | no |
2749
+ * | `tiktok` | yes | yes | yes | **no** — TikTok only lets you hide someone else's |
2750
+ * | `whatsapp`, `slack`, `pinterest` | no | no | no | no |
2718
2751
  *
2719
2752
  * Only needs authentication.
2720
2753
  */
@@ -2800,7 +2833,7 @@ interface webhooks {
2800
2833
  *
2801
2834
  * `field: "comments"` is the one for this section, and the comment itself travels in **`commentObj`** — a property of its own, never in `messageObj`. That is deliberate: a comment is not a message, it has no contact and it hangs off a publication. A consumer that only understands messages sees `commentObj` as absent and ignores the change, which is exactly what should happen.
2802
2835
  *
2803
- * **Which networks arrive this way:** Facebook and Instagram, because Meta pushes them. YouTube, LinkedIn and Google Business have no comment webhook, so those are polled by a background job and appear in the inbox within a few hours rather than instantly. X is polled too, and only when the organization turns it on, because reading replies there is billed per unit.
2836
+ * **Which networks arrive this way:** Facebook and Instagram, because Meta pushes them, and TikTok, which pushes them within a few minutes. YouTube, LinkedIn and Google Business have no comment webhook, so those are polled by a background job and appear in the inbox within a few hours rather than instantly. X is polled too, and only when the organization turns it on, because reading replies there is billed per unit.
2804
2837
  *
2805
2838
  * **Meta repeats deliveries.** The same comment can arrive more than once; the backend is idempotent about it and so should you be — deduplicate on `commentObj.external_id`.
2806
2839
  *
@@ -2846,6 +2879,8 @@ interface components {
2846
2879
  *
2847
2880
  * On `linkedin` one authorization brings two kinds of account: the **personal profile** of whoever authorizes and each **page** they manage. Both publish and both have statistics, but only pages have a comment inbox: LinkedIn does not let any app read the comments on a member's posts, so on a profile every comment endpoint returns error `2600`. `extra_data.is_personal_profile` tells them apart.
2848
2881
  *
2882
+ * On `tiktok` comments need a second authorization of the same account (TikTok API for Business, personal and Business accounts alike), turned on from the PlanVortex dashboard. Until then the account publishes and has statistics, and every comment endpoint returns error `2600`. `extra_data.tiktok_business` says whether comments are on.
2883
+ *
2849
2884
  * `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). On `slack` the bot token does not expire either: what breaks it is the app being removed from the channel (error 980) or the channel being archived or deleted (error 985).
2850
2885
  */
2851
2886
  Account: {
@@ -2858,6 +2893,23 @@ interface components {
2858
2893
  extra_data?: {
2859
2894
  /** @description `linkedin` only. `true` on the personal profile of whoever authorized, `false` on a page. A profile publishes and has statistics but no comment inbox (error `2600`). Pages connected before personal profiles existed do not carry it, so treat absent as a page. */
2860
2895
  is_personal_profile?: boolean;
2896
+ /** @description `tiktok` only, and only once somebody has turned comments on for this account in the PlanVortex dashboard. Absent means comments were never turned on: the account publishes, and every comment endpoint answers `2600`. It cannot be turned on through the API, because TikTok sends that authorization back to the dashboard and nowhere else. */
2897
+ tiktok_business?: {
2898
+ /** @description `true` when the comment inbox works for this account. Read it together with `error_code`. */
2899
+ comments?: boolean;
2900
+ /**
2901
+ * Format: date-time
2902
+ * @description When comments were turned on.
2903
+ */
2904
+ connected_at?: string;
2905
+ display_name?: string;
2906
+ /** @description Absent or `0` when it works. `2804` when TikTok no longer accepts the authorization behind comments: they have to be turned on again in the dashboard. It never touches the account's own `error_code`, so publishing keeps working. */
2907
+ error_code?: number;
2908
+ /** @description TikTok direct messages. Always `false` today. */
2909
+ messages?: boolean;
2910
+ /** @description The TikTok @username that authorized, already checked against this account's. Comments are only turned on for the same account that publishes. */
2911
+ username?: string;
2912
+ };
2861
2913
  } & {
2862
2914
  [key: string]: unknown;
2863
2915
  };
@@ -3854,6 +3906,7 @@ interface components {
3854
3906
  *
3855
3907
  * • 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`.
3856
3908
  * • 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.
3909
+ * • A TikTok comment travels as `{video_id}/{comment_id}`, because TikTok asks for the video to hide a comment or to reply to it.
3857
3910
  */
3858
3911
  external_id: string;
3859
3912
  /**
@@ -3862,7 +3915,11 @@ interface components {
3862
3915
  * Facebook, Threads, LinkedIn, X, Bluesky, Discord and Telegram give a comment's files, and on Google Business they are the photos and videos of a review. Instagram and YouTube do not expose them in their APIs, so there the list is always empty. A comment that is only a photo has an empty `text` and one file here.
3863
3916
  */
3864
3917
  files_urls?: components["schemas"]["SocialFileUrl"][];
3865
- /** @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. */
3918
+ /**
3919
+ * @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.
3920
+ *
3921
+ * On TikTok every new comment is hidden for a few minutes while TikTok reviews it. That state is not reported here: during a comment's first ten minutes this keeps the value it already had.
3922
+ */
3866
3923
  hidden: boolean;
3867
3924
  /**
3868
3925
  * @description The connected account it arrived on.
@@ -3925,7 +3982,7 @@ interface components {
3925
3982
  * @description A network that has comments. Treat it as an open list: a new one is added before your integration hears about it.
3926
3983
  * @enum {string}
3927
3984
  */
3928
- CommentsCommentNetworkName: "facebook" | "instagram" | "twitter" | "linkedin" | "youtube" | "google_business" | "bluesky" | "discord" | "telegram" | "threads";
3985
+ CommentsCommentNetworkName: "facebook" | "instagram" | "twitter" | "linkedin" | "youtube" | "tiktok" | "google_business" | "bluesky" | "discord" | "telegram" | "threads";
3929
3986
  /** @description A live read: asked of the network and reconciled with what was stored. */
3930
3987
  CommentsCommentThread: {
3931
3988
  comments: components["schemas"]["CommentsComment"][];
@@ -4337,7 +4394,7 @@ interface components {
4337
4394
  * The catalogue grows with the product, so treat an unknown `code` as a generic failure instead of rejecting it.
4338
4395
  */
4339
4396
  Error: {
4340
- /** @description PlanVortex error code. Ranges: 500-554 auth, tokens, client apps and connect sessions · 601-612 user · 700-716 social accounts · 800-810 files · 900-996 publications · 1000-1003 general · 1100-1111 organizations · 1200-1207 roles · 1300-1309 client plan · 1400-1408 organization plan · 1500-1517 messaging · 1600-1601 contacts · 1900-1906 payments · 2000-2099 products · 2100-2199 AI plans · 2200-2299 integrations · 2500-2599 publication fields, the ones that no longer fit in 900-996 (visibility, made for kids, TikTok's interactions and commercial content) · 2600-2699 comments, the ones that no longer fit in 945-948. */
4397
+ /** @description PlanVortex error code. Ranges: 500-554 auth, tokens, client apps and connect sessions · 601-612 user · 700-716 social accounts · 800-810 files · 900-996 publications · 1000-1003 general · 1100-1111 organizations · 1200-1207 roles · 1300-1309 client plan · 1400-1408 organization plan · 1500-1517 messaging · 1600-1601 contacts · 1900-1906 payments · 2000-2099 products · 2100-2199 AI plans · 2200-2299 integrations · 2500-2599 publication fields, the ones that no longer fit in 900-996 (visibility, made for kids, TikTok's interactions and commercial content) · 2600-2699 comments, the ones that no longer fit in 945-948 · 2700-2799 Discord · 2800-2899 TikTok comments, the ones that go through TikTok API for Business. */
4341
4398
  code: number;
4342
4399
  /** @description Extra context attached to the error, when there is any. */
4343
4400
  data?: {
@@ -4670,6 +4727,18 @@ interface components {
4670
4727
  /** @description Unread messages **from the contact**. Ours never count. */
4671
4728
  unread_messages: number;
4672
4729
  };
4730
+ /**
4731
+ * @example {
4732
+ * "success": true,
4733
+ * "network_read": true
4734
+ * }
4735
+ */
4736
+ MessagesConversationRead: {
4737
+ /** @description Whether the contact now sees the conversation as read on the network. `false` when the network has no read receipts, refused the request (call again to retry), or the latest WhatsApp message is older than 30 days. */
4738
+ network_read: boolean;
4739
+ /** @constant */
4740
+ success: true;
4741
+ };
4673
4742
  /** @description Two different answers, not one with optional fields: **without** `group_by` you get `{total}`, **with** it you get `{stats, group}`. Never both. */
4674
4743
  MessagesConversationTotals: {
4675
4744
  /** @description Conversations in the range. A conversation is one contact on one day, so the same person writing on Monday and on Tuesday counts twice. */
@@ -5616,8 +5685,8 @@ interface components {
5616
5685
  * | `700` | The account is not connected — no valid token, or nothing to ask the network about. |
5617
5686
  * | `936` | The publication was never sent, so it has no thread to read. |
5618
5687
  * | `940` | The client's monthly X credits are exhausted. Only X. |
5619
- * | `945` | This network has no comments (TikTok, WhatsApp). Carries `social_network` in `data`. |
5620
- * | `946` | The network has comments but does not allow **this action**: hiding on LinkedIn or Google Business, deleting someone else's on Instagram or X, deleting a review. Carries `social_network` and `action` in `data`. See `GET /social_comment_actions`. |
5688
+ * | `945` | This network has no comments (WhatsApp, Slack, Pinterest). Carries `social_network` in `data`. |
5689
+ * | `946` | The network has comments but does not allow **this action**: hiding on LinkedIn or Google Business, deleting someone else's on Instagram, X or TikTok, deleting a review. Carries `social_network` and `action` in `data`. See `GET /social_comment_actions`. |
5621
5690
  * | `947` | The comment no longer exists on the network. What is stored is a photograph; the network always wins. Carries `external_id` in `data`. |
5622
5691
  * | `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`. |
5623
5692
  * | `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. |
@@ -5627,7 +5696,12 @@ interface components {
5627
5696
  * | `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. |
5628
5697
  * | `1101` | Invalid organization. |
5629
5698
  * | `1501` | The comment's account could not be resolved. |
5630
- * | `2600` | The network has comments but **this account** has none: a LinkedIn personal profile. LinkedIn does not let any app read a member's comments, so only pages have an inbox. Carries `social_network` and `id_account` in `data`. |
5699
+ * | `2600` | The network has comments but **this account** has none: a LinkedIn personal profile (LinkedIn does not let any app read a member's comments, so only pages have an inbox), or a TikTok account whose comments have not been turned on in the dashboard. Carries `social_network` and `id_account` in `data`. |
5700
+ * | `2601` | The network refused the action on the comment: a permission the app lacks, a comment that does not accept replies, an account that lost its access. |
5701
+ * | `2603` | Hiding or showing one of **your own** comments. No network allows it: delete it instead. |
5702
+ * | `2804` | TikTok: the authorization behind this account's comments expired or was revoked. Comments have to be turned on again in the dashboard; publishing is not affected. |
5703
+ * | `2805` | TikTok is rate limiting PlanVortex's app. Temporary: retry shortly. |
5704
+ * | `2809` | TikTok keeps this comment hidden (its moderation, or the privacy settings of whoever wrote it), so showing it had no effect. |
5631
5705
  */
5632
5706
  CommentsCommentError: {
5633
5707
  headers: {
@@ -7993,7 +8067,7 @@ interface operations {
7993
8067
  /**
7994
8068
  * @description Only accounts whose network can do this. It is the same matrix `GET /social_capabilities` publishes, applied server-side: the way to ask for 'the accounts I can publish with' without keeping your own table of which network does what.
7995
8069
  *
7996
- * `comments` also looks at each account, not only at its network: a LinkedIn **personal profile** is left out, because only LinkedIn pages have a comment inbox. `total` counts the same way.
8070
+ * `comments` also looks at each account, not only at its network: a LinkedIn **personal profile** is left out, because only LinkedIn pages have a comment inbox, and so is a TikTok account whose comments have not been turned on (or stopped working, `extra_data.tiktok_business.error_code`). `total` counts the same way.
7997
8071
  *
7998
8072
  * `statistics` leaves out the networks PlanVortex reads no metric from (today `whatsapp`): the accounts worth offering on a statistics screen.
7999
8073
  */
@@ -8744,6 +8818,34 @@ interface operations {
8744
8818
  400: components["responses"]["MessagesError"];
8745
8819
  };
8746
8820
  };
8821
+ markConversationRead: {
8822
+ parameters: {
8823
+ query?: never;
8824
+ header?: never;
8825
+ path: {
8826
+ /** @description Connected account identifier */
8827
+ id_account: components["parameters"]["MessagesidAccount"];
8828
+ /** @description Contact identifier */
8829
+ id_contact: components["parameters"]["MessagesidContact"];
8830
+ /** @description Organization identifier */
8831
+ id_organization: components["parameters"]["MessagesidOrganization"];
8832
+ };
8833
+ cookie?: never;
8834
+ };
8835
+ requestBody?: never;
8836
+ responses: {
8837
+ /** @description Marked as read in PlanVortex, and `network_read` says whether the network has it too */
8838
+ 200: {
8839
+ headers: {
8840
+ [name: string]: unknown;
8841
+ };
8842
+ content: {
8843
+ "application/json": components["schemas"]["MessagesConversationRead"];
8844
+ };
8845
+ };
8846
+ 400: components["responses"]["MessagesError"];
8847
+ };
8848
+ };
8747
8849
  getMessageFile: {
8748
8850
  parameters: {
8749
8851
  query?: {
@@ -13127,6 +13229,13 @@ type ClientWithOrganizations = Operations["getClientsWithOrganizations"]["respon
13127
13229
  * paginas tienen bandeja de comentarios: LinkedIn no deja a ninguna app leer los comentarios de un
13128
13230
  * perfil, y ahi todo `comments.*` devuelve el error 2600. Se distinguen por
13129
13231
  * `extra_data.is_personal_profile`; ausente es pagina (las conectadas antes de que hubiera perfiles).
13232
+ *
13233
+ * En TikTok los comentarios piden una segunda autorizacion de la misma cuenta (TikTok API for
13234
+ * Business, vale una cuenta personal o una Business), que se activa desde el panel de PlanVortex.
13235
+ * Hasta entonces la
13236
+ * cuenta publica y tiene estadisticas, y todo `comments.*` devuelve el 2600.
13237
+ * `extra_data.tiktok_business` dice si estan activos (`comments`) y lleva `error_code` 2804
13238
+ * cuando hay que volver a activarlos, sin tocar el `error_code` de la cuenta.
13130
13239
  */
13131
13240
  type Account = Override<Schemas["Account"], {
13132
13241
  social_network: SocialNetwork;
@@ -13466,6 +13575,15 @@ type Conversation = Override<Schemas["MessagesConversation"], {
13466
13575
  * 2026—, no una fecha. Con `group_by: "day"` dos anos del mismo rango caen en el mismo valor.
13467
13576
  */
13468
13577
  type ConversationTotals = Schemas["MessagesConversationTotals"];
13578
+ /**
13579
+ * Lo que devuelve marcar una conversacion como leida EN LA RED (`messages.markConversationRead`).
13580
+ *
13581
+ * `network_read` dice si, al terminar, la red la tiene por leida: el contacto ve los ticks azules
13582
+ * (WhatsApp) o el «Visto» (Messenger, Instagram). Es `false` si la red no tiene acuse de lectura,
13583
+ * si fallo (llamar otra vez lo reintenta) o, en WhatsApp, si el ultimo mensaje tiene mas de 30
13584
+ * dias. En PlanVortex queda leida de todas formas.
13585
+ */
13586
+ type ConversationRead = Schemas["MessagesConversationRead"];
13469
13587
  /**
13470
13588
  * Lo que se manda para escribir un mensaje.
13471
13589
  *
@@ -14402,4 +14520,4 @@ interface PlanVortexWebhooksOptions {
14402
14520
  */
14403
14521
  declare function planvortexWebhooks(options: PlanVortexWebhooksOptions): (request: WebhookRequestLike, response: WebhookResponseLike, next: (error?: unknown) => void) => void;
14404
14522
 
14405
- export { type Client as $, type Account as A, type Comment as B, type ConnectLink as C, type Destination as D, type EnableResult as E, type CommentThread as F, type CommentReplyResult as G, type ContactExtraData as H, type Contact as I, type ContactCreate as J, type ContactUpdate as K, type IntegrationProviderName as L, type MetricName as M, type IntegrationProvider as N, type Integration as O, type Paginated as P, type IntegrationConnectRequest as Q, type IntegrationUpdate as R, type SocialNetwork as S, type TopPublicationsResult as T, type IntegrationPickerConfig as U, type IntegrationCatalogPage as V, type MessageTemplate as W, type Conversation as X, type ConversationTotals as Y, type Message as Z, type MessageInput as _, type ConnectResult as a, type MessageType as a$, type Organization as a0, type AiSettings as a1, type ClientWithOrganizations as a2, type AccountSelection as a3, type PlanData as a4, type PlanUseData as a5, type ConnectToken as a6, type AiContext as a7, type SocialCredentialsInput as a8, type Product as a9, type AiPlanSourceProduct as aA, type AiPlanState as aB, type ApiErrorBody as aC, type AspectRatios as aD, AuthError as aE, type ClientPlan as aF, type CommentAuthor as aG, type CommentChange as aH, type ConnectSessionAccount as aI, type ContactChannel as aJ, ContactError as aK, type DashboardAiPlanRef as aL, type DashboardPublicationRef as aM, type DashboardRange as aN, type EngagementBase as aO, FileError as aP, type FileFormat as aQ, type FileProperties as aR, type FileType as aS, type IntegrationCatalogProduct as aT, type IntegrationConfig as aU, IntegrationError as aV, type IntegrationErrorChange as aW, type IntegrationFormField as aX, type MessageChange as aY, type MessageEchoChange as aZ, type MessageOptions as a_, type ProductInput as aa, type ProductCatalog as ab, type ProductCatalogInput as ac, type PublicationInput as ad, type PublicationState as ae, type PublicationStats as af, type PublicationStatsHistory as ag, type Upload as ah, AccountError as ai, type AccountMetricRow as aj, type AccountStateChange as ak, type AccountWebhookChangeBase as al, type AccountWithError as am, type AiImageOrigin as an, type AiPlanCostEstimate as ao, type AiPlanDestination as ap, AiPlanError as aq, type AiPlanNotice as ar, type AiPlanOptions as as, type AiPlanOptionsInput as at, type AiPlanResult as au, type AiPlanResultsGroup as av, type AiPlanResultsTemplateGroup as aw, type AiPlanSource as ax, type AiPlanSourceImageInput as ay, type AiPlanSourceInput as az, type ConnectSession as b, WEBHOOK_SIGNATURE_HEADERS as b$, MessagingError as b0, type MetricRow as b1, NO_ERROR_CODE as b2, type components as b3, type operations as b4, type paths as b5, type webhooks as b6, type OpenEnum as b7, OrganizationError as b8, PLANVORTEX_ERROR_RANGES as b9, type TopPublication as bA, type UnknownWebhookChange as bB, UserError as bC, type WebhookAlgorithm as bD, type WebhookChange as bE, type WebhookEvent as bF, type WithAccount as bG, type WithPublication as bH, type WooCommerceConnectRequest as bI, account as bJ, accountId as bK, errorFamilyForCode as bL, isPlanVortexError as bM, isTokenError as bN, messageContact as bO, messageContactId as bP, messageDirection as bQ, messageFileIds as bR, messageFiles as bS, publication as bT, publicationId as bU, type AiPlanChange as bV, type HandleWebhookRequestOptions as bW, type PlanVortexWebhooksOptions as bX, type RawWebhookBody as bY, type VerifyWebhookSignatureOptions as bZ, WEBHOOK_EVENTS as b_, PlanLimitError as ba, PlanVortexAuthenticationError as bb, PlanVortexConfigError as bc, PlanVortexConnectionError as bd, PlanVortexError as be, type PlanVortexErrorOptions as bf, type PlanVortexErrorRange as bg, type PlannerTemplateField as bh, type PlannerTemplateFieldType as bi, ProductError as bj, type PublicationAiGenerated as bk, type PublicationDestination as bl, PublicationError as bm, type PublicationErrorDetail as bn, type PublicationMetrics as bo, type PublicationPending as bp, type PublicationStatsPoint as bq, type PublicationType as br, type PublicationsSummary as bs, type RssConfig as bt, type SocialAuthorizationMethod as bu, type SocialCredentials as bv, type SocialIdentifier as bw, type SocialIdentifierInput as bx, type SocialLimitsMap as by, TOKEN_ERROR_CODES as bz, type AccountMetrics as c, WebhookBodyError as c0, type WebhookHeaders as c1, type WebhookRequestLike as c2, type WebhookResponseLike as c3, WebhookSignatureError as c4, handleWebhookRequest as c5, isAccountStateChange as c6, isAiPlanChange as c7, isCommentChange as c8, isIntegrationErrorChange as c9, isMessageChange as ca, isMessageEchoChange as cb, parseWebhookPayload as cc, planvortexWebhooks as cd, verifyWebhookSignature as ce, type PublishSettings as d, type PersistentMenu as e, type Dashboard as f, type DashboardMetricsResult as g, type PublicationsSummaryResult as h, type PublicationsStatsResult as i, type PlanUse as j, type Publication as k, type AiPlanResultsSort as l, type PlannerTemplateName as m, type AiPlanCreateRequest as n, type AiPlanCreateResult as o, type AiPlan as p, type AiPlanResults as q, type ClientApp as r, type ClientAppInput as s, type SocialCapabilities as t, type CommentActions as u, type SocialLimits as v, type PublicationLimits as w, type AspectRatiosByNetwork as x, type PlannerTemplate as y, type CommentNetwork as z };
14523
+ export { type ConversationRead as $, type Account as A, type Comment as B, type ConnectLink as C, type Destination as D, type EnableResult as E, type CommentThread as F, type CommentReplyResult as G, type ContactExtraData as H, type Contact as I, type ContactCreate as J, type ContactUpdate as K, type IntegrationProviderName as L, type MetricName as M, type IntegrationProvider as N, type Integration as O, type Paginated as P, type IntegrationConnectRequest as Q, type IntegrationUpdate as R, type SocialNetwork as S, type TopPublicationsResult as T, type IntegrationPickerConfig as U, type IntegrationCatalogPage as V, type MessageTemplate as W, type Conversation as X, type ConversationTotals as Y, type Message as Z, type MessageInput as _, type ConnectResult as a, type MessageOptions as a$, type Client as a0, type Organization as a1, type AiSettings as a2, type ClientWithOrganizations as a3, type AccountSelection as a4, type PlanData as a5, type PlanUseData as a6, type ConnectToken as a7, type AiContext as a8, type SocialCredentialsInput as a9, type AiPlanSourceInput as aA, type AiPlanSourceProduct as aB, type AiPlanState as aC, type ApiErrorBody as aD, type AspectRatios as aE, AuthError as aF, type ClientPlan as aG, type CommentAuthor as aH, type CommentChange as aI, type ConnectSessionAccount as aJ, type ContactChannel as aK, ContactError as aL, type DashboardAiPlanRef as aM, type DashboardPublicationRef as aN, type DashboardRange as aO, type EngagementBase as aP, FileError as aQ, type FileFormat as aR, type FileProperties as aS, type FileType as aT, type IntegrationCatalogProduct as aU, type IntegrationConfig as aV, IntegrationError as aW, type IntegrationErrorChange as aX, type IntegrationFormField as aY, type MessageChange as aZ, type MessageEchoChange as a_, type Product as aa, type ProductInput as ab, type ProductCatalog as ac, type ProductCatalogInput as ad, type PublicationInput as ae, type PublicationState as af, type PublicationStats as ag, type PublicationStatsHistory as ah, type Upload as ai, AccountError as aj, type AccountMetricRow as ak, type AccountStateChange as al, type AccountWebhookChangeBase as am, type AccountWithError as an, type AiImageOrigin as ao, type AiPlanCostEstimate as ap, type AiPlanDestination as aq, AiPlanError as ar, type AiPlanNotice as as, type AiPlanOptions as at, type AiPlanOptionsInput as au, type AiPlanResult as av, type AiPlanResultsGroup as aw, type AiPlanResultsTemplateGroup as ax, type AiPlanSource as ay, type AiPlanSourceImageInput as az, type ConnectSession as b, WEBHOOK_EVENTS as b$, type MessageType as b0, MessagingError as b1, type MetricRow as b2, NO_ERROR_CODE as b3, type components as b4, type operations as b5, type paths as b6, type webhooks as b7, type OpenEnum as b8, OrganizationError as b9, TOKEN_ERROR_CODES as bA, type TopPublication as bB, type UnknownWebhookChange as bC, UserError as bD, type WebhookAlgorithm as bE, type WebhookChange as bF, type WebhookEvent as bG, type WithAccount as bH, type WithPublication as bI, type WooCommerceConnectRequest as bJ, account as bK, accountId as bL, errorFamilyForCode as bM, isPlanVortexError as bN, isTokenError as bO, messageContact as bP, messageContactId as bQ, messageDirection as bR, messageFileIds as bS, messageFiles as bT, publication as bU, publicationId as bV, type AiPlanChange as bW, type HandleWebhookRequestOptions as bX, type PlanVortexWebhooksOptions as bY, type RawWebhookBody as bZ, type VerifyWebhookSignatureOptions as b_, PLANVORTEX_ERROR_RANGES as ba, PlanLimitError as bb, PlanVortexAuthenticationError as bc, PlanVortexConfigError as bd, PlanVortexConnectionError as be, PlanVortexError as bf, type PlanVortexErrorOptions as bg, type PlanVortexErrorRange as bh, type PlannerTemplateField as bi, type PlannerTemplateFieldType as bj, ProductError as bk, type PublicationAiGenerated as bl, type PublicationDestination as bm, PublicationError as bn, type PublicationErrorDetail as bo, type PublicationMetrics as bp, type PublicationPending as bq, type PublicationStatsPoint as br, type PublicationType as bs, type PublicationsSummary as bt, type RssConfig as bu, type SocialAuthorizationMethod as bv, type SocialCredentials as bw, type SocialIdentifier as bx, type SocialIdentifierInput as by, type SocialLimitsMap as bz, type AccountMetrics as c, WEBHOOK_SIGNATURE_HEADERS as c0, WebhookBodyError as c1, type WebhookHeaders as c2, type WebhookRequestLike as c3, type WebhookResponseLike as c4, WebhookSignatureError as c5, handleWebhookRequest as c6, isAccountStateChange as c7, isAiPlanChange as c8, isCommentChange as c9, isIntegrationErrorChange as ca, isMessageChange as cb, isMessageEchoChange as cc, parseWebhookPayload as cd, planvortexWebhooks as ce, verifyWebhookSignature as cf, type PublishSettings as d, type PersistentMenu as e, type Dashboard as f, type DashboardMetricsResult as g, type PublicationsSummaryResult as h, type PublicationsStatsResult as i, type PlanUse as j, type Publication as k, type AiPlanResultsSort as l, type PlannerTemplateName as m, type AiPlanCreateRequest as n, type AiPlanCreateResult as o, type AiPlan as p, type AiPlanResults as q, type ClientApp as r, type ClientAppInput as s, type SocialCapabilities as t, type CommentActions as u, type SocialLimits as v, type PublicationLimits as w, type AspectRatiosByNetwork as x, type PlannerTemplate as y, type CommentNetwork as z };
package/dist/index.cjs CHANGED
@@ -4,7 +4,7 @@ var path = require('path');
4
4
 
5
5
  // src/version.ts
6
6
  var PLANVORTEX_API_URL = "https://api.planvortex.com/v1.0.0";
7
- var VERSION = "0.22.0";
7
+ var VERSION = "0.23.0";
8
8
 
9
9
  // src/core/errors.ts
10
10
  var PLANVORTEX_ERROR_RANGES = [
@@ -49,7 +49,11 @@ var PLANVORTEX_ERROR_RANGES = [
49
49
  //exige la auditoría de TikTok). Casi todos viajan en `publication_errors`, pero el 2508 se
50
50
  //LANZA: `accounts.publishSettings()` en una red que no los tiene.
51
51
  { from: 2500, to: 2599, family: "publication" },
52
- { from: 2600, to: 2699, family: "publication" }
52
+ { from: 2600, to: 2699, family: "publication" },
53
+ //Los comentarios de TikTok, que van por otra API (TikTok API for Business) con su propia
54
+ //credencial: 2804 = hay que volver a activarlos, 2805 = TikTok frena a la app (temporal),
55
+ //2809 = TikTok mantiene oculto el comentario. Son comentarios, así que la misma familia.
56
+ { from: 2800, to: 2899, family: "publication" }
53
57
  ];
54
58
  var NO_ERROR_CODE = 0;
55
59
  var TOKEN_ERROR_CODES = [501, 522];
@@ -2135,8 +2139,10 @@ var MessagesResource = class extends Resource {
2135
2139
  /**
2136
2140
  * El hilo con un contacto, del más reciente al más antiguo.
2137
2141
  *
2138
- * **Pedir la primera página (`offset` 0 o sin `offset`) marca el hilo como leído.** Es lo que
2139
- * baja el contador de {@link unreadCount}; no hay forma de leerlo sin marcarlo.
2142
+ * **Pedir la primera página (`offset` 0 o sin `offset`) marca el hilo como leído en
2143
+ * PlanVortex.** Es lo que baja el contador de {@link unreadCount}; no hay forma de leerlo sin
2144
+ * marcarlo. **A la red no le dice nada**: para que el contacto vea que lo leíste, usa
2145
+ * {@link markConversationRead}.
2140
2146
  *
2141
2147
  * Aquí, y en el webhook, `contact_id`, `from_contact_id` y `message_options.files` vienen
2142
2148
  * POBLADOS. Usa `messageContact`, `messageContactId` y `messageFiles` en vez de asumirlo.
@@ -2172,6 +2178,10 @@ var MessagesResource = class extends Resource {
2172
2178
  * En Facebook e Instagram sólo se admite **un** adjunto por mensaje (error 1509), y en WhatsApp
2173
2179
  * fuera de la ventana de 24 horas sólo se admite una plantilla.
2174
2180
  *
2181
+ * **Contestar marca leído en la red lo que escribió el contacto**, justo antes de enviar, como
2182
+ * {@link markConversationRead}: ve los ticks azules y luego la respuesta. Si eso falla, el
2183
+ * mensaje sale igual.
2184
+ *
2175
2185
  * Si el cuerpo de la plantilla tiene variables, sus valores van en `template_parameters`, en
2176
2186
  * orden: el primero rellena `{{1}}`, el segundo `{{2}}`. Sin ellos WhatsApp rechaza la plantilla.
2177
2187
  * Un valor vacío, con saltos de línea, tabuladores o más de cuatro espacios seguidos es un 1511
@@ -2210,6 +2220,27 @@ var MessagesResource = class extends Resource {
2210
2220
  options
2211
2221
  );
2212
2222
  }
2223
+ /**
2224
+ * Marca la conversación como leída **en PlanVortex y en la red, y el contacto lo ve**: los
2225
+ * ticks azules en WhatsApp, el «Visto» en Messenger e Instagram, leída en la app de Bluesky.
2226
+ * Llámalo cuando una persona haya visto de verdad la conversación; leerla con {@link list} no
2227
+ * lo hace, y contestar con {@link send} lo hace solo.
2228
+ *
2229
+ * Marca el último mensaje del contacto y la red marca lo anterior. Repetirlo es gratis: si la
2230
+ * red ya lo tiene, no se le pide nada. `network_read` dice si la red la tiene por leída al
2231
+ * terminar (ver {@link ConversationRead}).
2232
+ *
2233
+ * ```ts
2234
+ * const { network_read } = await pv.messages.markConversationRead(orgId, accountId, contactId);
2235
+ * ```
2236
+ */
2237
+ async markConversationRead(idOrganization, idAccount, idContact, options = {}) {
2238
+ return this.httpPost(
2239
+ `${this.threadPath(idOrganization, idAccount, idContact)}/read`,
2240
+ void 0,
2241
+ options
2242
+ );
2243
+ }
2213
2244
  /** Cuántos mensajes quedan sin leer en la organización. Es el número del badge. */
2214
2245
  async unreadCount(idOrganization, options = {}) {
2215
2246
  const response = await this.httpGet(