planvortex 0.24.0 → 0.25.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.
package/README.md CHANGED
@@ -388,6 +388,8 @@ malformed signature.
388
388
  | ---------------------- | -------------------------------------------------------- | ----------------------------- |
389
389
  | `new_account` | An account was connected | — |
390
390
  | `change_state_account` | An account changed state: broke, refreshed, disconnected | — |
391
+ | `publication_published`| A publication went out to the network | `id_publication`, `external_identifier` |
392
+ | `publication_failed` | A publication could not be published | `id_publication`, `error` |
391
393
  | `messages` | A message came in | `messageObj` |
392
394
  | `messaging_postbacks` | The contact pressed a button or a quick reply | `messageObj` |
393
395
  | `messaging_seen` | The contact read the conversation | `messageObj`, when we have it |
@@ -397,8 +399,9 @@ malformed signature.
397
399
  | `ai_plan_generated` | An AI plan finished and is ready to review | `id_ai_plan`, `warnings` |
398
400
  | `ai_plan_failed` | An AI plan gave up | `id_ai_plan`, `error` |
399
401
 
400
- `isAccountStateChange`, `isMessageChange`, `isCommentChange`, `isIntegrationErrorChange` and
401
- `isAiPlanChange` narrow a change to its own type. Use them rather than a `switch`: the union carries a member for the
402
+ `isAccountStateChange`, `isPublicationChange`, `isMessageChange`, `isCommentChange`,
403
+ `isIntegrationErrorChange` and `isAiPlanChange` narrow a change to its own type. `isTestChange`
404
+ tells a test sent from «Test webhook» in the dashboard (`test: true`) from a real event. Use them rather than a `switch`: the union carries a member for the
402
405
  `field`s this version does not know yet — the list grows — and TypeScript cannot rule that one out
403
406
  of a `case`.
404
407
 
