@botozap/sdk 0.8.0 → 0.10.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/CHANGELOG.md +47 -0
- package/README.md +117 -0
- package/dist/index.cjs +122 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +249 -14
- package/dist/index.d.ts +249 -14
- package/dist/index.js +117 -14
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -14,6 +14,19 @@ interface SendResult {
|
|
|
14
14
|
status: MessageStatus;
|
|
15
15
|
/** Presente apenas quando a chave é do ambiente sandbox. */
|
|
16
16
|
sandbox?: boolean;
|
|
17
|
+
/** Só em `type: "reaction"`: alvo e ação (`react`/`unreact`). */
|
|
18
|
+
type?: "reaction";
|
|
19
|
+
reaction?: SendReactionResult;
|
|
20
|
+
}
|
|
21
|
+
/** Eco de `POST /v1/messages` com `type: "reaction"`. */
|
|
22
|
+
interface SendReactionResult {
|
|
23
|
+
/** UUID interno da mensagem alvo. */
|
|
24
|
+
message_id: string;
|
|
25
|
+
/** wamid da mensagem alvo. */
|
|
26
|
+
wamid: string;
|
|
27
|
+
/** `""` quando a reação foi retirada. */
|
|
28
|
+
emoji: string;
|
|
29
|
+
action: "react" | "unreact";
|
|
17
30
|
}
|
|
18
31
|
/** Componente de template do WhatsApp (header, body, button…). */
|
|
19
32
|
interface TemplatePayload {
|
|
@@ -72,8 +85,20 @@ interface Customer {
|
|
|
72
85
|
name?: string;
|
|
73
86
|
[key: string]: unknown;
|
|
74
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* Origem da mensagem: `api` (esta API), `app` (Painel ou app WhatsApp Business
|
|
90
|
+
* em coexistência), `history` (histórico importado), `broadcast` (Transmissão).
|
|
91
|
+
* Valores novos podem surgir.
|
|
92
|
+
*/
|
|
93
|
+
type MessageSource = "api" | "app" | "history" | "broadcast" | (string & {});
|
|
75
94
|
interface Message {
|
|
76
95
|
id: string;
|
|
96
|
+
/** Origem da mensagem (ver `MessageSource`). */
|
|
97
|
+
source?: MessageSource;
|
|
98
|
+
/** Chegada à BotoZap (ISO 8601); chave de `sort=created_at`. */
|
|
99
|
+
created_at?: string;
|
|
100
|
+
/** Data real da mensagem no canal; `null` quando desconhecida. Chave de `sort=event_at`. */
|
|
101
|
+
event_at?: string | null;
|
|
77
102
|
[key: string]: unknown;
|
|
78
103
|
}
|
|
79
104
|
interface Broadcast {
|
|
@@ -116,6 +141,8 @@ interface ConversationReferral {
|
|
|
116
141
|
}
|
|
117
142
|
interface Conversation {
|
|
118
143
|
id: string;
|
|
144
|
+
/** Pausa do agente aguardando humano (ISO 8601); null quando não pausado. */
|
|
145
|
+
agent_paused_at?: string | null;
|
|
119
146
|
/** UUID interno do Número da própria Conversa. */
|
|
120
147
|
phone_number_id?: string;
|
|
121
148
|
contact?: {
|
|
@@ -138,6 +165,10 @@ interface Conversation {
|
|
|
138
165
|
* + 24h); `null` sem clique recente. Não altera a regra da janela de 24h.
|
|
139
166
|
*/
|
|
140
167
|
fep_reply_by?: string | null;
|
|
168
|
+
/** Última mensagem da Conversa (inclui `source`); `null` sem mensagens. */
|
|
169
|
+
last_message?: (Partial<Message> & {
|
|
170
|
+
source?: MessageSource;
|
|
171
|
+
}) | null;
|
|
141
172
|
[key: string]: unknown;
|
|
142
173
|
}
|
|
143
174
|
interface Assignment {
|
|
@@ -149,7 +180,7 @@ interface Webhook {
|
|
|
149
180
|
/** Cliente cujas entregas o endpoint recebe; `null` = todos os da Conta. */
|
|
150
181
|
customer_id?: string | null;
|
|
151
182
|
url: string;
|
|
152
|
-
events?: string[];
|
|
183
|
+
events?: (WebhookCategory | (string & {}))[];
|
|
153
184
|
active?: boolean;
|
|
154
185
|
/** True quando o endpoint tem Authorization no Vault. O valor nunca é devolvido. */
|
|
155
186
|
has_authorization?: boolean;
|
|
@@ -171,10 +202,24 @@ interface ApiLog {
|
|
|
171
202
|
id: string;
|
|
172
203
|
[key: string]: unknown;
|
|
173
204
|
}
|
|
205
|
+
/**
|
|
206
|
+
* Status de uma entrega de webhook. `limited`: recebida cortada pelo limite de
|
|
207
|
+
* repasse do plano Free; não será tentada.
|
|
208
|
+
*/
|
|
209
|
+
type WebhookDeliveryStatus = "pending" | "success" | "failed" | "exhausted" | "limited";
|
|
174
210
|
interface WebhookDelivery {
|
|
175
211
|
id: string;
|
|
212
|
+
status?: WebhookDeliveryStatus;
|
|
176
213
|
[key: string]: unknown;
|
|
177
214
|
}
|
|
215
|
+
/**
|
|
216
|
+
* Categorias aceitas em `webhooks.create({ events })`. `app_messages` é opt-in
|
|
217
|
+
* (coexistência: `whatsapp.message.echo`, `.edited`, `.revoked`) e só chega a
|
|
218
|
+
* Endpoints que a assinaram explicitamente; `events` vazio não a recebe.
|
|
219
|
+
* `account` inclui `whatsapp.phone_number.connected`.
|
|
220
|
+
*/
|
|
221
|
+
declare const WEBHOOK_CATEGORIES: readonly ["messages", "statuses", "crm", "account", "app_messages"];
|
|
222
|
+
type WebhookCategory = (typeof WEBHOOK_CATEGORIES)[number];
|
|
178
223
|
/** Evento autoritativo do stream durável da Conta e ambiente autenticados. */
|
|
179
224
|
interface BotoZapEvent {
|
|
180
225
|
id: string;
|
|
@@ -288,6 +333,18 @@ interface SetupLink {
|
|
|
288
333
|
|
|
289
334
|
/** Public /api/v1/ai contracts. Revisions are opaque strings unless the endpoint explicitly uses a number. */
|
|
290
335
|
type AiProvider = "anthropic" | "openai" | "google" | "openrouter" | "deepseek" | "xai";
|
|
336
|
+
/** Provedores que aceitam credencial NOVA hoje; os demais respondem 422 `provider_not_enabled`. */
|
|
337
|
+
declare const AI_CREDENTIAL_PROVIDERS: readonly ["openai", "anthropic"];
|
|
338
|
+
/** Item de `ai.providers.get().providers`. */
|
|
339
|
+
type AiProviderInfo = {
|
|
340
|
+
id: AiProvider;
|
|
341
|
+
label: string;
|
|
342
|
+
key_url: string | null;
|
|
343
|
+
description: string | null;
|
|
344
|
+
/** false: criar credencial desse provedor responde 422 `provider_not_enabled`. */
|
|
345
|
+
accepts_new_credentials: boolean;
|
|
346
|
+
[key: string]: unknown;
|
|
347
|
+
};
|
|
291
348
|
/** Every BYOK purpose. #498 added granular purposes; without their own binding they inherit the Customer default. */
|
|
292
349
|
declare const AI_PURPOSES: readonly ["default", "agent_turn", "agent_operator", "router", "followup", "proposal", "transcription", "embedding", "guard", "evaluator", "classification", "compaction", "case_chat", "learning_judge", "learning_distiller", "vision", "commercial_proposal"];
|
|
293
350
|
type AiPurpose = (typeof AI_PURPOSES)[number];
|
|
@@ -1514,6 +1571,10 @@ type AiCatalogModel = {
|
|
|
1514
1571
|
cache_read_usd_per_million: number | null;
|
|
1515
1572
|
cache_write_usd_per_million: number | null;
|
|
1516
1573
|
notes: ("request_fee" | "long_context" | "image_input" | "variable")[];
|
|
1574
|
+
/** Absent: reported by the credential's own provider. `"openrouter"`: the provider's own list
|
|
1575
|
+
* price read from OpenRouter's public catalog, for providers whose model list has no prices
|
|
1576
|
+
* (OpenAI, Anthropic, Google, DeepSeek). */
|
|
1577
|
+
source?: "openrouter";
|
|
1517
1578
|
} | null;
|
|
1518
1579
|
};
|
|
1519
1580
|
type AiModelCatalogSnapshot = {
|
|
@@ -1881,7 +1942,7 @@ declare class AiCredentialsResource {
|
|
|
1881
1942
|
get(input: AiScope & {
|
|
1882
1943
|
id: string;
|
|
1883
1944
|
}): Promise<AiCredential>;
|
|
1884
|
-
/** Cria credencial própria no Vault; a resposta nunca contém a chave. */
|
|
1945
|
+
/** Cria credencial própria no Vault; a resposta nunca contém a chave. Só `AI_CREDENTIAL_PROVIDERS` (openai/anthropic); os demais: 422 `provider_not_enabled`. */
|
|
1885
1946
|
create(input: AiScope & {
|
|
1886
1947
|
provider: AiProvider;
|
|
1887
1948
|
label: string;
|
|
@@ -1913,7 +1974,7 @@ declare class AiProvidersResource {
|
|
|
1913
1974
|
constructor(client: BotoZap);
|
|
1914
1975
|
/** GET /ai/providers */
|
|
1915
1976
|
get(input: AiScope): Promise<{
|
|
1916
|
-
providers:
|
|
1977
|
+
providers: AiProviderInfo[];
|
|
1917
1978
|
purposes: Record<string, string>;
|
|
1918
1979
|
credentials: AiCredential[];
|
|
1919
1980
|
bindings: AiBinding[];
|
|
@@ -3341,8 +3402,15 @@ declare class Radar {
|
|
|
3341
3402
|
configureStageRule(stageId: string, input: StageRuleInput): Promise<StageRule>;
|
|
3342
3403
|
}
|
|
3343
3404
|
|
|
3405
|
+
/**
|
|
3406
|
+
* Ordem de `messages.list`: `created_at` (padrão, chegada à BotoZap) ou
|
|
3407
|
+
* `event_at` (data real da mensagem; útil com histórico importado). O cursor é
|
|
3408
|
+
* da ordem que o gerou: reuse-o com o mesmo `sort`.
|
|
3409
|
+
*/
|
|
3410
|
+
type MessageSort = "created_at" | "event_at";
|
|
3344
3411
|
/** Filtros de `messages.list` (paginação por cursor). Ver GET /v1/messages. */
|
|
3345
3412
|
interface ListMessagesParams extends CursorParams {
|
|
3413
|
+
sort?: MessageSort;
|
|
3346
3414
|
/** id da Meta OU uuid interno do número. */
|
|
3347
3415
|
phone_number_id?: string;
|
|
3348
3416
|
/** uuid interno da conversa (o `id` de /v1/conversations). */
|
|
@@ -3398,16 +3466,128 @@ interface SendDocumentParams {
|
|
|
3398
3466
|
from?: string;
|
|
3399
3467
|
}
|
|
3400
3468
|
type SendMediaParams = SendImageParams | SendVideoParams | SendAudioParams | SendDocumentParams;
|
|
3469
|
+
/** Header de `interactive` (texto; mídia só em button e cta_url). */
|
|
3470
|
+
type InteractiveHeader = {
|
|
3471
|
+
type: "text";
|
|
3472
|
+
text: string;
|
|
3473
|
+
} | {
|
|
3474
|
+
type: "image";
|
|
3475
|
+
image: {
|
|
3476
|
+
link: string;
|
|
3477
|
+
};
|
|
3478
|
+
} | {
|
|
3479
|
+
type: "video";
|
|
3480
|
+
video: {
|
|
3481
|
+
link: string;
|
|
3482
|
+
};
|
|
3483
|
+
} | {
|
|
3484
|
+
type: "document";
|
|
3485
|
+
document: {
|
|
3486
|
+
link: string;
|
|
3487
|
+
filename?: string;
|
|
3488
|
+
};
|
|
3489
|
+
};
|
|
3490
|
+
interface InteractiveBase {
|
|
3491
|
+
header?: InteractiveHeader;
|
|
3492
|
+
body: {
|
|
3493
|
+
text: string;
|
|
3494
|
+
};
|
|
3495
|
+
footer?: {
|
|
3496
|
+
text: string;
|
|
3497
|
+
};
|
|
3498
|
+
}
|
|
3499
|
+
/** Até 3 botões de resposta (título até 20 caracteres, ids únicos). */
|
|
3500
|
+
interface InteractiveButtonPayload extends InteractiveBase {
|
|
3501
|
+
type: "button";
|
|
3502
|
+
action: {
|
|
3503
|
+
buttons: {
|
|
3504
|
+
type?: "reply";
|
|
3505
|
+
reply: {
|
|
3506
|
+
id: string;
|
|
3507
|
+
title: string;
|
|
3508
|
+
};
|
|
3509
|
+
}[];
|
|
3510
|
+
};
|
|
3511
|
+
}
|
|
3512
|
+
/** Lista: até 10 seções e 10 opções no total; `title` da seção obrigatório com mais de uma. */
|
|
3513
|
+
interface InteractiveListPayload extends InteractiveBase {
|
|
3514
|
+
type: "list";
|
|
3515
|
+
header?: {
|
|
3516
|
+
type: "text";
|
|
3517
|
+
text: string;
|
|
3518
|
+
};
|
|
3519
|
+
action: {
|
|
3520
|
+
button: string;
|
|
3521
|
+
sections: {
|
|
3522
|
+
title?: string;
|
|
3523
|
+
rows: {
|
|
3524
|
+
id: string;
|
|
3525
|
+
title: string;
|
|
3526
|
+
description?: string;
|
|
3527
|
+
}[];
|
|
3528
|
+
}[];
|
|
3529
|
+
};
|
|
3530
|
+
}
|
|
3531
|
+
/** Botão de link (URL https pública). */
|
|
3532
|
+
interface InteractiveCtaUrlPayload extends InteractiveBase {
|
|
3533
|
+
type: "cta_url";
|
|
3534
|
+
action: {
|
|
3535
|
+
name: "cta_url";
|
|
3536
|
+
parameters: {
|
|
3537
|
+
display_text: string;
|
|
3538
|
+
url: string;
|
|
3539
|
+
};
|
|
3540
|
+
};
|
|
3541
|
+
}
|
|
3542
|
+
/** Objeto `interactive` no formato da Cloud API (validado pela API). */
|
|
3543
|
+
type InteractivePayload = InteractiveButtonPayload | InteractiveListPayload | InteractiveCtaUrlPayload;
|
|
3544
|
+
interface SendInteractiveParams {
|
|
3545
|
+
to: string;
|
|
3546
|
+
interactive: InteractivePayload;
|
|
3547
|
+
from?: string;
|
|
3548
|
+
}
|
|
3549
|
+
interface SendLocationParams {
|
|
3550
|
+
to: string;
|
|
3551
|
+
latitude: number;
|
|
3552
|
+
longitude: number;
|
|
3553
|
+
name?: string;
|
|
3554
|
+
address?: string;
|
|
3555
|
+
from?: string;
|
|
3556
|
+
}
|
|
3557
|
+
interface SendReactionParams {
|
|
3558
|
+
to: string;
|
|
3559
|
+
/** UUID interno ou wamid da mensagem RECEBIDA do contato (até 30 dias). */
|
|
3560
|
+
message_id: string;
|
|
3561
|
+
/** Emoji da reação; `""` retira a reação. */
|
|
3562
|
+
emoji: string;
|
|
3563
|
+
from?: string;
|
|
3564
|
+
}
|
|
3565
|
+
interface SendOptions {
|
|
3566
|
+
/** Reuse for retries of the same send; a different payload conflicts. */
|
|
3567
|
+
idempotencyKey?: string;
|
|
3568
|
+
}
|
|
3401
3569
|
/** Endpoints de mensagem (POST /v1/messages, GET /v1/messages/:id). */
|
|
3402
3570
|
declare class Messages {
|
|
3403
3571
|
private readonly client;
|
|
3404
3572
|
constructor(client: BotoZap);
|
|
3405
3573
|
/** Envia uma mensagem de texto. */
|
|
3406
|
-
send(params: SendTextParams): Promise<SendResult>;
|
|
3574
|
+
send(params: SendTextParams, options?: SendOptions): Promise<SendResult>;
|
|
3407
3575
|
/** Envia uma mensagem usando um template aprovado. */
|
|
3408
|
-
sendTemplate(params: SendTemplateParams): Promise<SendResult>;
|
|
3576
|
+
sendTemplate(params: SendTemplateParams, options?: SendOptions): Promise<SendResult>;
|
|
3409
3577
|
/** Envia mídia por URL pública. */
|
|
3410
|
-
sendMedia(params: SendMediaParams): Promise<SendResult>;
|
|
3578
|
+
sendMedia(params: SendMediaParams, options?: SendOptions): Promise<SendResult>;
|
|
3579
|
+
/**
|
|
3580
|
+
* Envia botões de resposta, lista ou botão de link (WhatsApp; mensagem livre,
|
|
3581
|
+
* exige janela de 24h aberta).
|
|
3582
|
+
*/
|
|
3583
|
+
sendInteractive(params: SendInteractiveParams, options?: SendOptions): Promise<SendResult>;
|
|
3584
|
+
/** Envia uma localização (WhatsApp; mensagem livre). */
|
|
3585
|
+
sendLocation(params: SendLocationParams, options?: SendOptions): Promise<SendResult>;
|
|
3586
|
+
/**
|
|
3587
|
+
* Reage a uma mensagem recebida (WhatsApp). `emoji: ""` retira a reação.
|
|
3588
|
+
* O retorno traz `reaction` com o alvo e a ação.
|
|
3589
|
+
*/
|
|
3590
|
+
sendReaction(params: SendReactionParams, options?: SendOptions): Promise<SendResult>;
|
|
3411
3591
|
/** Lista as mensagens da conta (paginação por cursor). */
|
|
3412
3592
|
list(params?: ListMessagesParams): Promise<CursorList<Message>>;
|
|
3413
3593
|
/** Busca uma mensagem pelo id interno. */
|
|
@@ -3696,6 +3876,10 @@ declare class Contacts {
|
|
|
3696
3876
|
}
|
|
3697
3877
|
|
|
3698
3878
|
interface ListConversationsParams extends CursorParams {
|
|
3879
|
+
/** Recorta as conversas pelos canais do negócio autorizado. */
|
|
3880
|
+
customer_id?: string;
|
|
3881
|
+
/** true: somente conversas com agente pausado aguardando humano. */
|
|
3882
|
+
agent_paused?: boolean;
|
|
3699
3883
|
/** id da Meta OU uuid interno do número. */
|
|
3700
3884
|
phone_number_id?: string;
|
|
3701
3885
|
/** "active" | "ended" — derivado da janela de 24h. */
|
|
@@ -3734,7 +3918,7 @@ declare class Conversations {
|
|
|
3734
3918
|
* A leitura e o envio usam a mesma chave; o POST /messages revalida Conta,
|
|
3735
3919
|
* ambiente, identidade, janela, quota e billing antes de chamar a Meta.
|
|
3736
3920
|
*/
|
|
3737
|
-
reply(id: string, params: ReplyConversationParams): Promise<SendResult>;
|
|
3921
|
+
reply(id: string, params: ReplyConversationParams, options?: SendOptions): Promise<SendResult>;
|
|
3738
3922
|
update(id: string, params: Record<string, unknown>): Promise<Conversation>;
|
|
3739
3923
|
/** Lista as atribuições da conversa (paginação por offset/página). */
|
|
3740
3924
|
listAssignments(id: string, params?: OffsetParams): Promise<OffsetList<Assignment>>;
|
|
@@ -4036,8 +4220,8 @@ declare class ApiLogs {
|
|
|
4036
4220
|
interface ListWebhookDeliveriesParams extends CursorParams {
|
|
4037
4221
|
/** Alias de `endpoint_id` na rota — entregas de um endpoint específico. */
|
|
4038
4222
|
webhook_id?: string;
|
|
4039
|
-
/** delivery_status (pending|success|failed|exhausted). */
|
|
4040
|
-
status?: string;
|
|
4223
|
+
/** delivery_status (pending|success|failed|exhausted|limited). */
|
|
4224
|
+
status?: WebhookDeliveryStatus | (string & {});
|
|
4041
4225
|
/** Tipo do evento (ex.: "webhook.test", "messages"). */
|
|
4042
4226
|
event_type?: string;
|
|
4043
4227
|
}
|
|
@@ -4048,9 +4232,38 @@ declare class WebhookDeliveries {
|
|
|
4048
4232
|
list(params?: ListWebhookDeliveriesParams): Promise<CursorList<WebhookDelivery>>;
|
|
4049
4233
|
}
|
|
4050
4234
|
|
|
4235
|
+
/** Identidade e permissões efetivas da credencial autenticada. */
|
|
4236
|
+
interface Me {
|
|
4237
|
+
/** UUID da Conta derivado pela API a partir da chave autenticada. */
|
|
4238
|
+
account_id: string;
|
|
4239
|
+
/** Nome da Conta (#629). Ausente em versões anteriores da API — opcional
|
|
4240
|
+
* para continuar compatível com um servidor sem o campo. */
|
|
4241
|
+
account_name?: string;
|
|
4242
|
+
/** Ambiente ao qual a chave pertence. */
|
|
4243
|
+
environment: "live" | "sandbox";
|
|
4244
|
+
/** Scopes efetivos concedidos à chave. */
|
|
4245
|
+
scopes: string[];
|
|
4246
|
+
/** Ausente em versões anteriores da API; OAuth exige todos os campos abaixo. */
|
|
4247
|
+
auth_type?: "api_key" | "oauth";
|
|
4248
|
+
user_id?: string;
|
|
4249
|
+
client_id?: string;
|
|
4250
|
+
grant_id?: string;
|
|
4251
|
+
/** Contratos de rota permitidos, por exemplo GET /v1/contacts/:id. */
|
|
4252
|
+
allowed_routes?: string[];
|
|
4253
|
+
}
|
|
4254
|
+
/** Introspecção da identidade da chave autenticada. */
|
|
4255
|
+
declare class MeResource {
|
|
4256
|
+
private readonly client;
|
|
4257
|
+
constructor(client: BotoZap);
|
|
4258
|
+
/** Retorna a Conta, o ambiente e os scopes efetivos da chave. */
|
|
4259
|
+
get(): Promise<Me>;
|
|
4260
|
+
}
|
|
4261
|
+
|
|
4051
4262
|
interface BotoZapOptions {
|
|
4052
|
-
/** Chave de API da conta
|
|
4053
|
-
apiKey
|
|
4263
|
+
/** Chave de API da conta. Use apenas uma credencial: apiKey ou accessToken. */
|
|
4264
|
+
apiKey?: string;
|
|
4265
|
+
/** Token OAuth, ou provider chamado em cada requisição para usar o token atualizado. */
|
|
4266
|
+
accessToken?: string | (() => string | Promise<string>);
|
|
4054
4267
|
/** Sobrescreve a URL base. Padrão: https://botozap.com.br/api/v1 */
|
|
4055
4268
|
baseUrl?: string;
|
|
4056
4269
|
/** Injeta um fetch (testes, runtimes sem fetch global). */
|
|
@@ -4098,7 +4311,8 @@ declare class BotoZap {
|
|
|
4098
4311
|
readonly users: Users;
|
|
4099
4312
|
readonly apiLogs: ApiLogs;
|
|
4100
4313
|
readonly webhookDeliveries: WebhookDeliveries;
|
|
4101
|
-
|
|
4314
|
+
readonly me: MeResource;
|
|
4315
|
+
private readonly credential;
|
|
4102
4316
|
private readonly baseUrl;
|
|
4103
4317
|
private readonly fetchImpl;
|
|
4104
4318
|
constructor(options: BotoZapOptions);
|
|
@@ -4130,12 +4344,33 @@ declare class BotoZap {
|
|
|
4130
4344
|
* `Retry-After` / `X-RateLimit-*`. Os headers são só os da RESPOSTA; nenhum
|
|
4131
4345
|
* header de request (que carrega a apiKey) entra aqui.
|
|
4132
4346
|
*/
|
|
4347
|
+
type SendFailureDetails = {
|
|
4348
|
+
outcome?: "rejected" | "accepted" | "unknown";
|
|
4349
|
+
retry?: "backoff" | "after_correction" | "reconcile_first" | "unknown";
|
|
4350
|
+
};
|
|
4133
4351
|
declare class BotoZapError extends Error {
|
|
4134
4352
|
readonly code: string;
|
|
4135
4353
|
readonly status: number;
|
|
4354
|
+
readonly outcome?: SendFailureDetails["outcome"];
|
|
4355
|
+
readonly retry?: SendFailureDetails["retry"];
|
|
4136
4356
|
/** Headers da resposta HTTP. Ausente em erros sem resposta (status 0). */
|
|
4137
4357
|
readonly headers?: Record<string, string>;
|
|
4138
|
-
constructor(code: string, message: string, status: number, headers?: Record<string, string
|
|
4358
|
+
constructor(code: string, message: string, status: number, headers?: Record<string, string>, details?: SendFailureDetails);
|
|
4139
4359
|
}
|
|
4360
|
+
/**
|
|
4361
|
+
* Códigos de erro conhecidos da API (não exaustivo; valores novos podem surgir).
|
|
4362
|
+
* Envio (POST /v1/messages): `invalid_reaction`, `missing_reaction_target`,
|
|
4363
|
+
* `reaction_target_not_found`, `reaction_target_invalid`,
|
|
4364
|
+
* `reaction_target_expired`, `unsupported_type`, `free_form_limit_reached`
|
|
4365
|
+
* (429, limite 1:1 do Free). Plano: `plan_restricted` (403, escritas de IA,
|
|
4366
|
+
* Agenda, Calendário e Jornadas fora do plano), `free_number_cap` (402, setup
|
|
4367
|
+
* além do teto de Números do Free). IA: `provider_not_enabled` (422, credencial
|
|
4368
|
+
* nova de provedor com `accepts_new_credentials: false`).
|
|
4369
|
+
*/
|
|
4370
|
+
type BotoZapErrorCode = "invalid_request" | "unsupported_type" | "invalid_reaction" | "missing_reaction_target" | "reaction_target_not_found" | "reaction_target_invalid" | "reaction_target_expired" | "free_form_limit_reached" | "quota_exceeded" | "plan_restricted" | "free_number_cap" | "provider_not_enabled" | (string & {});
|
|
4371
|
+
/** Códigos que indicam limite ou restrição do plano contratado. */
|
|
4372
|
+
declare const PLAN_ERROR_CODES: readonly ["plan_restricted", "free_form_limit_reached", "free_number_cap"];
|
|
4373
|
+
/** True quando o erro é recusa por plano (upgrade resolve; retry não). */
|
|
4374
|
+
declare function isPlanError(error: unknown): error is BotoZapError;
|
|
4140
4375
|
|
|
4141
|
-
export { AI_CONFIGURABLE_PURPOSES, AI_OPERATIONS, AI_PURPOSES, type AddRecipientsError, type AddRecipientsResult, AgendaConfiguration, AgendaExceptions, type AgendaRecord, Ai, type AiAgent, type AiAgentConfig, type AiAgentCoverage, type AiAgentInput, type AiAgentVersion, AiAgentsResource, type AiAlert, type AiAlertBulkFilters, type AiAlertListItem, AiAlertsResource, type AiArtifactUploadInput, type AiAudioPricing, type AiBinding, type AiBindingTarget, type AiBudget, type AiBudgetInput, type AiCapabilitySignal, type AiCapabilityUsage, type AiCapabilityUsageList, type AiCase, type AiCaseChat, type AiCaseEvent, type AiCaseKind, type AiCaseReply, type AiCaseReplyInput, type AiCaseSource, AiCasesResource, type AiCatalogItems, type AiCatalogModel, type AiCatalogProduct, type AiCatalogSyncInput, type AiCatalogSyncResult, type AiChannelGate, type AiCommercialDecision, type AiCommercialEffect, type AiCommercialJob, type AiCommercialProposal, AiCommercialProposalsResource, type AiCommercialRequest, type AiCommercialSettings, type AiConfigurablePurpose, type AiContactAuthorization, type AiConversationCheckpoint, type AiCredential, AiCredentialsResource, type AiDraftResult, type AiEligibilityOverview, AiEligibilityResource, type AiEligibilitySettings, type AiEnrollment, type AiEvolution, AiEvolutionResource, type AiEvolutionSource, type AiExecution, type AiExecutionCitations, type AiExecutionSecurity, AiExecutionsResource, type AiField, type AiFlow, type AiFlowGraph, type AiFlowInput, type AiFlowSettings, type AiFlowVersion, type AiFollowupEffect, type AiFollowupEvent, AiFollowupFlowsResource, type AiFollowupPromise, type AiFollowupPromiseDetail, type AiFollowupPromiseStatus, type AiFollowupQueueFilters, type AiFollowupQueuePage, type AiFollowupQueueRow, AiFollowupsResource, type AiGateMode, type AiInference, type AiInferenceOrigin, type AiInferenceOutcome, type AiInferenceSummary, AiInferencesResource, type AiKnowledgeChunk, type AiKnowledgeCitation, type AiKnowledgeConversation, type AiKnowledgeHit, type AiKnowledgeImport, type AiKnowledgePreview, AiKnowledgeResource, type AiKnowledgeSearchDiagnostics, type AiKnowledgeSource, type AiMemory, type AiMemoryEntry, type AiMemoryEntryEvent, AiMemoryResource, type AiModelCatalogSnapshot, type AiModelCatalogSync, type AiNoticeCheck, type AiNoticeEffect, type AiNoticeField, type AiNoticeJob, type AiNoticeSettings, AiNoticesResource, type AiOperation, type AiOperatorMetrics, AiOperatorResource, type AiPage, type AiPlatformSkill, type AiPlatformSkillComposition, type AiPreparedUpload, type AiProposal, AiProposalsResource, type AiProvider, type AiProviderModel, AiProvidersResource, type AiPurpose, type AiRate, type AiRateInput, type AiRecord, type AiRevision, type AiRouter, type AiRouterConfig, type AiRouterTest, AiRoutersResource, type AiScope, type AiSkill, type AiSkillInput, type AiSkillNearMiss, type AiSkillVersion, AiSkillsResource, type AiSourceKind, type AiStyleAdjustment, type AiStyleAdjustmentId, AiStyleAdjustmentsResource, type AiToolId, type AiTurnPromise, type AiUploadReceiptCallback, AiUploadsResource, AiUsageResource, type AiUsageSummary, type AiUsageTokens, type AiWindow, type ApiLog, type Appointment, type AppointmentAvailability, type AppointmentExceptionInput, type AppointmentFields, type AppointmentHistory, type AppointmentQuery, type AppointmentScheduleInput, type AppointmentServiceInput, type AppointmentStatus, Appointments, type Assignment, type AvailabilityQuery, BotoZap, BotoZapError, type BotoZapEvent, type BotoZapOptions, type Broadcast, type BroadcastRecipient, type BroadcastRecipientInput, Calendar, type CalendarConnection, type CalendarJob, type CalendarSelection, type Contact, type ContactField, ContactFields, type ContactStage, ContactStages, type Conversation, type ConversationEntryPoint, type ConversationNote, type ConversationReferral, type ConversationReminder, type CreateAppointment, type CreateAssignmentParams, type CreateBroadcastParams, type CreateContactParams, type CreateCustomerParams, type CreateDemand, type CreateOpportunity, type CreateSetupLinkParams, type CreateTemplateParams, type CreateWebhookParams, type CrmActivity, type CrmConversation, type CrmFields, type CrmMetadata, type CrmQuery, type CrmRecord, CrmResource, type CursorList, type CursorPaging, type CursorParams, type Customer, type Demand, type DemandFields, type EventList, type EventPaging, Inbox, type InboxMutation, type InboxMutationResult, type InboxState, type InboxTools, type Journey, type JourneyConfig, type JourneyEnrollment, type JourneyQuery, type JourneyRun, type JourneyStep, Journeys, type ListApiLogsParams, type ListBroadcastsParams, type ListContactsParams, type ListConversationsParams, type ListEventsParams, type ListMessagesParams, type ListPhoneNumbersParams, type ListRecipientsParams, type ListTemplatesParams, type ListWebhookDeliveriesParams, type MediaAsset, type MediaUploadResult, type Message, type MessageStatus, type MetaCostCategory, type MetaCostDay, type MetaCostEstimate, type MetaCostGroup, type MetaCostReport, type MetaCostSource, type MetaCostSync, type MetaCostUnavailableReason, type MetaCostsParams, type OffsetList, type OffsetMeta, type OffsetParams, type Opportunity, type OpportunityFields, type PhoneNumber, Radar, type RadarEntry, type RadarPage, type RadarQuery, type ReplyConversationParams, type RequestOptions, SavedReplies, type SavedReply, type SavedReplyInput, type SavedReplyQuery, type ScheduleBroadcastParams, type SendAudioParams, type SendDocumentParams, type SendImageParams, type SendMediaParams, type SendResult, type SendTemplateParams, type SendTextParams, type SendVideoParams, type SetupLink, type StageColor, type StageRule, type StageRuleInput, type Template, type TemplatePayload, type UpdateAppointment, type UpdateBroadcastParams, type UpdateContactParams, type UpdateCustomerParams, type UpdatePhoneNumberParams, type UpdateSetupLinkParams, type UpdateWebhookParams, type UploadMediaParams, type User, type Webhook, type WebhookAuthorizationHeaders, type WebhookDelivery };
|
|
4376
|
+
export { AI_CONFIGURABLE_PURPOSES, AI_CREDENTIAL_PROVIDERS, AI_OPERATIONS, AI_PURPOSES, type AddRecipientsError, type AddRecipientsResult, AgendaConfiguration, AgendaExceptions, type AgendaRecord, Ai, type AiAgent, type AiAgentConfig, type AiAgentCoverage, type AiAgentInput, type AiAgentVersion, AiAgentsResource, type AiAlert, type AiAlertBulkFilters, type AiAlertListItem, AiAlertsResource, type AiArtifactUploadInput, type AiAudioPricing, type AiBinding, type AiBindingTarget, type AiBudget, type AiBudgetInput, type AiCapabilitySignal, type AiCapabilityUsage, type AiCapabilityUsageList, type AiCase, type AiCaseChat, type AiCaseEvent, type AiCaseKind, type AiCaseReply, type AiCaseReplyInput, type AiCaseSource, AiCasesResource, type AiCatalogItems, type AiCatalogModel, type AiCatalogProduct, type AiCatalogSyncInput, type AiCatalogSyncResult, type AiChannelGate, type AiCommercialDecision, type AiCommercialEffect, type AiCommercialJob, type AiCommercialProposal, AiCommercialProposalsResource, type AiCommercialRequest, type AiCommercialSettings, type AiConfigurablePurpose, type AiContactAuthorization, type AiConversationCheckpoint, type AiCredential, AiCredentialsResource, type AiDraftResult, type AiEligibilityOverview, AiEligibilityResource, type AiEligibilitySettings, type AiEnrollment, type AiEvolution, AiEvolutionResource, type AiEvolutionSource, type AiExecution, type AiExecutionCitations, type AiExecutionSecurity, AiExecutionsResource, type AiField, type AiFlow, type AiFlowGraph, type AiFlowInput, type AiFlowSettings, type AiFlowVersion, type AiFollowupEffect, type AiFollowupEvent, AiFollowupFlowsResource, type AiFollowupPromise, type AiFollowupPromiseDetail, type AiFollowupPromiseStatus, type AiFollowupQueueFilters, type AiFollowupQueuePage, type AiFollowupQueueRow, AiFollowupsResource, type AiGateMode, type AiInference, type AiInferenceOrigin, type AiInferenceOutcome, type AiInferenceSummary, AiInferencesResource, type AiKnowledgeChunk, type AiKnowledgeCitation, type AiKnowledgeConversation, type AiKnowledgeHit, type AiKnowledgeImport, type AiKnowledgePreview, AiKnowledgeResource, type AiKnowledgeSearchDiagnostics, type AiKnowledgeSource, type AiMemory, type AiMemoryEntry, type AiMemoryEntryEvent, AiMemoryResource, type AiModelCatalogSnapshot, type AiModelCatalogSync, type AiNoticeCheck, type AiNoticeEffect, type AiNoticeField, type AiNoticeJob, type AiNoticeSettings, AiNoticesResource, type AiOperation, type AiOperatorMetrics, AiOperatorResource, type AiPage, type AiPlatformSkill, type AiPlatformSkillComposition, type AiPreparedUpload, type AiProposal, AiProposalsResource, type AiProvider, type AiProviderInfo, type AiProviderModel, AiProvidersResource, type AiPurpose, type AiRate, type AiRateInput, type AiRecord, type AiRevision, type AiRouter, type AiRouterConfig, type AiRouterTest, AiRoutersResource, type AiScope, type AiSkill, type AiSkillInput, type AiSkillNearMiss, type AiSkillVersion, AiSkillsResource, type AiSourceKind, type AiStyleAdjustment, type AiStyleAdjustmentId, AiStyleAdjustmentsResource, type AiToolId, type AiTurnPromise, type AiUploadReceiptCallback, AiUploadsResource, AiUsageResource, type AiUsageSummary, type AiUsageTokens, type AiWindow, type ApiLog, type Appointment, type AppointmentAvailability, type AppointmentExceptionInput, type AppointmentFields, type AppointmentHistory, type AppointmentQuery, type AppointmentScheduleInput, type AppointmentServiceInput, type AppointmentStatus, Appointments, type Assignment, type AvailabilityQuery, BotoZap, BotoZapError, type BotoZapErrorCode, type BotoZapEvent, type BotoZapOptions, type Broadcast, type BroadcastRecipient, type BroadcastRecipientInput, Calendar, type CalendarConnection, type CalendarJob, type CalendarSelection, type Contact, type ContactField, ContactFields, type ContactStage, ContactStages, type Conversation, type ConversationEntryPoint, type ConversationNote, type ConversationReferral, type ConversationReminder, type CreateAppointment, type CreateAssignmentParams, type CreateBroadcastParams, type CreateContactParams, type CreateCustomerParams, type CreateDemand, type CreateOpportunity, type CreateSetupLinkParams, type CreateTemplateParams, type CreateWebhookParams, type CrmActivity, type CrmConversation, type CrmFields, type CrmMetadata, type CrmQuery, type CrmRecord, CrmResource, type CursorList, type CursorPaging, type CursorParams, type Customer, type Demand, type DemandFields, type EventList, type EventPaging, Inbox, type InboxMutation, type InboxMutationResult, type InboxState, type InboxTools, type InteractiveButtonPayload, type InteractiveCtaUrlPayload, type InteractiveHeader, type InteractiveListPayload, type InteractivePayload, type Journey, type JourneyConfig, type JourneyEnrollment, type JourneyQuery, type JourneyRun, type JourneyStep, Journeys, type ListApiLogsParams, type ListBroadcastsParams, type ListContactsParams, type ListConversationsParams, type ListEventsParams, type ListMessagesParams, type ListPhoneNumbersParams, type ListRecipientsParams, type ListTemplatesParams, type ListWebhookDeliveriesParams, type Me, type MediaAsset, type MediaUploadResult, type Message, type MessageSort, type MessageSource, type MessageStatus, type MetaCostCategory, type MetaCostDay, type MetaCostEstimate, type MetaCostGroup, type MetaCostReport, type MetaCostSource, type MetaCostSync, type MetaCostUnavailableReason, type MetaCostsParams, type OffsetList, type OffsetMeta, type OffsetParams, type Opportunity, type OpportunityFields, PLAN_ERROR_CODES, type PhoneNumber, Radar, type RadarEntry, type RadarPage, type RadarQuery, type ReplyConversationParams, type RequestOptions, SavedReplies, type SavedReply, type SavedReplyInput, type SavedReplyQuery, type ScheduleBroadcastParams, type SendAudioParams, type SendDocumentParams, type SendFailureDetails, type SendImageParams, type SendInteractiveParams, type SendLocationParams, type SendMediaParams, type SendOptions, type SendReactionParams, type SendReactionResult, type SendResult, type SendTemplateParams, type SendTextParams, type SendVideoParams, type SetupLink, type StageColor, type StageRule, type StageRuleInput, type Template, type TemplatePayload, type UpdateAppointment, type UpdateBroadcastParams, type UpdateContactParams, type UpdateCustomerParams, type UpdatePhoneNumberParams, type UpdateSetupLinkParams, type UpdateWebhookParams, type UploadMediaParams, type User, WEBHOOK_CATEGORIES, type Webhook, type WebhookAuthorizationHeaders, type WebhookCategory, type WebhookDelivery, type WebhookDeliveryStatus, isPlanError };
|