planvortex 0.20.0 → 0.21.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
@@ -437,7 +437,7 @@ if you would rather branch on `error.family`.
437
437
  | 1100-1111 | Organizations | `OrganizationError` |
438
438
  | 1200-1207 | Roles | `PlanVortexError` |
439
439
  | 1300-1308, 1400-1408 | Plan quota exhausted, at client and organization level | `PlanLimitError` |
440
- | 1500-1516 | Messaging | `MessagingError` |
440
+ | 1500-1517 | Messaging | `MessagingError` |
441
441
  | 1600-1601 | Contacts | `ContactError` |
442
442
  | 1900-1906 | Payments | `PlanVortexError` |
443
443
  | 2000-2099 | Products | `ProductError` |
@@ -26,8 +26,9 @@ var PLANVORTEX_ERROR_RANGES = [
26
26
  //1513 y 1514 son las plantillas de WhatsApp: el formato que Meta rechazaria sin decir por que,
27
27
  //y Meta rechazandola al crearla. Nacieron por encima del techo, la cuarta vez que pasa. 1515 y
28
28
  //1516 son los archivos que llegan de la red: 1515 = la red ya no lo tiene (tambien en un
29
- //comentario), 1516 = ese mensaje o esa posicion no existen.
30
- { from: 1500, to: 1516, family: "messaging" },
29
+ //comentario), 1516 = ese mensaje o esa posicion no existen. 1517 = ese audio o video no se pudo
30
+ //convertir con `playable` (el original sigue ahi sin el parametro): la quinta vez.
31
+ { from: 1500, to: 1517, family: "messaging" },
31
32
  { from: 1600, to: 1601, family: "contact" },
32
33
  { from: 1900, to: 1906, family: "payment" },
33
34
  { from: 2e3, to: 2099, family: "product" },
@@ -161,5 +162,5 @@ function isTokenError(error) {
161
162
  }
162
163
 
163
164
  export { AccountError, AiPlanError, AuthError, ContactError, FileError, IntegrationError, MessagingError, NO_ERROR_CODE, OrganizationError, PLANVORTEX_ERROR_RANGES, PlanLimitError, PlanVortexAuthenticationError, PlanVortexConfigError, PlanVortexConnectionError, PlanVortexError, ProductError, PublicationError, TOKEN_ERROR_CODES, UserError, createErrorFromResponse, errorFamilyForCode, isPlanVortexError, isTokenError };
164
- //# sourceMappingURL=chunk-DRVCK5JO.js.map
165
- //# sourceMappingURL=chunk-DRVCK5JO.js.map
165
+ //# sourceMappingURL=chunk-A77VAAQH.js.map
166
+ //# sourceMappingURL=chunk-A77VAAQH.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/core/errors.ts"],"names":[],"mappings":";AAuBO,IAAM,uBAAA,GAA2D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMpE,EAAE,IAAA,EAAM,GAAA,EAAK,EAAA,EAAI,GAAA,EAAK,QAAQ,MAAA,EAAO;AAAA,EACrC,EAAE,IAAA,EAAM,GAAA,EAAK,EAAA,EAAI,GAAA,EAAK,QAAQ,MAAA,EAAO;AAAA;AAAA;AAAA,EAGrC,EAAE,IAAA,EAAM,GAAA,EAAK,EAAA,EAAI,GAAA,EAAK,QAAQ,SAAA,EAAU;AAAA,EACxC,EAAE,IAAA,EAAM,GAAA,EAAK,EAAA,EAAI,GAAA,EAAK,QAAQ,MAAA,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMrC,EAAE,IAAA,EAAM,GAAA,EAAK,EAAA,EAAI,GAAA,EAAK,QAAQ,aAAA,EAAc;AAAA,EAC5C,EAAE,IAAA,EAAM,GAAA,EAAM,EAAA,EAAI,IAAA,EAAM,QAAQ,SAAA,EAAU;AAAA,EAC1C,EAAE,IAAA,EAAM,IAAA,EAAM,EAAA,EAAI,IAAA,EAAM,QAAQ,cAAA,EAAe;AAAA,EAC/C,EAAE,IAAA,EAAM,IAAA,EAAM,EAAA,EAAI,IAAA,EAAM,QAAQ,MAAA,EAAO;AAAA;AAAA,EAEvC,EAAE,IAAA,EAAM,IAAA,EAAM,EAAA,EAAI,IAAA,EAAM,QAAQ,YAAA,EAAa;AAAA,EAC7C,EAAE,IAAA,EAAM,IAAA,EAAM,EAAA,EAAI,IAAA,EAAM,QAAQ,YAAA,EAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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,aAAa,KAAA,EAAyB;AAClD,EAAA,OAAO,kBAAkB,KAAK,CAAA,IAAK,iBAAA,CAAkB,QAAA,CAAS,MAAM,IAAI,CAAA;AAC5E","file":"chunk-A77VAAQH.js","sourcesContent":["/**\n * El catálogo de errores de PlanVortex, por rangos, y las clases que salen de él.\n *\n * LA REGLA, y no es negociable: **los errores se clasifican por `body.code`, nunca por el status\n * HTTP.** Todo error de dominio viaja con un 400 — un token caducado, una cuenta desconectada, el\n * cupo del plan agotado y un texto demasiado largo son los cuatro un 400. Sólo el 520 (permisos)\n * sale 401 y un fallo inesperado sale 500. Un `if (response.status === 401) refreshToken()` sería\n * un bug silencioso: los códigos de token, 501 y 522, viajan dentro de un 400.\n *\n * El catálogo del servidor crece cada mes, así que un código fuera de estos rangos NO es un error\n * del cliente: cae en la clase base con su `code` y su `message` intactos. Nunca se traga y nunca\n * se renombra.\n */\n\nexport type PlanVortexErrorRange = {\n /** Primer código del rango, incluido */\n from: number;\n /** Último código del rango, incluido */\n to: number;\n /** Qué familia de problemas es */\n family: string;\n};\n\nexport const PLANVORTEX_ERROR_RANGES: readonly PlanVortexErrorRange[] = [\n //Hasta 548, no 544: la API publica se abrio a todos los planes y trajo dos codigos nuevos\n //—545 (ritmo por plan, que sale 429) y 546 (correo sin verificar al crear una app)—, y las\n //apps dos mas —547 (el identificador de una app no se cambia) y 548 (fallo al rotar el\n //secreto, que es justo lo que estreno `apps.rotateSecret`)—. Y hasta 554 desde que el selector\n //de cuentas puede ponerlo el integrador (549-554: el modo y su sesion de conexion).\n { from: 500, to: 554, family: \"auth\" },\n { from: 601, to: 612, family: \"user\" },\n //716: la sesion de Bluesky la esta renovando otro proceso. Es temporal, y fuera de familia no\n //habia forma de saber que la respuesta es reintentar.\n { from: 700, to: 716, family: \"account\" },\n { from: 800, to: 810, family: \"file\" },\n //El techo sube con el catalogo del servidor, y subir tarde no da un error: da un consejo\n //equivocado. Los codigos de Bluesky, Discord, Telegram y Threads (961-977) y los dos frenos\n //de ritmo de la fase de publicaciones ilimitadas (978, 979) nacieron por encima de 960 y\n //caian fuera de toda familia. Slack estreno el 980-986, que es el mismo caso otra vez, y\n //Pinterest el 987-996 — la tercera vez.\n { from: 900, to: 996, family: \"publication\" },\n { from: 1000, to: 1003, family: \"general\" },\n { from: 1100, to: 1111, family: \"organization\" },\n { from: 1200, to: 1207, family: \"role\" },\n //1308 es el tope de APPS del plan, que nacio al quitar el candado de precio de la API.\n { from: 1300, to: 1308, family: \"plan_limit\" },\n { from: 1400, to: 1408, family: \"plan_limit\" },\n //1513 y 1514 son las plantillas de WhatsApp: el formato que Meta rechazaria sin decir por que,\n //y Meta rechazandola al crearla. Nacieron por encima del techo, la cuarta vez que pasa. 1515 y\n //1516 son los archivos que llegan de la red: 1515 = la red ya no lo tiene (tambien en un\n //comentario), 1516 = ese mensaje o esa posicion no existen. 1517 = ese audio o video no se pudo\n //convertir con `playable` (el original sigue ahi sin el parametro): la quinta vez.\n { from: 1500, to: 1517, family: \"messaging\" },\n { from: 1600, to: 1601, family: \"contact\" },\n { from: 1900, to: 1906, family: \"payment\" },\n { from: 2000, to: 2099, family: \"product\" },\n { from: 2100, to: 2199, family: \"ai_plan\" },\n { from: 2200, to: 2299, family: \"integration\" },\n //Los COMENTARIOS siguen aquí porque sus 945-948 se llenaron, y van con ellos a `publication`:\n //el 2600 (esta cuenta no tiene bandeja, un perfil personal de LinkedIn) es la versión por\n //cuenta del 945, y separarlos daría dos clases para el mismo «aquí no hay comentarios».\n //Los campos de publicación que no cabían en los 9xx (2500-2507: visibilidad, niños, y lo que\n //exige la auditoría de TikTok). Casi todos viajan en `publication_errors`, pero el 2508 se\n //LANZA: `accounts.publishSettings()` en una red que no los tiene.\n { from: 2500, to: 2599, family: \"publication\" },\n { from: 2600, to: 2699, family: \"publication\" },\n] as const;\n\n/**\n * El `code` que lleva un error que **no** trae código del servidor: un fallo de red, un timeout, un\n * 502 de un proxy con cuerpo HTML, o el propio constructor quejándose de la configuración.\n *\n * El servidor no emite nunca el 0, así que sirve de centinela sin pisar el catálogo. Cuál de esos\n * casos es se distingue por `family`: `connection`, `http`, `oauth`, `config` o `webhook`.\n */\nexport const NO_ERROR_CODE = 0;\n\n/**\n * Los dos códigos que significan \"tu token ya no sirve\". Los dos llegan **dentro de un 400**, que es\n * justo por lo que existe esta constante: quien mire el status no los va a encontrar.\n *\n * El 520 (permisos) NO está aquí a propósito: sale 401, pero pedir un token nuevo no lo arregla — a\n * la app le faltan permisos, y con un token recién emitido le seguirán faltando.\n */\nexport const TOKEN_ERROR_CODES: readonly number[] = [501, 522];\n\n/** Opciones de construcción de un error. Todas opcionales: un error siempre se puede construir. */\nexport interface PlanVortexErrorOptions {\n /** El `data` del cuerpo — lo que el servidor adjuntó con `.withData({...})`. `{}` si no vino nada. */\n data?: Record<string, unknown>;\n /** Status HTTP. `undefined` cuando la petición no llegó a tener respuesta. */\n status?: number;\n /** `x-request-id` de la respuesta, si el despliegue lo pone delante. */\n requestId?: string;\n /** Segundos de la cabecera `Retry-After`, cuando la hay. */\n retryAfter?: number;\n /** El error original (un `TypeError` de `fetch`, por ejemplo). */\n cause?: unknown;\n /**\n * Familia, sólo para los errores que NO salen del catálogo: `connection`, `http`, `oauth`,\n * `config` y `webhook`. Los de dominio la deducen de su `code` y no la pasan nunca.\n */\n family?: string;\n}\n\n/**\n * La base de todo lo que lanza esta librería.\n *\n * Un `catch (e) { if (e instanceof PlanVortexError) }` los coge todos: los de dominio, los de red y\n * los de configuración. Para afinar están las subclases y el `code`.\n */\nexport class PlanVortexError extends Error {\n /** El `code` del cuerpo, tal cual. {@link NO_ERROR_CODE} si el error no viene del catálogo. */\n readonly code: number;\n /** La familia del rango: `auth`, `publication`, `plan_limit`... Ver {@link PLANVORTEX_ERROR_RANGES}. */\n readonly family: string;\n /** El `data` del cuerpo. */\n readonly data: Record<string, unknown>;\n /** Status HTTP, o `undefined` si nunca hubo respuesta. */\n readonly status: number | undefined;\n /** `x-request-id`, si el despliegue lo pone. Hoy el servidor no lo emite; un proxy delante sí. */\n readonly requestId: string | undefined;\n /** Segundos que pidió esperar la cabecera `Retry-After`, si llegó. */\n readonly retryAfter: number | undefined;\n\n constructor(code: number, message: string, options: PlanVortexErrorOptions = {}) {\n super(message, options.cause === undefined ? undefined : { cause: options.cause });\n this.name = new.target.name;\n this.code = code;\n this.family = options.family ?? errorFamilyForCode(code) ?? \"unknown\";\n this.data = options.data ?? {};\n this.status = options.status;\n this.requestId = options.requestId;\n this.retryAfter = options.retryAfter;\n }\n}\n\n/** 500-554 — tokens, apps de cliente, permisos, sesiones de conexion. Incluye el 501 y el 522, los de token caducado. */\nexport class AuthError extends PlanVortexError {}\n/** 601-612 — el usuario final. */\nexport class UserError extends PlanVortexError {}\n/** 700-716 — cuentas sociales: desconectada, sin permisos en la red, sin refrescar. */\nexport class AccountError extends PlanVortexError {}\n/** 800-810 — ficheros: formato no admitido, demasiado grande, conversión fallida. */\nexport class FileError extends PlanVortexError {}\n/** 900-996 — publicaciones, incluidos los límites por red (caracteres, imágenes, duración), los\n * dos frenos de ritmo —978 (demasiado rápido en esta cuenta) y 979 (tope diario de esa red)—, los\n * de Slack (980-986), que empiezan por el más común: 980, la app no está en el canal, y los de\n * Pinterest (987-996), que empiezan igual: 987, la publicación no dice en qué tablero va. Y uno\n * de ellos no es un fallo: el 991 es Pinterest frenando a la aplicación, sale 429 con\n * `Retry-After` y la respuesta es esperar. */\nexport class PublicationError extends PlanVortexError {}\n/** 1100-1111 — organizaciones, y el token temporal atado a una sola de ellas (1101). */\nexport class OrganizationError extends PlanVortexError {}\n/**\n * 1300-1308 y 1400-1408 — el cupo del plan, del cliente o de la organización.\n *\n * Es el error que un integrador **sí** quiere distinguir: no se arregla reintentando, se arregla\n * cambiando de plan. Por eso los dos rangos comparten clase.\n */\nexport class PlanLimitError extends PlanVortexError {}\n/** 1500-1517 — conversaciones, mensajes, plantillas y sus archivos. Exige plan de pago. */\nexport class MessagingError extends PlanVortexError {}\n/** 1600-1601 — contactos. */\nexport class ContactError extends PlanVortexError {}\n/** 2000-2099 — catálogos y productos (sólo Facebook e Instagram). */\nexport class ProductError extends PlanVortexError {}\n/** 2100-2199 — planes de publicaciones generados con IA. */\nexport class AiPlanError extends PlanVortexError {}\n/** 2200-2299 — integraciones: Google Drive, RSS. */\nexport class IntegrationError extends PlanVortexError {}\n\n/**\n * La petición no llegó a tener respuesta: DNS, conexión rechazada, socket cortado o timeout.\n *\n * No lleva código del catálogo porque el servidor nunca llegó a opinar.\n */\nexport class PlanVortexConnectionError extends PlanVortexError {\n /** `true` si lo que se agotó fue nuestro propio timeout, no la red. */\n readonly timeout: boolean;\n\n constructor(message: string, options: PlanVortexErrorOptions & { timeout?: boolean } = {}) {\n super(NO_ERROR_CODE, message, { ...options, family: \"connection\" });\n this.timeout = options.timeout ?? false;\n }\n}\n\n/**\n * `POST /oauth/token` rechazó las credenciales.\n *\n * Es el ÚNICO sitio del API con forma de error distinta: `{error, error_description}` de OAuth2, no\n * el `{code, message, data}` de todo lo demás. Y por eso el `code` es {@link NO_ERROR_CODE}: el\n * servidor tiene códigos para esto (538-541) pero **no los manda en el cuerpo**, así que ponerlos\n * aquí sería inventarse algo que nadie dijo. Lo que sí viaja es `oauthError`.\n */\nexport class PlanVortexAuthenticationError extends PlanVortexError {\n /** `invalid_client`, `invalid_request`, `unsupported_grant_type`, `slow_down` o `server_error`. */\n readonly oauthError: string;\n\n constructor(oauthError: string, description: string, options: PlanVortexErrorOptions = {}) {\n super(NO_ERROR_CODE, description, { ...options, family: \"oauth\" });\n this.oauthError = oauthError;\n }\n}\n\n/**\n * La librería está mal configurada y no ha llegado a salir de casa: sin credenciales, o instanciada\n * en un navegador (§ trampa 9 del roadmap).\n */\nexport class PlanVortexConfigError extends PlanVortexError {\n constructor(message: string) {\n super(NO_ERROR_CODE, message, { family: \"config\" });\n }\n}\n\n/** La familia a la que pertenece un código, o `undefined` si cae fuera del catálogo conocido. */\nexport function errorFamilyForCode(code: number): string | undefined {\n return PLANVORTEX_ERROR_RANGES.find((range) => code >= range.from && code <= range.to)?.family;\n}\n\n/**\n * Familia -> clase. Las que faltan —`general`, `role`, `payment` y cualquier rango nuevo— caen a\n * propósito en la clase base: existen en el servidor pero no son superficie de integración, y darles\n * clase propia sería prometer un `instanceof` que luego habría que mantener.\n */\nconst FAMILY_CLASSES: Record<string, typeof PlanVortexError> = {\n auth: AuthError,\n user: UserError,\n account: AccountError,\n file: FileError,\n publication: PublicationError,\n organization: OrganizationError,\n plan_limit: PlanLimitError,\n messaging: MessagingError,\n contact: ContactError,\n product: ProductError,\n ai_plan: AiPlanError,\n integration: IntegrationError,\n};\n\n/** El cuerpo de error del API: `{code, message, data}`. */\nexport interface ApiErrorBody {\n code: number;\n message?: string;\n data?: Record<string, unknown>;\n}\n\nfunction isApiErrorBody(body: unknown): body is ApiErrorBody {\n return typeof body === \"object\" && body !== null && typeof (body as ApiErrorBody).code === \"number\";\n}\n\n/**\n * Convierte una respuesta de error en la clase que le toca.\n *\n * Un cuerpo sin `code` —un 502 de un proxy, la página HTML de un balanceador— no es un error de\n * dominio: sale como clase base con `family: \"http\"` y el cuerpo entero en `data`, que es además lo\n * que necesita `auth.ts` para reconocer el `{error, error_description}` de OAuth2.\n */\nexport function createErrorFromResponse(input: {\n body: unknown;\n status: number;\n requestId?: string | undefined;\n retryAfter?: number | undefined;\n}): PlanVortexError {\n const options: PlanVortexErrorOptions = {\n status: input.status,\n ...(input.requestId === undefined ? {} : { requestId: input.requestId }),\n ...(input.retryAfter === undefined ? {} : { retryAfter: input.retryAfter }),\n };\n\n if (isApiErrorBody(input.body)) {\n const family = errorFamilyForCode(input.body.code);\n const ErrorClass = (family === undefined ? undefined : FAMILY_CLASSES[family]) ?? PlanVortexError;\n return new ErrorClass(input.body.code, input.body.message ?? \"PlanVortex error\", {\n ...options,\n data: input.body.data ?? {},\n });\n }\n\n return new PlanVortexError(NO_ERROR_CODE, `HTTP ${input.status}`, {\n ...options,\n family: \"http\",\n data:\n typeof input.body === \"object\" && input.body !== null\n ? (input.body as Record<string, unknown>)\n : { body: input.body },\n });\n}\n\n/** ¿Es un error de esta librería? Útil en un `catch` donde no apetece importar la clase. */\nexport function isPlanVortexError(error: unknown): error is PlanVortexError {\n return error instanceof PlanVortexError;\n}\n\n/**\n * ¿Dice este error que el token ya no sirve? (los códigos 501 y 522, los dos dentro de un 400).\n *\n * Es lo que dispara el único reintento con token nuevo del cliente.\n */\nexport function isTokenError(error: unknown): boolean {\n return isPlanVortexError(error) && TOKEN_ERROR_CODES.includes(error.code);\n}\n"]}
@@ -1124,6 +1124,8 @@ interface paths {
1124
1124
  * **The network decides how long a file lives.** WhatsApp lets go of a file 7 days after it arrived, and Meta drops one when the message or the story is deleted. After that the answer is **1515**, with `data.social_network`; on a number that also runs the WhatsApp Business app, the file is still there. **1516** means the message is not from this account, or has no file at that position.
1125
1125
  *
1126
1126
  * Images, videos and audio come back `inline`. Anything else (a PDF, a spreadsheet, an HTML file, an SVG) comes back as an `attachment`: someone outside the business sent it, so don't render it inside your own pages.
1127
+ *
1128
+ * **Playing it in a browser.** Not every format WhatsApp accepts plays in a browser: an AMR voice note or a 3GPP video plays in none, and Safari does not play the Ogg/Opus of an ordinary voice note. Add `playable=1` and an audio or a video comes back converted to a format every browser plays (`audio/mp4` or `video/mp4`). **1517** means it could not be converted; the original is still there without the parameter, and the original is what a download should give.
1127
1129
  */
1128
1130
  get: operations["getMessageFile"];
1129
1131
  put?: never;
@@ -1470,7 +1472,7 @@ interface paths {
1470
1472
  * You need it when a file has no `url`, or when its `url` stopped loading:
1471
1473
  *
1472
1474
  * • **LinkedIn** gives only the image's id, never a link.
1473
- * • **Telegram**'s download link carries the bot's token, so it never leaves PlanVortex. A bot can only download up to 20 MB: past that the answer is **1515** with `data.reason: "too_big"`, and the file is only visible in Telegram.
1475
+ * • **Telegram**'s download link carries the bot's token, so it never leaves PlanVortex. A bot can only download up to 20 MB: past that the answer is **1515** with `data.reason: "too_big"` and `data.max_mb: 20`, and the file is only visible in Telegram. Tell the user that, not that the file is gone: it is still there.
1474
1476
  * • **Bluesky** videos are an HLS playlist that browsers other than Safari do not play; this returns the video file itself.
1475
1477
  * • **Facebook, Threads and Discord** links expire; this reads the comment again and returns the file behind a fresh link.
1476
1478
  * • **X** links do not expire, and reading a post again costs money, so X is not re-read: if its `url` no longer loads, the post was deleted and the answer is **1515**.
@@ -1479,6 +1481,8 @@ interface paths {
1479
1481
  *
1480
1482
  * Images, videos and audio come back `inline`. Anything else comes back as an `attachment`: someone outside the business posted it, so don't render it inside your own pages.
1481
1483
  *
1484
+ * **Playing it in a browser.** Not every audio or video format plays in every browser: Safari does not play the Ogg/Opus of a Telegram voice note, for instance. Add `playable=1` and an audio or a video comes back converted to a format every browser plays (`audio/mp4` or `video/mp4`). **1517** means it could not be converted; the original is still there without the parameter, and the original is what a download should give.
1485
+ *
1482
1486
  * Requires the `comments:read` permission (`client_organization_comments:read` for apps) and a paid plan.
1483
1487
  */
1484
1488
  get: operations["getCommentFile"];
@@ -1641,6 +1645,8 @@ interface paths {
1641
1645
  /**
1642
1646
  * List the contacts of an organization
1643
1647
  * @description Newest first. `search` is a full-text search over the name, and `extra_data` filters by your own fields — which is what makes it possible to ask for "the contacts of this campaign" without keeping a second database.
1648
+ *
1649
+ * **A WhatsApp contact may have no phone number.** Since 2026 Meta leaves the number out for people who use a WhatsApp username and have not dealt with that business number by phone in the last 30 days. Such a contact's WhatsApp `external_identifier` is their `user_id` (the BSUID, e.g. `ES.13491208655302741918`), not a phone number, so don't show it or dial it as one. You can still write to them: PlanVortex sends through the BSUID. When their number arrives later, the same contact gets it as `external_identifier` and keeps its `_id` and its messages.
1644
1650
  */
1645
1651
  get: operations["getContacts"];
1646
1652
  put?: never;
@@ -1722,7 +1728,7 @@ interface paths {
1722
1728
  * The whole home screen in one call
1723
1729
  * @description Composes every block of the home screen in a single round trip: operational health, publications, publication metrics, account metrics, plan use, AI plans, the best AI plans and unread messages.
1724
1730
  *
1725
- * **A block the caller cannot read is omitted, not refused.** The endpoint only demands the minimum permission — reading the organization — and then checks each block on its own: somebody who can only see publications still gets their home instead of a 403. `available_blocks` says which blocks were allowed, so an absent block for lack of permission and an absent block for lack of data can be drawn differently.
1731
+ * **A block the caller cannot read is omitted, not refused.** The endpoint lets in anyone who can read at least one block (the organization, publications, publication stats, account stats, accounts, messages or AI plans) and then checks each block on its own: somebody who can only see publications gets their home with that block, not a 403. A caller who can read none of them gets `520`. `available_blocks` says which blocks were allowed, so an absent block for lack of permission and an absent block for lack of data can be drawn differently.
1726
1732
  *
1727
1733
  * The messages block is also omitted when the client's plan has no messaging.
1728
1734
  */
@@ -2462,7 +2468,7 @@ interface paths {
2462
2468
  };
2463
2469
  /**
2464
2470
  * Unread messages in the organization
2465
- * @description How many incoming messages are still unread across every account of the organization. It is the number for a badge, and it costs one query: do not compute it by walking the conversations.
2471
+ * @description How many incoming messages are still unread across every account of the organization, in total and per account. `total` is the number for a badge; `accounts` says which account holds them, so an inbox can mark the right one instead of making the user open each. It costs one query: do not compute it by walking the conversations.
2466
2472
  */
2467
2473
  get: operations["getUnreadMessages"];
2468
2474
  put?: never;
@@ -2666,6 +2672,8 @@ interface paths {
2666
2672
  *
2667
2673
  * **Four more are what TikTok's content sharing guidelines ask a composer to show**, and are `true` only on `tiktok` today: `visibility` (on TikTok, with no default), `interactions`, `commercial_content`, and `publish_settings`, which says the options each account allows must be read from `GET /organizations/{id_organization}/accounts/{id_account}/publish_settings` instead of a fixed list.
2668
2674
  *
2675
+ * **`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.
2676
+ *
2669
2677
  * 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.
2670
2678
  *
2671
2679
  * Only needs authentication.
@@ -2806,7 +2814,7 @@ interface webhooks {
2806
2814
  *
2807
2815
  * 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.
2808
2816
  *
2809
- * 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`.
2817
+ * 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`.
2810
2818
  *
2811
2819
  * ### Verifying the signature
2812
2820
  *
@@ -3959,6 +3967,8 @@ interface components {
3959
3967
  publish_settings: boolean;
3960
3968
  /** @description The publication can say **who can reply** to it (`reply_control`): anyone, the account's followers, the profiles it follows or the profiles mentioned in the text. It is set when the publication goes out and cannot be changed afterwards. On a network that answers `false` the field is deleted on save, so do not offer it. Today only `threads`. */
3961
3969
  reply_control: boolean;
3970
+ /** @description PlanVortex reads **statistics** for this network: account metrics (`GET /organizations/{id_organization}/accounts/{id_account}/metrics`, whose names come from `.../metric_list`) and, on the networks that publish, the metrics of each publication. It is `true` exactly when the network declares at least one account metric, so it never promises a statistics screen that would stay empty. Today every network but `whatsapp`, which does not publish and has none. */
3971
+ statistics: boolean;
3962
3972
  /** @description The publication can say **who can see it** when it goes out (`visibility`). On a network that answers `false` the field is deleted on save, so do not offer it. Today `youtube` (public, unlisted, private) and `tiktok` (public, friends, followers, private; which ones each account allows comes from `publish_settings`). */
3963
3973
  visibility: boolean;
3964
3974
  webhooks: boolean;
@@ -4076,7 +4086,7 @@ interface components {
4076
4086
  ContactsSocialIdentifierInput: {
4077
4087
  /** @description Only when you are keeping an identifier the API already gave you. */
4078
4088
  _id?: string;
4079
- /** @description The contact id on that channel — the phone number on WhatsApp, the PSID on Messenger. Optional in the model, but a contact without it cannot be written to, and it is what deduplicates on create. */
4089
+ /** @description The contact id on that channel — the phone number on WhatsApp, the PSID on Messenger. Optional in the model, but a contact without it cannot be written to, and it is what deduplicates on create. On WhatsApp, for someone whose number you don't have, the `user_id` (BSUID) of a contact the API already returned also works: PlanVortex then writes to them through it. */
4080
4090
  external_identifier?: string;
4081
4091
  social_network: components["schemas"]["ContactChannel"];
4082
4092
  };
@@ -4322,7 +4332,7 @@ interface components {
4322
4332
  * The catalogue grows with the product, so treat an unknown `code` as a generic failure instead of rejecting it.
4323
4333
  */
4324
4334
  Error: {
4325
- /** @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-1516 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. */
4335
+ /** @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. */
4326
4336
  code: number;
4327
4337
  /** @description Extra context attached to the error, when there is any. */
4328
4338
  data?: {
@@ -4579,6 +4589,28 @@ interface components {
4579
4589
  message_errors: components["schemas"]["Error"][];
4580
4590
  message_options: components["schemas"]["MessageOptions"];
4581
4591
  message_type: components["schemas"]["MessageType"];
4592
+ /**
4593
+ * @description The emoji reactions this message has on the network: WhatsApp, Instagram, Messenger and Bluesky. On WhatsApp, Instagram and Messenger each side has at most one reaction per message, and a new one replaces the old; on Bluesky one person can add several. Empty when there are none.
4594
+ *
4595
+ * A reaction is not a new message and **no webhook event is sent** for it: the message itself changes, and the next read returns it with its `reactions`. A reaction to a message PlanVortex never received (sent before the account was connected) is not recorded. On Bluesky, which has no webhook, a new reaction is picked up within a few minutes, and a removed one the next time the conversation is read.
4596
+ */
4597
+ reactions?: {
4598
+ /**
4599
+ * @description Who reacted: the `contact`, or the `account` itself (the business, from the network's own app or inbox).
4600
+ * @enum {string}
4601
+ */
4602
+ by: "contact" | "account";
4603
+ /**
4604
+ * Format: date-time
4605
+ * @description When the reaction was added.
4606
+ */
4607
+ date: string;
4608
+ /**
4609
+ * @description The emoji, as the network sends it.
4610
+ * @example 👍
4611
+ */
4612
+ emoji: string;
4613
+ }[];
4582
4614
  read: boolean;
4583
4615
  /** @description Absent on the messages that carry no text of their own, such as a `messaging_seen` acknowledgement. */
4584
4616
  text?: string;
@@ -4658,7 +4690,7 @@ interface components {
4658
4690
  /**
4659
4691
  * @description What kind of message this is. `simple_message` and `file_message` work everywhere; the rest are network-specific shapes.
4660
4692
  *
4661
- * `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.
4693
+ * `unsupported_message` only ever **arrives**: a message the network does not let the API show. On WhatsApp it is a type the API cannot read, with WhatsApp's reason in `message_errors`; if the number is also in the WhatsApp Business app, the message can be read there. On Instagram and Messenger it is something that is not a file, such as an audio shared from Instagram's own library, which arrives as an empty template. It carries no files and keeps the caption as `text` when there is one. Sending one is refused.
4662
4694
  * @enum {string}
4663
4695
  */
4664
4696
  MessageType: "simple_message" | "file_message" | "comment_message" | "publication_message" | "quick_reply_message" | "button_message" | "elements_message" | "postback_message" | "template_message" | "interactive_message" | "unsupported_message";
@@ -5469,7 +5501,7 @@ interface components {
5469
5501
  /** @description The same person, on one channel. */
5470
5502
  SocialIdentifier: {
5471
5503
  _id: string;
5472
- /** @description Identifier of the contact on that channel. */
5504
+ /** @description Identifier of the contact on that channel. On WhatsApp it is the phone number, digits only, **except** for someone who uses a WhatsApp username and has not shared their number with that business number: then it is their `user_id` (the BSUID, e.g. `ES.13491208655302741918`). It has a country code and a dot in front, so it never looks like a phone number. Don't show it or dial it as one. */
5473
5505
  external_identifier?: string;
5474
5506
  /**
5475
5507
  * Format: date-time
@@ -5477,6 +5509,8 @@ interface components {
5477
5509
  */
5478
5510
  last_send_date?: string;
5479
5511
  social_network: components["schemas"]["ContactChannel"];
5512
+ /** @description **WhatsApp only.** The person's business-scoped user id at Meta (BSUID), e.g. `ES.13491208655302741918`. Meta sends it with every message, and since 2026 it may leave the phone number out for people who use a username and have not dealt with that business number by phone in the last 30 days. When there is no phone number it is also the `external_identifier`, and PlanVortex writes to the contact through it. Treat it as opaque: it is scoped to Meta's business portfolio, and it changes when the person changes their number (PlanVortex updates the contact when that happens). */
5513
+ user_id?: string;
5480
5514
  };
5481
5515
  /**
5482
5516
  * @description A social network supported by PlanVortex.
@@ -7941,8 +7975,10 @@ interface operations {
7941
7975
  * @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.
7942
7976
  *
7943
7977
  * `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.
7978
+ *
7979
+ * `statistics` leaves out the networks PlanVortex reads no metric from (today `whatsapp`): the accounts worth offering on a statistics screen.
7944
7980
  */
7945
- capability?: "publications" | "messages" | "products" | "webhooks" | "persistent_menu" | "comments";
7981
+ capability?: "publications" | "messages" | "products" | "webhooks" | "persistent_menu" | "comments" | "statistics";
7946
7982
  /** @description The limit of records will be retrieved (pagination) */
7947
7983
  limit?: number;
7948
7984
  /** @description Free-text search over the account's name and username. */
@@ -8691,7 +8727,10 @@ interface operations {
8691
8727
  };
8692
8728
  getMessageFile: {
8693
8729
  parameters: {
8694
- query?: never;
8730
+ query?: {
8731
+ /** @description `1` (or `true`) returns an audio or a video in a format every browser plays: audio as AAC in an M4A (`audio/mp4`), video as H.264 with AAC in an MP4 (`video/mp4`). Ask for it only when your player can't open the original. Images and documents come back unchanged. **1517** means it could not be converted (`data.reason`: `too_big` past 64 MB, or `unreadable`); the original is still there without this parameter. Offer the original for download, not the converted copy. */
8732
+ playable?: "1" | "true";
8733
+ };
8695
8734
  header?: never;
8696
8735
  path: {
8697
8736
  /** @description Connected account identifier */
@@ -8707,7 +8746,7 @@ interface operations {
8707
8746
  };
8708
8747
  requestBody?: never;
8709
8748
  responses: {
8710
- /** @description The file, with the network's `Content-Type`. */
8749
+ /** @description The file, with the network's `Content-Type`. With `playable`, an audio comes back as `audio/mp4` and a video as `video/mp4`. */
8711
8750
  200: {
8712
8751
  headers: {
8713
8752
  [name: string]: unknown;
@@ -9565,7 +9604,10 @@ interface operations {
9565
9604
  };
9566
9605
  getCommentFile: {
9567
9606
  parameters: {
9568
- query?: never;
9607
+ query?: {
9608
+ /** @description `1` (or `true`) returns an audio or a video in a format every browser plays: audio as AAC in an M4A (`audio/mp4`), video as H.264 with AAC in an MP4 (`video/mp4`). Ask for it only when your player can't open the original. Images and documents come back unchanged. **1517** means it could not be converted (`data.reason`: `too_big` past 64 MB, or `unreadable`); the original is still there without this parameter. Offer the original for download, not the converted copy. */
9609
+ playable?: "1" | "true";
9610
+ };
9569
9611
  header?: never;
9570
9612
  path: {
9571
9613
  /** @description Comment identifier (PlanVortex's `_id`, not the network's `external_id`) */
@@ -9579,7 +9621,7 @@ interface operations {
9579
9621
  };
9580
9622
  requestBody?: never;
9581
9623
  responses: {
9582
- /** @description The file, with the network's `Content-Type`. */
9624
+ /** @description The file, with the network's `Content-Type`. With `playable`, an audio comes back as `audio/mp4` and a video as `video/mp4`. */
9583
9625
  200: {
9584
9626
  headers: {
9585
9627
  [name: string]: unknown;
@@ -12000,7 +12042,29 @@ interface operations {
12000
12042
  [name: string]: unknown;
12001
12043
  };
12002
12044
  content: {
12045
+ /**
12046
+ * @example {
12047
+ * "total": 5,
12048
+ * "accounts": [
12049
+ * {
12050
+ * "id_account": "6650f1c2a8b4e1d2c3f4a5b6",
12051
+ * "total": 3
12052
+ * },
12053
+ * {
12054
+ * "id_account": "6650f1c2a8b4e1d2c3f4a5b7",
12055
+ * "total": 2
12056
+ * }
12057
+ * ]
12058
+ * }
12059
+ */
12003
12060
  "application/json": {
12061
+ /** @description The same count per account. Only accounts with something unread are listed, most unread first; an account that is missing has none. */
12062
+ accounts: {
12063
+ /** @description The account's `_id`. */
12064
+ id_account: string;
12065
+ total: number;
12066
+ }[];
12067
+ /** @description Unread incoming messages across every account. Always the sum of `accounts`. */
12004
12068
  total: number;
12005
12069
  };
12006
12070
  };
@@ -12520,7 +12584,8 @@ interface operations {
12520
12584
  * "made_for_kids": false,
12521
12585
  * "interactions": false,
12522
12586
  * "commercial_content": false,
12523
- * "publish_settings": false
12587
+ * "publish_settings": false,
12588
+ * "statistics": true
12524
12589
  * },
12525
12590
  * "google_business": {
12526
12591
  * "publications": false,
@@ -12536,7 +12601,8 @@ interface operations {
12536
12601
  * "made_for_kids": false,
12537
12602
  * "interactions": false,
12538
12603
  * "commercial_content": false,
12539
- * "publish_settings": false
12604
+ * "publish_settings": false,
12605
+ * "statistics": true
12540
12606
  * },
12541
12607
  * "pinterest": {
12542
12608
  * "publications": true,
@@ -12552,7 +12618,8 @@ interface operations {
12552
12618
  * "made_for_kids": false,
12553
12619
  * "interactions": false,
12554
12620
  * "commercial_content": false,
12555
- * "publish_settings": false
12621
+ * "publish_settings": false,
12622
+ * "statistics": true
12556
12623
  * },
12557
12624
  * "threads": {
12558
12625
  * "publications": true,
@@ -12568,7 +12635,25 @@ interface operations {
12568
12635
  * "made_for_kids": false,
12569
12636
  * "interactions": false,
12570
12637
  * "commercial_content": false,
12571
- * "publish_settings": false
12638
+ * "publish_settings": false,
12639
+ * "statistics": true
12640
+ * },
12641
+ * "whatsapp": {
12642
+ * "publications": false,
12643
+ * "messages": true,
12644
+ * "products": false,
12645
+ * "webhooks": true,
12646
+ * "persistent_menu": false,
12647
+ * "comments": false,
12648
+ * "destinations": false,
12649
+ * "link": false,
12650
+ * "reply_control": false,
12651
+ * "visibility": false,
12652
+ * "made_for_kids": false,
12653
+ * "interactions": false,
12654
+ * "commercial_content": false,
12655
+ * "publish_settings": false,
12656
+ * "statistics": false
12572
12657
  * }
12573
12658
  * }
12574
12659
  */
@@ -13427,7 +13512,15 @@ type ContactCreate = Schemas["ContactsContactCreate"];
13427
13512
  type ContactUpdate = Schemas["ContactsContactUpdate"];
13428
13513
  /** Los campos propios de un contacto: el bloque de direccion y las seis propiedades libres. */
13429
13514
  type ContactExtraData = Schemas["ContactExtraData"];
13430
- /** El mismo contacto, en un canal. Es una red social o `email`. */
13515
+ /**
13516
+ * El mismo contacto, en un canal. Es una red social o `email`.
13517
+ *
13518
+ * **EN WHATSAPP PUEDE NO HABER TELEFONO.** Desde 2026 Meta deja de mandar el numero de quien usa
13519
+ * nombre de usuario y no ha tenido trato por telefono con ese numero de negocio en 30 dias. Lo que
13520
+ * llega siempre es `user_id`, su BSUID (`ES.13491208655302741918`), y sin telefono es tambien el
13521
+ * `external_identifier`. Se reconoce porque lleva el pais y un punto delante: nunca se parece a un
13522
+ * telefono, y no se ensena ni se marca como si lo fuera. Se le puede escribir igual.
13523
+ */
13431
13524
  type SocialIdentifier = Schemas["SocialIdentifier"];
13432
13525
  /**
13433
13526
  * El mismo, tal y como se MANDA: aqui `_id` es opcional y el servidor pone uno.
@@ -13918,7 +14011,7 @@ declare class OrganizationError extends PlanVortexError {
13918
14011
  */
13919
14012
  declare class PlanLimitError extends PlanVortexError {
13920
14013
  }
13921
- /** 1500-1516 — conversaciones, mensajes, plantillas y sus archivos. Exige plan de pago. */
14014
+ /** 1500-1517 — conversaciones, mensajes, plantillas y sus archivos. Exige plan de pago. */
13922
14015
  declare class MessagingError extends PlanVortexError {
13923
14016
  }
13924
14017
  /** 1600-1601 — contactos. */