planvortex 0.18.0 → 0.19.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 +11 -0
- package/dist/{index-6DpRjLs4.d.cts → index-DD7oGNvm.d.cts} +47 -8
- package/dist/{index-6DpRjLs4.d.ts → index-DD7oGNvm.d.ts} +47 -8
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/webhooks/index.cjs +5 -0
- package/dist/webhooks/index.cjs.map +1 -1
- package/dist/webhooks/index.d.cts +1 -1
- package/dist/webhooks/index.d.ts +1 -1
- package/dist/webhooks/index.js +5 -1
- package/dist/webhooks/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -477,6 +477,17 @@ JSON: the bytes differ and the signature never matches. Either let `planvortexWe
|
|
|
477
477
|
stream, or put `express.raw({ type: "application/json" })` in front of that one route. A global
|
|
478
478
|
`express.json()` is what breaks it, and it breaks it silently.
|
|
479
479
|
|
|
480
|
+
## Guides
|
|
481
|
+
|
|
482
|
+
Longer write-ups on planvortex.com:
|
|
483
|
+
|
|
484
|
+
- [Publishing to social media from Node.js without building one integration per network](https://planvortex.com/en/resources/publish-social-media-node-js)
|
|
485
|
+
- [Meta access token expired? Why it lasts 60 days and how to refresh it](https://planvortex.com/en/resources/meta-access-token-expiry)
|
|
486
|
+
- [Character limits across social APIs: .length lies, and it lies both ways](https://planvortex.com/en/resources/social-media-character-limits)
|
|
487
|
+
- [How much does it cost to post on X with the API in 2026](https://planvortex.com/en/resources/x-api-pricing-2026)
|
|
488
|
+
- [Is the LinkedIn API free? Pricing and posting access in 2026](https://planvortex.com/en/resources/linkedin-api-pricing-access)
|
|
489
|
+
- [All articles](https://planvortex.com/en/resources)
|
|
490
|
+
|
|
480
491
|
## Development
|
|
481
492
|
|
|
482
493
|
```bash
|
|
@@ -2711,7 +2711,7 @@ interface webhooks {
|
|
|
2711
2711
|
*
|
|
2712
2712
|
* 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.
|
|
2713
2713
|
*
|
|
2714
|
-
* The events delivered today are `new_account`, `change_state_account`, `messages`, `messaging_postbacks`, `messaging_seen`, `messaging_error`, `comments`, `integration_error`, `ai_plan_generated` and `ai_plan_failed`.
|
|
2714
|
+
* 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`.
|
|
2715
2715
|
*
|
|
2716
2716
|
* ### Comments
|
|
2717
2717
|
*
|
|
@@ -2729,6 +2729,12 @@ interface webhooks {
|
|
|
2729
2729
|
*
|
|
2730
2730
|
* 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.
|
|
2731
2731
|
*
|
|
2732
|
+
* ### WhatsApp replies sent from the phone
|
|
2733
|
+
*
|
|
2734
|
+
* 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.
|
|
2735
|
+
*
|
|
2736
|
+
* When a contact edits or deletes a message, no event is sent: the message itself changes, and the next read returns it with `edit_date` or `deleted_date`.
|
|
2737
|
+
*
|
|
2732
2738
|
* ### Verifying the signature
|
|
2733
2739
|
*
|
|
2734
2740
|
* Every delivery carries the body signed with your app's secret, twice:
|
|
@@ -3411,7 +3417,7 @@ interface components {
|
|
|
3411
3417
|
*
|
|
3412
3418
|
* **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.
|
|
3413
3419
|
*
|
|
3414
|
-
* The events delivered today are `new_account`, `change_state_account`, `messages`, `messaging_postbacks`, `messaging_seen`, `messaging_error`, `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.
|
|
3420
|
+
* 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.
|
|
3415
3421
|
*/
|
|
3416
3422
|
webhook_url?: string;
|
|
3417
3423
|
};
|
|
@@ -3889,15 +3895,16 @@ interface components {
|
|
|
3889
3895
|
/**
|
|
3890
3896
|
* @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.
|
|
3891
3897
|
*
|
|
3892
|
-
* - `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.
|
|
3898
|
+
* - `new_account` / `change_state_account`: an account was connected, or its state changed — it stopped working, its token was refreshed, it was disconnected. A WhatsApp number disconnected from the WhatsApp Business app (or by Meta, after about 14 days without the phone using the app) arrives here with `error_code` 717. 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.
|
|
3893
3899
|
* - `messages`: a message came in. It travels in `messageObj`.
|
|
3894
3900
|
* - `messaging_postbacks`: the contact pressed a button or a quick reply. Also in `messageObj`.
|
|
3895
3901
|
* - `messaging_seen`: the contact read the conversation. `messageObj` carries the message they read, when we still have it.
|
|
3896
3902
|
* - `messaging_error`: the network refused a message we sent. The reason is in `messageObj.message_errors`.
|
|
3903
|
+
* - `message_echoes`: WhatsApp only, when the number is also used in the **WhatsApp Business app** on a phone. The business replied from the app, and the reply travels in `messageObj` as **our** message (`contact_id` is set, `from_contact_id` is not). It is a separate `field` on purpose: a bot that answers every `messages` must not answer the business itself.
|
|
3897
3904
|
* - `comments`: a comment came in. It travels in `commentObj`, never in `messageObj`.
|
|
3898
3905
|
* @enum {string}
|
|
3899
3906
|
*/
|
|
3900
|
-
field: "new_account" | "change_state_account" | "messages" | "messaging_postbacks" | "messaging_seen" | "messaging_error" | "comments";
|
|
3907
|
+
field: "new_account" | "change_state_account" | "messages" | "messaging_postbacks" | "messaging_seen" | "messaging_error" | "message_echoes" | "comments";
|
|
3901
3908
|
id_account: string;
|
|
3902
3909
|
/** @description Only for messaging fields. A comment has no contact: its author is not someone you can write to. */
|
|
3903
3910
|
id_contact?: string;
|
|
@@ -4470,6 +4477,16 @@ interface components {
|
|
|
4470
4477
|
contact_id?: string | components["schemas"]["Contact"];
|
|
4471
4478
|
/** Format: date-time */
|
|
4472
4479
|
creation_date: string;
|
|
4480
|
+
/**
|
|
4481
|
+
* Format: date-time
|
|
4482
|
+
* @description When the contact **deleted** this message for everyone (WhatsApp allows it for two days). The message stays in the thread with no `text` and no files.
|
|
4483
|
+
*/
|
|
4484
|
+
deleted_date?: string;
|
|
4485
|
+
/**
|
|
4486
|
+
* Format: date-time
|
|
4487
|
+
* @description When the contact **edited** this message on the network (WhatsApp allows it for 15 minutes). `text` is already the edited text; the original is not kept.
|
|
4488
|
+
*/
|
|
4489
|
+
edit_date?: string;
|
|
4473
4490
|
/** @description Identifier of this message on the network. */
|
|
4474
4491
|
element_external_id?: string;
|
|
4475
4492
|
/** @description Set when the **contact** wrote to us. */
|
|
@@ -4564,9 +4581,11 @@ interface components {
|
|
|
4564
4581
|
};
|
|
4565
4582
|
/**
|
|
4566
4583
|
* @description What kind of message this is. `simple_message` and `file_message` work everywhere; the rest are network-specific shapes.
|
|
4584
|
+
*
|
|
4585
|
+
* `unsupported_message` only ever **arrives**: a WhatsApp message that cannot be shown through the API (a voice note, a document, a sticker, or a type WhatsApp does not let the API read). It carries no files, keeps the caption as `text` when there is one, and may carry the network's reason in `message_errors`. If the number is also in the WhatsApp Business app, the message can be read there. Sending one is refused.
|
|
4567
4586
|
* @enum {string}
|
|
4568
4587
|
*/
|
|
4569
|
-
MessageType: "simple_message" | "file_message" | "comment_message" | "publication_message" | "quick_reply_message" | "button_message" | "elements_message" | "postback_message" | "template_message" | "interactive_message";
|
|
4588
|
+
MessageType: "simple_message" | "file_message" | "comment_message" | "publication_message" | "quick_reply_message" | "button_message" | "elements_message" | "postback_message" | "template_message" | "interactive_message" | "unsupported_message";
|
|
4570
4589
|
/**
|
|
4571
4590
|
* @description Metrics translated to a **common vocabulary** shared by every network, which is what makes two networks comparable and summable (each network names them differently: `page_post_engagements`, `total_interactions`, `views`…).
|
|
4572
4591
|
*
|
|
@@ -13814,7 +13833,7 @@ type WebhookAlgorithm = keyof typeof WEBHOOK_SIGNATURE_HEADERS;
|
|
|
13814
13833
|
* **La lista crece**, así que un `field` desconocido se ignora en vez de romper: para eso está
|
|
13815
13834
|
* {@link UnknownWebhookChange}.
|
|
13816
13835
|
*/
|
|
13817
|
-
declare const WEBHOOK_EVENTS: readonly ["new_account", "change_state_account", "messages", "messaging_postbacks", "messaging_seen", "messaging_error", "comments", "integration_error", "ai_plan_generated", "ai_plan_failed"];
|
|
13836
|
+
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"];
|
|
13818
13837
|
type WebhookEvent = (typeof WEBHOOK_EVENTS)[number];
|
|
13819
13838
|
/** Lo que trae todo cambio que cuelga de una CUENTA, pase lo que pase. */
|
|
13820
13839
|
interface AccountWebhookChangeBase {
|
|
@@ -13846,6 +13865,21 @@ interface MessageChange extends AccountWebhookChangeBase {
|
|
|
13846
13865
|
/** El contacto del otro lado. Un comentario no tiene, y por eso aquí sí y allí no. */
|
|
13847
13866
|
id_contact?: string;
|
|
13848
13867
|
}
|
|
13868
|
+
/**
|
|
13869
|
+
* WhatsApp, cuando el número se usa también en la **app WhatsApp Business** del móvil: el negocio
|
|
13870
|
+
* contestó desde la app. `messageObj` es un mensaje **nuestro** —lleva `contact_id`, el contacto al
|
|
13871
|
+
* que se escribió, y no `from_contact_id`— y llega poblado, como en {@link MessageChange}.
|
|
13872
|
+
*
|
|
13873
|
+
* Es un evento aparte a propósito, y {@link isMessageChange} **no** lo incluye: un bot que contesta a
|
|
13874
|
+
* cada mensaje que entra no tiene que contestarle al propio negocio. Guárdalo en el hilo y ya. No
|
|
13875
|
+
* abre la ventana de 24 horas de WhatsApp.
|
|
13876
|
+
*/
|
|
13877
|
+
interface MessageEchoChange extends AccountWebhookChangeBase {
|
|
13878
|
+
field: "message_echoes";
|
|
13879
|
+
messageObj?: Message;
|
|
13880
|
+
/** El contacto al que escribió el negocio */
|
|
13881
|
+
id_contact?: string;
|
|
13882
|
+
}
|
|
13849
13883
|
/**
|
|
13850
13884
|
* Llegó un comentario.
|
|
13851
13885
|
*
|
|
@@ -13927,11 +13961,16 @@ interface UnknownWebhookChange {
|
|
|
13927
13961
|
* `CommentChange | UnknownWebhookChange`. Para estrechar de verdad están los predicados
|
|
13928
13962
|
* {@link isCommentChange} y compañía, que es la forma recomendada.
|
|
13929
13963
|
*/
|
|
13930
|
-
type WebhookChange = AccountStateChange | MessageChange | CommentChange | IntegrationErrorChange | AiPlanChange | UnknownWebhookChange;
|
|
13964
|
+
type WebhookChange = AccountStateChange | MessageChange | MessageEchoChange | CommentChange | IntegrationErrorChange | AiPlanChange | UnknownWebhookChange;
|
|
13931
13965
|
/** Una cuenta se conectó o cambió de estado. */
|
|
13932
13966
|
declare function isAccountStateChange(change: WebhookChange): change is AccountStateChange;
|
|
13933
13967
|
/** Algo pasó en la mensajería. Incluye el visto y el rechazo de la red, no sólo el mensaje nuevo. */
|
|
13934
13968
|
declare function isMessageChange(change: WebhookChange): change is MessageChange;
|
|
13969
|
+
/**
|
|
13970
|
+
* El negocio contestó desde la app WhatsApp Business del móvil. No es un mensaje entrante: no lo
|
|
13971
|
+
* contestes. {@link isMessageChange} no lo incluye.
|
|
13972
|
+
*/
|
|
13973
|
+
declare function isMessageEchoChange(change: WebhookChange): change is MessageEchoChange;
|
|
13935
13974
|
/** Llegó un comentario. */
|
|
13936
13975
|
declare function isCommentChange(change: WebhookChange): change is CommentChange;
|
|
13937
13976
|
/** Una integración dejó de funcionar. */
|
|
@@ -14080,4 +14119,4 @@ interface PlanVortexWebhooksOptions {
|
|
|
14080
14119
|
*/
|
|
14081
14120
|
declare function planvortexWebhooks(options: PlanVortexWebhooksOptions): (request: WebhookRequestLike, response: WebhookResponseLike, next: (error?: unknown) => void) => void;
|
|
14082
14121
|
|
|
14083
|
-
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,
|
|
14122
|
+
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 };
|
|
@@ -2711,7 +2711,7 @@ interface webhooks {
|
|
|
2711
2711
|
*
|
|
2712
2712
|
* 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.
|
|
2713
2713
|
*
|
|
2714
|
-
* The events delivered today are `new_account`, `change_state_account`, `messages`, `messaging_postbacks`, `messaging_seen`, `messaging_error`, `comments`, `integration_error`, `ai_plan_generated` and `ai_plan_failed`.
|
|
2714
|
+
* 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`.
|
|
2715
2715
|
*
|
|
2716
2716
|
* ### Comments
|
|
2717
2717
|
*
|
|
@@ -2729,6 +2729,12 @@ interface webhooks {
|
|
|
2729
2729
|
*
|
|
2730
2730
|
* 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.
|
|
2731
2731
|
*
|
|
2732
|
+
* ### WhatsApp replies sent from the phone
|
|
2733
|
+
*
|
|
2734
|
+
* 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.
|
|
2735
|
+
*
|
|
2736
|
+
* When a contact edits or deletes a message, no event is sent: the message itself changes, and the next read returns it with `edit_date` or `deleted_date`.
|
|
2737
|
+
*
|
|
2732
2738
|
* ### Verifying the signature
|
|
2733
2739
|
*
|
|
2734
2740
|
* Every delivery carries the body signed with your app's secret, twice:
|
|
@@ -3411,7 +3417,7 @@ interface components {
|
|
|
3411
3417
|
*
|
|
3412
3418
|
* **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.
|
|
3413
3419
|
*
|
|
3414
|
-
* The events delivered today are `new_account`, `change_state_account`, `messages`, `messaging_postbacks`, `messaging_seen`, `messaging_error`, `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.
|
|
3420
|
+
* 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.
|
|
3415
3421
|
*/
|
|
3416
3422
|
webhook_url?: string;
|
|
3417
3423
|
};
|
|
@@ -3889,15 +3895,16 @@ interface components {
|
|
|
3889
3895
|
/**
|
|
3890
3896
|
* @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.
|
|
3891
3897
|
*
|
|
3892
|
-
* - `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.
|
|
3898
|
+
* - `new_account` / `change_state_account`: an account was connected, or its state changed — it stopped working, its token was refreshed, it was disconnected. A WhatsApp number disconnected from the WhatsApp Business app (or by Meta, after about 14 days without the phone using the app) arrives here with `error_code` 717. 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.
|
|
3893
3899
|
* - `messages`: a message came in. It travels in `messageObj`.
|
|
3894
3900
|
* - `messaging_postbacks`: the contact pressed a button or a quick reply. Also in `messageObj`.
|
|
3895
3901
|
* - `messaging_seen`: the contact read the conversation. `messageObj` carries the message they read, when we still have it.
|
|
3896
3902
|
* - `messaging_error`: the network refused a message we sent. The reason is in `messageObj.message_errors`.
|
|
3903
|
+
* - `message_echoes`: WhatsApp only, when the number is also used in the **WhatsApp Business app** on a phone. The business replied from the app, and the reply travels in `messageObj` as **our** message (`contact_id` is set, `from_contact_id` is not). It is a separate `field` on purpose: a bot that answers every `messages` must not answer the business itself.
|
|
3897
3904
|
* - `comments`: a comment came in. It travels in `commentObj`, never in `messageObj`.
|
|
3898
3905
|
* @enum {string}
|
|
3899
3906
|
*/
|
|
3900
|
-
field: "new_account" | "change_state_account" | "messages" | "messaging_postbacks" | "messaging_seen" | "messaging_error" | "comments";
|
|
3907
|
+
field: "new_account" | "change_state_account" | "messages" | "messaging_postbacks" | "messaging_seen" | "messaging_error" | "message_echoes" | "comments";
|
|
3901
3908
|
id_account: string;
|
|
3902
3909
|
/** @description Only for messaging fields. A comment has no contact: its author is not someone you can write to. */
|
|
3903
3910
|
id_contact?: string;
|
|
@@ -4470,6 +4477,16 @@ interface components {
|
|
|
4470
4477
|
contact_id?: string | components["schemas"]["Contact"];
|
|
4471
4478
|
/** Format: date-time */
|
|
4472
4479
|
creation_date: string;
|
|
4480
|
+
/**
|
|
4481
|
+
* Format: date-time
|
|
4482
|
+
* @description When the contact **deleted** this message for everyone (WhatsApp allows it for two days). The message stays in the thread with no `text` and no files.
|
|
4483
|
+
*/
|
|
4484
|
+
deleted_date?: string;
|
|
4485
|
+
/**
|
|
4486
|
+
* Format: date-time
|
|
4487
|
+
* @description When the contact **edited** this message on the network (WhatsApp allows it for 15 minutes). `text` is already the edited text; the original is not kept.
|
|
4488
|
+
*/
|
|
4489
|
+
edit_date?: string;
|
|
4473
4490
|
/** @description Identifier of this message on the network. */
|
|
4474
4491
|
element_external_id?: string;
|
|
4475
4492
|
/** @description Set when the **contact** wrote to us. */
|
|
@@ -4564,9 +4581,11 @@ interface components {
|
|
|
4564
4581
|
};
|
|
4565
4582
|
/**
|
|
4566
4583
|
* @description What kind of message this is. `simple_message` and `file_message` work everywhere; the rest are network-specific shapes.
|
|
4584
|
+
*
|
|
4585
|
+
* `unsupported_message` only ever **arrives**: a WhatsApp message that cannot be shown through the API (a voice note, a document, a sticker, or a type WhatsApp does not let the API read). It carries no files, keeps the caption as `text` when there is one, and may carry the network's reason in `message_errors`. If the number is also in the WhatsApp Business app, the message can be read there. Sending one is refused.
|
|
4567
4586
|
* @enum {string}
|
|
4568
4587
|
*/
|
|
4569
|
-
MessageType: "simple_message" | "file_message" | "comment_message" | "publication_message" | "quick_reply_message" | "button_message" | "elements_message" | "postback_message" | "template_message" | "interactive_message";
|
|
4588
|
+
MessageType: "simple_message" | "file_message" | "comment_message" | "publication_message" | "quick_reply_message" | "button_message" | "elements_message" | "postback_message" | "template_message" | "interactive_message" | "unsupported_message";
|
|
4570
4589
|
/**
|
|
4571
4590
|
* @description Metrics translated to a **common vocabulary** shared by every network, which is what makes two networks comparable and summable (each network names them differently: `page_post_engagements`, `total_interactions`, `views`…).
|
|
4572
4591
|
*
|
|
@@ -13814,7 +13833,7 @@ type WebhookAlgorithm = keyof typeof WEBHOOK_SIGNATURE_HEADERS;
|
|
|
13814
13833
|
* **La lista crece**, así que un `field` desconocido se ignora en vez de romper: para eso está
|
|
13815
13834
|
* {@link UnknownWebhookChange}.
|
|
13816
13835
|
*/
|
|
13817
|
-
declare const WEBHOOK_EVENTS: readonly ["new_account", "change_state_account", "messages", "messaging_postbacks", "messaging_seen", "messaging_error", "comments", "integration_error", "ai_plan_generated", "ai_plan_failed"];
|
|
13836
|
+
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"];
|
|
13818
13837
|
type WebhookEvent = (typeof WEBHOOK_EVENTS)[number];
|
|
13819
13838
|
/** Lo que trae todo cambio que cuelga de una CUENTA, pase lo que pase. */
|
|
13820
13839
|
interface AccountWebhookChangeBase {
|
|
@@ -13846,6 +13865,21 @@ interface MessageChange extends AccountWebhookChangeBase {
|
|
|
13846
13865
|
/** El contacto del otro lado. Un comentario no tiene, y por eso aquí sí y allí no. */
|
|
13847
13866
|
id_contact?: string;
|
|
13848
13867
|
}
|
|
13868
|
+
/**
|
|
13869
|
+
* WhatsApp, cuando el número se usa también en la **app WhatsApp Business** del móvil: el negocio
|
|
13870
|
+
* contestó desde la app. `messageObj` es un mensaje **nuestro** —lleva `contact_id`, el contacto al
|
|
13871
|
+
* que se escribió, y no `from_contact_id`— y llega poblado, como en {@link MessageChange}.
|
|
13872
|
+
*
|
|
13873
|
+
* Es un evento aparte a propósito, y {@link isMessageChange} **no** lo incluye: un bot que contesta a
|
|
13874
|
+
* cada mensaje que entra no tiene que contestarle al propio negocio. Guárdalo en el hilo y ya. No
|
|
13875
|
+
* abre la ventana de 24 horas de WhatsApp.
|
|
13876
|
+
*/
|
|
13877
|
+
interface MessageEchoChange extends AccountWebhookChangeBase {
|
|
13878
|
+
field: "message_echoes";
|
|
13879
|
+
messageObj?: Message;
|
|
13880
|
+
/** El contacto al que escribió el negocio */
|
|
13881
|
+
id_contact?: string;
|
|
13882
|
+
}
|
|
13849
13883
|
/**
|
|
13850
13884
|
* Llegó un comentario.
|
|
13851
13885
|
*
|
|
@@ -13927,11 +13961,16 @@ interface UnknownWebhookChange {
|
|
|
13927
13961
|
* `CommentChange | UnknownWebhookChange`. Para estrechar de verdad están los predicados
|
|
13928
13962
|
* {@link isCommentChange} y compañía, que es la forma recomendada.
|
|
13929
13963
|
*/
|
|
13930
|
-
type WebhookChange = AccountStateChange | MessageChange | CommentChange | IntegrationErrorChange | AiPlanChange | UnknownWebhookChange;
|
|
13964
|
+
type WebhookChange = AccountStateChange | MessageChange | MessageEchoChange | CommentChange | IntegrationErrorChange | AiPlanChange | UnknownWebhookChange;
|
|
13931
13965
|
/** Una cuenta se conectó o cambió de estado. */
|
|
13932
13966
|
declare function isAccountStateChange(change: WebhookChange): change is AccountStateChange;
|
|
13933
13967
|
/** Algo pasó en la mensajería. Incluye el visto y el rechazo de la red, no sólo el mensaje nuevo. */
|
|
13934
13968
|
declare function isMessageChange(change: WebhookChange): change is MessageChange;
|
|
13969
|
+
/**
|
|
13970
|
+
* El negocio contestó desde la app WhatsApp Business del móvil. No es un mensaje entrante: no lo
|
|
13971
|
+
* contestes. {@link isMessageChange} no lo incluye.
|
|
13972
|
+
*/
|
|
13973
|
+
declare function isMessageEchoChange(change: WebhookChange): change is MessageEchoChange;
|
|
13935
13974
|
/** Llegó un comentario. */
|
|
13936
13975
|
declare function isCommentChange(change: WebhookChange): change is CommentChange;
|
|
13937
13976
|
/** Una integración dejó de funcionar. */
|
|
@@ -14080,4 +14119,4 @@ interface PlanVortexWebhooksOptions {
|
|
|
14080
14119
|
*/
|
|
14081
14120
|
declare function planvortexWebhooks(options: PlanVortexWebhooksOptions): (request: WebhookRequestLike, response: WebhookResponseLike, next: (error?: unknown) => void) => void;
|
|
14082
14121
|
|
|
14083
|
-
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,
|
|
14122
|
+
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 };
|