planvortex 0.18.1 → 0.20.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
@@ -108,8 +108,8 @@ for await (const publication of pv.publications.iterate(orgId, { state: ["ready"
108
108
  | `pv.accounts` | `list`, `iterate`, `get`, `update`, `remove`, `metrics`, `metricList`, `destinations`, `destination`, `publishSettings`, `getPersistentMenu`, `setPersistentMenu`, `connectLinks`, `connect`, `enable` |
109
109
  | `pv.uploads` | `create`, `list`, `iterate`, `get`, `update`, `remove`, `import` |
110
110
  | `pv.publications` | `create`, `get`, `list`, `iterate`, `listByAccount`, `update`, `updateByAccount`, `remove`, `retry`, `metrics`, `stats`, `listOnNetwork` |
111
- | `pv.comments` | `list`, `iterate`, `unreadCount`, `thread`, `threadByAccount`, `replies`, `reply`, `update`, `markRead`, `remove`, `actions` |
112
- | `pv.messages` | `conversations`, `iterateConversations`, `conversationTotals`, `list`, `iterate`, `send`, `unreadCount`, `removeByAccount`, `templates`, `createTemplate`, `deleteTemplate` |
111
+ | `pv.comments` | `list`, `iterate`, `unreadCount`, `thread`, `threadByAccount`, `replies`, `reply`, `update`, `markRead`, `remove`, `actions`, `downloadFile` |
112
+ | `pv.messages` | `conversations`, `iterateConversations`, `conversationTotals`, `list`, `iterate`, `send`, `unreadCount`, `removeByAccount`, `templates`, `createTemplate`, `deleteTemplate`, `downloadFile` |
113
113
  | `pv.contacts` | `list`, `iterate`, `get`, `create`, `update`, `merge`, `remove`, `removeAll` |
114
114
  | `pv.products` | `list`, `iterate`, `get`, `create`, `catalogs`, `createCatalog` |
115
115
  | `pv.integrations` | `providers`, `list`, `iterate`, `get`, `connectLink`, `connect`, `reconnect`, `update`, `remove`, `pickerConfig`, `products` |
@@ -238,6 +238,23 @@ await pv.messages.send(orgId, accountId, conversations[0].contact._id, {
238
238
  Message templates are **WhatsApp only**. Every other network answers HTTP 500 with `code: 500`
239
239
  rather than the 1502 you would expect, so check the account's network first.
240
240
 
241
+ ### Files that arrive from the network
242
+
243
+ A photo, a voice note or a document in a private message, and a photo or a sticker in a comment,
244
+ **are not stored by PlanVortex**. They stay on the network, and `files_urls` says where each one is.
245
+ When an entry has a `url`, load it directly; when it has none (every WhatsApp and Telegram file, a
246
+ LinkedIn image, a Bluesky video) or the `url` stopped loading, ask PlanVortex for it:
247
+
248
+ ```ts
249
+ const file = await pv.messages.downloadFile(orgId, accountId, message._id, 0);
250
+ // or: await pv.comments.downloadFile(orgId, comment._id, 0);
251
+ console.log(file.contentType, file.fileName, file.data.byteLength);
252
+ ```
253
+
254
+ The network decides how long a file lives: WhatsApp lets go of one 7 days after it arrived, and from
255
+ then on the answer is error 1515. A `disposition` of `"attachment"` is a document somebody outside
256
+ the business sent: don't render it inside your own pages.
257
+
241
258
  ## Connecting a social account
242
259
 
243
260
  **An app cannot connect one.** Authorizing Instagram is an OAuth flow with a person in front of it,
@@ -420,7 +437,7 @@ if you would rather branch on `error.family`.
420
437
  | 1100-1111 | Organizations | `OrganizationError` |
421
438
  | 1200-1207 | Roles | `PlanVortexError` |
422
439
  | 1300-1308, 1400-1408 | Plan quota exhausted, at client and organization level | `PlanLimitError` |
423
- | 1500-1512 | Messaging | `MessagingError` |
440
+ | 1500-1516 | Messaging | `MessagingError` |
424
441
  | 1600-1601 | Contacts | `ContactError` |
425
442
  | 1900-1906 | Payments | `PlanVortexError` |
426
443
  | 2000-2099 | Products | `ProductError` |
@@ -23,7 +23,11 @@ var PLANVORTEX_ERROR_RANGES = [
23
23
  //1308 es el tope de APPS del plan, que nacio al quitar el candado de precio de la API.
24
24
  { from: 1300, to: 1308, family: "plan_limit" },
25
25
  { from: 1400, to: 1408, family: "plan_limit" },
26
- { from: 1500, to: 1512, family: "messaging" },
26
+ //1513 y 1514 son las plantillas de WhatsApp: el formato que Meta rechazaria sin decir por que,
27
+ //y Meta rechazandola al crearla. Nacieron por encima del techo, la cuarta vez que pasa. 1515 y
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" },
27
31
  { from: 1600, to: 1601, family: "contact" },
28
32
  { from: 1900, to: 1906, family: "payment" },
29
33
  { from: 2e3, to: 2099, family: "product" },
@@ -157,5 +161,5 @@ function isTokenError(error) {
157
161
  }
158
162
 
159
163
  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 };
160
- //# sourceMappingURL=chunk-ZHS7FY3T.js.map
161
- //# sourceMappingURL=chunk-ZHS7FY3T.js.map
164
+ //# sourceMappingURL=chunk-DRVCK5JO.js.map
165
+ //# sourceMappingURL=chunk-DRVCK5JO.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;A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AA,IAAQ;AAAC,KAC7B,CAAA;AAAA,EACL;AAEA,EAAA,OAAO,IAAI,eAAA,CAAgB,aAAA,EAAe,CAAA,KAAA,EAAQ,KAAA,CAAM,MAAM,CAAA,CAAA,EAAI;AAAA,IAC9D,GAAG,OAAA;AAAA,IACH,MAAA,EAAQ,MAAA;AAAA,IACR,IAAA,EACI,OAAO,KAAA,CAAM,IAAA,KAAS,QAAA,IAAY,KAAA,CAAM,IAAA,KAAS,IAAA,GAC1C,KAAA,CAAM,IAAA,GACP,EAAE,IAAA,EAAM,MAAM,IAAA;AAAK,GAChC,CAAA;AACL;AAGO,SAAS,kBAAkB,KAAA,EAA0C;AACxE,EAAA,OAAO,KAAA,YAAiB,eAAA;AAC5B;AAOO,SAAS,aAAa,KAAA,EAAyB;AAClD,EAAA,OAAO,kBAAkB,KAAK,CAAA,IAAK,iBAAA,CAAkB,QAAA,CAAS,MAAM,IAAI,CAAA;AAC5E","file":"chunk-DRVCK5JO.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.\n { from: 1500, to: 1516, 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-1516 — 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"]}
@@ -991,7 +991,7 @@ interface paths {
991
991
  * Re-enable a disconnected account
992
992
  * @description Brings back an account that was removed, without going through the authorization again — as long as its stored token still works.
993
993
  *
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.
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.
995
995
  *
996
996
  * **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
997
  *
@@ -1017,6 +1017,10 @@ interface paths {
1017
1017
  *
1018
1018
  * The shape of a template is the network's own: PlanVortex does not normalise it.
1019
1019
  *
1020
+ * **A rejected template says why.** WhatsApp templates carry `rejected_reason` (`INVALID_FORMAT`, `PROMOTIONAL`, `TAG_CONTENT_MISMATCH`...) next to their `status`, as WhatsApp sends it.
1021
+ *
1022
+ * **`health` says whether the account can start conversations at all.** A template is only needed outside the 24-hour window, which is exactly what a failed payment method or an unverified business blocks, and neither of them fails when you create or approve a template: the message is simply never delivered. `health` is WhatsApp's own status for the phone number, reduced to `can_send_message` (`AVAILABLE`, `LIMITED`, `BLOCKED`), the `issues` behind it with WhatsApp's code (141006 = payment method, 141010 = business not verified) and `notes`. When it can't be read the field is absent, which means unknown, not healthy.
1023
+ *
1020
1024
  * **WhatsApp only.** No other network implements message templates: asking any of them returns HTTP 500 with `code: 500` (an unhandled server error), not the 1502 you would expect. Check `messages` in `GET /social_capabilities` and that the account is WhatsApp before calling.
1021
1025
  */
1022
1026
  get: operations["getMessageTemplates"];
@@ -1027,6 +1031,10 @@ interface paths {
1027
1031
  *
1028
1032
  * **Approval is not immediate.** The template comes back in a pending state and only becomes usable when the network approves it, which takes minutes or hours and can be refused.
1029
1033
  *
1034
+ * **WhatsApp templates are checked before they leave.** WhatsApp rejects a badly formatted template in the same second with `INVALID_FORMAT` and no explanation, so PlanVortex checks the rules it documents first and answers **1513** with `data.field` and `data.reason`: `invalid_name` (lowercase letters, numbers and underscores only), `missing_language`, `missing_body`, `body_too_long` (1,024 characters), `malformed_variable`, `variables_not_sequential`, `variable_at_edge` (the text can't start or end with a variable), `adjacent_variables` and `missing_examples`. **A body with variables needs one example per variable** in `example.body_text`, as in the example below.
1035
+ *
1036
+ * If WhatsApp refuses the template when it is created (a language it doesn't have, a name already in use), the answer is **1514** with WhatsApp's own `code`, `subcode` and `message` in `data`.
1037
+ *
1030
1038
  * **WhatsApp only.** No other network implements message templates: asking any of them returns HTTP 500 with `code: 500` (an unhandled server error), not the 1502 you would expect. Check `messages` in `GET /social_capabilities` and that the account is WhatsApp before calling.
1031
1039
  */
1032
1040
  post: operations["createMessageTemplate"];
@@ -1097,6 +1105,35 @@ interface paths {
1097
1105
  patch?: never;
1098
1106
  trace?: never;
1099
1107
  };
1108
+ "/organizations/{id_organization}/accounts/{id_account}/messages/{id_message}/files/{index}": {
1109
+ parameters: {
1110
+ query?: never;
1111
+ header?: never;
1112
+ path?: never;
1113
+ cookie?: never;
1114
+ };
1115
+ /**
1116
+ * One file of a message, fetched from the network
1117
+ * @description Files that arrive in a message (a photo, a video, a voice note, a document, a sticker) **are not stored by PlanVortex**: they stay on the network, and `message_options.files_urls` says where each one is.
1118
+ *
1119
+ * • **With `url`** (Instagram and Messenger): Meta's own CDN link. It works until Meta expires it.
1120
+ * • **Without `url`** (every WhatsApp file): WhatsApp only hands a file over with the account's token, through a link that lasts five minutes, so there is no link to give you.
1121
+ *
1122
+ * Either way, this endpoint asks the network for the file now and streams it back without keeping a copy. `index` is the file's position in `files_urls`. `message_options.files` holds only the files **you** sent from PlanVortex, which are uploads.
1123
+ *
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
+ *
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
+ get: operations["getMessageFile"];
1129
+ put?: never;
1130
+ post?: never;
1131
+ delete?: never;
1132
+ options?: never;
1133
+ head?: never;
1134
+ patch?: never;
1135
+ trace?: never;
1136
+ };
1100
1137
  "/organizations/{id_organization}/accounts/{id_account}/metric_list": {
1101
1138
  parameters: {
1102
1139
  query?: never;
@@ -1419,6 +1456,40 @@ interface paths {
1419
1456
  patch?: never;
1420
1457
  trace?: never;
1421
1458
  };
1459
+ "/organizations/{id_organization}/comments/{id_comment}/files/{index}": {
1460
+ parameters: {
1461
+ query?: never;
1462
+ header?: never;
1463
+ path?: never;
1464
+ cookie?: never;
1465
+ };
1466
+ /**
1467
+ * One file of a comment, fetched from the network
1468
+ * @description Files in a comment (a photo, a GIF, a sticker, a video) **are not stored by PlanVortex**: they stay on the network, and the comment's `files_urls` says where each one is. This endpoint asks the network for the file now and streams it back without keeping a copy. `index` is the file's position in `files_urls`.
1469
+ *
1470
+ * You need it when a file has no `url`, or when its `url` stopped loading:
1471
+ *
1472
+ * • **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.
1474
+ * • **Bluesky** videos are an HLS playlist that browsers other than Safari do not play; this returns the video file itself.
1475
+ * • **Facebook, Threads and Discord** links expire; this reads the comment again and returns the file behind a fresh link.
1476
+ * • **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**.
1477
+ *
1478
+ * **1515** means the network no longer has the file (`data.social_network`), and **2602** that the comment has no file at that position. A comment of another organization is **1102**.
1479
+ *
1480
+ * 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
+ *
1482
+ * Requires the `comments:read` permission (`client_organization_comments:read` for apps) and a paid plan.
1483
+ */
1484
+ get: operations["getCommentFile"];
1485
+ put?: never;
1486
+ post?: never;
1487
+ delete?: never;
1488
+ options?: never;
1489
+ head?: never;
1490
+ patch?: never;
1491
+ trace?: never;
1492
+ };
1422
1493
  "/organizations/{id_organization}/comments/{id_comment}/replies": {
1423
1494
  parameters: {
1424
1495
  query?: never;
@@ -1490,6 +1561,8 @@ interface paths {
1490
1561
  *
1491
1562
  * **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}`).
1492
1563
  *
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.
1565
+ *
1493
1566
  * **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.
1494
1567
  *
1495
1568
  * **Read `authorization`, not `link`.** Almost every network is `redirect` and you send the person to `link`. Two are not, and neither of them fails visibly if you treat it as one:
@@ -2335,7 +2408,7 @@ interface paths {
2335
2408
  *
2336
2409
  * **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.
2337
2410
  *
2338
- * **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.
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.
2339
2412
  *
2340
2413
  * **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:
2341
2414
  *
@@ -2711,7 +2784,7 @@ interface webhooks {
2711
2784
  *
2712
2785
  * Three shapes travel in that array. A change on an **account** (`WebhookChange`) always carries `id_account`, `id_organization` and `social_network`. A change on an **integration** (`IntegrationWebhookChange`) and the end of an **AI plan** (`AiPlanWebhookChange`) carry none of those, because they hang off the organization and not off any account.
2713
2786
  *
2714
- * The events delivered today are `new_account`, `change_state_account`, `messages`, `messaging_postbacks`, `messaging_seen`, `messaging_error`, `comments`, `integration_error`, `ai_plan_generated` and `ai_plan_failed`.
2787
+ * The events delivered today are `new_account`, `change_state_account`, `messages`, `messaging_postbacks`, `messaging_seen`, `messaging_error`, `message_echoes`, `comments`, `integration_error`, `ai_plan_generated` and `ai_plan_failed`.
2715
2788
  *
2716
2789
  * ### Comments
2717
2790
  *
@@ -2729,6 +2802,12 @@ interface webhooks {
2729
2802
  *
2730
2803
  * The event goes to **every** app of the client that has a `webhook_url`, not only to the one that created the plan. And it is not retried: if your endpoint was down when the plan finished, the `GET` still tells you how it ended, so on startup read the plans you were waiting for.
2731
2804
  *
2805
+ * ### WhatsApp replies sent from the phone
2806
+ *
2807
+ * 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
+ *
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`.
2810
+ *
2732
2811
  * ### Verifying the signature
2733
2812
  *
2734
2813
  * Every delivery carries the body signed with your app's secret, twice:
@@ -3411,7 +3490,7 @@ interface components {
3411
3490
  *
3412
3491
  * **The body is an array of changes, not a single object**, and it carries two signature headers computed with this app's secret over the **raw** body: `x-hub-signature` (`sha1=<hex>`) and `x-hub-signature-256` (`sha256=<hex>`). Verify against the bytes you received — parsing the JSON and re-serialising it changes them and the signature will not match.
3413
3492
  *
3414
- * The events delivered today are `new_account`, `change_state_account`, `messages`, `messaging_postbacks`, `messaging_seen`, `messaging_error`, `comments`, `integration_error`, `ai_plan_generated` and `ai_plan_failed`. The payload is documented in the `comments` specification. **Every** app of the client that has a `webhook_url` receives every event, not only the app whose call caused it: with two apps, each event arrives twice. Delivery is best effort: PlanVortex does not retry a webhook that fails.
3493
+ * The events delivered today are `new_account`, `change_state_account`, `messages`, `messaging_postbacks`, `messaging_seen`, `messaging_error`, `message_echoes`, `comments`, `integration_error`, `ai_plan_generated` and `ai_plan_failed`. The payload is documented in the `comments` specification. **Every** app of the client that has a `webhook_url` receives every event, not only the app whose call caused it: with two apps, each event arrives twice. Delivery is best effort: PlanVortex does not retry a webhook that fails.
3415
3494
  */
3416
3495
  webhook_url?: string;
3417
3496
  };
@@ -3765,6 +3844,12 @@ interface components {
3765
3844
  * • A Telegram comment lives in a **different chat** from the post it answers (the channel's linked discussion group), so it needs two ids at once and travels as `{thread}/{message}`: replying wants the first, deleting wants the second.
3766
3845
  */
3767
3846
  external_id: string;
3847
+ /**
3848
+ * @description The comment's files: a photo, a GIF, a sticker, a video. **PlanVortex does not store them** (see `SocialFileUrl`): open `url` when there is one, and when there is not, or it stops loading, fetch the file with `GET /organizations/{id_organization}/comments/{id_comment}/files/{index}`.
3849
+ *
3850
+ * Facebook, Threads, LinkedIn, X, Bluesky, Discord and Telegram give a comment's files, and on Google Business they are the photos and videos of a review. Instagram and YouTube do not expose them in their APIs, so there the list is always empty. A comment that is only a photo has an empty `text` and one file here.
3851
+ */
3852
+ files_urls?: components["schemas"]["SocialFileUrl"][];
3768
3853
  /** @description Hidden on the network. A hidden comment is never swept as deleted: on YouTube, hiding one makes the API stop returning it forever, and without that exception hiding would be indistinguishable from deleting. */
3769
3854
  hidden: boolean;
3770
3855
  /**
@@ -3801,7 +3886,7 @@ interface components {
3801
3886
  /** @description Absent when the network does not publish it — not zero */
3802
3887
  reply_count?: number;
3803
3888
  social_network: components["schemas"]["CommentsCommentNetworkName"];
3804
- /** @description **May legitimately be empty.** A stars-only review carries no text at all, so render `rating` alongside it and never assume a blank comment is a loading failure. */
3889
+ /** @description **May legitimately be empty.** A stars-only review carries no text at all, and a comment can be only a photo or a sticker (see `files_urls`), so render `rating` and the files alongside it and never assume a blank comment is a loading failure. */
3805
3890
  text: string;
3806
3891
  };
3807
3892
  /** @description What one network lets you do to a comment. Four booleans and never fewer: an absent key would be indistinguishable from an oversight. */
@@ -3889,15 +3974,16 @@ interface components {
3889
3974
  /**
3890
3975
  * @description What kind of change this is. **Treat it as an open list** and ignore what you do not handle: it grows with the product.
3891
3976
  *
3892
- * - `new_account` / `change_state_account`: an account was connected, or its state changed — it stopped working, its token was refreshed, it was disconnected. On `telegram` this is the **only** way to hear about a connection: there is no callback there, so no request of yours ever returns that account.
3977
+ * - `new_account` / `change_state_account`: an account was connected, or its state changed — it stopped working, its token was refreshed, it was disconnected. A WhatsApp number disconnected from the WhatsApp Business app (or by Meta, after about 14 days without the phone using the app) arrives here with `error_code` 717. On `telegram` this is the **only** way to hear about a connection: there is no callback there, so no request of yours ever returns that account.
3893
3978
  * - `messages`: a message came in. It travels in `messageObj`.
3894
3979
  * - `messaging_postbacks`: the contact pressed a button or a quick reply. Also in `messageObj`.
3895
3980
  * - `messaging_seen`: the contact read the conversation. `messageObj` carries the message they read, when we still have it.
3896
3981
  * - `messaging_error`: the network refused a message we sent. The reason is in `messageObj.message_errors`.
3982
+ * - `message_echoes`: WhatsApp only, when the number is also used in the **WhatsApp Business app** on a phone. The business replied from the app, and the reply travels in `messageObj` as **our** message (`contact_id` is set, `from_contact_id` is not). It is a separate `field` on purpose: a bot that answers every `messages` must not answer the business itself.
3897
3983
  * - `comments`: a comment came in. It travels in `commentObj`, never in `messageObj`.
3898
3984
  * @enum {string}
3899
3985
  */
3900
- field: "new_account" | "change_state_account" | "messages" | "messaging_postbacks" | "messaging_seen" | "messaging_error" | "comments";
3986
+ field: "new_account" | "change_state_account" | "messages" | "messaging_postbacks" | "messaging_seen" | "messaging_error" | "message_echoes" | "comments";
3901
3987
  id_account: string;
3902
3988
  /** @description Only for messaging fields. A comment has no contact: its author is not someone you can write to. */
3903
3989
  id_contact?: string;
@@ -4236,7 +4322,7 @@ interface components {
4236
4322
  * The catalogue grows with the product, so treat an unknown `code` as a generic failure instead of rejecting it.
4237
4323
  */
4238
4324
  Error: {
4239
- /** @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-1308 client plan · 1400-1408 organization plan · 1500-1512 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. */
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. */
4240
4326
  code: number;
4241
4327
  /** @description Extra context attached to the error, when there is any. */
4242
4328
  data?: {
@@ -4470,6 +4556,16 @@ interface components {
4470
4556
  contact_id?: string | components["schemas"]["Contact"];
4471
4557
  /** Format: date-time */
4472
4558
  creation_date: string;
4559
+ /**
4560
+ * Format: date-time
4561
+ * @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
+ */
4563
+ deleted_date?: string;
4564
+ /**
4565
+ * Format: date-time
4566
+ * @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.
4567
+ */
4568
+ edit_date?: string;
4473
4569
  /** @description Identifier of this message on the network. */
4474
4570
  element_external_id?: string;
4475
4571
  /** @description Set when the **contact** wrote to us. */
@@ -4491,11 +4587,8 @@ interface components {
4491
4587
  MessageOptions: {
4492
4588
  /** @description The uploads attached to the message. **Populated** wherever the message itself is: the messages list and webhook deliveries carry whole uploads, everything else carries their identifiers. Handle both. */
4493
4589
  files: (string | components["schemas"]["Upload"])[];
4494
- /** @description Files already hosted somewhere else. Filled in by PlanVortex when a message arrives from the network. */
4495
- files_urls: {
4496
- mime_type?: string;
4497
- url?: string;
4498
- }[];
4590
+ /** @description Files that arrived with the message from the network. PlanVortex does not store them: they live on the network (see `SocialFileUrl`). On WhatsApp every file is here, photos and videos included, and none has a `url`. */
4591
+ files_urls: components["schemas"]["SocialFileUrl"][];
4499
4592
  /** @description Meta cards, for `elements_message` and `button_message`. */
4500
4593
  metaElements?: {
4501
4594
  [key: string]: unknown;
@@ -4564,9 +4657,11 @@ interface components {
4564
4657
  };
4565
4658
  /**
4566
4659
  * @description What kind of message this is. `simple_message` and `file_message` work everywhere; the rest are network-specific shapes.
4660
+ *
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.
4567
4662
  * @enum {string}
4568
4663
  */
4569
- MessageType: "simple_message" | "file_message" | "comment_message" | "publication_message" | "quick_reply_message" | "button_message" | "elements_message" | "postback_message" | "template_message" | "interactive_message";
4664
+ MessageType: "simple_message" | "file_message" | "comment_message" | "publication_message" | "quick_reply_message" | "button_message" | "elements_message" | "postback_message" | "template_message" | "interactive_message" | "unsupported_message";
4570
4665
  /**
4571
4666
  * @description Metrics translated to a **common vocabulary** shared by every network, which is what makes two networks comparable and summable (each network names them differently: `page_post_engagements`, `total_interactions`, `views`…).
4572
4667
  *
@@ -5353,6 +5448,24 @@ interface components {
5353
5448
  */
5354
5449
  verified_date?: string;
5355
5450
  };
5451
+ /**
5452
+ * @description A file that arrived from the network: a photo, a video, a voice note, a document or a sticker in a private message or a comment. **PlanVortex does not store it**: it stays on the network, and this says where to find it.
5453
+ *
5454
+ * • **With `url`**: the network's own link, which your page can load directly. On Instagram, Messenger, Facebook, Threads and Discord it **expires**; on X and Bluesky it does not.
5455
+ * • **Without `url`**: the network only hands the file over with a token that never leaves PlanVortex (WhatsApp, and Telegram, whose download link carries the bot's token), or gives only an identifier (LinkedIn, a Bluesky video). Fetch it through the API.
5456
+ *
5457
+ * Either way, when `url` is missing or stops loading, fetch the file with `GET .../messages/{id_message}/files/{index}` or `GET .../comments/{id_comment}/files/{index}`, where `index` is its position in the list. PlanVortex asks the network for it at that moment and streams it back without keeping a copy.
5458
+ */
5459
+ SocialFileUrl: {
5460
+ /** @description The file's id on the network (WhatsApp's media id, Telegram's `file_id`, a Bluesky CID, a LinkedIn image URN). Treat it as opaque. */
5461
+ external_id?: string;
5462
+ /** @description Always present, so you can decide how to show it. When the network does not say, it is the most likely type: the file fetched through the API comes with its real `Content-Type`. */
5463
+ mime_type: string;
5464
+ /** @description The document's file name, when the network gives one. */
5465
+ name?: string;
5466
+ /** @description The network's direct link, when there is one a browser can open. It may expire. Never present on WhatsApp, Telegram, LinkedIn or a Bluesky video. */
5467
+ url?: string;
5468
+ };
5356
5469
  /** @description The same person, on one channel. */
5357
5470
  SocialIdentifier: {
5358
5471
  _id: string;
@@ -8339,6 +8452,7 @@ interface operations {
8339
8452
  * | --- | --- |
8340
8453
  * | `700` | The account has no usable token: it has to be connected again |
8341
8454
  * | `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`) |
8342
8456
  * | `519` | This endpoint does not accept app credentials |
8343
8457
  * | `544` | This temporal connect token was issued for a different social network |
8344
8458
  */
@@ -8385,7 +8499,23 @@ interface operations {
8385
8499
  };
8386
8500
  content: {
8387
8501
  "application/json": {
8388
- /** @description Templates as the network returns them. */
8502
+ /** @description Whether the account can start conversations. WhatsApp only, and absent when it couldn't be read. */
8503
+ health?: {
8504
+ /** @enum {string} */
8505
+ can_send_message: "AVAILABLE" | "LIMITED" | "BLOCKED";
8506
+ /** @description What blocks or limits it. Calling (SIP) errors are left out: they don't affect messaging. */
8507
+ issues: {
8508
+ /** @description WhatsApp's code: 141006 = payment method, 141010 = business not verified. */
8509
+ code: number;
8510
+ description?: string;
8511
+ /** @description Where the problem is: `PHONE_NUMBER`, `WABA`, `BUSINESS` or `APP`. */
8512
+ entity_type: string;
8513
+ solution?: string;
8514
+ }[];
8515
+ /** @description Warnings that are not errors, such as a display name still pending approval. */
8516
+ notes: string[];
8517
+ };
8518
+ /** @description Templates as the network returns them. For WhatsApp: `id`, `name`, `status`, `category`, `language`, `components` and, when rejected, `rejected_reason`. */
8389
8519
  templates: {
8390
8520
  [key: string]: unknown;
8391
8521
  }[];
@@ -8559,6 +8689,36 @@ interface operations {
8559
8689
  400: components["responses"]["MessagesError"];
8560
8690
  };
8561
8691
  };
8692
+ getMessageFile: {
8693
+ parameters: {
8694
+ query?: never;
8695
+ header?: never;
8696
+ path: {
8697
+ /** @description Connected account identifier */
8698
+ id_account: components["parameters"]["MessagesidAccount"];
8699
+ /** @description The message's `_id`. */
8700
+ id_message: string;
8701
+ /** @description Organization identifier */
8702
+ id_organization: components["parameters"]["MessagesidOrganization"];
8703
+ /** @description Position of the file in `message_options.files_urls`, from 0. */
8704
+ index: number;
8705
+ };
8706
+ cookie?: never;
8707
+ };
8708
+ requestBody?: never;
8709
+ responses: {
8710
+ /** @description The file, with the network's `Content-Type`. */
8711
+ 200: {
8712
+ headers: {
8713
+ [name: string]: unknown;
8714
+ };
8715
+ content: {
8716
+ "*/*": string;
8717
+ };
8718
+ };
8719
+ 400: components["responses"]["MessagesError"];
8720
+ };
8721
+ };
8562
8722
  getMetricList: {
8563
8723
  parameters: {
8564
8724
  query?: never;
@@ -9403,6 +9563,34 @@ interface operations {
9403
9563
  400: components["responses"]["CommentsCommentError"];
9404
9564
  };
9405
9565
  };
9566
+ getCommentFile: {
9567
+ parameters: {
9568
+ query?: never;
9569
+ header?: never;
9570
+ path: {
9571
+ /** @description Comment identifier (PlanVortex's `_id`, not the network's `external_id`) */
9572
+ id_comment: components["parameters"]["CommentsidComment"];
9573
+ /** @description Organization identifier */
9574
+ id_organization: components["parameters"]["CommentsidOrganization"];
9575
+ /** @description Position of the file in the comment's `files_urls`, from 0. */
9576
+ index: number;
9577
+ };
9578
+ cookie?: never;
9579
+ };
9580
+ requestBody?: never;
9581
+ responses: {
9582
+ /** @description The file, with the network's `Content-Type`. */
9583
+ 200: {
9584
+ headers: {
9585
+ [name: string]: unknown;
9586
+ };
9587
+ content: {
9588
+ "*/*": string;
9589
+ };
9590
+ };
9591
+ 400: components["responses"]["CommentsCommentError"];
9592
+ };
9593
+ };
9406
9594
  getCommentReplies: {
9407
9595
  parameters: {
9408
9596
  query?: {
@@ -9620,6 +9808,7 @@ interface operations {
9620
9808
  * | `553` | Some account is not part of this session. `data.accounts` lists them |
9621
9809
  * | `706` | The new accounts do not fit in the plan. `data` carries `limit`, `used` and `requested`, and none was enabled |
9622
9810
  * | `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`) |
9623
9812
  */
9624
9813
  400: {
9625
9814
  headers: {
@@ -11743,6 +11932,7 @@ interface operations {
11743
11932
  * | Code | Meaning |
11744
11933
  * | --- | --- |
11745
11934
  * | `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 |
11746
11936
  * | `532` | `redirect_uri` is not one of the app's registered `redirect_urls` |
11747
11937
  * | `549` | `account_selection` is not `planvortex` or `integrator`, or it is `integrator` without `redirect_uri` or `social_network`. `data` says which |
11748
11938
  * | `550` | `account_selection=integrator` on a network with no return to the browser (`telegram`) |
@@ -13728,7 +13918,7 @@ declare class OrganizationError extends PlanVortexError {
13728
13918
  */
13729
13919
  declare class PlanLimitError extends PlanVortexError {
13730
13920
  }
13731
- /** 1500-1512 — conversaciones, mensajes y plantillas. Exige plan de pago. */
13921
+ /** 1500-1516 — conversaciones, mensajes, plantillas y sus archivos. Exige plan de pago. */
13732
13922
  declare class MessagingError extends PlanVortexError {
13733
13923
  }
13734
13924
  /** 1600-1601 — contactos. */
@@ -13814,7 +14004,7 @@ type WebhookAlgorithm = keyof typeof WEBHOOK_SIGNATURE_HEADERS;
13814
14004
  * **La lista crece**, así que un `field` desconocido se ignora en vez de romper: para eso está
13815
14005
  * {@link UnknownWebhookChange}.
13816
14006
  */
13817
- declare const WEBHOOK_EVENTS: readonly ["new_account", "change_state_account", "messages", "messaging_postbacks", "messaging_seen", "messaging_error", "comments", "integration_error", "ai_plan_generated", "ai_plan_failed"];
14007
+ declare const WEBHOOK_EVENTS: readonly ["new_account", "change_state_account", "messages", "messaging_postbacks", "messaging_seen", "messaging_error", "message_echoes", "comments", "integration_error", "ai_plan_generated", "ai_plan_failed"];
13818
14008
  type WebhookEvent = (typeof WEBHOOK_EVENTS)[number];
13819
14009
  /** Lo que trae todo cambio que cuelga de una CUENTA, pase lo que pase. */
13820
14010
  interface AccountWebhookChangeBase {
@@ -13846,6 +14036,21 @@ interface MessageChange extends AccountWebhookChangeBase {
13846
14036
  /** El contacto del otro lado. Un comentario no tiene, y por eso aquí sí y allí no. */
13847
14037
  id_contact?: string;
13848
14038
  }
14039
+ /**
14040
+ * WhatsApp, cuando el número se usa también en la **app WhatsApp Business** del móvil: el negocio
14041
+ * contestó desde la app. `messageObj` es un mensaje **nuestro** —lleva `contact_id`, el contacto al
14042
+ * que se escribió, y no `from_contact_id`— y llega poblado, como en {@link MessageChange}.
14043
+ *
14044
+ * Es un evento aparte a propósito, y {@link isMessageChange} **no** lo incluye: un bot que contesta a
14045
+ * cada mensaje que entra no tiene que contestarle al propio negocio. Guárdalo en el hilo y ya. No
14046
+ * abre la ventana de 24 horas de WhatsApp.
14047
+ */
14048
+ interface MessageEchoChange extends AccountWebhookChangeBase {
14049
+ field: "message_echoes";
14050
+ messageObj?: Message;
14051
+ /** El contacto al que escribió el negocio */
14052
+ id_contact?: string;
14053
+ }
13849
14054
  /**
13850
14055
  * Llegó un comentario.
13851
14056
  *
@@ -13927,11 +14132,16 @@ interface UnknownWebhookChange {
13927
14132
  * `CommentChange | UnknownWebhookChange`. Para estrechar de verdad están los predicados
13928
14133
  * {@link isCommentChange} y compañía, que es la forma recomendada.
13929
14134
  */
13930
- type WebhookChange = AccountStateChange | MessageChange | CommentChange | IntegrationErrorChange | AiPlanChange | UnknownWebhookChange;
14135
+ type WebhookChange = AccountStateChange | MessageChange | MessageEchoChange | CommentChange | IntegrationErrorChange | AiPlanChange | UnknownWebhookChange;
13931
14136
  /** Una cuenta se conectó o cambió de estado. */
13932
14137
  declare function isAccountStateChange(change: WebhookChange): change is AccountStateChange;
13933
14138
  /** Algo pasó en la mensajería. Incluye el visto y el rechazo de la red, no sólo el mensaje nuevo. */
13934
14139
  declare function isMessageChange(change: WebhookChange): change is MessageChange;
14140
+ /**
14141
+ * El negocio contestó desde la app WhatsApp Business del móvil. No es un mensaje entrante: no lo
14142
+ * contestes. {@link isMessageChange} no lo incluye.
14143
+ */
14144
+ declare function isMessageEchoChange(change: WebhookChange): change is MessageEchoChange;
13935
14145
  /** Llegó un comentario. */
13936
14146
  declare function isCommentChange(change: WebhookChange): change is CommentChange;
13937
14147
  /** Una integración dejó de funcionar. */
@@ -14080,4 +14290,4 @@ interface PlanVortexWebhooksOptions {
14080
14290
  */
14081
14291
  declare function planvortexWebhooks(options: PlanVortexWebhooksOptions): (request: WebhookRequestLike, response: WebhookResponseLike, next: (error?: unknown) => void) => void;
14082
14292
 
14083
- export { type Client as $, type Account as A, type Comment as B, type ConnectLink as C, type Destination as D, type EnableResult as E, type CommentThread as F, type CommentReplyResult as G, type ContactExtraData as H, type Contact as I, type ContactCreate as J, type ContactUpdate as K, type IntegrationProviderName as L, type MetricName as M, type IntegrationProvider as N, type Integration as O, type Paginated as P, type IntegrationConnectRequest as Q, type IntegrationUpdate as R, type SocialNetwork as S, type TopPublicationsResult as T, type IntegrationPickerConfig as U, type IntegrationCatalogPage as V, type MessageTemplate as W, type Conversation as X, type ConversationTotals as Y, type Message as Z, type MessageInput as _, type ConnectResult as a, MessagingError as a$, type Organization as a0, type AiSettings as a1, type ClientWithOrganizations as a2, type AccountSelection as a3, type PlanData as a4, type PlanUseData as a5, type ConnectToken as a6, type AiContext as a7, type SocialCredentialsInput as a8, type Product as a9, type AiPlanSourceProduct as aA, type AiPlanState as aB, type ApiErrorBody as aC, type AspectRatios as aD, AuthError as aE, type ClientPlan as aF, type CommentAuthor as aG, type CommentChange as aH, type ConnectSessionAccount as aI, type ContactChannel as aJ, ContactError as aK, type DashboardAiPlanRef as aL, type DashboardPublicationRef as aM, type DashboardRange as aN, type EngagementBase as aO, FileError as aP, type FileFormat as aQ, type FileProperties as aR, type FileType as aS, type IntegrationCatalogProduct as aT, type IntegrationConfig as aU, IntegrationError as aV, type IntegrationErrorChange as aW, type IntegrationFormField as aX, type MessageChange as aY, type MessageOptions as aZ, type MessageType as a_, type ProductInput as aa, type ProductCatalog as ab, type ProductCatalogInput as ac, type PublicationInput as ad, type PublicationState as ae, type PublicationStats as af, type PublicationStatsHistory as ag, type Upload as ah, AccountError as ai, type AccountMetricRow as aj, type AccountStateChange as ak, type AccountWebhookChangeBase as al, type AccountWithError as am, type AiImageOrigin as an, type AiPlanCostEstimate as ao, type AiPlanDestination as ap, AiPlanError as aq, type AiPlanNotice as ar, type AiPlanOptions as as, type AiPlanOptionsInput as at, type AiPlanResult as au, type AiPlanResultsGroup as av, type AiPlanResultsTemplateGroup as aw, type AiPlanSource as ax, type AiPlanSourceImageInput as ay, type AiPlanSourceInput as az, type ConnectSession as b, WebhookBodyError as b$, type MetricRow as b0, NO_ERROR_CODE as b1, type components as b2, type operations as b3, type paths as b4, type webhooks as b5, type OpenEnum as b6, OrganizationError as b7, PLANVORTEX_ERROR_RANGES as b8, PlanLimitError as b9, type UnknownWebhookChange as bA, UserError as bB, type WebhookAlgorithm as bC, type WebhookChange as bD, type WebhookEvent as bE, type WithAccount as bF, type WithPublication as bG, type WooCommerceConnectRequest as bH, account as bI, accountId as bJ, errorFamilyForCode as bK, isPlanVortexError as bL, isTokenError as bM, messageContact as bN, messageContactId as bO, messageDirection as bP, messageFileIds as bQ, messageFiles as bR, publication as bS, publicationId as bT, type AiPlanChange as bU, type HandleWebhookRequestOptions as bV, type PlanVortexWebhooksOptions as bW, type RawWebhookBody as bX, type VerifyWebhookSignatureOptions as bY, WEBHOOK_EVENTS as bZ, WEBHOOK_SIGNATURE_HEADERS as b_, PlanVortexAuthenticationError as ba, PlanVortexConfigError as bb, PlanVortexConnectionError as bc, PlanVortexError as bd, type PlanVortexErrorOptions as be, type PlanVortexErrorRange as bf, type PlannerTemplateField as bg, type PlannerTemplateFieldType as bh, ProductError as bi, type PublicationAiGenerated as bj, type PublicationDestination as bk, PublicationError as bl, type PublicationErrorDetail as bm, type PublicationMetrics as bn, type PublicationPending as bo, type PublicationStatsPoint as bp, type PublicationType as bq, type PublicationsSummary as br, type RssConfig as bs, type SocialAuthorizationMethod as bt, type SocialCredentials as bu, type SocialIdentifier as bv, type SocialIdentifierInput as bw, type SocialLimitsMap as bx, TOKEN_ERROR_CODES as by, type TopPublication as bz, type AccountMetrics as c, type WebhookHeaders as c0, type WebhookRequestLike as c1, type WebhookResponseLike as c2, WebhookSignatureError as c3, handleWebhookRequest as c4, isAccountStateChange as c5, isAiPlanChange as c6, isCommentChange as c7, isIntegrationErrorChange as c8, isMessageChange as c9, parseWebhookPayload as ca, planvortexWebhooks as cb, verifyWebhookSignature as cc, type PublishSettings as d, type PersistentMenu as e, type Dashboard as f, type DashboardMetricsResult as g, type PublicationsSummaryResult as h, type PublicationsStatsResult as i, type PlanUse as j, type Publication as k, type AiPlanResultsSort as l, type PlannerTemplateName as m, type AiPlanCreateRequest as n, type AiPlanCreateResult as o, type AiPlan as p, type AiPlanResults as q, type ClientApp as r, type ClientAppInput as s, type SocialCapabilities as t, type CommentActions as u, type SocialLimits as v, type PublicationLimits as w, type AspectRatiosByNetwork as x, type PlannerTemplate as y, type CommentNetwork as z };
14293
+ export { type Client as $, type Account as A, type Comment as B, type ConnectLink as C, type Destination as D, type EnableResult as E, type CommentThread as F, type CommentReplyResult as G, type ContactExtraData as H, type Contact as I, type ContactCreate as J, type ContactUpdate as K, type IntegrationProviderName as L, type MetricName as M, type IntegrationProvider as N, type Integration as O, type Paginated as P, type IntegrationConnectRequest as Q, type IntegrationUpdate as R, type SocialNetwork as S, type TopPublicationsResult as T, type IntegrationPickerConfig as U, type IntegrationCatalogPage as V, type MessageTemplate as W, type Conversation as X, type ConversationTotals as Y, type Message as Z, type MessageInput as _, type ConnectResult as a, type MessageType as a$, type Organization as a0, type AiSettings as a1, type ClientWithOrganizations as a2, type AccountSelection as a3, type PlanData as a4, type PlanUseData as a5, type ConnectToken as a6, type AiContext as a7, type SocialCredentialsInput as a8, type Product as a9, type AiPlanSourceProduct as aA, type AiPlanState as aB, type ApiErrorBody as aC, type AspectRatios as aD, AuthError as aE, type ClientPlan as aF, type CommentAuthor as aG, type CommentChange as aH, type ConnectSessionAccount as aI, type ContactChannel as aJ, ContactError as aK, type DashboardAiPlanRef as aL, type DashboardPublicationRef as aM, type DashboardRange as aN, type EngagementBase as aO, FileError as aP, type FileFormat as aQ, type FileProperties as aR, type FileType as aS, type IntegrationCatalogProduct as aT, type IntegrationConfig as aU, IntegrationError as aV, type IntegrationErrorChange as aW, type IntegrationFormField as aX, type MessageChange as aY, type MessageEchoChange as aZ, type MessageOptions as a_, type ProductInput as aa, type ProductCatalog as ab, type ProductCatalogInput as ac, type PublicationInput as ad, type PublicationState as ae, type PublicationStats as af, type PublicationStatsHistory as ag, type Upload as ah, AccountError as ai, type AccountMetricRow as aj, type AccountStateChange as ak, type AccountWebhookChangeBase as al, type AccountWithError as am, type AiImageOrigin as an, type AiPlanCostEstimate as ao, type AiPlanDestination as ap, AiPlanError as aq, type AiPlanNotice as ar, type AiPlanOptions as as, type AiPlanOptionsInput as at, type AiPlanResult as au, type AiPlanResultsGroup as av, type AiPlanResultsTemplateGroup as aw, type AiPlanSource as ax, type AiPlanSourceImageInput as ay, type AiPlanSourceInput as az, type ConnectSession as b, WEBHOOK_SIGNATURE_HEADERS as b$, MessagingError as b0, type MetricRow as b1, NO_ERROR_CODE as b2, type components as b3, type operations as b4, type paths as b5, type webhooks as b6, type OpenEnum as b7, OrganizationError as b8, PLANVORTEX_ERROR_RANGES as b9, type TopPublication as bA, type UnknownWebhookChange as bB, UserError as bC, type WebhookAlgorithm as bD, type WebhookChange as bE, type WebhookEvent as bF, type WithAccount as bG, type WithPublication as bH, type WooCommerceConnectRequest as bI, account as bJ, accountId as bK, errorFamilyForCode as bL, isPlanVortexError as bM, isTokenError as bN, messageContact as bO, messageContactId as bP, messageDirection as bQ, messageFileIds as bR, messageFiles as bS, publication as bT, publicationId as bU, type AiPlanChange as bV, type HandleWebhookRequestOptions as bW, type PlanVortexWebhooksOptions as bX, type RawWebhookBody as bY, type VerifyWebhookSignatureOptions as bZ, WEBHOOK_EVENTS as b_, PlanLimitError as ba, PlanVortexAuthenticationError as bb, PlanVortexConfigError as bc, PlanVortexConnectionError as bd, PlanVortexError as be, type PlanVortexErrorOptions as bf, type PlanVortexErrorRange as bg, type PlannerTemplateField as bh, type PlannerTemplateFieldType as bi, ProductError as bj, type PublicationAiGenerated as bk, type PublicationDestination as bl, PublicationError as bm, type PublicationErrorDetail as bn, type PublicationMetrics as bo, type PublicationPending as bp, type PublicationStatsPoint as bq, type PublicationType as br, type PublicationsSummary as bs, type RssConfig as bt, type SocialAuthorizationMethod as bu, type SocialCredentials as bv, type SocialIdentifier as bw, type SocialIdentifierInput as bx, type SocialLimitsMap as by, TOKEN_ERROR_CODES as bz, type AccountMetrics as c, WebhookBodyError as c0, type WebhookHeaders as c1, type WebhookRequestLike as c2, type WebhookResponseLike as c3, WebhookSignatureError as c4, handleWebhookRequest as c5, isAccountStateChange as c6, isAiPlanChange as c7, isCommentChange as c8, isIntegrationErrorChange as c9, isMessageChange as ca, isMessageEchoChange as cb, parseWebhookPayload as cc, planvortexWebhooks as cd, verifyWebhookSignature as ce, type PublishSettings as d, type PersistentMenu as e, type Dashboard as f, type DashboardMetricsResult as g, type PublicationsSummaryResult as h, type PublicationsStatsResult as i, type PlanUse as j, type Publication as k, type AiPlanResultsSort as l, type PlannerTemplateName as m, type AiPlanCreateRequest as n, type AiPlanCreateResult as o, type AiPlan as p, type AiPlanResults as q, type ClientApp as r, type ClientAppInput as s, type SocialCapabilities as t, type CommentActions as u, type SocialLimits as v, type PublicationLimits as w, type AspectRatiosByNetwork as x, type PlannerTemplate as y, type CommentNetwork as z };