@@ -207,7 +207,7 @@ interface paths {
207
207
  *
208
208
  * **The identifier has a format** (error 533): lowercase letters, numbers, `.`, `-` and `_`, starting with a letter or a number, 3 to 64 characters. Pick it carefully — it cannot be changed later (error 547).
209
209
  *
210
- * Every URL is validated: a bad entry in `allowed_domains` answers 531, in `redirect_urls` 532, and a bad `webhook_url` answers 535.
210
+ * Every URL is validated: a bad entry in `allowed_domains` answers 531, in `redirect_urls` 532, and a bad `webhook_url` answers 535. A `webhook_url` must be `https://` and point to a public address; the 535 says why in `data.reason` (`not_a_url`, `protocol`, `https_required`, `credentials` or `local_address`).
211
211
  *
212
212
  * **The secret is not in the response.** Read it with `GET /clients/{id_client}/apps/{id_app}/secret`.
213
213
  *
@@ -236,11 +236,9 @@ interface paths {
236
236
  get: operations["getClientApp"];
237
237
  /**
238
238
  * Update an app
239
- * @description Replaces the app's configuration. **Every field is overwritten with what you send**, so a `redirect_urls` you leave out becomes an empty list — send the whole object, not a patch.
239
+ * @description Updates the app's configuration. `name` is required. `allowed_domains`, `redirect_urls` and `webhook_url` are **kept when you leave them out**: to remove the webhook, send `webhook_url: null` or `""`. Until 28 November 2026 an update without `webhook_url` turned the webhook off; it no longer does.
240
240
  *
241
- * Changing `webhook_url` takes effect on the next event; there is no verification handshake.
242
- *
243
- * **It replaces every field with what the body carries.** `name`, `keycloak_client_idenfifier`, `allowed_domains`, `redirect_urls` and `webhook_url` are all written as sent, so omitting one erases it — sending an update without `webhook_url` turns the webhook off. Read the app first and send it back whole.
241
+ * Changing `webhook_url` takes effect on the next event; there is no verification handshake. A new or changed URL must be `https://` and point to a public address (error 535, with the reason in `data.reason`). To check it end to end, use «Test webhook» in the app's form in the dashboard.
244
242
  *
245
243
  * **`keycloak_client_idenfifier` is the one field that is NOT overwritten.** Sending a different one answers `ERROR_CODE_547` and nothing is written: it is the `client_id` your integration authenticates with, and renaming it would lock out everything already asking for tokens with the old one. Send it unchanged, or leave it out. If you need a different identifier, create another app.
246
244
  *
@@ -2829,15 +2827,19 @@ interface webhooks {
2829
2827
  * A change happened (notification to your app)
2830
2828
  * @description PlanVortex `POST`s to the `webhook_url` of your client app when something happens. **The body is an array of changes**, and each one carries `field` telling you what it is — switch on it and ignore what you do not handle, because the list grows with the product.
2831
2829
  *
2832
- * Three shapes travel in that array. A change on an **account** (`WebhookChange`) always carries `id_account`, `id_organization` and `social_network`. A change on an **integration** (`IntegrationWebhookChange`) and the end of an **AI plan** (`AiPlanWebhookChange`) carry none of those, because they hang off the organization and not off any account.
2830
+ * Four shapes travel in that array. A change on an **account** (`WebhookChange`) always carries `id_account`, `id_organization` and `social_network`. A **publication** that finished (`PublicationWebhookChange`) carries those three plus `id_publication`. A change on an **integration** (`IntegrationWebhookChange`) and the end of an **AI plan** (`AiPlanWebhookChange`) carry neither `id_account` nor `social_network`, because they hang off the organization and not off any account.
2831
+ *
2832
+ * The events delivered today are `new_account`, `change_state_account`, `publication_published`, `publication_failed`, `messages`, `messaging_postbacks`, `messaging_seen`, `messaging_error`, `message_echoes`, `comments`, `integration_error`, `ai_plan_generated` and `ai_plan_failed`.
2833
2833
  *
2834
- * The events delivered today are `new_account`, `change_state_account`, `messages`, `messaging_postbacks`, `messaging_seen`, `messaging_error`, `message_echoes`, `comments`, `integration_error`, `ai_plan_generated` and `ai_plan_failed`.
2834
+ * **Messages and comments need a paid plan.** `messages`, `messaging_postbacks`, `messaging_seen`, `messaging_error`, `message_echoes` and `comments` are only sent while the client is on an active paid plan: on the free plan, or after a payment fails, they are not sent at all. Every other event goes out on every plan.
2835
2835
  *
2836
2836
  * ### Comments
2837
2837
  *
2838
2838
  * `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.
2839
2839
  *
2840
- * **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.
2840
+ * **Every network with comments sends this event.** Facebook, Instagram, TikTok and Telegram push their comments to PlanVortex, so they arrive within seconds or a few minutes. YouTube, LinkedIn, X, Discord, Bluesky, Threads and Google Business are read by a background job, so their comments arrive when that job finds them (each publication every three hours during its first two days, every twelve hours for the rest of its first week and once a day after that, up to a month; a Google Business listing every six hours; a Discord channel every five minutes), or earlier if someone opens that thread in the dashboard or through the API. X is read only when the organization turns it on, because reading replies there is billed per unit.
2841
+ *
2842
+ * Three things never arrive as `comments`: your own replies; a comment older than seven days that PlanVortex sees for the first time; and the first read of a Google Business listing or a Discord channel, which brings its whole history. Those are in the inbox anyway.
2841
2843
  *
2842
2844
  * **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`.
2843
2845
  *
@@ -2849,12 +2851,33 @@ interface webhooks {
2849
2851
  *
2850
2852
  * The event goes to **every** app of the client that has a `webhook_url`, not only to the one that created the plan. And it is not retried: if your endpoint was down when the plan finished, the `GET` still tells you how it ended, so on startup read the plans you were waiting for.
2851
2853
  *
2854
+ * ### Publications
2855
+ *
2856
+ * `publication_published` and `publication_failed` say that a publication has **finished**: it went out to the network, or it ended in `withErrors`. They are sent for every publication, the ones published on the spot, the scheduled ones when their time comes and the retries, so you no longer need to poll a scheduled publication to know whether it went out. A reel that the network is still processing (`publishing`) sends nothing until it is resolved.
2857
+ *
2858
+ * The change carries ids, the `state` and, when it went out, `external_identifier` (the id on the network) and `publish_date`. When it failed, `error` carries the first of `publication_errors` with its `code` and `message`. The text and the files are in `GET /organizations/{id_organization}/publish/{id_publication}`. These two events go out on every plan.
2859
+ *
2852
2860
  * ### WhatsApp replies sent from the phone
2853
2861
  *
2854
2862
  * A WhatsApp number can work in the **WhatsApp Business app** on a phone and in PlanVortex at the same time. What the business sends from the app arrives as `field: "message_echoes"`, with the message in `messageObj` as one of **ours**: `contact_id` is the person it was sent to and `from_contact_id` is absent. Store it in the thread; do not answer it. It does not open WhatsApp's 24-hour window.
2855
2863
  *
2856
2864
  * When a contact edits or deletes a message, or anyone reacts to one, no event is sent: the message itself changes, and the next read returns it with `edit_date`, `deleted_date` or its `reactions`.
2857
2865
  *
2866
+ * ### The URL, and what your endpoint has to answer
2867
+ *
2868
+ * - A **new or changed** `webhook_url` must be `https://` and point to a public address. `localhost`, a private IP or a name without a domain answers error 535 with `data.reason` (`not_a_url`, `protocol`, `https_required`, `credentials` or `local_address`). To test on your machine, use a tunnel (ngrok, Cloudflare Tunnel) and save its https URL.
2869
+ * - Answer with any **2xx within 10 seconds**. After 10 seconds the connection is closed. Answer first and process the event afterwards.
2870
+ * - **Redirects are not followed.** A 3xx counts as a failed delivery: save the final URL.
2871
+ * - Every delivery carries `User-Agent: PlanVortex-Webhooks/1.0`.
2872
+ *
2873
+ * ### Testing from the dashboard
2874
+ *
2875
+ * The form of each app in the dashboard has a **«Test webhook»** section. It sends an example of the event you choose to the saved `webhook_url`, signed with the app's secret like a real event, and shows what your server answered: the status code, the time it took and the first kilobyte of the body. A test carries `test: true` in the change and the header `x-planvortex-test: 1`, and only goes to that app.
2876
+ *
2877
+ * The same section lists the app's **recent deliveries** (real events and tests from the last seven days) with the status your server answered, or why it could not be reached. The content of the events is not kept.
2878
+ *
2879
+ * A step-by-step guide, with signature checks in Node, Python and PHP and what to look at when nothing arrives, is at https://planvortex.com/en/resources/social-media-webhooks.
2880
+ *
2858
2881
  * ### Verifying the signature
2859
2882
  *
2860
2883
  * Every delivery carries the body signed with your app's secret, twice:
@@ -2988,16 +3011,21 @@ interface components {
2988
3011
  /** @description `true` when the account was already connected before this authorization (a reconnection). Confirming it takes no slot of the plan. */
2989
3012
  already_enabled: boolean;
2990
3013
  };
2991
- AccountsMetricList: ("page_total_actions" | "page_call_phone_clicks_logged_in_unique" | "page_get_directions_clicks_logged_in_unique" | "page_website_clicks_logged_in_unique" | "page_post_engagements" | "page_consumptions_unique" | "page_negative_feedback" | "page_negative_feedback_unique" | "page_fans_online_per_day" | "page_impressions" | "page_impressions_unique" | "page_impressions_paid" | "page_impressions_paid_unique" | "page_impressions_organic_v2" | "page_impressions_organic_unique_v2" | "page_impressions_viral" | "page_impressions_viral_unique" | "page_impressions_nonviral" | "page_impressions_nonviral_unique" | "page_posts_impressions" | "page_posts_impressions_unique" | "page_posts_impressions_paid" | "page_posts_impressions_paid_unique" | "page_posts_impressions_organic" | "page_posts_impressions_organic_unique" | "page_posts_served_impressions_organic_unique" | "page_posts_impressions_viral" | "page_posts_impressions_viral_unique" | "page_posts_impressions_nonviral" | "page_posts_impressions_nonviral_unique" | "impressions" | "reach" | "total_interactions" | "accounts_engaged" | "likes" | "comments" | "saves" | "shares" | "replies" | "follows_and_unfollows" | "profile_links_taps" | "website_clicks" | "profile_views" | "paidFollowers" | "organicFollowerGain" | "careersPageBannerPromoClicks" | "careersPagePromoLinksClicks" | "careersPageEmployeesClicks" | "careersPageJobsClicks" | "careersPageViewsUnique" | "careersPageViews" | "overviewPageViewsUnique" | "overviewPageViews" | "allPageViews" | "follows" | "share" | "views")[];
3014
+ AccountsMetricList: ("page_total_actions" | "page_call_phone_clicks_logged_in_unique" | "page_get_directions_clicks_logged_in_unique" | "page_website_clicks_logged_in_unique" | "page_post_engagements" | "page_consumptions_unique" | "page_negative_feedback" | "page_negative_feedback_unique" | "page_fans_online_per_day" | "page_impressions" | "page_impressions_unique" | "page_impressions_paid" | "page_impressions_paid_unique" | "page_impressions_organic_v2" | "page_impressions_organic_unique_v2" | "page_impressions_viral" | "page_impressions_viral_unique" | "page_impressions_nonviral" | "page_impressions_nonviral_unique" | "page_posts_impressions" | "page_posts_impressions_unique" | "page_posts_impressions_paid" | "page_posts_impressions_paid_unique" | "page_posts_impressions_organic" | "page_posts_impressions_organic_unique" | "page_posts_served_impressions_organic_unique" | "page_posts_impressions_viral" | "page_posts_impressions_viral_unique" | "page_posts_impressions_nonviral" | "page_posts_impressions_nonviral_unique" | "impressions" | "reach" | "total_interactions" | "accounts_engaged" | "likes" | "comments" | "saves" | "shares" | "replies" | "follows_and_unfollows" | "profile_links_taps" | "website_clicks" | "profile_views" | "organicFollowerGain" | "paidFollowers" | "impressionCount" | "uniqueImpressionsCount" | "clickCount" | "likeCount" | "commentCount" | "shareCount" | "allPageViews" | "allPageViewsUnique" | "overviewPageViews" | "overviewPageViewsUnique" | "customButtonClicks" | "careersPageViews" | "follows" | "share" | "views")[];
2992
3015
  /** @description A metric series for one account, already grouped. `group` says what each row covers: a range of 31 days or less is grouped by day, up to 720 by month, and beyond that by year. */
2993
3016
  AccountsMetricModel: {
2994
3017
  /** @enum {string} */
2995
3018
  group: "day" | "month" | "year";
2996
3019
  /** @description One row per metric and per group. Empty when nothing was measured in the range. */
2997
3020
  stats: {
3021
+ /**
3022
+ * @description How the days of the group were put together. `sum` for what happens every day (impressions, page views, followers gained). `last` for a running total (followers): adding up thirty snapshots of 15 followers would say 450.
3023
+ * @enum {string}
3024
+ */
3025
+ aggregation?: "sum" | "last";
2998
3026
  /**
2999
3027
  * Format: date-time
3000
- * @description First measurement of the group, which is what dates the row.
3028
+ * @description First measurement of the group: the moment its first measured day ENDED, so the midnight after it. To place the row on a chart use `period`.
3001
3029
  */
3002
3030
  date: string;
3003
3031
  /** @enum {string} */
@@ -3006,7 +3034,12 @@ interface components {
3006
3034
  group_value: number;
3007
3035
  /** @description The metric's RAW name, the one the network publishes — the same names `GET .../metric_list` returns. */
3008
3036
  name: string;
3009
- /** @description Sum of the measurements in the group. */
3037
+ /**
3038
+ * @description The day, month or year that was measured, matching `group`: `2026-11-24`, `2026-11` or `2026`.
3039
+ * @example 2026-11-24
3040
+ */
3041
+ period?: string;
3042
+ /** @description The value of the group, already put together as `aggregation` says. Rows with `sum` can be added up across groups; rows with `last` cannot. */
3010
3043
  value: number;
3011
3044
  }[];
3012
3045
  };
@@ -3561,7 +3594,9 @@ interface components {
3561
3594
  *
3562
3595
  * **The body is an array of changes, not a single object**, and it carries two signature headers computed with this app's secret over the **raw** body: `x-hub-signature` (`sha1=<hex>`) and `x-hub-signature-256` (`sha256=<hex>`). Verify against the bytes you received — parsing the JSON and re-serialising it changes them and the signature will not match.
3563
3596
  *
3564
- * The events delivered today are `new_account`, `change_state_account`, `messages`, `messaging_postbacks`, `messaging_seen`, `messaging_error`, `message_echoes`, `comments`, `integration_error`, `ai_plan_generated` and `ai_plan_failed`. The payload is documented in the `comments` specification. **Every** app of the client that has a `webhook_url` receives every event, not only the app whose call caused it: with two apps, each event arrives twice. Delivery is best effort: PlanVortex does not retry a webhook that fails.
3597
+ * The events delivered today are `new_account`, `change_state_account`, `publication_published`, `publication_failed`, `messages`, `messaging_postbacks`, `messaging_seen`, `messaging_error`, `message_echoes`, `comments`, `integration_error`, `ai_plan_generated` and `ai_plan_failed`. Messages and comments are only sent on an active paid plan. The payload is documented in the `comments` specification.
3598
+ *
3599
+ * Your endpoint has to answer a 2xx within 10 seconds, and redirects are not followed. The dashboard can send a signed test of any event to this URL («Test webhook», with `test: true` in the change) and lists the app's recent deliveries. **Every** app of the client that has a `webhook_url` receives every event, not only the app whose call caused it: with two apps, each event arrives twice. Delivery is best effort: PlanVortex does not retry a webhook that fails.
3565
3600
  */
3566
3601
  webhook_url?: string;
3567
3602
  };
@@ -3581,7 +3616,7 @@ interface components {
3581
3616
  name: string;
3582
3617
  /** @description URLs the connect flow is allowed to come back to. A `redirect_uri` that is not in this list is refused when issuing a temporal connect token (error 532). */
3583
3618
  redirect_urls?: string[];
3584
- /** @description Where PlanVortex posts events. Has to be a valid URL (error 535). See `ClientApp.webhook_url` for what arrives and how it is signed. */
3619
+ /** @description Where PlanVortex posts events. It must be an `https://` URL that points to a public address (error 535, with the reason in `data.reason`): `localhost`, a private IP or a name without a domain are refused. Send `null` or `""` to remove it. See `ClientApp.webhook_url` for what arrives and how it is signed. */
3585
3620
  webhook_url?: string;
3586
3621
  };
3587
3622
  /** @description The error shape of the token endpoint, and **only** of the token endpoint. Every other endpoint in the API answers with `Error` instead. */
@@ -3882,6 +3917,8 @@ interface components {
3882
3917
  * @enum {string}
3883
3918
  */
3884
3919
  template: "standard" | "from_images" | "from_text" | "from_catalog" | "campaign";
3920
+ /** @description Only present on a **test** delivery, sent with the «Test webhook» button of the dashboard. A real event never carries it. A test also carries the header `x-planvortex-test: 1`, and its ids are made up except `id_organization`, which is a real organization of yours. */
3921
+ test?: boolean;
3885
3922
  /** @description How many draft publications the plan holds. A failed plan can still hold the drafts of its failed attempt; retrying it discards them. */
3886
3923
  total_publications: number;
3887
3924
  /** @description **How many** non-blocking notices the plan has, not the notices themselves: those are in `AiPlan.warnings`. Above zero the plan is still generated and usable. */
@@ -4018,6 +4055,52 @@ interface components {
4018
4055
  id_organization: string;
4019
4056
  /** @description `google_drive` or `rss` today. **This list grows**: treat it as an open enumeration. */
4020
4057
  provider: string;
4058
+ /** @description Only present on a **test** delivery, sent with the «Test webhook» button of the dashboard. A real event never carries it. A test also carries the header `x-planvortex-test: 1`, and its ids are made up except `id_organization`, which is a real organization of yours. */
4059
+ test?: boolean;
4060
+ };
4061
+ /**
4062
+ * @description One change in the array PlanVortex posts to your app's `webhook_url`, when a **publication finished**: `publication_published` when it went out to the network, `publication_failed` when it ended in `withErrors`.
4063
+ *
4064
+ * It carries ids, the state and, on failure, the first error. Read the publication itself with `GET /organizations/{id_organization}/publish/{id_publication}`, which stays the source of truth if a delivery is lost.
4065
+ * @example {
4066
+ * "field": "publication_published",
4067
+ * "id_publication": "6748c2a1f0e4b7a91c3d5e20",
4068
+ * "id_organization": "6748c2a1f0e4b7a91c3d5e10",
4069
+ * "id_account": "6748c2a1f0e4b7a91c3d5e11",
4070
+ * "social_network": "instagram",
4071
+ * "state": "sended",
4072
+ * "external_identifier": "17890000000000000",
4073
+ * "publish_date": "2026-11-28T09:00:04.000Z"
4074
+ * }
4075
+ */
4076
+ CommentsPublicationWebhookChange: {
4077
+ /** @description Only in `publication_failed`: the first entry of `publication_errors`, without its `data`. */
4078
+ error?: components["schemas"]["CommentsPublicationWebhookError"];
4079
+ /** @description Only in `publication_published`: the publication's id on the network. */
4080
+ external_identifier?: string;
4081
+ /** @enum {string} */
4082
+ field: "publication_published" | "publication_failed";
4083
+ id_account: string;
4084
+ id_organization: string;
4085
+ id_publication: string;
4086
+ /**
4087
+ * Format: date-time
4088
+ * @description Only in `publication_published`: when it went out.
4089
+ */
4090
+ publish_date?: string;
4091
+ social_network: components["schemas"]["SocialNetwork"];
4092
+ /**
4093
+ * @description `sended` when it went out, `withErrors` when it failed.
4094
+ * @enum {string}
4095
+ */
4096
+ state: "sended" | "withErrors";
4097
+ /** @description Only present on a **test** delivery, sent with the «Test webhook» button of the dashboard. A real event never carries it. A test also carries the header `x-planvortex-test: 1`, and its ids are made up except `id_organization`, which is a real organization of yours. */
4098
+ test?: boolean;
4099
+ };
4100
+ /** @description Why a publication failed: the first entry of its `publication_errors`, without its `data`. The `code` is from the PlanVortex error catalogue. */
4101
+ CommentsPublicationWebhookError: {
4102
+ code: number;
4103
+ message: string;
4021
4104
  };
4022
4105
  /** @description The coarse gates of one network */
4023
4106
  CommentsSocialCapabilities: {
@@ -4049,7 +4132,7 @@ interface components {
4049
4132
  /**
4050
4133
  * @description One change in the array PlanVortex posts to your app's `webhook_url`, when the change concerns a social **account**.
4051
4134
  *
4052
- * An integration that stopped working has a shape of its own (`IntegrationWebhookChange`), and so does an AI plan that finished (`AiPlanWebhookChange`). One delivery can mix them. Switch on `field`, and ignore what you do not handle.
4135
+ * A publication that finished has a shape of its own (`PublicationWebhookChange`), and so do an integration that stopped working (`IntegrationWebhookChange`) and an AI plan that finished (`AiPlanWebhookChange`). One delivery can mix them. Switch on `field`, and ignore what you do not handle.
4053
4136
  */
4054
4137
  CommentsWebhookChange: {
4055
4138
  /** @description The comment. Present only when `field` is `comments`, and absent even then if the author deleted a comment we had never seen. */
@@ -4082,6 +4165,8 @@ interface components {
4082
4165
  [key: string]: unknown;
4083
4166
  };
4084
4167
  social_network: components["schemas"]["SocialNetwork"];
4168
+ /** @description Only present on a **test** delivery, sent with the «Test webhook» button of the dashboard. A real event never carries it. A test also carries the header `x-planvortex-test: 1`, and its ids are made up except `id_organization`, which is a real organization of yours. */
4169
+ test?: boolean;
4085
4170
  };
4086
4171
  /** @description A person the organization exchanges messages with. The same contact can be reachable on several channels — that is what `social_identifiers` is. */
4087
4172
  Contact: {
@@ -12972,11 +13057,11 @@ interface operations {
12972
13057
  * }
12973
13058
  * ]
12974
13059
  */
12975
- "application/json": (components["schemas"]["CommentsWebhookChange"] | components["schemas"]["CommentsIntegrationWebhookChange"] | components["schemas"]["CommentsAiPlanWebhookChange"])[];
13060
+ "application/json": (components["schemas"]["CommentsWebhookChange"] | components["schemas"]["CommentsPublicationWebhookChange"] | components["schemas"]["CommentsIntegrationWebhookChange"] | components["schemas"]["CommentsAiPlanWebhookChange"])[];
12976
13061
  };
12977
13062
  };
12978
13063
  responses: {
12979
- /** @description Your endpoint acknowledged the delivery. PlanVortex does not retry: a delivery that fails is logged and dropped, so treat the inbox endpoints as the way to catch up on anything you missed. */
13064
+ /** @description Your endpoint acknowledged the delivery with a 2xx within 10 seconds. Redirects are not followed. PlanVortex does not retry: a delivery that fails is logged and dropped, so treat the inbox endpoints as the way to catch up on anything you missed. The dashboard shows each app's recent deliveries. */
12980
13065
  200: {
12981
13066
  headers: {
12982
13067
  [name: string]: unknown;
@@ -14252,7 +14337,7 @@ type WebhookAlgorithm = keyof typeof WEBHOOK_SIGNATURE_HEADERS;
14252
14337
  * **La lista crece**, así que un `field` desconocido se ignora en vez de romper: para eso está
14253
14338
  * {@link UnknownWebhookChange}.
14254
14339
  */
14255
- declare const WEBHOOK_EVENTS: readonly ["new_account", "change_state_account", "messages", "messaging_postbacks", "messaging_seen", "messaging_error", "message_echoes", "comments", "integration_error", "ai_plan_generated", "ai_plan_failed"];
14340
+ declare const WEBHOOK_EVENTS: readonly ["new_account", "change_state_account", "publication_published", "publication_failed", "messages", "messaging_postbacks", "messaging_seen", "messaging_error", "message_echoes", "comments", "integration_error", "ai_plan_generated", "ai_plan_failed"];
14256
14341
  type WebhookEvent = (typeof WEBHOOK_EVENTS)[number];
14257
14342
  /** Lo que trae todo cambio que cuelga de una CUENTA, pase lo que pase. */
14258
14343
  interface AccountWebhookChangeBase {
@@ -14264,6 +14349,8 @@ interface AccountWebhookChangeBase {
14264
14349
  * PlanVortex por su cuenta, como `new_account`.
14265
14350
  */
14266
14351
  originalChange?: Record<string, unknown>;
14352
+ /** Ver {@link isTestChange}: sólo en las pruebas que se mandan desde el panel */
14353
+ test?: boolean;
14267
14354
  }
14268
14355
  /** Una cuenta se conectó, o cambió de estado: dejó de funcionar, se refrescó, se desconectó. */
14269
14356
  interface AccountStateChange extends AccountWebhookChangeBase {
@@ -14328,6 +14415,32 @@ interface IntegrationErrorChange {
14328
14415
  provider: string;
14329
14416
  /** El código del catálogo de PlanVortex que dice qué pasó. Los de integraciones van del 2200 al 2299. */
14330
14417
  error_code: number;
14418
+ /** Ver {@link isTestChange} */
14419
+ test?: boolean;
14420
+ }
14421
+ /**
14422
+ * Una publicación TERMINÓ: salió a la red (`publication_published`) o se quedó en `withErrors`
14423
+ * (`publication_failed`). Llega tanto para las que se publican al momento como para las programadas
14424
+ * cuando les toca y para los reintentos, así que ya no hace falta preguntar por una programada para
14425
+ * saber si salió. Un reel que la red aún procesa no manda nada hasta que se resuelve.
14426
+ *
14427
+ * Sólo trae ids, el estado y, si falló, el primer error. El texto y los ficheros, con
14428
+ * `pv.publications.get()`, que sigue diciendo cómo acabó si esta entrega se pierde.
14429
+ */
14430
+ interface PublicationChange extends AccountWebhookChangeBase {
14431
+ field: "publication_published" | "publication_failed";
14432
+ id_publication: string;
14433
+ /** `sended` si salió, `withErrors` si falló. Siempre cuadra con `field`. */
14434
+ state: "sended" | "withErrors";
14435
+ /** Sólo en `publication_published`: el id de la publicación en la red */
14436
+ external_identifier?: string;
14437
+ /** Sólo en `publication_published`: cuándo salió */
14438
+ publish_date?: string;
14439
+ /** Sólo en `publication_failed`: el primero de `publication_errors`, sin su `data` */
14440
+ error?: {
14441
+ code: number;
14442
+ message: string;
14443
+ };
14331
14444
  }
14332
14445
  /**
14333
14446
  * Un plan de IA TERMINÓ: salió (`ai_plan_generated`) o se rindió (`ai_plan_failed`).
@@ -14361,6 +14474,8 @@ interface AiPlanChange {
14361
14474
  code: number;
14362
14475
  message: string;
14363
14476
  };
14477
+ /** Ver {@link isTestChange} */
14478
+ test?: boolean;
14364
14479
  }
14365
14480
  /**
14366
14481
  * Un `field` que esta versión del paquete todavía no conoce.
@@ -14380,7 +14495,15 @@ interface UnknownWebhookChange {
14380
14495
  * `CommentChange | UnknownWebhookChange`. Para estrechar de verdad están los predicados
14381
14496
  * {@link isCommentChange} y compañía, que es la forma recomendada.
14382
14497
  */
14383
- type WebhookChange = AccountStateChange | MessageChange | MessageEchoChange | CommentChange | IntegrationErrorChange | AiPlanChange | UnknownWebhookChange;
14498
+ type WebhookChange = AccountStateChange | PublicationChange | MessageChange | MessageEchoChange | CommentChange | IntegrationErrorChange | AiPlanChange | UnknownWebhookChange;
14499
+ /** Una publicación salió o falló. Mira `field` (o `state`) para saber cuál. */
14500
+ declare function isPublicationChange(change: WebhookChange): change is PublicationChange;
14501
+ /**
14502
+ * Una PRUEBA mandada desde «Probar webhook» en el panel, no un evento de verdad. Lleva `test: true`
14503
+ * (y la cabecera `x-planvortex-test: 1`), está firmada igual que uno real y sus ids son inventados,
14504
+ * salvo `id_organization`. Lo normal es contestar 200 y no hacer nada más con ella.
14505
+ */
14506
+ declare function isTestChange(change: WebhookChange): boolean;
14384
14507
  /** Una cuenta se conectó o cambió de estado. */
14385
14508
  declare function isAccountStateChange(change: WebhookChange): change is AccountStateChange;
14386
14509
  /** Algo pasó en la mensajería. Incluye el visto y el rechazo de la red, no sólo el mensaje nuevo. */
@@ -14538,4 +14661,4 @@ interface PlanVortexWebhooksOptions {
14538
14661
  */
14539
14662
  declare function planvortexWebhooks(options: PlanVortexWebhooksOptions): (request: WebhookRequestLike, response: WebhookResponseLike, next: (error?: unknown) => void) => void;
14540
14663
 
14541
- 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 };
14664
+ 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, type VerifyWebhookSignatureOptions 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 PublicationChange as bZ, type RawWebhookBody 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_EVENTS as c0, WEBHOOK_SIGNATURE_HEADERS as c1, WebhookBodyError as c2, type WebhookHeaders as c3, type WebhookRequestLike as c4, type WebhookResponseLike as c5, WebhookSignatureError as c6, handleWebhookRequest as c7, isAccountStateChange as c8, isAiPlanChange as c9, isCommentChange as ca, isIntegrationErrorChange as cb, isMessageChange as cc, isMessageEchoChange as cd, isPublicationChange as ce, isTestChange as cf, parseWebhookPayload as cg, planvortexWebhooks as ch, verifyWebhookSignature as ci, 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 };