@funnelchat-hq/sdk 0.3.1 → 0.3.2
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 +19 -10
- package/dist/index.cjs +28 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +125 -12
- package/dist/index.d.ts +125 -12
- package/dist/index.js +28 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -81,7 +81,7 @@ declare class PagePromise<T> implements PromiseLike<Page<T>>, AsyncIterable<T> {
|
|
|
81
81
|
|
|
82
82
|
/**
|
|
83
83
|
* GENERATED FILE — do not edit. Run `npm run generate`.
|
|
84
|
-
* Source: spec/funnelchat.json (sha256
|
|
84
|
+
* Source: spec/funnelchat.json (sha256 0ffaad2b25733d28…) + spec/pending.json.
|
|
85
85
|
*/
|
|
86
86
|
interface paths {
|
|
87
87
|
"/api/v1/broadcasts": {
|
|
@@ -2556,6 +2556,8 @@ interface paths {
|
|
|
2556
2556
|
* Listar los grupos que administra un número
|
|
2557
2557
|
* @description **Permiso requerido:** **Grupos y campañas → Ver**
|
|
2558
2558
|
*
|
|
2559
|
+
* **Nota:** La lista se lee de WhatsApp y, para una API key, se reutiliza durante un minuto por número: un grupo recién creado en WhatsApp puede tardar hasta un minuto en aparecer. Si un grupo ya está en la cuenta, trae `device_id`. Para importar uno: `POST /groups/{group}/import`.
|
|
2560
|
+
*
|
|
2559
2561
|
* **Con API key:** la respuesta siempre viene paginada. Tamaño de página: `pageSize` (por defecto 25, máximo 100; un valor mayor, menor que 1 o no entero responde `422`).
|
|
2560
2562
|
*/
|
|
2561
2563
|
get: operations["group.groups"];
|
|
@@ -2631,6 +2633,28 @@ interface paths {
|
|
|
2631
2633
|
patch?: never;
|
|
2632
2634
|
trace?: never;
|
|
2633
2635
|
};
|
|
2636
|
+
"/api/v1/groups/{group}/import": {
|
|
2637
|
+
parameters: {
|
|
2638
|
+
query?: never;
|
|
2639
|
+
header?: never;
|
|
2640
|
+
path?: never;
|
|
2641
|
+
cookie?: never;
|
|
2642
|
+
};
|
|
2643
|
+
get?: never;
|
|
2644
|
+
put?: never;
|
|
2645
|
+
/**
|
|
2646
|
+
* Importar un grupo de un número
|
|
2647
|
+
* @description **Permiso requerido:** **Grupos y campañas → Administrar grupos**
|
|
2648
|
+
*
|
|
2649
|
+
* **Nota:** Importa a la cuenta un grupo del número indicado en `device_id`, igual que importarlo desde el panel: queda visible en el panel, se sincronizan sus participantes y desde entonces genera los avisos `group_participant.joined` y `group_participant.left`. Los datos del grupo y si el número es administrador se leen de WhatsApp en la misma llamada. Responde `201` si lo importó y `200` si ya estaba en la cuenta, con `is_admin`. Solo números QR: con un número oficial responde `422 provider_unsupported`. Si el grupo no es del número responde `404 group_not_found`. Cada número importa hasta 5 grupos por minuto (`429 import_rate_limited`, con `retry_after` en segundos). Dos pedidos a la vez por el mismo grupo lo importan una sola vez. Un grupo que ya está en otro workspace de la cuenta no se puede importar en este.
|
|
2650
|
+
*/
|
|
2651
|
+
post: operations["v2.apiGroupImport"];
|
|
2652
|
+
delete?: never;
|
|
2653
|
+
options?: never;
|
|
2654
|
+
head?: never;
|
|
2655
|
+
patch?: never;
|
|
2656
|
+
trace?: never;
|
|
2657
|
+
};
|
|
2634
2658
|
"/api/v1/groups/{group}": {
|
|
2635
2659
|
parameters: {
|
|
2636
2660
|
query?: never;
|
|
@@ -2692,7 +2716,7 @@ interface paths {
|
|
|
2692
2716
|
* Mandar un mensaje a un grupo
|
|
2693
2717
|
* @description **Permiso requerido:** **Grupos y campañas → Enviar**
|
|
2694
2718
|
*
|
|
2695
|
-
* **Nota:** Asíncrona: responde 202 con `action_id`; consulta el resultado en `GET /groups/actions/{action}` (`result.message.uid` es el id del mensaje en WhatsApp). `type`: `text`, `image`, `video`, `audio` o `document`. Con un número QR sale al ritmo de los mensajes programados de velocidad Low, que el integrador no puede cambiar. Con un número oficial se verifican, antes de aceptar, la ventana de servicio de 24 horas y la calidad del número. No tiene tope de volumen del plan.
|
|
2719
|
+
* **Nota:** Asíncrona: responde 202 con `action_id`; consulta el resultado en `GET /groups/actions/{action}` (`result.message.uid` es el id del mensaje en WhatsApp). `type`: `text`, `image`, `video`, `audio` o `document`. Con un número QR sale al ritmo de los mensajes programados de velocidad Low, que el integrador no puede cambiar. Con un número oficial se verifican, antes de aceptar, la ventana de servicio de 24 horas y la calidad del número. No tiene tope de volumen del plan. Si el grupo todavía no está en la cuenta y el número es QR, primero se importa como en `POST /groups/{group}/import` (pide además **Grupos y campañas → Administrar grupos**, `403 import_permission_required` sin él) y el envío sigue con las mismas reglas: si el número no es administrador del grupo no se importa nada y responde `422 device_not_group_admin`. Esa importación cuenta en el tope de 5 por minuto del número.
|
|
2696
2720
|
*/
|
|
2697
2721
|
post: operations["apiGroupAction.sendMessage"];
|
|
2698
2722
|
delete?: never;
|
|
@@ -8566,6 +8590,25 @@ interface components {
|
|
|
8566
8590
|
device_id: number;
|
|
8567
8591
|
description: string | null;
|
|
8568
8592
|
};
|
|
8593
|
+
/**
|
|
8594
|
+
* ApiGroupDeviceRequest
|
|
8595
|
+
* @description `device_id` of the number that acts (query string of the live invite-link read, body of the renew
|
|
8596
|
+
* action).
|
|
8597
|
+
*/
|
|
8598
|
+
ApiGroupDeviceRequest: {
|
|
8599
|
+
device_id: number;
|
|
8600
|
+
};
|
|
8601
|
+
/** ApiGroupImportResource */
|
|
8602
|
+
ApiGroupImportResource: {
|
|
8603
|
+
/** @description Identificador del grupo en WhatsApp. */
|
|
8604
|
+
uid: string;
|
|
8605
|
+
/** @description Nombre del grupo. */
|
|
8606
|
+
name: string | null;
|
|
8607
|
+
/** @description `true` si esta llamada lo importó; `false` si ya estaba en la cuenta. */
|
|
8608
|
+
imported: boolean;
|
|
8609
|
+
/** @description Si el número indicado es administrador del grupo, según WhatsApp. Sin serlo no puede enviarle mensajes ni hacer acciones de grupo. */
|
|
8610
|
+
is_admin: boolean;
|
|
8611
|
+
};
|
|
8569
8612
|
/**
|
|
8570
8613
|
* ApiGroupNameRequest
|
|
8571
8614
|
* @description Cuerpo de `PUT /groups/{group}/name`: el nombre se envía a WhatsApp tal cual, sin numeración de campaña.
|
|
@@ -17304,6 +17347,49 @@ interface operations {
|
|
|
17304
17347
|
};
|
|
17305
17348
|
};
|
|
17306
17349
|
};
|
|
17350
|
+
"v2.apiGroupImport": {
|
|
17351
|
+
parameters: {
|
|
17352
|
+
query?: never;
|
|
17353
|
+
header?: never;
|
|
17354
|
+
path: {
|
|
17355
|
+
/** @description Identificador del grupo en WhatsApp, como lo lista `GET /v1/devices/{device}/groups`. */
|
|
17356
|
+
group: string;
|
|
17357
|
+
};
|
|
17358
|
+
cookie?: never;
|
|
17359
|
+
};
|
|
17360
|
+
requestBody: {
|
|
17361
|
+
content: {
|
|
17362
|
+
"application/json": components["schemas"]["ApiGroupDeviceRequest"];
|
|
17363
|
+
};
|
|
17364
|
+
};
|
|
17365
|
+
responses: {
|
|
17366
|
+
/** @description El grupo ya estaba en la cuenta: no se importó de nuevo. */
|
|
17367
|
+
200: {
|
|
17368
|
+
headers: {
|
|
17369
|
+
[name: string]: unknown;
|
|
17370
|
+
};
|
|
17371
|
+
content: {
|
|
17372
|
+
"application/json": {
|
|
17373
|
+
data: components["schemas"]["ApiGroupImportResource"];
|
|
17374
|
+
};
|
|
17375
|
+
};
|
|
17376
|
+
};
|
|
17377
|
+
/** @description El grupo se importó en esta llamada. */
|
|
17378
|
+
201: {
|
|
17379
|
+
headers: {
|
|
17380
|
+
[name: string]: unknown;
|
|
17381
|
+
};
|
|
17382
|
+
content: {
|
|
17383
|
+
"application/json": {
|
|
17384
|
+
data: components["schemas"]["ApiGroupImportResource"];
|
|
17385
|
+
};
|
|
17386
|
+
};
|
|
17387
|
+
};
|
|
17388
|
+
401: components["responses"]["CommunitiesAuthenticationException"];
|
|
17389
|
+
403: components["responses"]["CommunitiesAuthorizationException"];
|
|
17390
|
+
422: components["responses"]["CommunitiesValidationException"];
|
|
17391
|
+
};
|
|
17392
|
+
};
|
|
17307
17393
|
"group.show": {
|
|
17308
17394
|
parameters: {
|
|
17309
17395
|
query?: never;
|
|
@@ -24775,6 +24861,7 @@ type GroupUid = PathParams<'/api/v1/groups/{groupUid}/metadata', 'GET'>['groupUi
|
|
|
24775
24861
|
type DeviceId$1 = PathParams<'/api/v1/devices/{device}/groups', 'GET'>['device'];
|
|
24776
24862
|
type SendGroup = PathParams<'/api/v1/groups/{group}/messages', 'POST'>['group'];
|
|
24777
24863
|
type ActionId = PathParams<'/api/v1/groups/actions/{action}', 'GET'>['action'];
|
|
24864
|
+
type FollowGroup = PathParams<'/api/v1/groups/{group}/import', 'POST'>['group'];
|
|
24778
24865
|
/**
|
|
24779
24866
|
* WhatsApp groups (communities area): read them, their participants, events and messages, and send a
|
|
24780
24867
|
* message to a group. Reading needs **Groups and campaigns → View**; sending,
|
|
@@ -24866,7 +24953,11 @@ declare class Groups extends Resource {
|
|
|
24866
24953
|
} & {
|
|
24867
24954
|
[key: string]: unknown;
|
|
24868
24955
|
}>;
|
|
24869
|
-
/**
|
|
24956
|
+
/**
|
|
24957
|
+
* `GET /api/v1/devices/{device}/groups`, paginated (`page`, `pageSize`): the groups of one number,
|
|
24958
|
+
* read live from WhatsApp (for a key, reused for a minute per number). A group that is already in
|
|
24959
|
+
* the account brings `device_id`; any other can be followed with {@link Groups.follow}.
|
|
24960
|
+
*/
|
|
24870
24961
|
listByDevice(device: DeviceId$1, query?: Query<'/api/v1/devices/{device}/groups'>, options?: RequestOptions): PagePromise<{
|
|
24871
24962
|
uid: string | "";
|
|
24872
24963
|
name: string | "";
|
|
@@ -24986,6 +25077,22 @@ declare class Groups extends Resource {
|
|
|
24986
25077
|
action_id: string;
|
|
24987
25078
|
status: "queued";
|
|
24988
25079
|
}>;
|
|
25080
|
+
/**
|
|
25081
|
+
* `POST /api/v1/groups/{group}/import`: follows a WhatsApp group of a QR number (`device_id`), as
|
|
25082
|
+
* importing it in the panel does: from then on its joins and leaves arrive by
|
|
25083
|
+
* `group_participant.joined` and `group_participant.left`. Resolves to `{ data: { uid, name,
|
|
25084
|
+
* imported, is_admin } }`: `imported` is `false` when the group was already in the account, and
|
|
25085
|
+
* `is_admin` says whether the number administers it (without that it cannot write to it). Needs
|
|
25086
|
+
* **Groups and campaigns → Manage groups** (`403 import_permission_required`); up to 5 groups
|
|
25087
|
+
* per number per minute (`429 import_rate_limited`, with `retryAfter`); an official number is
|
|
25088
|
+
* `422 provider_unsupported`. {@link Groups.sendMessage} follows the group itself when it is not in
|
|
25089
|
+
* the account yet.
|
|
25090
|
+
*/
|
|
25091
|
+
follow(group: FollowGroup, body: Body<'/api/v1/groups/{group}/import', 'POST'>, options?: RequestOptions): APIPromise<{
|
|
25092
|
+
data: components["schemas"]["ApiGroupImportResource"];
|
|
25093
|
+
} | {
|
|
25094
|
+
data: components["schemas"]["ApiGroupImportResource"];
|
|
25095
|
+
}>;
|
|
24989
25096
|
/**
|
|
24990
25097
|
* `GET /api/v1/groups/actions/{action}`: where a group action, such as a message sent with
|
|
24991
25098
|
* {@link Groups.sendMessage}, is (`queued`, `running`, `completed` or `failed`) and its `result`.
|
|
@@ -25303,7 +25410,7 @@ declare class Templates extends Resource {
|
|
|
25303
25410
|
|
|
25304
25411
|
/**
|
|
25305
25412
|
* GENERATED FILE — do not edit. Run `npm run generate`.
|
|
25306
|
-
* Source: spec/funnelchat.json (sha256
|
|
25413
|
+
* Source: spec/funnelchat.json (sha256 0ffaad2b25733d28…) + spec/pending.json.
|
|
25307
25414
|
*/
|
|
25308
25415
|
|
|
25309
25416
|
/** One entry of the webhook event catalog. `pending` = taken from spec/pending.json. */
|
|
@@ -26387,7 +26494,7 @@ type PendingEventData = Record<never, never>;
|
|
|
26387
26494
|
* to production on 25-10 (src/index.ts; its latest tag, v0.3.0, is older); conversations v1.19.7
|
|
26388
26495
|
* (Message/Services/ApiSendGuard.php and Message/Support/ApiKeySendResponse.php, byte-identical to
|
|
26389
26496
|
* v1.18.10, and WhatsappForm/Support/FormSendPreflight.php); accounts v1.5.97 (creating and
|
|
26390
|
-
* connecting numbers, contract 1022-alta-de-numeros); communities v2.35.5 (the callers of
|
|
26497
|
+
* connecting numbers, contract 1022-alta-de-numeros); communities v2.35.5 and v2.35.7 (the callers of
|
|
26391
26498
|
* GroupManagement/Exceptions/ApiGroupActionRejected.php). The full unified spec of developers-portal
|
|
26392
26499
|
* c90565e4 enumerates only the send rules of conversations (and the read receipt and typing routes,
|
|
26393
26500
|
* which have no method here); the rest is not documented there yet. When it is, this list can be
|
|
@@ -26505,9 +26612,9 @@ declare const NUMBER_ERROR_CODES: {
|
|
|
26505
26612
|
readonly credentials_not_allowed: 403;
|
|
26506
26613
|
};
|
|
26507
26614
|
/**
|
|
26508
|
-
* Rejections of a message to a group (`groups.sendMessage`)
|
|
26509
|
-
* (`groups.retrieveAction`): nothing was queued. A number
|
|
26510
|
-
* that does not exist.
|
|
26615
|
+
* Rejections of a message to a group (`groups.sendMessage`), of following a group (`groups.follow`)
|
|
26616
|
+
* and of reading a group action (`groups.retrieveAction`): nothing was queued or imported. A number
|
|
26617
|
+
* or group of another workspace is answered as one that does not exist.
|
|
26511
26618
|
*/
|
|
26512
26619
|
declare const GROUP_ACTION_ERROR_CODES: {
|
|
26513
26620
|
/** 404: `device_id` is not a number of the key's workspace. */
|
|
@@ -26534,6 +26641,12 @@ declare const GROUP_ACTION_ERROR_CODES: {
|
|
|
26534
26641
|
readonly unsupported_type: 422;
|
|
26535
26642
|
/** 429: the number has 50 group actions open. Wait for some to finish; not worth retrying. */
|
|
26536
26643
|
readonly too_many_pending_actions: 429;
|
|
26644
|
+
/** 403: following a group (also by writing to one not in the account) needs **Groups and campaigns → Manage groups**. */
|
|
26645
|
+
readonly import_permission_required: 403;
|
|
26646
|
+
/** 429, with `Retry-After`: the number already followed 5 groups this minute. */
|
|
26647
|
+
readonly import_rate_limited: 429;
|
|
26648
|
+
/** 409: another call is following the same group right now. */
|
|
26649
|
+
readonly import_in_progress: 409;
|
|
26537
26650
|
};
|
|
26538
26651
|
/** Rejections of a create sent with `idempotencyKey`. */
|
|
26539
26652
|
declare const IDEMPOTENCY_ERROR_CODES: {
|
|
@@ -26982,7 +27095,7 @@ declare class Funnelchat {
|
|
|
26982
27095
|
readonly verify: typeof verify;
|
|
26983
27096
|
readonly constructEvent: typeof constructEvent;
|
|
26984
27097
|
};
|
|
26985
|
-
static readonly VERSION = "0.3.
|
|
27098
|
+
static readonly VERSION = "0.3.2";
|
|
26986
27099
|
readonly baseUrl: string;
|
|
26987
27100
|
readonly timeoutMs: number;
|
|
26988
27101
|
readonly maxRetries: number;
|
|
@@ -27030,7 +27143,7 @@ declare class Funnelchat {
|
|
|
27030
27143
|
|
|
27031
27144
|
/**
|
|
27032
27145
|
* GENERATED FILE — do not edit. Run `npm run generate`.
|
|
27033
|
-
* Source: spec/funnelchat.json (sha256
|
|
27146
|
+
* Source: spec/funnelchat.json (sha256 0ffaad2b25733d28…) + spec/pending.json.
|
|
27034
27147
|
*/
|
|
27035
27148
|
/** One operation of the public API. `pending` = taken from spec/pending.json, not from the snapshot. */
|
|
27036
27149
|
interface RouteInfo {
|
|
@@ -27043,10 +27156,10 @@ interface RouteInfo {
|
|
|
27043
27156
|
readonly summary: string | null;
|
|
27044
27157
|
readonly pending: boolean;
|
|
27045
27158
|
}
|
|
27046
|
-
/** Every operation of the spec (
|
|
27159
|
+
/** Every operation of the spec (284), sorted by path. */
|
|
27047
27160
|
declare const routes: readonly RouteInfo[];
|
|
27048
27161
|
|
|
27049
27162
|
/** The SDK version, sent in the `User-Agent`. A test keeps it equal to package.json. */
|
|
27050
|
-
declare const VERSION = "0.3.
|
|
27163
|
+
declare const VERSION = "0.3.2";
|
|
27051
27164
|
|
|
27052
27165
|
export { ACCESS_ERROR_CODES, APIConnectionError, APIConnectionTimeoutError, APIError, APIPromise, type APIResponse, APIUserAbortError, type AccessErrorCode, type ApiPath, AuthenticationError, BASE_URLS, BadRequestError, type Body, type ClientOptions, ConflictError, DEFAULT_MAX_RETRIES, DEFAULT_TIMEOUT_MS, DEFAULT_TOLERANCE_SECONDS, type Environment, type FieldErrors, Funnelchat, FunnelchatError, GROUP_ACTION_ERROR_CODES, type GroupActionErrorCode, type HttpMethod, IDEMPOTENCY_ERROR_CODES, type IdempotencyErrorCode, type IdempotentRequestOptions, InternalServerError, type KnownErrorCode, type ListItem, NUMBER_ERROR_CODES, NotFoundError, type NumberErrorCode, Page, PagePromise, type PathParams, PermissionDeniedError, type Query, type QueryParams, REQUEST_ID_HEADER, RateLimitError, type RawBody, type RequestBody, type RequestOptions, type ResponseBody, type RouteInfo, SEND_ERROR_CODES, SIGNATURE_HEADER, type SendErrorCode, type SendMessageParams, type TypedRequestOptions, UnprocessableEntityError, UnsupportedMediaTypeError, type UntypedRequestOptions, VERSION, type VerifyOptions, type WebhookEvent, type WebhookEventData, type WebhookEventEnvelope, type WebhookEventInfo, type WebhookEventOf, type WebhookEventType, type webhooks as WebhookSchemas, WebhookVerificationError, type WebhookVerificationFailure, type components, constructEvent, Funnelchat as default, isNumberQuotaError, isSendRuleError, type operations, type paths, routes, verify, webhookEvents };
|
package/dist/index.d.ts
CHANGED
|
@@ -81,7 +81,7 @@ declare class PagePromise<T> implements PromiseLike<Page<T>>, AsyncIterable<T> {
|
|
|
81
81
|
|
|
82
82
|
/**
|
|
83
83
|
* GENERATED FILE — do not edit. Run `npm run generate`.
|
|
84
|
-
* Source: spec/funnelchat.json (sha256
|
|
84
|
+
* Source: spec/funnelchat.json (sha256 0ffaad2b25733d28…) + spec/pending.json.
|
|
85
85
|
*/
|
|
86
86
|
interface paths {
|
|
87
87
|
"/api/v1/broadcasts": {
|
|
@@ -2556,6 +2556,8 @@ interface paths {
|
|
|
2556
2556
|
* Listar los grupos que administra un número
|
|
2557
2557
|
* @description **Permiso requerido:** **Grupos y campañas → Ver**
|
|
2558
2558
|
*
|
|
2559
|
+
* **Nota:** La lista se lee de WhatsApp y, para una API key, se reutiliza durante un minuto por número: un grupo recién creado en WhatsApp puede tardar hasta un minuto en aparecer. Si un grupo ya está en la cuenta, trae `device_id`. Para importar uno: `POST /groups/{group}/import`.
|
|
2560
|
+
*
|
|
2559
2561
|
* **Con API key:** la respuesta siempre viene paginada. Tamaño de página: `pageSize` (por defecto 25, máximo 100; un valor mayor, menor que 1 o no entero responde `422`).
|
|
2560
2562
|
*/
|
|
2561
2563
|
get: operations["group.groups"];
|
|
@@ -2631,6 +2633,28 @@ interface paths {
|
|
|
2631
2633
|
patch?: never;
|
|
2632
2634
|
trace?: never;
|
|
2633
2635
|
};
|
|
2636
|
+
"/api/v1/groups/{group}/import": {
|
|
2637
|
+
parameters: {
|
|
2638
|
+
query?: never;
|
|
2639
|
+
header?: never;
|
|
2640
|
+
path?: never;
|
|
2641
|
+
cookie?: never;
|
|
2642
|
+
};
|
|
2643
|
+
get?: never;
|
|
2644
|
+
put?: never;
|
|
2645
|
+
/**
|
|
2646
|
+
* Importar un grupo de un número
|
|
2647
|
+
* @description **Permiso requerido:** **Grupos y campañas → Administrar grupos**
|
|
2648
|
+
*
|
|
2649
|
+
* **Nota:** Importa a la cuenta un grupo del número indicado en `device_id`, igual que importarlo desde el panel: queda visible en el panel, se sincronizan sus participantes y desde entonces genera los avisos `group_participant.joined` y `group_participant.left`. Los datos del grupo y si el número es administrador se leen de WhatsApp en la misma llamada. Responde `201` si lo importó y `200` si ya estaba en la cuenta, con `is_admin`. Solo números QR: con un número oficial responde `422 provider_unsupported`. Si el grupo no es del número responde `404 group_not_found`. Cada número importa hasta 5 grupos por minuto (`429 import_rate_limited`, con `retry_after` en segundos). Dos pedidos a la vez por el mismo grupo lo importan una sola vez. Un grupo que ya está en otro workspace de la cuenta no se puede importar en este.
|
|
2650
|
+
*/
|
|
2651
|
+
post: operations["v2.apiGroupImport"];
|
|
2652
|
+
delete?: never;
|
|
2653
|
+
options?: never;
|
|
2654
|
+
head?: never;
|
|
2655
|
+
patch?: never;
|
|
2656
|
+
trace?: never;
|
|
2657
|
+
};
|
|
2634
2658
|
"/api/v1/groups/{group}": {
|
|
2635
2659
|
parameters: {
|
|
2636
2660
|
query?: never;
|
|
@@ -2692,7 +2716,7 @@ interface paths {
|
|
|
2692
2716
|
* Mandar un mensaje a un grupo
|
|
2693
2717
|
* @description **Permiso requerido:** **Grupos y campañas → Enviar**
|
|
2694
2718
|
*
|
|
2695
|
-
* **Nota:** Asíncrona: responde 202 con `action_id`; consulta el resultado en `GET /groups/actions/{action}` (`result.message.uid` es el id del mensaje en WhatsApp). `type`: `text`, `image`, `video`, `audio` o `document`. Con un número QR sale al ritmo de los mensajes programados de velocidad Low, que el integrador no puede cambiar. Con un número oficial se verifican, antes de aceptar, la ventana de servicio de 24 horas y la calidad del número. No tiene tope de volumen del plan.
|
|
2719
|
+
* **Nota:** Asíncrona: responde 202 con `action_id`; consulta el resultado en `GET /groups/actions/{action}` (`result.message.uid` es el id del mensaje en WhatsApp). `type`: `text`, `image`, `video`, `audio` o `document`. Con un número QR sale al ritmo de los mensajes programados de velocidad Low, que el integrador no puede cambiar. Con un número oficial se verifican, antes de aceptar, la ventana de servicio de 24 horas y la calidad del número. No tiene tope de volumen del plan. Si el grupo todavía no está en la cuenta y el número es QR, primero se importa como en `POST /groups/{group}/import` (pide además **Grupos y campañas → Administrar grupos**, `403 import_permission_required` sin él) y el envío sigue con las mismas reglas: si el número no es administrador del grupo no se importa nada y responde `422 device_not_group_admin`. Esa importación cuenta en el tope de 5 por minuto del número.
|
|
2696
2720
|
*/
|
|
2697
2721
|
post: operations["apiGroupAction.sendMessage"];
|
|
2698
2722
|
delete?: never;
|
|
@@ -8566,6 +8590,25 @@ interface components {
|
|
|
8566
8590
|
device_id: number;
|
|
8567
8591
|
description: string | null;
|
|
8568
8592
|
};
|
|
8593
|
+
/**
|
|
8594
|
+
* ApiGroupDeviceRequest
|
|
8595
|
+
* @description `device_id` of the number that acts (query string of the live invite-link read, body of the renew
|
|
8596
|
+
* action).
|
|
8597
|
+
*/
|
|
8598
|
+
ApiGroupDeviceRequest: {
|
|
8599
|
+
device_id: number;
|
|
8600
|
+
};
|
|
8601
|
+
/** ApiGroupImportResource */
|
|
8602
|
+
ApiGroupImportResource: {
|
|
8603
|
+
/** @description Identificador del grupo en WhatsApp. */
|
|
8604
|
+
uid: string;
|
|
8605
|
+
/** @description Nombre del grupo. */
|
|
8606
|
+
name: string | null;
|
|
8607
|
+
/** @description `true` si esta llamada lo importó; `false` si ya estaba en la cuenta. */
|
|
8608
|
+
imported: boolean;
|
|
8609
|
+
/** @description Si el número indicado es administrador del grupo, según WhatsApp. Sin serlo no puede enviarle mensajes ni hacer acciones de grupo. */
|
|
8610
|
+
is_admin: boolean;
|
|
8611
|
+
};
|
|
8569
8612
|
/**
|
|
8570
8613
|
* ApiGroupNameRequest
|
|
8571
8614
|
* @description Cuerpo de `PUT /groups/{group}/name`: el nombre se envía a WhatsApp tal cual, sin numeración de campaña.
|
|
@@ -17304,6 +17347,49 @@ interface operations {
|
|
|
17304
17347
|
};
|
|
17305
17348
|
};
|
|
17306
17349
|
};
|
|
17350
|
+
"v2.apiGroupImport": {
|
|
17351
|
+
parameters: {
|
|
17352
|
+
query?: never;
|
|
17353
|
+
header?: never;
|
|
17354
|
+
path: {
|
|
17355
|
+
/** @description Identificador del grupo en WhatsApp, como lo lista `GET /v1/devices/{device}/groups`. */
|
|
17356
|
+
group: string;
|
|
17357
|
+
};
|
|
17358
|
+
cookie?: never;
|
|
17359
|
+
};
|
|
17360
|
+
requestBody: {
|
|
17361
|
+
content: {
|
|
17362
|
+
"application/json": components["schemas"]["ApiGroupDeviceRequest"];
|
|
17363
|
+
};
|
|
17364
|
+
};
|
|
17365
|
+
responses: {
|
|
17366
|
+
/** @description El grupo ya estaba en la cuenta: no se importó de nuevo. */
|
|
17367
|
+
200: {
|
|
17368
|
+
headers: {
|
|
17369
|
+
[name: string]: unknown;
|
|
17370
|
+
};
|
|
17371
|
+
content: {
|
|
17372
|
+
"application/json": {
|
|
17373
|
+
data: components["schemas"]["ApiGroupImportResource"];
|
|
17374
|
+
};
|
|
17375
|
+
};
|
|
17376
|
+
};
|
|
17377
|
+
/** @description El grupo se importó en esta llamada. */
|
|
17378
|
+
201: {
|
|
17379
|
+
headers: {
|
|
17380
|
+
[name: string]: unknown;
|
|
17381
|
+
};
|
|
17382
|
+
content: {
|
|
17383
|
+
"application/json": {
|
|
17384
|
+
data: components["schemas"]["ApiGroupImportResource"];
|
|
17385
|
+
};
|
|
17386
|
+
};
|
|
17387
|
+
};
|
|
17388
|
+
401: components["responses"]["CommunitiesAuthenticationException"];
|
|
17389
|
+
403: components["responses"]["CommunitiesAuthorizationException"];
|
|
17390
|
+
422: components["responses"]["CommunitiesValidationException"];
|
|
17391
|
+
};
|
|
17392
|
+
};
|
|
17307
17393
|
"group.show": {
|
|
17308
17394
|
parameters: {
|
|
17309
17395
|
query?: never;
|
|
@@ -24775,6 +24861,7 @@ type GroupUid = PathParams<'/api/v1/groups/{groupUid}/metadata', 'GET'>['groupUi
|
|
|
24775
24861
|
type DeviceId$1 = PathParams<'/api/v1/devices/{device}/groups', 'GET'>['device'];
|
|
24776
24862
|
type SendGroup = PathParams<'/api/v1/groups/{group}/messages', 'POST'>['group'];
|
|
24777
24863
|
type ActionId = PathParams<'/api/v1/groups/actions/{action}', 'GET'>['action'];
|
|
24864
|
+
type FollowGroup = PathParams<'/api/v1/groups/{group}/import', 'POST'>['group'];
|
|
24778
24865
|
/**
|
|
24779
24866
|
* WhatsApp groups (communities area): read them, their participants, events and messages, and send a
|
|
24780
24867
|
* message to a group. Reading needs **Groups and campaigns → View**; sending,
|
|
@@ -24866,7 +24953,11 @@ declare class Groups extends Resource {
|
|
|
24866
24953
|
} & {
|
|
24867
24954
|
[key: string]: unknown;
|
|
24868
24955
|
}>;
|
|
24869
|
-
/**
|
|
24956
|
+
/**
|
|
24957
|
+
* `GET /api/v1/devices/{device}/groups`, paginated (`page`, `pageSize`): the groups of one number,
|
|
24958
|
+
* read live from WhatsApp (for a key, reused for a minute per number). A group that is already in
|
|
24959
|
+
* the account brings `device_id`; any other can be followed with {@link Groups.follow}.
|
|
24960
|
+
*/
|
|
24870
24961
|
listByDevice(device: DeviceId$1, query?: Query<'/api/v1/devices/{device}/groups'>, options?: RequestOptions): PagePromise<{
|
|
24871
24962
|
uid: string | "";
|
|
24872
24963
|
name: string | "";
|
|
@@ -24986,6 +25077,22 @@ declare class Groups extends Resource {
|
|
|
24986
25077
|
action_id: string;
|
|
24987
25078
|
status: "queued";
|
|
24988
25079
|
}>;
|
|
25080
|
+
/**
|
|
25081
|
+
* `POST /api/v1/groups/{group}/import`: follows a WhatsApp group of a QR number (`device_id`), as
|
|
25082
|
+
* importing it in the panel does: from then on its joins and leaves arrive by
|
|
25083
|
+
* `group_participant.joined` and `group_participant.left`. Resolves to `{ data: { uid, name,
|
|
25084
|
+
* imported, is_admin } }`: `imported` is `false` when the group was already in the account, and
|
|
25085
|
+
* `is_admin` says whether the number administers it (without that it cannot write to it). Needs
|
|
25086
|
+
* **Groups and campaigns → Manage groups** (`403 import_permission_required`); up to 5 groups
|
|
25087
|
+
* per number per minute (`429 import_rate_limited`, with `retryAfter`); an official number is
|
|
25088
|
+
* `422 provider_unsupported`. {@link Groups.sendMessage} follows the group itself when it is not in
|
|
25089
|
+
* the account yet.
|
|
25090
|
+
*/
|
|
25091
|
+
follow(group: FollowGroup, body: Body<'/api/v1/groups/{group}/import', 'POST'>, options?: RequestOptions): APIPromise<{
|
|
25092
|
+
data: components["schemas"]["ApiGroupImportResource"];
|
|
25093
|
+
} | {
|
|
25094
|
+
data: components["schemas"]["ApiGroupImportResource"];
|
|
25095
|
+
}>;
|
|
24989
25096
|
/**
|
|
24990
25097
|
* `GET /api/v1/groups/actions/{action}`: where a group action, such as a message sent with
|
|
24991
25098
|
* {@link Groups.sendMessage}, is (`queued`, `running`, `completed` or `failed`) and its `result`.
|
|
@@ -25303,7 +25410,7 @@ declare class Templates extends Resource {
|
|
|
25303
25410
|
|
|
25304
25411
|
/**
|
|
25305
25412
|
* GENERATED FILE — do not edit. Run `npm run generate`.
|
|
25306
|
-
* Source: spec/funnelchat.json (sha256
|
|
25413
|
+
* Source: spec/funnelchat.json (sha256 0ffaad2b25733d28…) + spec/pending.json.
|
|
25307
25414
|
*/
|
|
25308
25415
|
|
|
25309
25416
|
/** One entry of the webhook event catalog. `pending` = taken from spec/pending.json. */
|
|
@@ -26387,7 +26494,7 @@ type PendingEventData = Record<never, never>;
|
|
|
26387
26494
|
* to production on 25-10 (src/index.ts; its latest tag, v0.3.0, is older); conversations v1.19.7
|
|
26388
26495
|
* (Message/Services/ApiSendGuard.php and Message/Support/ApiKeySendResponse.php, byte-identical to
|
|
26389
26496
|
* v1.18.10, and WhatsappForm/Support/FormSendPreflight.php); accounts v1.5.97 (creating and
|
|
26390
|
-
* connecting numbers, contract 1022-alta-de-numeros); communities v2.35.5 (the callers of
|
|
26497
|
+
* connecting numbers, contract 1022-alta-de-numeros); communities v2.35.5 and v2.35.7 (the callers of
|
|
26391
26498
|
* GroupManagement/Exceptions/ApiGroupActionRejected.php). The full unified spec of developers-portal
|
|
26392
26499
|
* c90565e4 enumerates only the send rules of conversations (and the read receipt and typing routes,
|
|
26393
26500
|
* which have no method here); the rest is not documented there yet. When it is, this list can be
|
|
@@ -26505,9 +26612,9 @@ declare const NUMBER_ERROR_CODES: {
|
|
|
26505
26612
|
readonly credentials_not_allowed: 403;
|
|
26506
26613
|
};
|
|
26507
26614
|
/**
|
|
26508
|
-
* Rejections of a message to a group (`groups.sendMessage`)
|
|
26509
|
-
* (`groups.retrieveAction`): nothing was queued. A number
|
|
26510
|
-
* that does not exist.
|
|
26615
|
+
* Rejections of a message to a group (`groups.sendMessage`), of following a group (`groups.follow`)
|
|
26616
|
+
* and of reading a group action (`groups.retrieveAction`): nothing was queued or imported. A number
|
|
26617
|
+
* or group of another workspace is answered as one that does not exist.
|
|
26511
26618
|
*/
|
|
26512
26619
|
declare const GROUP_ACTION_ERROR_CODES: {
|
|
26513
26620
|
/** 404: `device_id` is not a number of the key's workspace. */
|
|
@@ -26534,6 +26641,12 @@ declare const GROUP_ACTION_ERROR_CODES: {
|
|
|
26534
26641
|
readonly unsupported_type: 422;
|
|
26535
26642
|
/** 429: the number has 50 group actions open. Wait for some to finish; not worth retrying. */
|
|
26536
26643
|
readonly too_many_pending_actions: 429;
|
|
26644
|
+
/** 403: following a group (also by writing to one not in the account) needs **Groups and campaigns → Manage groups**. */
|
|
26645
|
+
readonly import_permission_required: 403;
|
|
26646
|
+
/** 429, with `Retry-After`: the number already followed 5 groups this minute. */
|
|
26647
|
+
readonly import_rate_limited: 429;
|
|
26648
|
+
/** 409: another call is following the same group right now. */
|
|
26649
|
+
readonly import_in_progress: 409;
|
|
26537
26650
|
};
|
|
26538
26651
|
/** Rejections of a create sent with `idempotencyKey`. */
|
|
26539
26652
|
declare const IDEMPOTENCY_ERROR_CODES: {
|
|
@@ -26982,7 +27095,7 @@ declare class Funnelchat {
|
|
|
26982
27095
|
readonly verify: typeof verify;
|
|
26983
27096
|
readonly constructEvent: typeof constructEvent;
|
|
26984
27097
|
};
|
|
26985
|
-
static readonly VERSION = "0.3.
|
|
27098
|
+
static readonly VERSION = "0.3.2";
|
|
26986
27099
|
readonly baseUrl: string;
|
|
26987
27100
|
readonly timeoutMs: number;
|
|
26988
27101
|
readonly maxRetries: number;
|
|
@@ -27030,7 +27143,7 @@ declare class Funnelchat {
|
|
|
27030
27143
|
|
|
27031
27144
|
/**
|
|
27032
27145
|
* GENERATED FILE — do not edit. Run `npm run generate`.
|
|
27033
|
-
* Source: spec/funnelchat.json (sha256
|
|
27146
|
+
* Source: spec/funnelchat.json (sha256 0ffaad2b25733d28…) + spec/pending.json.
|
|
27034
27147
|
*/
|
|
27035
27148
|
/** One operation of the public API. `pending` = taken from spec/pending.json, not from the snapshot. */
|
|
27036
27149
|
interface RouteInfo {
|
|
@@ -27043,10 +27156,10 @@ interface RouteInfo {
|
|
|
27043
27156
|
readonly summary: string | null;
|
|
27044
27157
|
readonly pending: boolean;
|
|
27045
27158
|
}
|
|
27046
|
-
/** Every operation of the spec (
|
|
27159
|
+
/** Every operation of the spec (284), sorted by path. */
|
|
27047
27160
|
declare const routes: readonly RouteInfo[];
|
|
27048
27161
|
|
|
27049
27162
|
/** The SDK version, sent in the `User-Agent`. A test keeps it equal to package.json. */
|
|
27050
|
-
declare const VERSION = "0.3.
|
|
27163
|
+
declare const VERSION = "0.3.2";
|
|
27051
27164
|
|
|
27052
27165
|
export { ACCESS_ERROR_CODES, APIConnectionError, APIConnectionTimeoutError, APIError, APIPromise, type APIResponse, APIUserAbortError, type AccessErrorCode, type ApiPath, AuthenticationError, BASE_URLS, BadRequestError, type Body, type ClientOptions, ConflictError, DEFAULT_MAX_RETRIES, DEFAULT_TIMEOUT_MS, DEFAULT_TOLERANCE_SECONDS, type Environment, type FieldErrors, Funnelchat, FunnelchatError, GROUP_ACTION_ERROR_CODES, type GroupActionErrorCode, type HttpMethod, IDEMPOTENCY_ERROR_CODES, type IdempotencyErrorCode, type IdempotentRequestOptions, InternalServerError, type KnownErrorCode, type ListItem, NUMBER_ERROR_CODES, NotFoundError, type NumberErrorCode, Page, PagePromise, type PathParams, PermissionDeniedError, type Query, type QueryParams, REQUEST_ID_HEADER, RateLimitError, type RawBody, type RequestBody, type RequestOptions, type ResponseBody, type RouteInfo, SEND_ERROR_CODES, SIGNATURE_HEADER, type SendErrorCode, type SendMessageParams, type TypedRequestOptions, UnprocessableEntityError, UnsupportedMediaTypeError, type UntypedRequestOptions, VERSION, type VerifyOptions, type WebhookEvent, type WebhookEventData, type WebhookEventEnvelope, type WebhookEventInfo, type WebhookEventOf, type WebhookEventType, type webhooks as WebhookSchemas, WebhookVerificationError, type WebhookVerificationFailure, type components, constructEvent, Funnelchat as default, isNumberQuotaError, isSendRuleError, type operations, type paths, routes, verify, webhookEvents };
|
package/dist/index.js
CHANGED
|
@@ -384,7 +384,13 @@ var GROUP_ACTION_ERROR_CODES = {
|
|
|
384
384
|
/** 422: that `type` cannot be sent to this group by this number. */
|
|
385
385
|
unsupported_type: 422,
|
|
386
386
|
/** 429: the number has 50 group actions open. Wait for some to finish; not worth retrying. */
|
|
387
|
-
too_many_pending_actions: 429
|
|
387
|
+
too_many_pending_actions: 429,
|
|
388
|
+
/** 403: following a group (also by writing to one not in the account) needs **Groups and campaigns → Manage groups**. */
|
|
389
|
+
import_permission_required: 403,
|
|
390
|
+
/** 429, with `Retry-After`: the number already followed 5 groups this minute. */
|
|
391
|
+
import_rate_limited: 429,
|
|
392
|
+
/** 409: another call is following the same group right now. */
|
|
393
|
+
import_in_progress: 409
|
|
388
394
|
};
|
|
389
395
|
var IDEMPOTENCY_ERROR_CODES = {
|
|
390
396
|
/** 422: the key was already used with another body. Use a new key for a new resource. */
|
|
@@ -596,6 +602,7 @@ var routes = [
|
|
|
596
602
|
{ "method": "POST", "path": "/api/v1/groups/{group}/admins", "operationId": "apiGroupAction.promoteAdmins", "domain": "communities", "permission": "communities:operate", "tag": "Acciones de grupo", "summary": "Promueve tel\xE9fonos a administrador", "pending": false },
|
|
597
603
|
{ "method": "POST", "path": "/api/v1/groups/{group}/admins/remove", "operationId": "apiGroupAction.demoteAdmins", "domain": "communities", "permission": "communities:operate", "tag": "Acciones de grupo", "summary": "Quita el rol de administrador a tel\xE9fonos", "pending": false },
|
|
598
604
|
{ "method": "PUT", "path": "/api/v1/groups/{group}/description", "operationId": "apiGroupAction.updateDescription", "domain": "communities", "permission": "communities:operate", "tag": "Acciones de grupo", "summary": "Cambia la descripci\xF3n del grupo", "pending": false },
|
|
605
|
+
{ "method": "POST", "path": "/api/v1/groups/{group}/import", "operationId": "v2.apiGroupImport", "domain": "communities", "permission": "communities:operate", "tag": "Grupos", "summary": "Importar un grupo de un n\xFAmero", "pending": false },
|
|
599
606
|
{ "method": "GET", "path": "/api/v1/groups/{group}/invite-link/live", "operationId": "apiGroupAction.inviteLink", "domain": "communities", "permission": "communities:read", "tag": "Acciones de grupo", "summary": "Link de invitaci\xF3n vigente del grupo", "pending": false },
|
|
600
607
|
{ "method": "POST", "path": "/api/v1/groups/{group}/invite-link/renew", "operationId": "apiGroupAction.renewInviteLink", "domain": "communities", "permission": "communities:operate", "tag": "Acciones de grupo", "summary": "Renueva el link de invitaci\xF3n del grupo", "pending": false },
|
|
601
608
|
{ "method": "GET", "path": "/api/v1/groups/{group}/join-requests", "operationId": "apiGroupAction.joinRequests", "domain": "communities", "permission": "communities:read", "tag": "Acciones de grupo", "summary": "Solicitudes pendientes para unirse al grupo", "pending": false },
|
|
@@ -1128,7 +1135,11 @@ var Groups = class extends Resource {
|
|
|
1128
1135
|
retrieve(group, options) {
|
|
1129
1136
|
return this.client.request("GET", "/api/v1/groups/{group}", { ...options, path: { group } });
|
|
1130
1137
|
}
|
|
1131
|
-
/**
|
|
1138
|
+
/**
|
|
1139
|
+
* `GET /api/v1/devices/{device}/groups`, paginated (`page`, `pageSize`): the groups of one number,
|
|
1140
|
+
* read live from WhatsApp (for a key, reused for a minute per number). A group that is already in
|
|
1141
|
+
* the account brings `device_id`; any other can be followed with {@link Groups.follow}.
|
|
1142
|
+
*/
|
|
1132
1143
|
listByDevice(device, query, options) {
|
|
1133
1144
|
return this.client.paginate("/api/v1/devices/{device}/groups", { ...options, path: { device }, query });
|
|
1134
1145
|
}
|
|
@@ -1171,6 +1182,20 @@ var Groups = class extends Resource {
|
|
|
1171
1182
|
sendMessage(group, body, options) {
|
|
1172
1183
|
return this.client.request("POST", "/api/v1/groups/{group}/messages", { ...options, path: { group }, body });
|
|
1173
1184
|
}
|
|
1185
|
+
/**
|
|
1186
|
+
* `POST /api/v1/groups/{group}/import`: follows a WhatsApp group of a QR number (`device_id`), as
|
|
1187
|
+
* importing it in the panel does: from then on its joins and leaves arrive by
|
|
1188
|
+
* `group_participant.joined` and `group_participant.left`. Resolves to `{ data: { uid, name,
|
|
1189
|
+
* imported, is_admin } }`: `imported` is `false` when the group was already in the account, and
|
|
1190
|
+
* `is_admin` says whether the number administers it (without that it cannot write to it). Needs
|
|
1191
|
+
* **Groups and campaigns → Manage groups** (`403 import_permission_required`); up to 5 groups
|
|
1192
|
+
* per number per minute (`429 import_rate_limited`, with `retryAfter`); an official number is
|
|
1193
|
+
* `422 provider_unsupported`. {@link Groups.sendMessage} follows the group itself when it is not in
|
|
1194
|
+
* the account yet.
|
|
1195
|
+
*/
|
|
1196
|
+
follow(group, body, options) {
|
|
1197
|
+
return this.client.request("POST", "/api/v1/groups/{group}/import", { ...options, path: { group }, body });
|
|
1198
|
+
}
|
|
1174
1199
|
/**
|
|
1175
1200
|
* `GET /api/v1/groups/actions/{action}`: where a group action, such as a message sent with
|
|
1176
1201
|
* {@link Groups.sendMessage}, is (`queued`, `running`, `completed` or `failed`) and its `result`.
|
|
@@ -1458,7 +1483,7 @@ var Webhooks = class extends Resource {
|
|
|
1458
1483
|
};
|
|
1459
1484
|
|
|
1460
1485
|
// src/version.ts
|
|
1461
|
-
var VERSION = "0.3.
|
|
1486
|
+
var VERSION = "0.3.2";
|
|
1462
1487
|
|
|
1463
1488
|
// src/client.ts
|
|
1464
1489
|
var BASE_URLS = {
|