planvortex 0.20.0 → 0.22.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"]}
@@ -755,7 +755,9 @@ interface paths {
755
755
  };
756
756
  /**
757
757
  * Get an organization by identifier
758
- * @description Get one organization by its identifier
758
+ * @description Get one organization by its identifier, with what it is using of its plan (`actual_use`) and what it has been assigned (`actual_asigned`).
759
+ *
760
+ * **Anyone with a role in the organization can read it**, whatever that role's permissions are, and so can anyone with a client role, an app of the client and a temporal token of this organization. It used to require `organization:read`, and that left a role allowed to connect accounts, create AI plans or publish without knowing how much of the plan was left. `organization:read` now means seeing the plan consumption: `GET /organizations/{id_organization}/use`, `GET /organizations/{id_organization}/limits` and the `plan_use` block of the dashboard.
759
761
  */
760
762
  get: operations["getOrganization"];
761
763
  /**
@@ -991,7 +993,7 @@ interface paths {
991
993
  * Re-enable a disconnected account
992
994
  * @description Brings back an account that was removed, without going through the authorization again — as long as its stored token still works.
993
995
  *
994
- * It takes a **slot of the plan**, so it fails with error 706 when the organization is already at its account limit. It also turns the network's webhooks back on, on any plan but the free one. On the free plan a `whatsapp` account that is not active cannot be enabled (error 516), because its chat and its templates need a paid plan. One that is already active can still be reconnected.
996
+ * It takes a **slot of the plan**, so it fails with error 706 when the organization is already at its account limit. It also turns the network's webhooks back on, on any plan but the free one. On the free plan a `whatsapp` or `google_business` account that is not active cannot be enabled (error 516), because everything those networks do needs a paid plan (chat and templates on WhatsApp, reviews on Google Business). One that is already active can still be reconnected.
995
997
  *
996
998
  * **On `telegram` you normally never call this.** That network's accounts are born active — there is no authorization return in which to choose them, so PlanVortex takes the slot when the bot is added to the channel. The one case left is a channel that arrived while the plan was full: it stays off until a slot frees up, and this is what turns it on.
997
999
  *
@@ -1124,6 +1126,8 @@ interface paths {
1124
1126
  * **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
1127
  *
1126
1128
  * 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.
1129
+ *
1130
+ * **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
1131
  */
1128
1132
  get: operations["getMessageFile"];
1129
1133
  put?: never;
