@botozap/sdk 0.19.0 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +36 -0
- package/README.md +88 -9
- package/dist/index.cjs +187 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +494 -23
- package/dist/index.d.ts +494 -23
- package/dist/index.js +184 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -141,6 +141,17 @@ interface Customer {
|
|
|
141
141
|
* (`list`/`get`); ausente em servidores antigos.
|
|
142
142
|
*/
|
|
143
143
|
plan_suspended?: boolean;
|
|
144
|
+
/**
|
|
145
|
+
* Palavras que fazem o contato recusar mensagens (Palavras de saída). Não há
|
|
146
|
+
* lista padrão: só valem as que o Cliente cadastra. `[]` quando não há.
|
|
147
|
+
*/
|
|
148
|
+
opt_out_keywords?: string[];
|
|
149
|
+
/** Palavras de volta: o contato que as manda volta a aceitar mensagens. `[]` quando não há. */
|
|
150
|
+
opt_in_keywords?: string[];
|
|
151
|
+
/** Texto que o contato recebe ao recusar. */
|
|
152
|
+
opt_out_confirmation?: string;
|
|
153
|
+
/** Texto que o contato recebe ao voltar a aceitar. */
|
|
154
|
+
opt_in_confirmation?: string;
|
|
144
155
|
[key: string]: unknown;
|
|
145
156
|
}
|
|
146
157
|
/**
|
|
@@ -215,8 +226,86 @@ interface Contact {
|
|
|
215
226
|
display_name?: string | null;
|
|
216
227
|
/** Contact tags (stored in metadata.tags); returned by servers with #498. */
|
|
217
228
|
tags?: string[];
|
|
229
|
+
/**
|
|
230
|
+
* Só na resposta de `contacts.create` (201): avisos por canal e finalidade
|
|
231
|
+
* sobre os Consentimentos iniciais. Ausente quando não há aviso.
|
|
232
|
+
*/
|
|
233
|
+
warnings?: ContactWarning[];
|
|
218
234
|
[key: string]: unknown;
|
|
219
235
|
}
|
|
236
|
+
/** Canal de um Consentimento. */
|
|
237
|
+
type ConsentChannel = "whatsapp" | "instagram";
|
|
238
|
+
/** Finalidade de um Consentimento: `marketing` (promoções) ou `utility` (avisos e serviço). */
|
|
239
|
+
type ConsentPurpose = "marketing" | "utility";
|
|
240
|
+
/** Estado de um Consentimento: `granted` (aceitou) ou `revoked` (recusou). */
|
|
241
|
+
type ConsentState = "granted" | "revoked";
|
|
242
|
+
/**
|
|
243
|
+
* Como o Consentimento foi registrado. `manual` (painel), `import` (planilha),
|
|
244
|
+
* `api` (esta API, inclusive `consent_basis` no envio), `keyword` (Palavra de
|
|
245
|
+
* saída), `conversation_button` (botão do pedido de consentimento na conversa),
|
|
246
|
+
* `contact_keyword` (o próprio contato mandou uma Palavra de volta cadastrada
|
|
247
|
+
* pelo Cliente), `template_button` (o contato tocou num botão de saída marcado
|
|
248
|
+
* no template) e `meta_opt_out` (a Meta informou a recusa, erro 131050). Valores
|
|
249
|
+
* novos podem surgir.
|
|
250
|
+
*/
|
|
251
|
+
type ConsentOrigin = "manual" | "import" | "api" | "keyword" | "conversation_button" | "contact_keyword" | "template_button" | "meta_opt_out" | (string & {});
|
|
252
|
+
/** Um registro de Consentimento do Contato (por canal e finalidade). */
|
|
253
|
+
interface Consent {
|
|
254
|
+
id: string;
|
|
255
|
+
channel: ConsentChannel;
|
|
256
|
+
purpose: ConsentPurpose;
|
|
257
|
+
state: ConsentState;
|
|
258
|
+
origin: ConsentOrigin;
|
|
259
|
+
/** Quem registrou, quando foi uma pessoa; `null` na API e nas origens automáticas. */
|
|
260
|
+
recorded_by: string | null;
|
|
261
|
+
/** Texto livre de evidência (até 500 caracteres); `""` quando não há. */
|
|
262
|
+
evidence: string;
|
|
263
|
+
/** ISO 8601. */
|
|
264
|
+
created_at: string;
|
|
265
|
+
}
|
|
266
|
+
/** Resposta de `GET /v1/contacts/{id}/consents`. */
|
|
267
|
+
interface ContactConsents {
|
|
268
|
+
/** O registro vigente por canal e finalidade. */
|
|
269
|
+
current: Consent[];
|
|
270
|
+
/** Todos os registros, do mais novo ao mais antigo. */
|
|
271
|
+
history: Consent[];
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Aviso de `POST /v1/contacts` sobre um Consentimento inicial que não valeu.
|
|
275
|
+
* `consent_opted_out`: o contato já recusou (o aceite pedido não foi gravado e
|
|
276
|
+
* ele nasce como Recusou). `consent_unconfirmed`: o contato foi criado, mas não
|
|
277
|
+
* foi possível confirmar o consentimento vigente; consulte `contacts.listConsents`.
|
|
278
|
+
*/
|
|
279
|
+
interface ContactWarning {
|
|
280
|
+
code: "consent_opted_out" | "consent_unconfirmed" | (string & {});
|
|
281
|
+
message: string;
|
|
282
|
+
channel: ConsentChannel;
|
|
283
|
+
purpose: ConsentPurpose;
|
|
284
|
+
}
|
|
285
|
+
/** Resposta de `conversations.requestConsent` (201). */
|
|
286
|
+
interface ConsentRequestResult {
|
|
287
|
+
/** UUID interno da mensagem; `null` quando a gravação falhou (veja `warnings`). */
|
|
288
|
+
id: string | null;
|
|
289
|
+
/** ID da mensagem no WhatsApp; `null` no Instagram. */
|
|
290
|
+
wamid: string | null;
|
|
291
|
+
conversation_id: string;
|
|
292
|
+
contact_id: string;
|
|
293
|
+
/** Canal do envio. */
|
|
294
|
+
channel: ConsentChannel;
|
|
295
|
+
type: "interactive";
|
|
296
|
+
status: "sent";
|
|
297
|
+
/** Destinatário efetivamente usado. */
|
|
298
|
+
sent_to: string;
|
|
299
|
+
/** Finalidades pedidas. */
|
|
300
|
+
purposes: ConsentPurpose[];
|
|
301
|
+
/** Texto enviado. */
|
|
302
|
+
body: string;
|
|
303
|
+
/** `send_unrecorded`: a Meta aceitou e o registro falhou; não reenvie. */
|
|
304
|
+
warnings?: {
|
|
305
|
+
code: string;
|
|
306
|
+
message: string;
|
|
307
|
+
}[];
|
|
308
|
+
}
|
|
220
309
|
/** Origem da Conversa: anúncio Click-to-WhatsApp, orgânica ou desconhecida (`null`). */
|
|
221
310
|
type ConversationEntryPoint = "ctwa" | "organic";
|
|
222
311
|
/**
|
|
@@ -548,11 +637,23 @@ interface ConnectionBilling {
|
|
|
548
637
|
}
|
|
549
638
|
|
|
550
639
|
/** Public /api/v1/ai contracts. Revisions are opaque strings unless the endpoint explicitly uses a number. */
|
|
551
|
-
|
|
552
|
-
|
|
640
|
+
/**
|
|
641
|
+
* Provedores do catálogo de IA hoje: só `openai` e `anthropic`. É o que as
|
|
642
|
+
* entradas aceitam (credencial, vínculo, modelos, tarifa, agente); qualquer outro
|
|
643
|
+
* responde 422 `provider_not_enabled`.
|
|
644
|
+
*/
|
|
553
645
|
declare const AI_CREDENTIAL_PROVIDERS: readonly ["openai", "anthropic"];
|
|
646
|
+
type AiEnabledProvider = (typeof AI_CREDENTIAL_PROVIDERS)[number];
|
|
647
|
+
/**
|
|
648
|
+
* Provedor como a leitura devolve. Além dos do catálogo, mantém os seis
|
|
649
|
+
* históricos porque credenciais, vínculos e agentes antigos podem continuar
|
|
650
|
+
* guardados com um provedor descontinuado (`google`, `openrouter`, `deepseek`,
|
|
651
|
+
* `xai`), desativados. Para ENTRADA use {@link AiEnabledProvider}.
|
|
652
|
+
*/
|
|
653
|
+
type AiProvider = AiEnabledProvider | "google" | "openrouter" | "deepseek" | "xai";
|
|
554
654
|
/** Item de `ai.providers.get().providers`. */
|
|
555
655
|
type AiProviderInfo = {
|
|
656
|
+
/** `GET /ai/providers` lista só os provedores do catálogo (`openai` e `anthropic`). */
|
|
556
657
|
id: AiProvider;
|
|
557
658
|
label: string;
|
|
558
659
|
key_url: string | null;
|
|
@@ -578,14 +679,22 @@ type AiPage = AiScope & {
|
|
|
578
679
|
page?: number;
|
|
579
680
|
per_page?: number;
|
|
580
681
|
};
|
|
682
|
+
/**
|
|
683
|
+
* Destino de um vínculo na ENTRADA (`providers.saveBinding`, classificador do
|
|
684
|
+
* roteador): só provedores do catálogo (`openai` e `anthropic`).
|
|
685
|
+
*/
|
|
581
686
|
type AiBindingTarget = {
|
|
582
|
-
provider:
|
|
687
|
+
provider: AiEnabledProvider;
|
|
583
688
|
model: string;
|
|
584
689
|
credential_id: string;
|
|
585
690
|
};
|
|
586
|
-
|
|
691
|
+
/** Destino de um vínculo como a leitura devolve: pode ser de um provedor descontinuado. */
|
|
692
|
+
type AiBindingTargetRead = Omit<AiBindingTarget, "provider"> & {
|
|
693
|
+
provider: AiProvider;
|
|
694
|
+
};
|
|
695
|
+
type AiBinding = AiBindingTargetRead & {
|
|
587
696
|
purpose: AiPurpose;
|
|
588
|
-
fallback:
|
|
697
|
+
fallback: AiBindingTargetRead | null;
|
|
589
698
|
};
|
|
590
699
|
type AiCredential = {
|
|
591
700
|
id: string;
|
|
@@ -612,16 +721,21 @@ type AiWindow = {
|
|
|
612
721
|
weekdays: number[];
|
|
613
722
|
};
|
|
614
723
|
type AiToolId = "contacts.read" | "contacts.update" | "conversations.read" | "conversations.note" | "crm.opportunities.read" | "crm.opportunities.write" | "crm.demands.read" | "crm.demands.write" | "crm.stages.read" | "crm.stages.write" | "agenda.availability" | "agenda.propose" | "agenda.appointments.read" | "agenda.appointments.reschedule" | "agenda.appointments.cancel" | "knowledge.search" | "memory.read" | "memory.propose" | "skills.read" | "followups.enroll" | "followups.pause" | "followups.cancel" | "cases.open" | "cases.update" | "followups.schedule" | "followups.list" | "handoff" | "alerts.create" | "contacts.search" | "contacts.get" | "contacts.propose_update" | "conversations.list" | "conversations.get" | "conversations.history" | "conversations.assign" | "team.members.read" | "inbox.queue.read" | "tags.read" | "tags.manage" | "saved_replies.read" | "saved_replies.render" | "automations.read" | "automations.runs.read" | "radar.read" | "radar.propose_reactivation" | "catalog.products.search" | "privacy.consent.read" | "knowledge.sources.read" | "proposals.read" | "cases.read" | "crm.search" | "agenda.schedule.read" | "agenda.appointments.confirm" | "cases.note" | "cases.close";
|
|
724
|
+
/**
|
|
725
|
+
* Configuração do agente na ENTRADA (`ai.agents.create` e `saveDraft`): o
|
|
726
|
+
* provedor só pode ser `openai` ou `anthropic`. A leitura devolve
|
|
727
|
+
* {@link AiAgentConfigRead}.
|
|
728
|
+
*/
|
|
615
729
|
interface AiAgentConfig {
|
|
616
730
|
system_prompt?: string;
|
|
617
|
-
provider?:
|
|
731
|
+
provider?: AiEnabledProvider;
|
|
618
732
|
model?: string;
|
|
619
733
|
credential_id?: string | null;
|
|
620
734
|
channel_account_id?: string | null;
|
|
621
735
|
tool_ids?: AiToolId[];
|
|
622
736
|
operator?: {
|
|
623
737
|
enabled?: boolean;
|
|
624
|
-
provider?:
|
|
738
|
+
provider?: AiEnabledProvider | null;
|
|
625
739
|
model?: string | null;
|
|
626
740
|
credential_id?: string | null;
|
|
627
741
|
tool_ids?: AiToolId[];
|
|
@@ -693,6 +807,13 @@ interface AiAgentConfig {
|
|
|
693
807
|
instructions?: string;
|
|
694
808
|
};
|
|
695
809
|
}
|
|
810
|
+
/** Configuração do agente como a leitura devolve: versões antigas podem ter um provedor descontinuado. */
|
|
811
|
+
type AiAgentConfigRead = Omit<AiAgentConfig, "provider" | "operator"> & {
|
|
812
|
+
provider?: AiProvider;
|
|
813
|
+
operator?: Omit<NonNullable<AiAgentConfig["operator"]>, "provider"> & {
|
|
814
|
+
provider?: AiProvider | null;
|
|
815
|
+
};
|
|
816
|
+
};
|
|
696
817
|
type AiAgentInput = AiScope & {
|
|
697
818
|
name: string;
|
|
698
819
|
description?: string;
|
|
@@ -724,7 +845,7 @@ type AiAgentVersion = {
|
|
|
724
845
|
number: number;
|
|
725
846
|
revision: string;
|
|
726
847
|
status: "draft" | "published";
|
|
727
|
-
config:
|
|
848
|
+
config: AiAgentConfigRead;
|
|
728
849
|
created_at: string;
|
|
729
850
|
published_at: string | null;
|
|
730
851
|
created_by: string | null;
|
|
@@ -874,7 +995,9 @@ type AiRouterConfig = {
|
|
|
874
995
|
position?: number;
|
|
875
996
|
}[];
|
|
876
997
|
};
|
|
877
|
-
type AiRouter = AiRouterConfig & {
|
|
998
|
+
type AiRouter = Omit<AiRouterConfig, "classifier"> & {
|
|
999
|
+
/** O classificador de um roteador antigo pode ser de um provedor descontinuado. */
|
|
1000
|
+
classifier: AiBindingTargetRead;
|
|
878
1001
|
id: string;
|
|
879
1002
|
revision: string;
|
|
880
1003
|
active: boolean;
|
|
@@ -1093,7 +1216,7 @@ type AiAudioPricing = {
|
|
|
1093
1216
|
usd_per_minute: number;
|
|
1094
1217
|
};
|
|
1095
1218
|
type AiRateInput = AiScope & {
|
|
1096
|
-
provider:
|
|
1219
|
+
provider: AiEnabledProvider;
|
|
1097
1220
|
model: string;
|
|
1098
1221
|
input_usd_per_million: number;
|
|
1099
1222
|
output_usd_per_million: number;
|
|
@@ -1246,7 +1369,9 @@ type AiBudget = Omit<AiBudgetInput, "customer_id" | "expected_revision"> & {
|
|
|
1246
1369
|
revision: number;
|
|
1247
1370
|
updated_at: string | null;
|
|
1248
1371
|
};
|
|
1249
|
-
type AiRate = Omit<AiRateInput, "customer_id" | "expected_revision" | "audio_pricing"> & {
|
|
1372
|
+
type AiRate = Omit<AiRateInput, "customer_id" | "expected_revision" | "audio_pricing" | "provider"> & {
|
|
1373
|
+
/** Tarifas antigas podem ser de um provedor descontinuado. */
|
|
1374
|
+
provider: AiProvider;
|
|
1250
1375
|
audio_pricing: AiAudioPricing | null;
|
|
1251
1376
|
revision: number;
|
|
1252
1377
|
updated_at: string;
|
|
@@ -2168,9 +2293,9 @@ declare class AiCredentialsResource {
|
|
|
2168
2293
|
get(input: AiScope & {
|
|
2169
2294
|
id: string;
|
|
2170
2295
|
}): Promise<AiCredential>;
|
|
2171
|
-
/** 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
|
|
2296
|
+
/** 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`, o mesmo erro de reativar (`update` com `active: true`), trocar a chave, `revalidate` e vincular um provedor descontinuado. */
|
|
2172
2297
|
create(input: AiScope & {
|
|
2173
|
-
provider:
|
|
2298
|
+
provider: AiEnabledProvider;
|
|
2174
2299
|
label: string;
|
|
2175
2300
|
key: string;
|
|
2176
2301
|
}): Promise<AiCredential>;
|
|
@@ -2198,7 +2323,12 @@ declare class AiCredentialsResource {
|
|
|
2198
2323
|
declare class AiProvidersResource {
|
|
2199
2324
|
private readonly client;
|
|
2200
2325
|
constructor(client: BotoZap);
|
|
2201
|
-
/**
|
|
2326
|
+
/**
|
|
2327
|
+
* GET /ai/providers. A lista `providers` traz só `openai` e `anthropic`;
|
|
2328
|
+
* `credentials` e `bindings` podem trazer, desativados, os de provedores
|
|
2329
|
+
* antigos. Salvar vínculo ou agente com provedor descontinuado: 422
|
|
2330
|
+
* `provider_not_enabled`.
|
|
2331
|
+
*/
|
|
2202
2332
|
get(input: AiScope): Promise<{
|
|
2203
2333
|
providers: AiProviderInfo[];
|
|
2204
2334
|
purposes: Record<string, string>;
|
|
@@ -2218,7 +2348,7 @@ declare class AiProvidersResource {
|
|
|
2218
2348
|
}): Promise<void>;
|
|
2219
2349
|
/** GET /ai/providers/:provider/models */
|
|
2220
2350
|
models(input: AiScope & {
|
|
2221
|
-
provider:
|
|
2351
|
+
provider: AiEnabledProvider;
|
|
2222
2352
|
credential_id: string;
|
|
2223
2353
|
}): Promise<AiProviderModel[]>;
|
|
2224
2354
|
/** Último snapshot do catálogo por credencial; nunca contém chaves. */
|
|
@@ -2829,7 +2959,7 @@ declare class AiUsageResource {
|
|
|
2829
2959
|
saveRate(input: AiRateInput): Promise<AiRate>;
|
|
2830
2960
|
/** Aplica tarifa própria a medições sem preço; não gera cobrança BotoZap. Exige confirmação. */
|
|
2831
2961
|
reprice(input: AiScope & {
|
|
2832
|
-
provider:
|
|
2962
|
+
provider: AiEnabledProvider;
|
|
2833
2963
|
model: string;
|
|
2834
2964
|
expected_revision: number;
|
|
2835
2965
|
confirm: true;
|
|
@@ -3674,6 +3804,14 @@ interface SendTemplateParams {
|
|
|
3674
3804
|
template: TemplatePayload;
|
|
3675
3805
|
/** ID Meta ou UUID interno do Número de origem. */
|
|
3676
3806
|
from?: string;
|
|
3807
|
+
/**
|
|
3808
|
+
* Só em template de marketing: texto curto (até 500 caracteres) que vira a
|
|
3809
|
+
* evidência do aceite do contato (origem `api`) quando ele não tem registro de
|
|
3810
|
+
* consentimento. Não desfaz uma recusa: contato que recusou marketing recebe
|
|
3811
|
+
* 422 `consent_revoked`, com ou sem `consent_basis`, e só ele volta a aceitar
|
|
3812
|
+
* (botão do pedido de consentimento ou Palavra de volta).
|
|
3813
|
+
*/
|
|
3814
|
+
consent_basis?: string;
|
|
3677
3815
|
}
|
|
3678
3816
|
interface SendImageParams {
|
|
3679
3817
|
to: string;
|
|
@@ -3885,10 +4023,28 @@ interface CreateCustomerParams {
|
|
|
3885
4023
|
external_customer_id?: string;
|
|
3886
4024
|
[key: string]: unknown;
|
|
3887
4025
|
}
|
|
3888
|
-
/**
|
|
4026
|
+
/**
|
|
4027
|
+
* Campos editáveis de um cliente (`PATCH /v1/customers/:id`). Lista enviada
|
|
4028
|
+
* substitui a anterior (`[]` limpa); campo ausente fica como está.
|
|
4029
|
+
*/
|
|
3889
4030
|
interface UpdateCustomerParams {
|
|
3890
4031
|
name?: string;
|
|
3891
4032
|
external_customer_id?: string;
|
|
4033
|
+
/**
|
|
4034
|
+
* Palavras de saída: o contato que as manda recusa mensagens (origem
|
|
4035
|
+
* `keyword`). Não existe lista padrão. Até 40 palavras de até 40 caracteres,
|
|
4036
|
+
* sem repetir entre saída e volta.
|
|
4037
|
+
*/
|
|
4038
|
+
opt_out_keywords?: string[];
|
|
4039
|
+
/**
|
|
4040
|
+
* Palavras de volta: o contato que as manda volta a aceitar (origem
|
|
4041
|
+
* `contact_keyword`). Mesmos limites de `opt_out_keywords`.
|
|
4042
|
+
*/
|
|
4043
|
+
opt_in_keywords?: string[];
|
|
4044
|
+
/** Texto enviado ao contato quando ele recusa (até 500 caracteres, não vazio). */
|
|
4045
|
+
opt_out_confirmation?: string;
|
|
4046
|
+
/** Texto enviado ao contato quando ele volta a aceitar (até 500 caracteres, não vazio). */
|
|
4047
|
+
opt_in_confirmation?: string;
|
|
3892
4048
|
}
|
|
3893
4049
|
/**
|
|
3894
4050
|
* Corpo de `POST /v1/customers/:id/setup_links`.
|
|
@@ -3966,7 +4122,11 @@ declare class Customers {
|
|
|
3966
4122
|
* segundo responde 402 `free_cap` (veja `isFreeCap`).
|
|
3967
4123
|
*/
|
|
3968
4124
|
create(params: CreateCustomerParams): Promise<Customer>;
|
|
3969
|
-
/**
|
|
4125
|
+
/**
|
|
4126
|
+
* Atualiza `name` / `external_customer_id` de um cliente e as Palavras de saída
|
|
4127
|
+
* e de volta com os textos de confirmação. Palavra repetida entre saída e volta
|
|
4128
|
+
* responde 422 `invalid_request`.
|
|
4129
|
+
*/
|
|
3970
4130
|
update(id: string, params: UpdateCustomerParams): Promise<Customer>;
|
|
3971
4131
|
/** Exclui um cliente. Responde 204 (sem corpo). */
|
|
3972
4132
|
delete(id: string): Promise<void>;
|
|
@@ -3987,6 +4147,12 @@ declare class Customers {
|
|
|
3987
4147
|
interface Template {
|
|
3988
4148
|
id: string;
|
|
3989
4149
|
name?: string;
|
|
4150
|
+
/**
|
|
4151
|
+
* Textos dos botões de resposta rápida marcados como de saída. O toque num
|
|
4152
|
+
* botão marcado grava a recusa da finalidade do template (marketing ou
|
|
4153
|
+
* avisos). `[]` quando não há marcação.
|
|
4154
|
+
*/
|
|
4155
|
+
opt_out_buttons?: string[];
|
|
3990
4156
|
[key: string]: unknown;
|
|
3991
4157
|
}
|
|
3992
4158
|
/** Filtros de `templates.list` (paginação por offset). Ver GET /v1/templates. */
|
|
@@ -4017,6 +4183,20 @@ interface CreateTemplateParams {
|
|
|
4017
4183
|
waba_connection_id?: string;
|
|
4018
4184
|
/** phone_number_id (Meta) → resolve a conexão do número (alternativa). */
|
|
4019
4185
|
phone_number_id?: string;
|
|
4186
|
+
/**
|
|
4187
|
+
* Textos dos botões de resposta rápida de `components` que são de saída
|
|
4188
|
+
* (até 10). Texto que não é botão de resposta rápida do template responde 422
|
|
4189
|
+
* `invalid_template`.
|
|
4190
|
+
*/
|
|
4191
|
+
opt_out_buttons?: string[];
|
|
4192
|
+
}
|
|
4193
|
+
/** Corpo de `PATCH /v1/templates/:id`. */
|
|
4194
|
+
interface UpdateTemplateParams {
|
|
4195
|
+
/**
|
|
4196
|
+
* Textos dos botões de resposta rápida que são de saída; `[]` limpa a marcação.
|
|
4197
|
+
* Anotação do BotoZap: não altera o template na Meta.
|
|
4198
|
+
*/
|
|
4199
|
+
opt_out_buttons: string[];
|
|
4020
4200
|
}
|
|
4021
4201
|
/** Endpoints de template (GET/POST /v1/templates, GET /v1/templates/:id). */
|
|
4022
4202
|
declare class Templates {
|
|
@@ -4028,6 +4208,13 @@ declare class Templates {
|
|
|
4028
4208
|
get(id: string): Promise<Template>;
|
|
4029
4209
|
/** Cria um template e o submete à Meta para análise. */
|
|
4030
4210
|
create(params: CreateTemplateParams): Promise<Template>;
|
|
4211
|
+
/**
|
|
4212
|
+
* Marca quais botões de resposta rápida são de saída (`opt_out_buttons`). O toque
|
|
4213
|
+
* num botão marcado grava a recusa da finalidade do template; botão não marcado
|
|
4214
|
+
* não muda nada, qualquer que seja o texto. Não altera o template na Meta.
|
|
4215
|
+
* Scope `templates:write`.
|
|
4216
|
+
*/
|
|
4217
|
+
update(id: string, params: UpdateTemplateParams): Promise<Template>;
|
|
4031
4218
|
}
|
|
4032
4219
|
|
|
4033
4220
|
interface ListBroadcastsParams extends OffsetParams {
|
|
@@ -4135,6 +4322,22 @@ interface ListContactsParams extends CursorParams {
|
|
|
4135
4322
|
/** Criados em ou antes desta data (ISO 8601). */
|
|
4136
4323
|
created_before?: string;
|
|
4137
4324
|
}
|
|
4325
|
+
/** Consentimento inicial de `contacts.create` (campo `consents`). */
|
|
4326
|
+
interface InitialConsent {
|
|
4327
|
+
channel: ConsentChannel;
|
|
4328
|
+
purpose: ConsentPurpose;
|
|
4329
|
+
state: ConsentState;
|
|
4330
|
+
/** Texto livre de evidência (até 500 caracteres). */
|
|
4331
|
+
evidence?: string;
|
|
4332
|
+
}
|
|
4333
|
+
/** Corpo de `contacts.recordConsent` (`POST /v1/contacts/{id}/consents`). */
|
|
4334
|
+
interface RecordConsentParams {
|
|
4335
|
+
channel: ConsentChannel;
|
|
4336
|
+
purpose: ConsentPurpose;
|
|
4337
|
+
state: ConsentState;
|
|
4338
|
+
/** Texto livre de evidência (até 500 caracteres). */
|
|
4339
|
+
evidence?: string;
|
|
4340
|
+
}
|
|
4138
4341
|
interface CreateContactParams {
|
|
4139
4342
|
/** wa_id canônico (BSUID "BR.1A2B…" ou dígitos E.164). */
|
|
4140
4343
|
wa_id: string;
|
|
@@ -4146,6 +4349,13 @@ interface CreateContactParams {
|
|
|
4146
4349
|
display_name?: string | null;
|
|
4147
4350
|
/** Até 20 tags de 1–40 caracteres; o servidor apara e remove repetidas sem diferenciar maiúsculas. Não combine com metadata.tags. */
|
|
4148
4351
|
tags?: string[];
|
|
4352
|
+
/**
|
|
4353
|
+
* Consentimentos iniciais, gravados junto com o contato numa transação só. Se
|
|
4354
|
+
* o contato já recusou (foi excluído depois de recusar e voltou), o aceite não
|
|
4355
|
+
* é gravado, o contato nasce como Recusou e a resposta traz `warnings` com
|
|
4356
|
+
* `consent_opted_out`.
|
|
4357
|
+
*/
|
|
4358
|
+
consents?: InitialConsent[];
|
|
4149
4359
|
[key: string]: unknown;
|
|
4150
4360
|
}
|
|
4151
4361
|
/**
|
|
@@ -4176,10 +4386,33 @@ declare class Contacts {
|
|
|
4176
4386
|
/** Lista os contatos da conta (paginação por cursor). */
|
|
4177
4387
|
list(params?: ListContactsParams): Promise<CursorList<Contact>>;
|
|
4178
4388
|
get(id: string): Promise<Contact>;
|
|
4389
|
+
/**
|
|
4390
|
+
* Cria um contato. A resposta (201) pode trazer `warnings` por canal e
|
|
4391
|
+
* finalidade: `consent_opted_out` (o contato já recusou; o aceite pedido em
|
|
4392
|
+
* `consents` não foi gravado) ou `consent_unconfirmed` (não foi possível
|
|
4393
|
+
* confirmar o consentimento vigente).
|
|
4394
|
+
*/
|
|
4179
4395
|
create(params: CreateContactParams): Promise<Contact>;
|
|
4180
4396
|
update(id: string, params: UpdateContactParams | Record<string, unknown>): Promise<Contact>;
|
|
4181
|
-
/**
|
|
4397
|
+
/**
|
|
4398
|
+
* Remove um contato e o que é dele (conversas, mensagens, CRM, compromissos e
|
|
4399
|
+
* Consentimentos); a mídia dele é apagada. A recusa não se perde: fica guardada
|
|
4400
|
+
* como código cifrado (hash) na lista de recusa da Conta e vale se o contato
|
|
4401
|
+
* voltar, que nasce como Recusou. Responde 204 (sem corpo).
|
|
4402
|
+
*/
|
|
4182
4403
|
delete(id: string): Promise<void>;
|
|
4404
|
+
/**
|
|
4405
|
+
* Consentimentos do contato: `current` (o vigente por canal e finalidade) e
|
|
4406
|
+
* `history` (todos, do mais novo ao mais antigo). Scope `contacts:read`.
|
|
4407
|
+
*/
|
|
4408
|
+
listConsents(id: string): Promise<ContactConsents>;
|
|
4409
|
+
/**
|
|
4410
|
+
* Registra um Consentimento do contato (origem `api`). Scope `contacts:write`.
|
|
4411
|
+
* Sobre uma recusa do próprio contato responde `409 consent_opted_out` e nada é
|
|
4412
|
+
* gravado: só ele volta a aceitar (botão do pedido de consentimento ou Palavra
|
|
4413
|
+
* de volta). Para recusar, registre `state: "revoked"`.
|
|
4414
|
+
*/
|
|
4415
|
+
recordConsent(id: string, params: RecordConsentParams): Promise<Consent>;
|
|
4183
4416
|
}
|
|
4184
4417
|
|
|
4185
4418
|
interface ListConversationsParams extends CursorParams {
|
|
@@ -4216,6 +4449,13 @@ interface ReplyConversationParams {
|
|
|
4216
4449
|
/** Opções de resposta (só em Conversas do Instagram; ver `messages.send`). */
|
|
4217
4450
|
quick_replies?: QuickReply[];
|
|
4218
4451
|
}
|
|
4452
|
+
/** Corpo opcional de `conversations.requestConsent`. */
|
|
4453
|
+
interface RequestConsentParams {
|
|
4454
|
+
/** Finalidades pedidas ao contato (lista não vazia). Padrão: `["marketing"]`. */
|
|
4455
|
+
purposes?: ConsentPurpose[];
|
|
4456
|
+
/** Texto do pedido (até 1024 caracteres). Padrão: o texto padrão do BotoZap. */
|
|
4457
|
+
body?: string;
|
|
4458
|
+
}
|
|
4219
4459
|
/** Conversas (read + status) e atribuições a membros. */
|
|
4220
4460
|
declare class Conversations {
|
|
4221
4461
|
private readonly client;
|
|
@@ -4236,6 +4476,31 @@ declare class Conversations {
|
|
|
4236
4476
|
* billing antes de chamar a Meta.
|
|
4237
4477
|
*/
|
|
4238
4478
|
reply(id: string, params: ReplyConversationParams, options?: SendOptions): Promise<SendResult>;
|
|
4479
|
+
/**
|
|
4480
|
+
* Envia o pedido de consentimento na conversa (o "Pedir consentimento" do
|
|
4481
|
+
* composer): botões no WhatsApp, respostas rápidas no Instagram. Só com a
|
|
4482
|
+
* janela de 24h aberta, e sai também para quem recusou marketing: é o caminho
|
|
4483
|
+
* de volta. O toque do contato grava o aceite (origem `conversation_button`).
|
|
4484
|
+
* Scope `messages:send`. Responde 201 com o `channel` do envio; `warnings` com
|
|
4485
|
+
* `send_unrecorded` significa que a Meta aceitou e a gravação falhou: não
|
|
4486
|
+
* reenvie, o pedido já saiu.
|
|
4487
|
+
*
|
|
4488
|
+
* Recusas: `outside_window` (WhatsApp) ou `window_closed` (Instagram) com a
|
|
4489
|
+
* janela fechada, `channel_not_supported` (canal sem botões), `no_phone`,
|
|
4490
|
+
* `not_connected` (número desconectado ou sem token), `invalid_recipient`.
|
|
4491
|
+
* Não há chave de idempotência: não repita um pedido de resultado incerto sem
|
|
4492
|
+
* conferir o histórico da conversa.
|
|
4493
|
+
*/
|
|
4494
|
+
requestConsent(id: string, params?: RequestConsentParams): Promise<ConsentRequestResult>;
|
|
4495
|
+
/**
|
|
4496
|
+
* Exclui a conversa, com efeito imediato e sem volta: mensagens, notas,
|
|
4497
|
+
* atribuições, vínculos com oportunidades e demandas e o que a IA guardou
|
|
4498
|
+
* dela saem juntos, e os arquivos de mídia são apagados. O contato fica, com a
|
|
4499
|
+
* recusa e o consentimento. Só Administrador (por OAuth, papel de
|
|
4500
|
+
* administrador). Responde 204; id inexistente, de outra Conta ou já excluído
|
|
4501
|
+
* é 404. Scope `conversations:write`.
|
|
4502
|
+
*/
|
|
4503
|
+
delete(id: string): Promise<void>;
|
|
4239
4504
|
update(id: string, params: Record<string, unknown>): Promise<Conversation>;
|
|
4240
4505
|
/** Lista as atribuições da conversa (paginação por offset/página). */
|
|
4241
4506
|
listAssignments(id: string, params?: OffsetParams): Promise<OffsetList<Assignment>>;
|
|
@@ -4987,6 +5252,18 @@ interface BusinessSlot {
|
|
|
4987
5252
|
/** ISO 8601. */
|
|
4988
5253
|
created_at: string;
|
|
4989
5254
|
}
|
|
5255
|
+
/**
|
|
5256
|
+
* Garantia de 7 dias: enquanto ela vale, cancelar devolve a primeira
|
|
5257
|
+
* mensalidade integral.
|
|
5258
|
+
*/
|
|
5259
|
+
interface BillingGuarantee {
|
|
5260
|
+
/** Ciclo da assinatura: `monthly` ou `annual`. */
|
|
5261
|
+
term: "monthly" | "annual";
|
|
5262
|
+
/** Valor devolvido no cancelamento, em centavos. */
|
|
5263
|
+
amount_cents: number;
|
|
5264
|
+
/** Prazo final da garantia (ISO 8601). */
|
|
5265
|
+
deadline: string;
|
|
5266
|
+
}
|
|
4990
5267
|
/** Resposta de `GET /v1/billing`: plano da Conta e slots adicionais. */
|
|
4991
5268
|
interface Billing {
|
|
4992
5269
|
plan: BillingPlan;
|
|
@@ -5000,6 +5277,12 @@ interface Billing {
|
|
|
5000
5277
|
can_add_slot: boolean;
|
|
5001
5278
|
/** Slots ativos, dos mais antigos aos mais novos. */
|
|
5002
5279
|
slots: BusinessSlot[];
|
|
5280
|
+
/**
|
|
5281
|
+
* Garantia de 7 dias: presente enquanto o cancelamento ainda devolve a
|
|
5282
|
+
* primeira mensalidade integral; `null` quando não há direito. Ausente em
|
|
5283
|
+
* servidores antigos.
|
|
5284
|
+
*/
|
|
5285
|
+
guarantee?: BillingGuarantee | null | undefined;
|
|
5003
5286
|
}
|
|
5004
5287
|
/** Opções de {@link BillingSlots.create}. */
|
|
5005
5288
|
interface CreateBusinessSlotOptions {
|
|
@@ -5039,6 +5322,156 @@ declare class BillingResource {
|
|
|
5039
5322
|
get(): Promise<Billing>;
|
|
5040
5323
|
}
|
|
5041
5324
|
|
|
5325
|
+
/** Formato do arquivo exportado. */
|
|
5326
|
+
type ExportFormat = "json" | "csv";
|
|
5327
|
+
/**
|
|
5328
|
+
* Estado do pedido: `pending` (na fila), `processing` (gerando), `ready`
|
|
5329
|
+
* (pronto para baixar), `failed` (veja `error`) ou `expired` (passou o prazo de
|
|
5330
|
+
* 7 dias e o arquivo foi apagado). Valores novos podem surgir.
|
|
5331
|
+
*/
|
|
5332
|
+
type ExportStatus = "pending" | "processing" | "ready" | "failed" | "expired" | (string & {});
|
|
5333
|
+
/** Abrangência do pedido: a Conta inteira ou um Cliente. */
|
|
5334
|
+
type ExportScope = {
|
|
5335
|
+
type: "account";
|
|
5336
|
+
customer_id: null;
|
|
5337
|
+
customer_name: null;
|
|
5338
|
+
} | {
|
|
5339
|
+
type: "customer";
|
|
5340
|
+
customer_id: string;
|
|
5341
|
+
customer_name: string | null;
|
|
5342
|
+
};
|
|
5343
|
+
/** Link de download assinado; só vem em `exports.get`, com o pedido pronto. */
|
|
5344
|
+
interface ExportDownload {
|
|
5345
|
+
/** URL assinada do zip, com um arquivo por tipo de dado. */
|
|
5346
|
+
url: string;
|
|
5347
|
+
/** Validade do link, em segundos (poucos minutos). Peça de novo para receber outro. */
|
|
5348
|
+
expires_in: number;
|
|
5349
|
+
}
|
|
5350
|
+
/** Pedido de exportação de dados da Conta. */
|
|
5351
|
+
interface AccountExport {
|
|
5352
|
+
id: string;
|
|
5353
|
+
status: ExportStatus;
|
|
5354
|
+
format: ExportFormat;
|
|
5355
|
+
scope: ExportScope;
|
|
5356
|
+
/** Quem pediu (nome da pessoa, "Aplicativo conectado" ou "API (chave …)"). */
|
|
5357
|
+
requested_by: string;
|
|
5358
|
+
/** Por onde foi pedido: `painel` ou `api`. */
|
|
5359
|
+
requested_via: "painel" | "api" | (string & {});
|
|
5360
|
+
/** ISO 8601. */
|
|
5361
|
+
created_at: string;
|
|
5362
|
+
/** Quando terminou; `null` enquanto não terminou. */
|
|
5363
|
+
finished_at: string | null;
|
|
5364
|
+
/** Quando o arquivo é apagado (7 dias depois de pronto); `null` antes de pronto. */
|
|
5365
|
+
expires_at: string | null;
|
|
5366
|
+
size_bytes: number | null;
|
|
5367
|
+
/** Quantidade de registros por tipo; `null` antes de pronto. */
|
|
5368
|
+
counts: Record<string, number> | null;
|
|
5369
|
+
/** Só em `failed`: `export_failed`, `export_too_large`, `storage_unavailable`, `scope_not_found` ou `account_deleting`. */
|
|
5370
|
+
error: {
|
|
5371
|
+
code: string;
|
|
5372
|
+
message: string;
|
|
5373
|
+
} | null;
|
|
5374
|
+
/** Link de download: só em `exports.get`, com o pedido pronto e dentro do prazo. */
|
|
5375
|
+
download: ExportDownload | null;
|
|
5376
|
+
}
|
|
5377
|
+
/** Corpo de `exports.create`. */
|
|
5378
|
+
interface CreateExportParams {
|
|
5379
|
+
/** Exporta só este Cliente; sem ele, a Conta inteira. */
|
|
5380
|
+
customer_id?: string;
|
|
5381
|
+
/** `json` (padrão) ou `csv`. */
|
|
5382
|
+
format?: ExportFormat;
|
|
5383
|
+
}
|
|
5384
|
+
/**
|
|
5385
|
+
* Exportação de dados (`/v1/exports`), pedida pela API ou pelo painel. O arquivo
|
|
5386
|
+
* é gerado em fila, fica 7 dias e vem num zip com um arquivo por tipo de dado.
|
|
5387
|
+
*/
|
|
5388
|
+
declare class Exports {
|
|
5389
|
+
private readonly client;
|
|
5390
|
+
constructor(client: BotoZap);
|
|
5391
|
+
/**
|
|
5392
|
+
* Pede a exportação completa da Conta, ou de um Cliente (`customer_id`). Scope
|
|
5393
|
+
* `exports:write`. Responde 202 com o pedido novo; pedido igual enquanto o
|
|
5394
|
+
* anterior ainda está na fila devolve o mesmo (200). Funciona com a Conta em
|
|
5395
|
+
* somente leitura por exclusão: é o que se faz antes da exclusão começar. Cliente
|
|
5396
|
+
* inexistente é 404 `not_found`; exclusão já iniciada, 409
|
|
5397
|
+
* `account_deletion_in_progress`; muitos pedidos seguidos, 429 `rate_limited`.
|
|
5398
|
+
*/
|
|
5399
|
+
create(params?: CreateExportParams): Promise<AccountExport>;
|
|
5400
|
+
/**
|
|
5401
|
+
* Últimos pedidos da Conta (até 50), do mais novo ao mais antigo, sem o link de
|
|
5402
|
+
* download. Scope `exports:read`.
|
|
5403
|
+
*/
|
|
5404
|
+
list(): Promise<AccountExport[]>;
|
|
5405
|
+
/**
|
|
5406
|
+
* Estado de um pedido e, quando pronto e dentro do prazo, `download` com um
|
|
5407
|
+
* link assinado de poucos minutos: cada consulta gera um novo. Scope
|
|
5408
|
+
* `exports:read`. Pedido de outra Conta é 404 `not_found`.
|
|
5409
|
+
*/
|
|
5410
|
+
get(id: string): Promise<AccountExport>;
|
|
5411
|
+
}
|
|
5412
|
+
|
|
5413
|
+
/** Quem agiu: `user` (pessoa da equipe), `api_key` (chave de API) ou `system`. */
|
|
5414
|
+
interface TeamEventActor {
|
|
5415
|
+
type: "user" | "api_key" | "system" | (string & {});
|
|
5416
|
+
user_id: string | null;
|
|
5417
|
+
api_key_id: string | null;
|
|
5418
|
+
label: string | null;
|
|
5419
|
+
}
|
|
5420
|
+
/** Sobre o que a ação foi (conversa, canal, webhook, exportação…). */
|
|
5421
|
+
interface TeamEventTarget {
|
|
5422
|
+
type: string | null;
|
|
5423
|
+
/** Nome legível do tipo; `null` quando o tipo é desconhecido. */
|
|
5424
|
+
type_label: string | null;
|
|
5425
|
+
id: string | null;
|
|
5426
|
+
label: string | null;
|
|
5427
|
+
}
|
|
5428
|
+
/** Um evento do Registro de atividades da equipe. */
|
|
5429
|
+
interface TeamEvent {
|
|
5430
|
+
id: string;
|
|
5431
|
+
/** ISO 8601. */
|
|
5432
|
+
created_at: string;
|
|
5433
|
+
actor: TeamEventActor;
|
|
5434
|
+
/** Código da ação, por exemplo `export.requested` ou `webhook.created`. */
|
|
5435
|
+
action: string;
|
|
5436
|
+
/** Texto legível da ação. */
|
|
5437
|
+
action_label: string;
|
|
5438
|
+
target: TeamEventTarget;
|
|
5439
|
+
/** Estado antes da ação, quando a ação altera algo. */
|
|
5440
|
+
before: unknown;
|
|
5441
|
+
/** Estado depois da ação. */
|
|
5442
|
+
after: unknown;
|
|
5443
|
+
ip_address: string | null;
|
|
5444
|
+
}
|
|
5445
|
+
/** Filtros de `teamEvents.list`. */
|
|
5446
|
+
interface ListTeamEventsParams extends CursorParams {
|
|
5447
|
+
/** Eventos a partir desta data (ISO 8601, inclusive). */
|
|
5448
|
+
since?: string;
|
|
5449
|
+
/** Eventos antes desta data (ISO 8601, exclusive). */
|
|
5450
|
+
until?: string;
|
|
5451
|
+
/** Pessoa ou chave de API que agiu (o id de quem agiu). */
|
|
5452
|
+
actor_id?: string;
|
|
5453
|
+
/** Código da ação, por exemplo `export.requested`. */
|
|
5454
|
+
action?: string;
|
|
5455
|
+
/** Tipo do alvo, por exemplo `conversation` ou `webhook`. */
|
|
5456
|
+
target_type?: string;
|
|
5457
|
+
/** Id do alvo, por exemplo o da conversa. */
|
|
5458
|
+
target_id?: string;
|
|
5459
|
+
}
|
|
5460
|
+
/**
|
|
5461
|
+
* Registro de atividades da equipe (`/v1/team_events`): quem fez o quê, quando e
|
|
5462
|
+
* de onde. Só leitura, mais novo primeiro.
|
|
5463
|
+
*/
|
|
5464
|
+
declare class TeamEvents {
|
|
5465
|
+
private readonly client;
|
|
5466
|
+
constructor(client: BotoZap);
|
|
5467
|
+
/**
|
|
5468
|
+
* Lista o registro (paginação por cursor). Scope `team:read`, e só
|
|
5469
|
+
* Administrador lê: a chave vale enquanto quem a criou seguir como
|
|
5470
|
+
* Administrador da Conta (senão 403 `admin_required`). Filtro inválido é 422.
|
|
5471
|
+
*/
|
|
5472
|
+
list(params?: ListTeamEventsParams): Promise<CursorList<TeamEvent>>;
|
|
5473
|
+
}
|
|
5474
|
+
|
|
5042
5475
|
/** Membros da conta (somente leitura via API). */
|
|
5043
5476
|
declare class Users {
|
|
5044
5477
|
private readonly client;
|
|
@@ -5155,6 +5588,10 @@ declare class BotoZap {
|
|
|
5155
5588
|
readonly usage: Usage;
|
|
5156
5589
|
/** Plano da Conta e slots adicionais (só chave de API). */
|
|
5157
5590
|
readonly billing: BillingResource;
|
|
5591
|
+
/** Exportação de dados da Conta (`/v1/exports`). */
|
|
5592
|
+
readonly exports: Exports;
|
|
5593
|
+
/** Registro de atividades da equipe (`/v1/team_events`, só Administrador). */
|
|
5594
|
+
readonly teamEvents: TeamEvents;
|
|
5158
5595
|
readonly users: Users;
|
|
5159
5596
|
readonly apiLogs: ApiLogs;
|
|
5160
5597
|
readonly webhookDeliveries: WebhookDeliveries;
|
|
@@ -5216,15 +5653,29 @@ declare class BotoZapError extends Error {
|
|
|
5216
5653
|
* Agenda, Calendário, Jornadas, Regras de mensagem do Direct e Perguntas e menu
|
|
5217
5654
|
* fora do plano), `free_number_cap` (402, setup além do teto de Números do Free
|
|
5218
5655
|
* ou envio por um Número suspenso no Free), `free_cap` (402, criar o 2º Cliente
|
|
5219
|
-
* no Free ou enviar por um Cliente suspenso no Free).
|
|
5220
|
-
*
|
|
5656
|
+
* no Free ou enviar por um Cliente suspenso no Free). Consentimento:
|
|
5657
|
+
* `consent_opted_out` (409, registrar aceite sobre uma recusa do contato; nada é
|
|
5658
|
+
* gravado), `consent_revoked` (422, envio de template de marketing a quem
|
|
5659
|
+
* recusou, também quando a recusa foi por outro número da Conta; `consent_basis`
|
|
5660
|
+
* não desfaz); só o próprio contato volta a aceitar. Pedido de consentimento
|
|
5661
|
+
* (`conversations.requestConsent`): `outside_window` (WhatsApp) e `window_closed`
|
|
5662
|
+
* (Instagram) com a janela de 24h fechada, `channel_not_supported`. IA:
|
|
5663
|
+
* `provider_not_enabled` (422, provedor descontinuado: o catálogo aceita só
|
|
5664
|
+
* `openai` e `anthropic`; vale na credencial nova, ao ativar ou trocar a chave,
|
|
5665
|
+
* revalidar, nos vínculos de provedor e ao salvar agente com provedor
|
|
5666
|
+
* descontinuado). Conexão: `not_connected` (409, número desconectado ou sem
|
|
5667
|
+
* token no envio, na mídia, no pedido de consentimento, em transmissão e ao criar template). Acesso:
|
|
5668
|
+
* `ip_not_allowed` (403, chave com lista de IPs autorizados e chamada de outro
|
|
5669
|
+
* IP), `admin_required` (403, registro de atividades só para Administrador),
|
|
5670
|
+
* `gone` (410, rota removida; nenhuma ação é necessária, como as de
|
|
5671
|
+
* data-use da IA). Cobrança:
|
|
5221
5672
|
* `business_payment_required` (402 no envio: o negócio está pausado porque a
|
|
5222
5673
|
* fatura do slot venceu há mais de 7 dias; pague e envie de novo),
|
|
5223
5674
|
* `plan_required` (402, comprar slot no Free ou teste), `slot_limit` (402, já há
|
|
5224
5675
|
* 2 slots com fatura em aberto), `billing_customer_required` (402, conta sem
|
|
5225
5676
|
* cadastro de cobrança), `slot_in_use` (409, cancelar slot ocupado).
|
|
5226
5677
|
*/
|
|
5227
|
-
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" | "free_cap" | "feature_unavailable" | "provider_not_enabled" | "business_payment_required" | "plan_required" | "slot_limit" | "slot_in_use" | "billing_customer_required" | (string & {});
|
|
5678
|
+
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" | "free_cap" | "feature_unavailable" | "provider_not_enabled" | "consent_opted_out" | "consent_revoked" | "outside_window" | "window_closed" | "channel_not_supported" | "not_connected" | "ip_not_allowed" | "admin_required" | "gone" | "business_payment_required" | "plan_required" | "slot_limit" | "slot_in_use" | "billing_customer_required" | (string & {});
|
|
5228
5679
|
/** Códigos que indicam limite ou restrição do plano contratado. */
|
|
5229
5680
|
declare const PLAN_ERROR_CODES: readonly ["plan_restricted", "free_form_limit_reached", "free_number_cap", "free_cap"];
|
|
5230
5681
|
/** True quando o erro é recusa por plano (upgrade resolve; retry não). */
|
|
@@ -5254,5 +5705,25 @@ declare function isFreeCap(error: unknown): error is BotoZapError;
|
|
|
5254
5705
|
* `true`).
|
|
5255
5706
|
*/
|
|
5256
5707
|
declare function isFreeNumberCap(error: unknown): error is BotoZapError;
|
|
5708
|
+
/**
|
|
5709
|
+
* True quando a API recusou registrar um aceite porque o contato recusou
|
|
5710
|
+
* mensagens (409 `consent_opted_out`, em `contacts.recordConsent`). Nada foi
|
|
5711
|
+
* gravado e repetir não adianta: só o próprio contato volta a aceitar (botão do
|
|
5712
|
+
* pedido de consentimento ou Palavra de volta cadastrada pelo Cliente).
|
|
5713
|
+
*/
|
|
5714
|
+
declare function isConsentOptedOut(error: unknown): error is BotoZapError;
|
|
5715
|
+
/**
|
|
5716
|
+
* True quando o envio de um template de marketing foi recusado porque o
|
|
5717
|
+
* contato recusou marketing (422 `consent_revoked`), sem enviar. Vale também
|
|
5718
|
+
* para quem recusou por outro número da mesma Conta. `consent_basis` não desfaz
|
|
5719
|
+
* a recusa; só o contato volta a aceitar.
|
|
5720
|
+
*/
|
|
5721
|
+
declare function isConsentRevoked(error: unknown): error is BotoZapError;
|
|
5722
|
+
/**
|
|
5723
|
+
* True quando a API recusou porque o número está desconectado ou sem token de
|
|
5724
|
+
* acesso (409 `not_connected`): envio, mídia, pedido de consentimento, transmissão ou template.
|
|
5725
|
+
* Reconecte o número em Canais; repetir antes disso não adianta.
|
|
5726
|
+
*/
|
|
5727
|
+
declare function isNotConnected(error: unknown): error is BotoZapError;
|
|
5257
5728
|
|
|
5258
|
-
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, type Billing, type BillingPlan, BotoZap, BotoZapError, type BotoZapErrorCode, type BotoZapEvent, type BotoZapOptions, type Broadcast, type BroadcastRecipient, type BroadcastRecipientInput, type BusinessSlot, Calendar, type CalendarConnection, type CalendarJob, type CalendarSelection, type ChannelAccount, type ChannelAccountRef, ChannelAccounts, type CommentAiDeliveryStatus, type CommentRule, type CommentRuleCounters, type CommentRuleMetrics, type CommentRuleMetricsParams, type CommentRuleStatus, type ConnectionBilling, type ConnectionBillingOutcome, type ConnectionBillingRefusal, 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 CreateBusinessSlotOptions, type CreateCommentRuleParams, type CreateContactParams, type CreateCustomerParams, type CreateDemand, type CreateMessageRuleParams, 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 CustomerBusinessSlot, type DeleteCommentRuleResult, type DeleteMessageRuleResult, type Demand, type DemandFields, type EventList, type EventPaging, type FixedRuleMessage, Inbox, type InboxMutation, type InboxMutationResult, type InboxState, type InboxTools, type InstagramCommentAi, type InstagramCommentAiAutomation, type InstagramCommentAiRepliedEvent, type InstagramCommentAiRun, type InstagramConnection, type InstagramGenericElement, type InstagramIceBreaker, type InstagramInteractiveButton, type InstagramInteractiveButtonPayload, type InstagramInteractiveGenericPayload, type InstagramInteractivePayload, type InstagramPersistentMenuItem, type InstagramTokenStatus, 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 ListChannelAccountsParams, 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 MessageChannel, type MessageContent, type MessageEdit, type MessageRule, type MessageRuleAction, type MessageRuleQrParams, type MessageRuleTrigger, type MessageSort, type MessageSource, type MessageStatus, type MessengerProfile, type MessengerProfileConfig, 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, type QuickReply, 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 UpdateCommentAiParams, type UpdateCommentRuleParams, type UpdateContactParams, type UpdateCustomerParams, type UpdateMessageRuleParams, type UpdateMessengerProfileParams, type UpdatePhoneNumberParams, type UpdateSetupLinkParams, type UpdateWebhookParams, type UploadMediaParams, type User, WEBHOOK_CATEGORIES, type Webhook, type WebhookAuthorizationHeaders, type WebhookCategory, type WebhookChannelHealth, type WebhookChannelHealthStatus, type WebhookDelivery, type WebhookDeliveryStatus, isBusinessPaymentRequired, isFreeCap, isFreeNumberCap, isPlanError };
|
|
5729
|
+
export { AI_CONFIGURABLE_PURPOSES, AI_CREDENTIAL_PROVIDERS, AI_OPERATIONS, AI_PURPOSES, type AccountExport, type AddRecipientsError, type AddRecipientsResult, AgendaConfiguration, AgendaExceptions, type AgendaRecord, Ai, type AiAgent, type AiAgentConfig, type AiAgentConfigRead, type AiAgentCoverage, type AiAgentInput, type AiAgentVersion, AiAgentsResource, type AiAlert, type AiAlertBulkFilters, type AiAlertListItem, AiAlertsResource, type AiArtifactUploadInput, type AiAudioPricing, type AiBinding, type AiBindingTarget, type AiBindingTargetRead, 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 AiEnabledProvider, 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, type Billing, type BillingGuarantee, type BillingPlan, BotoZap, BotoZapError, type BotoZapErrorCode, type BotoZapEvent, type BotoZapOptions, type Broadcast, type BroadcastRecipient, type BroadcastRecipientInput, type BusinessSlot, Calendar, type CalendarConnection, type CalendarJob, type CalendarSelection, type ChannelAccount, type ChannelAccountRef, ChannelAccounts, type CommentAiDeliveryStatus, type CommentRule, type CommentRuleCounters, type CommentRuleMetrics, type CommentRuleMetricsParams, type CommentRuleStatus, type ConnectionBilling, type ConnectionBillingOutcome, type ConnectionBillingRefusal, type Consent, type ConsentChannel, type ConsentOrigin, type ConsentPurpose, type ConsentRequestResult, type ConsentState, type Contact, type ContactConsents, type ContactField, ContactFields, type ContactStage, ContactStages, type ContactWarning, type Conversation, type ConversationEntryPoint, type ConversationNote, type ConversationReferral, type ConversationReminder, type CreateAppointment, type CreateAssignmentParams, type CreateBroadcastParams, type CreateBusinessSlotOptions, type CreateCommentRuleParams, type CreateContactParams, type CreateCustomerParams, type CreateDemand, type CreateExportParams, type CreateMessageRuleParams, 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 CustomerBusinessSlot, type DeleteCommentRuleResult, type DeleteMessageRuleResult, type Demand, type DemandFields, type EventList, type EventPaging, type ExportDownload, type ExportFormat, type ExportScope, type ExportStatus, type FixedRuleMessage, Inbox, type InboxMutation, type InboxMutationResult, type InboxState, type InboxTools, type InitialConsent, type InstagramCommentAi, type InstagramCommentAiAutomation, type InstagramCommentAiRepliedEvent, type InstagramCommentAiRun, type InstagramConnection, type InstagramGenericElement, type InstagramIceBreaker, type InstagramInteractiveButton, type InstagramInteractiveButtonPayload, type InstagramInteractiveGenericPayload, type InstagramInteractivePayload, type InstagramPersistentMenuItem, type InstagramTokenStatus, 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 ListChannelAccountsParams, type ListContactsParams, type ListConversationsParams, type ListEventsParams, type ListMessagesParams, type ListPhoneNumbersParams, type ListRecipientsParams, type ListTeamEventsParams, type ListTemplatesParams, type ListWebhookDeliveriesParams, type Me, type MediaAsset, type MediaUploadResult, type Message, type MessageChannel, type MessageContent, type MessageEdit, type MessageRule, type MessageRuleAction, type MessageRuleQrParams, type MessageRuleTrigger, type MessageSort, type MessageSource, type MessageStatus, type MessengerProfile, type MessengerProfileConfig, 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, type QuickReply, Radar, type RadarEntry, type RadarPage, type RadarQuery, type RecordConsentParams, type ReplyConversationParams, type RequestConsentParams, 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 TeamEvent, type TeamEventActor, type TeamEventTarget, type Template, type TemplatePayload, type UpdateAppointment, type UpdateBroadcastParams, type UpdateCommentAiParams, type UpdateCommentRuleParams, type UpdateContactParams, type UpdateCustomerParams, type UpdateMessageRuleParams, type UpdateMessengerProfileParams, type UpdatePhoneNumberParams, type UpdateSetupLinkParams, type UpdateTemplateParams, type UpdateWebhookParams, type UploadMediaParams, type User, WEBHOOK_CATEGORIES, type Webhook, type WebhookAuthorizationHeaders, type WebhookCategory, type WebhookChannelHealth, type WebhookChannelHealthStatus, type WebhookDelivery, type WebhookDeliveryStatus, isBusinessPaymentRequired, isConsentOptedOut, isConsentRevoked, isFreeCap, isFreeNumberCap, isNotConnected, isPlanError };
|