planvortex 0.19.0 → 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 +20 -3
- package/dist/{chunk-ZHS7FY3T.js → chunk-DRVCK5JO.js} +7 -3
- package/dist/chunk-DRVCK5JO.js.map +1 -0
- package/dist/{index-DD7oGNvm.d.cts → index-BQPQczjR.d.cts} +182 -11
- package/dist/{index-DD7oGNvm.d.ts → index-BQPQczjR.d.ts} +182 -11
- package/dist/index.cjs +84 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +61 -6
- package/dist/index.d.ts +61 -6
- package/dist/index.js +81 -3
- package/dist/index.js.map +1 -1
- package/dist/webhooks/index.cjs +5 -1
- package/dist/webhooks/index.cjs.map +1 -1
- package/dist/webhooks/index.d.cts +1 -1
- package/dist/webhooks/index.d.ts +1 -1
- package/dist/webhooks/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-ZHS7FY3T.js.map +0 -1
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-
|
|
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
|
-
|
|
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-
|
|
161
|
-
//# sourceMappingURL=chunk-
|
|
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;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,Y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M,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
|
*
|
|
@@ -3771,6 +3844,12 @@ interface components {
|
|
|
3771
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.
|
|
3772
3845
|
*/
|
|
3773
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"][];
|
|
3774
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. */
|
|
3775
3854
|
hidden: boolean;
|
|
3776
3855
|
/**
|
|
@@ -3807,7 +3886,7 @@ interface components {
|
|
|
3807
3886
|
/** @description Absent when the network does not publish it — not zero */
|
|
3808
3887
|
reply_count?: number;
|
|
3809
3888
|
social_network: components["schemas"]["CommentsCommentNetworkName"];
|
|
3810
|
-
/** @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. */
|
|
3811
3890
|
text: string;
|
|
3812
3891
|
};
|
|
3813
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. */
|
|
@@ -4243,7 +4322,7 @@ interface components {
|
|
|
4243
4322
|
* The catalogue grows with the product, so treat an unknown `code` as a generic failure instead of rejecting it.
|
|
4244
4323
|
*/
|
|
4245
4324
|
Error: {
|
|
4246
|
-
/** @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-
|
|
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. */
|
|
4247
4326
|
code: number;
|
|
4248
4327
|
/** @description Extra context attached to the error, when there is any. */
|
|
4249
4328
|
data?: {
|
|
@@ -4508,11 +4587,8 @@ interface components {
|
|
|
4508
4587
|
MessageOptions: {
|
|
4509
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. */
|
|
4510
4589
|
files: (string | components["schemas"]["Upload"])[];
|
|
4511
|
-
/** @description Files
|
|
4512
|
-
files_urls:
|
|
4513
|
-
mime_type?: string;
|
|
4514
|
-
url?: string;
|
|
4515
|
-
}[];
|
|
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"][];
|
|
4516
4592
|
/** @description Meta cards, for `elements_message` and `button_message`. */
|
|
4517
4593
|
metaElements?: {
|
|
4518
4594
|
[key: string]: unknown;
|
|
@@ -5372,6 +5448,24 @@ interface components {
|
|
|
5372
5448
|
*/
|
|
5373
5449
|
verified_date?: string;
|
|
5374
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
|
+
};
|
|
5375
5469
|
/** @description The same person, on one channel. */
|
|
5376
5470
|
SocialIdentifier: {
|
|
5377
5471
|
_id: string;
|
|
@@ -8358,6 +8452,7 @@ interface operations {
|
|
|
8358
8452
|
* | --- | --- |
|
|
8359
8453
|
* | `700` | The account has no usable token: it has to be connected again |
|
|
8360
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`) |
|
|
8361
8456
|
* | `519` | This endpoint does not accept app credentials |
|
|
8362
8457
|
* | `544` | This temporal connect token was issued for a different social network |
|
|
8363
8458
|
*/
|
|
@@ -8404,7 +8499,23 @@ interface operations {
|
|
|
8404
8499
|
};
|
|
8405
8500
|
content: {
|
|
8406
8501
|
"application/json": {
|
|
8407
|
-
/** @description
|
|
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`. */
|
|
8408
8519
|
templates: {
|
|
8409
8520
|
[key: string]: unknown;
|
|
8410
8521
|
}[];
|
|
@@ -8578,6 +8689,36 @@ interface operations {
|
|
|
8578
8689
|
400: components["responses"]["MessagesError"];
|
|
8579
8690
|
};
|
|
8580
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
|
+
};
|
|
8581
8722
|
getMetricList: {
|
|
8582
8723
|
parameters: {
|
|
8583
8724
|
query?: never;
|
|
@@ -9422,6 +9563,34 @@ interface operations {
|
|
|
9422
9563
|
400: components["responses"]["CommentsCommentError"];
|
|
9423
9564
|
};
|
|
9424
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
|
+
};
|
|
9425
9594
|
getCommentReplies: {
|
|
9426
9595
|
parameters: {
|
|
9427
9596
|
query?: {
|
|
@@ -9639,6 +9808,7 @@ interface operations {
|
|
|
9639
9808
|
* | `553` | Some account is not part of this session. `data.accounts` lists them |
|
|
9640
9809
|
* | `706` | The new accounts do not fit in the plan. `data` carries `limit`, `used` and `requested`, and none was enabled |
|
|
9641
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`) |
|
|
9642
9812
|
*/
|
|
9643
9813
|
400: {
|
|
9644
9814
|
headers: {
|
|
@@ -11762,6 +11932,7 @@ interface operations {
|
|
|
11762
11932
|
* | Code | Meaning |
|
|
11763
11933
|
* | --- | --- |
|
|
11764
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 |
|
|
11765
11936
|
* | `532` | `redirect_uri` is not one of the app's registered `redirect_urls` |
|
|
11766
11937
|
* | `549` | `account_selection` is not `planvortex` or `integrator`, or it is `integrator` without `redirect_uri` or `social_network`. `data` says which |
|
|
11767
11938
|
* | `550` | `account_selection=integrator` on a network with no return to the browser (`telegram`) |
|
|
@@ -13747,7 +13918,7 @@ declare class OrganizationError extends PlanVortexError {
|
|
|
13747
13918
|
*/
|
|
13748
13919
|
declare class PlanLimitError extends PlanVortexError {
|
|
13749
13920
|
}
|
|
13750
|
-
/** 1500-
|
|
13921
|
+
/** 1500-1516 — conversaciones, mensajes, plantillas y sus archivos. Exige plan de pago. */
|
|
13751
13922
|
declare class MessagingError extends PlanVortexError {
|
|
13752
13923
|
}
|
|
13753
13924
|
/** 1600-1601 — contactos. */
|