@@ -1434,7 +1438,7 @@ interface paths {
1434
1438
  * - `read` is **yours**. It touches no social network, costs nothing and can always be set.
1435
1439
  * - `hidden` **touches the network**, and not every network allows it — LinkedIn and Google Business have no hide endpoint at all and return error `946`. Check `GET /social_comment_actions` before offering the control.
1436
1440
  *
1437
- * Requires the `comments:create` permission (`client_organization_comments:create` for apps) and a paid plan.
1441
+ * Setting `read` requires the `comments:read` permission (`client_organization_comments:read` for apps): marking a comment read is part of reading it, as opening a conversation is in the chat. Setting `hidden` also requires `comments:create` (`client_organization_comments:create`), the same as replying, and without it the whole request is refused with `520` and nothing changes, `read` included. Both need a paid plan.
1438
1442
  */
1439
1443
  put: operations["updateComment"];
1440
1444
  post?: never;
@@ -1470,7 +1474,7 @@ interface paths {
1470
1474
  * You need it when a file has no `url`, or when its `url` stopped loading:
1471
1475
  *
1472
1476
  * • **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.
1477
+ * • **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
1478
  * • **Bluesky** videos are an HLS playlist that browsers other than Safari do not play; this returns the video file itself.
1475
1479
  * • **Facebook, Threads and Discord** links expire; this reads the comment again and returns the file behind a fresh link.
1476
1480
  * • **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 +1483,8 @@ interface paths {
1479
1483
  *
1480
1484
  * 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
1485
  *
1486
+ * **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.
1487
+ *
1482
1488
  * Requires the `comments:read` permission (`client_organization_comments:read` for apps) and a paid plan.
1483
1489
  */
1484
1490
  get: operations["getCommentFile"];
@@ -1561,7 +1567,7 @@ interface paths {
1561
1567
  *
1562
1568
  * **A network that cannot produce a link simply does not appear.** That is a legitimate answer, not a failure: it is what happens with `discord` in an organization that has not saved its own bot credentials yet (see `PUT /organizations/{id_organization}/social_credentials/{social_network}`).
1563
1569
  *
1564
- * **On the free plan `whatsapp` does not appear either**, unless the organization already has an active WhatsApp account, which has to stay reconnectable. Its chat and its templates need a paid plan, so enabling a new account answers error 516. Asking for it by name gets you an empty list, not an error.
1570
+ * **On the free plan `whatsapp` and `google_business` do not appear either**, unless the organization already has an active account of that network, which has to stay reconnectable. WhatsApp only has chat and templates and Google Business only has reviews, and all of that needs a paid plan, so enabling a new account answers error 516. Asking for it by name gets you an empty list, not an error.
1565
1571
  *
1566
1572
  * **An app cannot call this.** Connecting a social account is an OAuth flow with a person in front of it, so this endpoint only accepts a user token or a temporal connect token; with app credentials it answers error 519. The way an integration does it is to issue a temporal connect token with `GET /organizations/{id_organization}/temporal_connect_token` and hand it to its end user.
1567
1573
  *
@@ -1641,6 +1647,8 @@ interface paths {
1641
1647
  /**
1642
1648
  * List the contacts of an organization
1643
1649
  * @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.
1650
+ *
1651
+ * **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
1652
  */
1645
1653
  get: operations["getContacts"];
1646
1654
  put?: never;
@@ -1722,7 +1730,7 @@ interface paths {
1722
1730
  * The whole home screen in one call
1723
1731
  * @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
1732
  *
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.
1733
+ * **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
1734
  *
1727
1735
  * The messages block is also omitted when the client's plan has no messaging.
1728
1736
  */
@@ -2408,7 +2416,7 @@ interface paths {
2408
2416
  *
2409
2417
  * **It connects once.** As soon as an `account-connect` succeeds, the token stops being able to connect anything else and answers error 543; the `enable` calls that finish that same connection keep working until it expires. Issue a new one per connection — they are free and immediate.
2410
2418
  *
2411
- * **If you pass `social_network`, the token is bound to that network** and will not connect any other (error 544). Leave it out to let the person pick. On the free plan, asking for `whatsapp` answers error 516 unless the organization already has an active WhatsApp account to reconnect: its chat and its templates need a paid plan.
2419
+ * **If you pass `social_network`, the token is bound to that network** and will not connect any other (error 544). Leave it out to let the person pick. On the free plan, asking for `whatsapp` or `google_business` answers error 516 unless the organization already has an active account of that network to reconnect: everything those networks do needs a paid plan.
2412
2420
  *
2413
2421
  * **Or show the account picker yourself** with `account_selection=integrator`. By default PlanVortex shows the screen where the person picks which accounts to enable, and only then sends them to your `redirect_uri`. In this mode that screen is yours:
2414
2422
  *
@@ -2462,7 +2470,7 @@ interface paths {
2462
2470
  };
2463
2471
  /**
2464
2472
  * 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.
2473
+ * @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
2474
  */
2467
2475
  get: operations["getUnreadMessages"];
2468
2476
  put?: never;
@@ -2666,6 +2674,8 @@ interface paths {
2666
2674
  *
2667
2675
  * **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
2676
  *
2677
+ * **`statistics` says whether PlanVortex reads any metric of that network.** It is `true` on every network but `whatsapp`, which does not publish and has no metrics to read. Use it to decide which accounts to offer on a statistics screen (or filter the account list with `capability=statistics`) instead of finding out from an empty series.
2678
+ *
2669
2679
  * A `true` here is about the **network**, not about one account of it: a Telegram channel with no linked discussion group answers 965 on its comments even though the network has them.
2670
2680
  *
2671
2681
  * Only needs authentication.
@@ -2806,7 +2816,7 @@ interface webhooks {
2806
2816
  *
2807
2817
  * 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
2818
  *
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`.
2819
+ * 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
2820
  *
2811
2821
  * ### Verifying the signature
2812
2822
  *
@@ -3676,7 +3686,7 @@ interface components {
3676
3686
  ClientsClient: {
3677
3687
  /** @example 66d04a6a427f4c43b9d97f54 */
3678
3688
  _id: string;
3679
- /** @description What is already handed out to the client's root organizations, which is what is left to assign. **Only present with `getUse=true`.** */
3689
+ /** @description What is already handed out to organizations with a plan of their own (root organizations, or organizations under a folder), which is not available to the shared pool any more. **Only present with `getUse=true`.** */
3680
3690
  actual_asigned?: components["schemas"]["PlanData"];
3681
3691
  actual_plan: components["schemas"]["ClientsPlan"];
3682
3692
  /** @description Current consumption across every organization of the client. **Only present with `getUse=true`.** `twitter_credits` and `ai_credits` are what has been spent this calendar month. */
@@ -3688,6 +3698,8 @@ interface components {
3688
3698
  /** Format: date-time */
3689
3699
  creation_date: string;
3690
3700
  name: string;
3701
+ /** @description What the client's shared pool is using: the root organizations without a plan of their own and the folders below them, which is the `actual_use` each of them shows. **Only present with `getUse=true`.** Together with `actual_asigned` and the plan it splits the plan in three: used by the shared pool, free in the shared pool, and handed out to organizations with a plan of their own. `apps` is not here: apps belong to the client, not to an organization. */
3702
+ pool_use?: components["schemas"]["PlanUseData"];
3691
3703
  /** @description Whether this client has already used its trial. */
3692
3704
  trial_tested?: boolean;
3693
3705
  };
@@ -3904,8 +3916,9 @@ interface components {
3904
3916
  external_id: string;
3905
3917
  /** @description Whether the connected account wrote it. This is what separates "delete mine" from "delete theirs", and what keeps your own replies out of the inbox. */
3906
3918
  is_own: boolean;
3907
- /** @description Display name. Always present for a review, including anonymous ones, which get a placeholder rather than an empty string. */
3919
+ /** @description Display name. Always present for a review, including anonymous ones, which get a placeholder rather than an empty string. On LinkedIn it is read from LinkedIn on every request and is not stored by PlanVortex: it is absent when LinkedIn does not return the member's profile, and LinkedIn only lets you cache it for 24 hours (see the LinkedIn section above). */
3908
3920
  name?: string;
3921
+ /** @description Link to the author's picture, when the network gives one. On LinkedIn it is read on every request like `name`, it is a signed link that expires after a few weeks, and LinkedIn's servers refuse most downloads that do not come from a browser: show it in an `<img>`, do not copy it. */
3909
3922
  profile_pic?: string;
3910
3923
  };
3911
3924
  /**
@@ -3959,6 +3972,8 @@ interface components {
3959
3972
  publish_settings: boolean;
3960
3973
  /** @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
3974
  reply_control: boolean;
3975
+ /** @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. */
3976
+ statistics: boolean;
3962
3977
  /** @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
3978
  visibility: boolean;
3964
3979
  webhooks: boolean;
@@ -4076,7 +4091,7 @@ interface components {
4076
4091
  ContactsSocialIdentifierInput: {
4077
4092
  /** @description Only when you are keeping an identifier the API already gave you. */
4078
4093
  _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. */
4094
+ /** @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
4095
  external_identifier?: string;
4081
4096
  social_network: components["schemas"]["ContactChannel"];
4082
4097
  };
@@ -4322,7 +4337,7 @@ interface components {
4322
4337
  * The catalogue grows with the product, so treat an unknown `code` as a generic failure instead of rejecting it.
4323
4338
  */
4324
4339
  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. */
4340
+ /** @description PlanVortex error code. Ranges: 500-554 auth, tokens, client apps and connect sessions · 601-612 user · 700-716 social accounts · 800-810 files · 900-996 publications · 1000-1003 general · 1100-1111 organizations · 1200-1207 roles · 1300-1309 client plan · 1400-1408 organization plan · 1500-1517 messaging · 1600-1601 contacts · 1900-1906 payments · 2000-2099 products · 2100-2199 AI plans · 2200-2299 integrations · 2500-2599 publication fields, the ones that no longer fit in 900-996 (visibility, made for kids, TikTok's interactions and commercial content) · 2600-2699 comments, the ones that no longer fit in 945-948. */
4326
4341
  code: number;
4327
4342
  /** @description Extra context attached to the error, when there is any. */
4328
4343
  data?: {
@@ -4561,6 +4576,17 @@ interface components {
4561
4576
  * @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.
4562
4577
  */
4563
4578
  deleted_date?: string;
4579
+ /**
4580
+ * @description Only on messages **we** sent (`contact_id`): how far the message got, like the ticks in WhatsApp. `sent` means the network accepted it, `delivered` that it reached the contact's device, `read` that the contact saw it, and `failed` that the network rejected it (`message_errors` says why).
4581
+ *
4582
+ * It only moves forward, and each network reports what it can. WhatsApp and Messenger report all three steps, Instagram reports `sent` and `read` (it does not report delivery), and Bluesky only `sent`. A read receipt also covers the earlier messages to that contact, the same as opening the chat.
4583
+ *
4584
+ * Absent when PlanVortex does not know: messages from the contact, messages sent before 15 November 2026 and messages imported from the network's history.
4585
+ *
4586
+ * No webhook event is sent for `delivered`: read the field on the message. A `read` arrives as `messaging_seen`.
4587
+ * @enum {string}
4588
+ */
4589
+ delivery_status?: "sent" | "delivered" | "read" | "failed";
4564
4590
  /**
4565
4591
  * Format: date-time
4566
4592
  * @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.
@@ -4579,6 +4605,29 @@ interface components {
4579
4605
  message_errors: components["schemas"]["Error"][];
4580
4606
  message_options: components["schemas"]["MessageOptions"];
4581
4607
  message_type: components["schemas"]["MessageType"];
4608
+ /**
4609
+ * @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.
4610
+ *
4611
+ * 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.
4612
+ */
4613
+ reactions?: {
4614
+ /**
4615
+ * @description Who reacted: the `contact`, or the `account` itself (the business, from the network's own app or inbox).
4616
+ * @enum {string}
4617
+ */
4618
+ by: "contact" | "account";
4619
+ /**
4620
+ * Format: date-time
4621
+ * @description When the reaction was added.
4622
+ */
4623
+ date: string;
4624
+ /**
4625
+ * @description The emoji, as the network sends it.
4626
+ * @example 👍
4627
+ */
4628
+ emoji: string;
4629
+ }[];
4630
+ /** @description On a message from the contact, whether someone has read it in PlanVortex. On one of ours it is **not** a read receipt (messages sent from the WhatsApp Business app, or imported from the network, are stored as read): use `delivery_status`. */
4582
4631
  read: boolean;
4583
4632
  /** @description Absent on the messages that carry no text of their own, such as a `messaging_seen` acknowledgement. */
4584
4633
  text?: string;
@@ -4658,7 +4707,7 @@ interface components {
4658
4707
  /**
4659
4708
  * @description What kind of message this is. `simple_message` and `file_message` work everywhere; the rest are network-specific shapes.
4660
4709
  *
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.
4710
+ * `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
4711
  * @enum {string}
4663
4712
  */
4664
4713
  MessageType: "simple_message" | "file_message" | "comment_message" | "publication_message" | "quick_reply_message" | "button_message" | "elements_message" | "postback_message" | "template_message" | "interactive_message" | "unsupported_message";
@@ -4696,7 +4745,7 @@ interface components {
4696
4745
  actual_asigned?: components["schemas"]["PlanData"];
4697
4746
  /** @description The slice of the client's plan assigned to this organization. **Absent when nothing was assigned**, and then the organization shares whatever its nearest parent with a plan has — or, failing that, the client's unassigned remainder. Ask `GET /organizations/{id_organization}/limits` for the effective numbers instead of reading this. */
4698
4747
  actual_plan?: components["schemas"]["PlanData"];
4699
- /** @description Current consumption. **Only present with `getUse=true`.** `twitter_credits` and `ai_credits` are what has been spent in the current calendar month; the rest is what exists right now. */
4748
+ /** @description What the plan this organization draws from is using, which is the figure the server checks before letting one more account or integration in: the owner of that plan (this organization if it has a plan of its own, otherwise its nearest parent with one, otherwise the client's shared pool) plus the folders without a plan below it. Organizations sharing a pool therefore show the same `actual_use`; what each one uses on its own is `own_use`. **Only present with `getUse=true`.** `twitter_credits` and `ai_credits` are what has been spent in the current calendar month; the rest is what exists right now. */
4700
4749
  actual_use?: components["schemas"]["PlanUseData"];
4701
4750
  ai_context?: components["schemas"]["AiContext"];
4702
4751
  /** Format: date-time */
@@ -4704,6 +4753,8 @@ interface components {
4704
4753
  /** @description The client this organization belongs to. */
4705
4754
  id_client: string;
4706
4755
  name: string;
4756
+ /** @description What THIS organization uses on its own, without the folders it shares a plan with. **Only present with `getUse=true`.** `actual_use` is the consumption of the whole pool this organization draws from (the same figure the server checks before letting one more account in), so every organization without a plan of its own shows the same `actual_use`; `own_use` is what hangs from this one. Adding up the `own_use` of the organizations that share a pool gives that pool's `actual_use`. On an organization with a plan of its own and no folders below it, both are the same. */
4757
+ own_use?: components["schemas"]["PlanUseData"];
4707
4758
  /** @description The organization this one hangs from. Absent on a root organization. */
4708
4759
  parent_organization?: string;
4709
4760
  /** @description The organization's own application credentials, by network. A network that is absent is not configured, and then it does not even appear as connectable. */
@@ -5469,7 +5520,7 @@ interface components {
5469
5520
  /** @description The same person, on one channel. */
5470
5521
  SocialIdentifier: {
5471
5522
  _id: string;
5472
- /** @description Identifier of the contact on that channel. */
5523
+ /** @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
5524
  external_identifier?: string;
5474
5525
  /**
5475
5526
  * Format: date-time
@@ -5477,6 +5528,8 @@ interface components {
5477
5528
  */
5478
5529
  last_send_date?: string;
5479
5530
  social_network: components["schemas"]["ContactChannel"];
5531
+ /** @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). */
5532
+ user_id?: string;
5480
5533
  };
5481
5534
  /**
5482
5535
  * @description A social network supported by PlanVortex.
@@ -7941,8 +7994,10 @@ interface operations {
7941
7994
  * @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
7995
  *
7943
7996
  * `comments` also looks at each account, not only at its network: a LinkedIn **personal profile** is left out, because only LinkedIn pages have a comment inbox. `total` counts the same way.
7997
+ *
7998
+ * `statistics` leaves out the networks PlanVortex reads no metric from (today `whatsapp`): the accounts worth offering on a statistics screen.
7944
7999
  */
7945
- capability?: "publications" | "messages" | "products" | "webhooks" | "persistent_menu" | "comments";
8000
+ capability?: "publications" | "messages" | "products" | "webhooks" | "persistent_menu" | "comments" | "statistics";
7946
8001
  /** @description The limit of records will be retrieved (pagination) */
7947
8002
  limit?: number;
7948
8003
  /** @description Free-text search over the account's name and username. */
@@ -8452,7 +8507,7 @@ interface operations {
8452
8507
  * | --- | --- |
8453
8508
  * | `700` | The account has no usable token: it has to be connected again |
8454
8509
  * | `706` | The organization has no account slots left in its plan |
8455
- * | `516` | The plan is free and this network needs a paid plan (today, `whatsapp`) |
8510
+ * | `516` | The plan is free and this network needs a paid plan (today, `whatsapp` and `google_business`) |
8456
8511
  * | `519` | This endpoint does not accept app credentials |
8457
8512
  * | `544` | This temporal connect token was issued for a different social network |
8458
8513
  */
@@ -8691,7 +8746,10 @@ interface operations {
8691
8746
  };
8692
8747
  getMessageFile: {
8693
8748
  parameters: {
8694
- query?: never;
8749
+ query?: {
8750
+ /** @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. */
8751
+ playable?: "1" | "true";
8752
+ };
8695
8753
  header?: never;
8696
8754
  path: {
8697
8755
  /** @description Connected account identifier */
@@ -8707,7 +8765,7 @@ interface operations {
8707
8765
  };
8708
8766
  requestBody?: never;
8709
8767
  responses: {
8710
- /** @description The file, with the network's `Content-Type`. */
8768
+ /** @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
8769
  200: {
8712
8770
  headers: {
8713
8771
  [name: string]: unknown;
@@ -9565,7 +9623,10 @@ interface operations {
9565
9623
  };
9566
9624
  getCommentFile: {
9567
9625
  parameters: {
9568
- query?: never;
9626
+ query?: {
9627
+ /** @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. */
9628
+ playable?: "1" | "true";
9629
+ };
9569
9630
  header?: never;
9570
9631
  path: {
9571
9632
  /** @description Comment identifier (PlanVortex's `_id`, not the network's `external_id`) */
@@ -9579,7 +9640,7 @@ interface operations {
9579
9640
  };
9580
9641
  requestBody?: never;
9581
9642
  responses: {
9582
- /** @description The file, with the network's `Content-Type`. */
9643
+ /** @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
9644
  200: {
9584
9645
  headers: {
9585
9646
  [name: string]: unknown;
@@ -9808,7 +9869,7 @@ interface operations {
9808
9869
  * | `553` | Some account is not part of this session. `data.accounts` lists them |
9809
9870
  * | `706` | The new accounts do not fit in the plan. `data` carries `limit`, `used` and `requested`, and none was enabled |
9810
9871
  * | `1101` | Invalid organization |
9811
- * | `516` | The plan is free and one of the accounts belongs to a network that needs a paid plan (today, `whatsapp`) |
9872
+ * | `516` | The plan is free and one of the accounts belongs to a network that needs a paid plan (today, `whatsapp` and `google_business`) |
9812
9873
  */
9813
9874
  400: {
9814
9875
  headers: {
@@ -11932,7 +11993,7 @@ interface operations {
11932
11993
  * | Code | Meaning |
11933
11994
  * | --- | --- |
11934
11995
  * | `514` | This endpoint needs app credentials: neither a user token nor a temporal connect token can issue one |
11935
- * | `516` | The plan is free, `social_network` needs a paid plan (today, `whatsapp`) and the organization has no active account of it to reconnect |
11996
+ * | `516` | The plan is free, `social_network` needs a paid plan (today, `whatsapp` and `google_business`) and the organization has no active account of it to reconnect |
11936
11997
  * | `532` | `redirect_uri` is not one of the app's registered `redirect_urls` |
11937
11998
  * | `549` | `account_selection` is not `planvortex` or `integrator`, or it is `integrator` without `redirect_uri` or `social_network`. `data` says which |
11938
11999
  * | `550` | `account_selection=integrator` on a network with no return to the browser (`telegram`) |
@@ -12000,7 +12061,29 @@ interface operations {
12000
12061
  [name: string]: unknown;
12001
12062
  };
12002
12063
  content: {
12064
+ /**
12065
+ * @example {
12066
+ * "total": 5,
12067
+ * "accounts": [
12068
+ * {
12069
+ * "id_account": "6650f1c2a8b4e1d2c3f4a5b6",
12070
+ * "total": 3
12071
+ * },
12072
+ * {
12073
+ * "id_account": "6650f1c2a8b4e1d2c3f4a5b7",
12074
+ * "total": 2
12075
+ * }
12076
+ * ]
12077
+ * }
12078
+ */
12003
12079
  "application/json": {
12080
+ /** @description The same count per account. Only accounts with something unread are listed, most unread first; an account that is missing has none. */
12081
+ accounts: {
12082
+ /** @description The account's `_id`. */
12083
+ id_account: string;
12084
+ total: number;
12085
+ }[];
12086
+ /** @description Unread incoming messages across every account. Always the sum of `accounts`. */
12004
12087
  total: number;
12005
12088
  };
12006
12089
  };
@@ -12520,7 +12603,8 @@ interface operations {
12520
12603
  * "made_for_kids": false,
12521
12604
  * "interactions": false,
12522
12605
  * "commercial_content": false,
12523
- * "publish_settings": false
12606
+ * "publish_settings": false,
12607
+ * "statistics": true
12524
12608
  * },
12525
12609
  * "google_business": {
12526
12610
  * "publications": false,
@@ -12536,7 +12620,8 @@ interface operations {
12536
12620
  * "made_for_kids": false,
12537
12621
  * "interactions": false,
12538
12622
  * "commercial_content": false,
12539
- * "publish_settings": false
12623
+ * "publish_settings": false,
12624
+ * "statistics": true
12540
12625
  * },
12541
12626
  * "pinterest": {
12542
12627
  * "publications": true,
@@ -12552,7 +12637,8 @@ interface operations {
12552
12637
  * "made_for_kids": false,
12553
12638
  * "interactions": false,
12554
12639
  * "commercial_content": false,
12555
- * "publish_settings": false
12640
+ * "publish_settings": false,
12641
+ * "statistics": true
12556
12642
  * },
12557
12643
  * "threads": {
12558
12644
  * "publications": true,
@@ -12568,7 +12654,25 @@ interface operations {
12568
12654
  * "made_for_kids": false,
12569
12655
  * "interactions": false,
12570
12656
  * "commercial_content": false,
12571
- * "publish_settings": false
12657
+ * "publish_settings": false,
12658
+ * "statistics": true
12659
+ * },
12660
+ * "whatsapp": {
12661
+ * "publications": false,
12662
+ * "messages": true,
12663
+ * "products": false,
12664
+ * "webhooks": true,
12665
+ * "persistent_menu": false,
12666
+ * "comments": false,
12667
+ * "destinations": false,
12668
+ * "link": false,
12669
+ * "reply_control": false,
12670
+ * "visibility": false,
12671
+ * "made_for_kids": false,
12672
+ * "interactions": false,
12673
+ * "commercial_content": false,
12674
+ * "publish_settings": false,
12675
+ * "statistics": false
12572
12676
  * }
12573
12677
  * }
12574
12678
  */
@@ -13427,7 +13531,15 @@ type ContactCreate = Schemas["ContactsContactCreate"];
13427
13531
  type ContactUpdate = Schemas["ContactsContactUpdate"];
13428
13532
  /** Los campos propios de un contacto: el bloque de direccion y las seis propiedades libres. */
13429
13533
  type ContactExtraData = Schemas["ContactExtraData"];
13430
- /** El mismo contacto, en un canal. Es una red social o `email`. */
13534
+ /**
13535
+ * El mismo contacto, en un canal. Es una red social o `email`.
13536
+ *
13537
+ * **EN WHATSAPP PUEDE NO HABER TELEFONO.** Desde 2026 Meta deja de mandar el numero de quien usa
13538
+ * nombre de usuario y no ha tenido trato por telefono con ese numero de negocio en 30 dias. Lo que
13539
+ * llega siempre es `user_id`, su BSUID (`ES.13491208655302741918`), y sin telefono es tambien el
13540
+ * `external_identifier`. Se reconoce porque lleva el pais y un punto delante: nunca se parece a un
13541
+ * telefono, y no se ensena ni se marca como si lo fuera. Se le puede escribir igual.
13542
+ */
13431
13543
  type SocialIdentifier = Schemas["SocialIdentifier"];
13432
13544
  /**
13433
13545
  * El mismo, tal y como se MANDA: aqui `_id` es opcional y el servidor pone uno.
@@ -13918,7 +14030,7 @@ declare class OrganizationError extends PlanVortexError {
13918
14030
  */
13919
14031
  declare class PlanLimitError extends PlanVortexError {
13920
14032
  }
13921
- /** 1500-1516 — conversaciones, mensajes, plantillas y sus archivos. Exige plan de pago. */
14033
+ /** 1500-1517 — conversaciones, mensajes, plantillas y sus archivos. Exige plan de pago. */
13922
14034
  declare class MessagingError extends PlanVortexError {
13923
14035
  }
13924
14036
  /** 1600-1601 — contactos. */