planvortex 0.2.0 → 0.3.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 +6 -4
- package/dist/{index-Bs_Usq51.d.cts → index-BMoQHhe-.d.cts} +16 -10
- package/dist/{index-Bs_Usq51.d.ts → index-BMoQHhe-.d.ts} +16 -10
- package/dist/index.cjs +53 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +46 -10
- package/dist/index.d.ts +46 -10
- package/dist/index.js +54 -8
- package/dist/index.js.map +1 -1
- package/dist/webhooks/index.d.cts +1 -1
- package/dist/webhooks/index.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -111,7 +111,7 @@ for await (const publication of pv.publications.iterate(orgId, { state: ["ready"
|
|
|
111
111
|
| `pv.comments` | `list`, `iterate`, `unreadCount`, `thread`, `threadByAccount`, `replies`, `reply`, `update`, `markRead`, `remove`, `actions` |
|
|
112
112
|
| `pv.messages` | `conversations`, `iterateConversations`, `conversationTotals`, `list`, `iterate`, `send`, `unreadCount`, `removeByAccount`, `templates`, `createTemplate`, `deleteTemplate` |
|
|
113
113
|
| `pv.contacts` | `list`, `iterate`, `get`, `create`, `update`, `merge`, `remove`, `removeAll` |
|
|
114
|
-
| `pv.products` | `list`, `iterate`, `create`, `catalogs`, `createCatalog` |
|
|
114
|
+
| `pv.products` | `list`, `iterate`, `get`, `create`, `catalogs`, `createCatalog` |
|
|
115
115
|
| `pv.integrations` | `providers`, `list`, `iterate`, `get`, `connectLink`, `connect`, `reconnect`, `update`, `remove`, `pickerConfig` |
|
|
116
116
|
| `pv.aiPlans` | `create`, `get`, `list`, `iterate`, `validate`, `retry`, `regenerate`, `remove` |
|
|
117
117
|
| `pv.dashboard` | `summary`, `metrics`, `publications`, `topPublications`, `publicationStats`, `use` |
|
|
@@ -131,8 +131,10 @@ const { data } = await pv.request<{ comments: Comment[]; total: number }>({
|
|
|
131
131
|
```
|
|
132
132
|
|
|
133
133
|
These types are generated from the same OpenAPI specification the
|
|
134
|
-
[documentation](https://planvortex.com/documentation) is rendered from
|
|
135
|
-
|
|
134
|
+
[documentation](https://planvortex.com/documentation) is rendered from — published whole at
|
|
135
|
+
[planvortex.com/openapi.json](https://planvortex.com/openapi.json), if you would rather generate
|
|
136
|
+
your own client — so they cannot describe an endpoint that does not exist. One deliberate
|
|
137
|
+
exception to "generated": every enumeration that grows
|
|
136
138
|
with the product — `SocialNetwork`, `PublicationState`, `FileFormat` — is **open**. The known values
|
|
137
139
|
autocomplete, and a network added to PlanVortex next month does not break your build.
|
|
138
140
|
|
|
@@ -391,7 +393,7 @@ npm test # no network, no credentials
|
|
|
391
393
|
npm run typecheck
|
|
392
394
|
npm run lint
|
|
393
395
|
npm run docs # the TypeDoc reference, into docs/
|
|
394
|
-
npm run generate #
|
|
396
|
+
npm run generate # refresh the OpenAPI copy from PlanVortexHome and regenerate the types
|
|
395
397
|
npm run check:exports # publint + arethetypeswrong
|
|
396
398
|
npm run test:live # against a real PlanVortex; needs .env.live, and skips itself without it
|
|
397
399
|
```
|
|
@@ -3571,9 +3571,15 @@ interface components {
|
|
|
3571
3571
|
/**
|
|
3572
3572
|
* @description What you send to write a message.
|
|
3573
3573
|
*
|
|
3574
|
-
*
|
|
3574
|
+
* `comment_message` and `publication_message` need `in_response_external_id`, the identifier of the comment or the publication being answered ON THE NETWORK. The endpoint did not read it from the body until 2026-08-24, which left both types unreachable from the public API; it does now.
|
|
3575
3575
|
*/
|
|
3576
3576
|
MessagesMessageInput: {
|
|
3577
|
+
/**
|
|
3578
|
+
* @description Required by `comment_message` and `publication_message`, and ignored by every other type (error `1510` when it is missing). It is the identifier the NETWORK gives: a comment's `external_id` or a publication's `external_identifier`, never a PlanVortex `_id`.
|
|
3579
|
+
*
|
|
3580
|
+
* Only Facebook and Instagram do anything with it: `comment_message` sends a private reply to a public comment (Meta's `recipient.comment_id`) and `publication_message` attaches the post as a `MEDIA_SHARE`.
|
|
3581
|
+
*/
|
|
3582
|
+
in_response_external_id?: string;
|
|
3577
3583
|
message_options?: components["schemas"]["MessageOptions"];
|
|
3578
3584
|
message_type: components["schemas"]["MessageType"];
|
|
3579
3585
|
/** @description Required for the text-based types. Validated against `characters` in `GET /social_limits`. */
|
|
@@ -7085,8 +7091,9 @@ interface operations {
|
|
|
7085
7091
|
/** @description The catalogue to list. **Effectively required**: without it the request fails with `ERROR_CODE_2000`. Get one from `GET .../products_catalogs`. */
|
|
7086
7092
|
product_catalog_id?: string;
|
|
7087
7093
|
/**
|
|
7088
|
-
* @
|
|
7089
|
-
*
|
|
7094
|
+
* @description One product, by its identifier on the network. It takes precedence over `product_catalog_id`, and one of the two has to travel or the call answers `ERROR_CODE_2000`. It used to be forwarded under a name the SDK does not read, so it never reached the network; that was fixed on 2026-08-24.
|
|
7095
|
+
*
|
|
7096
|
+
* **The answer is shaped differently.** Asking for one product goes to that product's node, so the network answers with the product itself and `items` carries an object rather than an array. Handle both shapes, or use `product_catalog_id` and pick the product out of the page.
|
|
7090
7097
|
*/
|
|
7091
7098
|
product_id?: string;
|
|
7092
7099
|
};
|
|
@@ -7761,10 +7768,7 @@ interface operations {
|
|
|
7761
7768
|
offset?: components["parameters"]["Contactsoffset"];
|
|
7762
7769
|
/** @description Full-text search over the contact's name. */
|
|
7763
7770
|
search?: string;
|
|
7764
|
-
/**
|
|
7765
|
-
* @deprecated
|
|
7766
|
-
* @description **Do not use: it always returns an empty list.** The server compares the whole `social_identifiers` array against the network name, and the array holds objects, so nothing ever matches. Filter client-side on `social_identifiers[].social_network` until this is fixed.
|
|
7767
|
-
*/
|
|
7771
|
+
/** @description Only the contacts reachable on this network. It matches on `social_identifiers[].social_network`, so a contact with several channels comes back through any of them. It used to return an empty list always, because the server compared the whole array of objects against the network name; that was fixed on 2026-08-24. */
|
|
7768
7772
|
social_network?: components["schemas"]["SocialNetwork"];
|
|
7769
7773
|
};
|
|
7770
7774
|
header?: never;
|
|
@@ -10882,9 +10886,11 @@ type ConversationTotals = Schemas["MessagesConversationTotals"];
|
|
|
10882
10886
|
/**
|
|
10883
10887
|
* Lo que se manda para escribir un mensaje.
|
|
10884
10888
|
*
|
|
10885
|
-
* `comment_message` y `publication_message`
|
|
10886
|
-
*
|
|
10887
|
-
*
|
|
10889
|
+
* `comment_message` y `publication_message` exigen `in_response_external_id`: el identificador EN
|
|
10890
|
+
* LA RED de lo que se responde —el `external_id` de un comentario, el `external_identifier` de una
|
|
10891
|
+
* publicacion—, nunca un `_id` de PlanVortex, y error 1510 si falta. El endpoint no lo leia del
|
|
10892
|
+
* cuerpo hasta el 2026-08-24, lo que dejaba los dos tipos fuera del alcance de la API publica; ya
|
|
10893
|
+
* funcionan, en Facebook y en Instagram.
|
|
10888
10894
|
*/
|
|
10889
10895
|
type MessageInput = Override<Schemas["MessagesMessageInput"], {
|
|
10890
10896
|
message_options: Partial<MessageOptions>;
|
|
@@ -3571,9 +3571,15 @@ interface components {
|
|
|
3571
3571
|
/**
|
|
3572
3572
|
* @description What you send to write a message.
|
|
3573
3573
|
*
|
|
3574
|
-
*
|
|
3574
|
+
* `comment_message` and `publication_message` need `in_response_external_id`, the identifier of the comment or the publication being answered ON THE NETWORK. The endpoint did not read it from the body until 2026-08-24, which left both types unreachable from the public API; it does now.
|
|
3575
3575
|
*/
|
|
3576
3576
|
MessagesMessageInput: {
|
|
3577
|
+
/**
|
|
3578
|
+
* @description Required by `comment_message` and `publication_message`, and ignored by every other type (error `1510` when it is missing). It is the identifier the NETWORK gives: a comment's `external_id` or a publication's `external_identifier`, never a PlanVortex `_id`.
|
|
3579
|
+
*
|
|
3580
|
+
* Only Facebook and Instagram do anything with it: `comment_message` sends a private reply to a public comment (Meta's `recipient.comment_id`) and `publication_message` attaches the post as a `MEDIA_SHARE`.
|
|
3581
|
+
*/
|
|
3582
|
+
in_response_external_id?: string;
|
|
3577
3583
|
message_options?: components["schemas"]["MessageOptions"];
|
|
3578
3584
|
message_type: components["schemas"]["MessageType"];
|
|
3579
3585
|
/** @description Required for the text-based types. Validated against `characters` in `GET /social_limits`. */
|
|
@@ -7085,8 +7091,9 @@ interface operations {
|
|
|
7085
7091
|
/** @description The catalogue to list. **Effectively required**: without it the request fails with `ERROR_CODE_2000`. Get one from `GET .../products_catalogs`. */
|
|
7086
7092
|
product_catalog_id?: string;
|
|
7087
7093
|
/**
|
|
7088
|
-
* @
|
|
7089
|
-
*
|
|
7094
|
+
* @description One product, by its identifier on the network. It takes precedence over `product_catalog_id`, and one of the two has to travel or the call answers `ERROR_CODE_2000`. It used to be forwarded under a name the SDK does not read, so it never reached the network; that was fixed on 2026-08-24.
|
|
7095
|
+
*
|
|
7096
|
+
* **The answer is shaped differently.** Asking for one product goes to that product's node, so the network answers with the product itself and `items` carries an object rather than an array. Handle both shapes, or use `product_catalog_id` and pick the product out of the page.
|
|
7090
7097
|
*/
|
|
7091
7098
|
product_id?: string;
|
|
7092
7099
|
};
|
|
@@ -7761,10 +7768,7 @@ interface operations {
|
|
|
7761
7768
|
offset?: components["parameters"]["Contactsoffset"];
|
|
7762
7769
|
/** @description Full-text search over the contact's name. */
|
|
7763
7770
|
search?: string;
|
|
7764
|
-
/**
|
|
7765
|
-
* @deprecated
|
|
7766
|
-
* @description **Do not use: it always returns an empty list.** The server compares the whole `social_identifiers` array against the network name, and the array holds objects, so nothing ever matches. Filter client-side on `social_identifiers[].social_network` until this is fixed.
|
|
7767
|
-
*/
|
|
7771
|
+
/** @description Only the contacts reachable on this network. It matches on `social_identifiers[].social_network`, so a contact with several channels comes back through any of them. It used to return an empty list always, because the server compared the whole array of objects against the network name; that was fixed on 2026-08-24. */
|
|
7768
7772
|
social_network?: components["schemas"]["SocialNetwork"];
|
|
7769
7773
|
};
|
|
7770
7774
|
header?: never;
|
|
@@ -10882,9 +10886,11 @@ type ConversationTotals = Schemas["MessagesConversationTotals"];
|
|
|
10882
10886
|
/**
|
|
10883
10887
|
* Lo que se manda para escribir un mensaje.
|
|
10884
10888
|
*
|
|
10885
|
-
* `comment_message` y `publication_message`
|
|
10886
|
-
*
|
|
10887
|
-
*
|
|
10889
|
+
* `comment_message` y `publication_message` exigen `in_response_external_id`: el identificador EN
|
|
10890
|
+
* LA RED de lo que se responde —el `external_id` de un comentario, el `external_identifier` de una
|
|
10891
|
+
* publicacion—, nunca un `_id` de PlanVortex, y error 1510 si falta. El endpoint no lo leia del
|
|
10892
|
+
* cuerpo hasta el 2026-08-24, lo que dejaba los dos tipos fuera del alcance de la API publica; ya
|
|
10893
|
+
* funcionan, en Facebook y en Instagram.
|
|
10888
10894
|
*/
|
|
10889
10895
|
type MessageInput = Override<Schemas["MessagesMessageInput"], {
|
|
10890
10896
|
message_options: Partial<MessageOptions>;
|
package/dist/index.cjs
CHANGED
|
@@ -4,7 +4,7 @@ var path = require('path');
|
|
|
4
4
|
|
|
5
5
|
// src/version.ts
|
|
6
6
|
var PLANVORTEX_API_URL = "https://api.planvortex.com/v1.0.0";
|
|
7
|
-
var VERSION = "0.
|
|
7
|
+
var VERSION = "0.3.0";
|
|
8
8
|
|
|
9
9
|
// src/core/errors.ts
|
|
10
10
|
var PLANVORTEX_ERROR_RANGES = [
|
|
@@ -1265,9 +1265,13 @@ var ContactsResource = class extends Resource {
|
|
|
1265
1265
|
/**
|
|
1266
1266
|
* La agenda de la organización, de la más reciente a la más antigua.
|
|
1267
1267
|
*
|
|
1268
|
-
*
|
|
1269
|
-
* array `social_identifiers`
|
|
1270
|
-
*
|
|
1268
|
+
* `social_network` acota a los contactos localizables en esa red. Devolvía siempre una lista
|
|
1269
|
+
* vacía —el servidor comparaba el array entero de `social_identifiers` contra el nombre de la
|
|
1270
|
+
* red— hasta que se arregló el 2026-08-24; hasta la 0.3.0 este método no lo exponía.
|
|
1271
|
+
*
|
|
1272
|
+
* ```ts
|
|
1273
|
+
* const { data } = await pv.contacts.list(orgId, { social_network: "whatsapp", limit: 50 });
|
|
1274
|
+
* ```
|
|
1271
1275
|
*/
|
|
1272
1276
|
async list(idOrganization, options = {}) {
|
|
1273
1277
|
return this.getList(this.path(idOrganization), "contacts", listQuery2(options), options);
|
|
@@ -1362,7 +1366,8 @@ function listQuery2(options) {
|
|
|
1362
1366
|
const query = {
|
|
1363
1367
|
offset: options.offset,
|
|
1364
1368
|
limit: options.limit,
|
|
1365
|
-
search: options.search
|
|
1369
|
+
search: options.search,
|
|
1370
|
+
social_network: options.social_network
|
|
1366
1371
|
};
|
|
1367
1372
|
options.extra_data?.forEach((filter, index) => {
|
|
1368
1373
|
query[`extra_data[${index}][key]`] = filter.key;
|
|
@@ -1713,6 +1718,13 @@ var MessagesResource = class extends Resource {
|
|
|
1713
1718
|
* En Facebook e Instagram sólo se admite **un** adjunto por mensaje (error 1509), y en WhatsApp
|
|
1714
1719
|
* fuera de la ventana de 24 horas sólo se admite una plantilla.
|
|
1715
1720
|
*
|
|
1721
|
+
* `comment_message` y `publication_message` exigen `in_response_external_id`: el identificador
|
|
1722
|
+
* EN LA RED de lo que se responde —el `external_id` de un comentario, el `external_identifier`
|
|
1723
|
+
* de una publicación—, nunca un `_id` de PlanVortex, y error 1510 si falta. El endpoint no lo
|
|
1724
|
+
* leía del cuerpo hasta el 2026-08-24, lo que dejaba los dos tipos fuera del alcance de la API
|
|
1725
|
+
* pública; ya funcionan, y sólo en Facebook e Instagram: `comment_message` manda una respuesta
|
|
1726
|
+
* privada a un comentario público y `publication_message` adjunta el post como `MEDIA_SHARE`.
|
|
1727
|
+
*
|
|
1716
1728
|
* ```ts
|
|
1717
1729
|
* await pv.messages.send(orgId, accountId, contactId, {
|
|
1718
1730
|
* message_type: "simple_message",
|
|
@@ -2091,8 +2103,8 @@ var ProductsResource = class extends Resource {
|
|
|
2091
2103
|
* Los productos de un catálogo.
|
|
2092
2104
|
*
|
|
2093
2105
|
* `idCatalog` es obligatorio de hecho aunque la API lo pinte opcional: sin él la petición falla
|
|
2094
|
-
* con el error 2000.
|
|
2095
|
-
*
|
|
2106
|
+
* con el error 2000. Para pedir **un** producto por su identificador, {@link get} — no es un
|
|
2107
|
+
* argumento de aquí porque la respuesta viene con otra forma.
|
|
2096
2108
|
*
|
|
2097
2109
|
* ```ts
|
|
2098
2110
|
* const { data } = await pv.products.list(orgId, accountId, catalogId, { limit: 50 });
|
|
@@ -2122,6 +2134,40 @@ var ProductsResource = class extends Resource {
|
|
|
2122
2134
|
options
|
|
2123
2135
|
);
|
|
2124
2136
|
}
|
|
2137
|
+
/**
|
|
2138
|
+
* UN producto, por su identificador **en la red** (el de Meta, no un `_id` de PlanVortex).
|
|
2139
|
+
*
|
|
2140
|
+
* El servidor reenviaba ese filtro con un nombre que el SDK no lee, así que nunca llegaba a la
|
|
2141
|
+
* red y la llamada moría con un 2000; se arregló el 2026-08-24 y aquí se expone desde la 0.3.0.
|
|
2142
|
+
*
|
|
2143
|
+
* **La respuesta viene con otra forma que la del listado.** Pedir un producto suelto va al nodo
|
|
2144
|
+
* de ese producto, así que la red contesta con el producto y `items` trae un objeto. Por eso
|
|
2145
|
+
* esto es un método aparte y no un argumento de {@link list}: con un objeto no se construye una
|
|
2146
|
+
* página. Se acepta también una lista, que es lo que devolvería un despliegue que envolviera la
|
|
2147
|
+
* respuesta, y coger el primero es mejor que reventar por la forma del sobre.
|
|
2148
|
+
*
|
|
2149
|
+
* ```ts
|
|
2150
|
+
* const product = await pv.products.get(orgId, accountId, "7123456789012345");
|
|
2151
|
+
* ```
|
|
2152
|
+
*/
|
|
2153
|
+
async get(idOrganization, idAccount, productId, options = {}) {
|
|
2154
|
+
const body = await this.httpGet(
|
|
2155
|
+
`${this.path(idOrganization, idAccount)}/products`,
|
|
2156
|
+
{ product_id: requireId(productId, "productId") },
|
|
2157
|
+
options
|
|
2158
|
+
);
|
|
2159
|
+
const content = unwrapOne(body, "items");
|
|
2160
|
+
if (Array.isArray(content)) {
|
|
2161
|
+
if (!content.length) {
|
|
2162
|
+
throw new PlanVortexError(NO_ERROR_CODE, `La red no devuelve ning\xFAn producto "${productId}".`, {
|
|
2163
|
+
family: "http",
|
|
2164
|
+
data: { product_id: productId }
|
|
2165
|
+
});
|
|
2166
|
+
}
|
|
2167
|
+
return content[0];
|
|
2168
|
+
}
|
|
2169
|
+
return content;
|
|
2170
|
+
}
|
|
2125
2171
|
/**
|
|
2126
2172
|
* Da de alta un producto en un catálogo, o **actualiza uno existente** si el cuerpo trae `id`.
|
|
2127
2173
|
* Devuelve el identificador en la red, no el producto.
|