@botozap/sdk 0.18.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/dist/index.d.ts CHANGED
@@ -114,7 +114,6 @@ interface OffsetParams {
114
114
  page?: number;
115
115
  per_page?: number;
116
116
  }
117
- /** Cliente (customer) da sua conta. */
118
117
  /** Slot adicional que o Cliente ocupa (ver `billing.get()`). */
119
118
  interface CustomerBusinessSlot {
120
119
  slot_id: string;
@@ -125,6 +124,7 @@ interface CustomerBusinessSlot {
125
124
  */
126
125
  paused: boolean;
127
126
  }
127
+ /** Cliente (customer) da sua conta. */
128
128
  interface Customer {
129
129
  id: string;
130
130
  name?: string;
@@ -133,6 +133,25 @@ interface Customer {
133
133
  * inclui. Ausente em servidores antigos.
134
134
  */
135
135
  business_slot?: CustomerBusinessSlot | null;
136
+ /**
137
+ * `true` quando o Cliente passou do teto do plano Free (1 negócio, com canal
138
+ * ou não): continua recebendo, mas não conecta canais e o envio responde 402
139
+ * `free_cap`. Volta sozinho ao assinar ou quando a vaga é liberada (apagar o
140
+ * outro Cliente ou desconectar os canais dele). Vem nas leituras
141
+ * (`list`/`get`); ausente em servidores antigos.
142
+ */
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;
136
155
  [key: string]: unknown;
137
156
  }
138
157
  /**
@@ -207,8 +226,86 @@ interface Contact {
207
226
  display_name?: string | null;
208
227
  /** Contact tags (stored in metadata.tags); returned by servers with #498. */
209
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[];
210
234
  [key: string]: unknown;
211
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
+ }
212
309
  /** Origem da Conversa: anúncio Click-to-WhatsApp, orgânica ou desconhecida (`null`). */
213
310
  type ConversationEntryPoint = "ctwa" | "organic";
214
311
  /**
@@ -321,6 +418,13 @@ interface PhoneNumber {
321
418
  id: string;
322
419
  /** Nome local do Número no BotoZap (até 100 caracteres); `null` se não definido. */
323
420
  label?: string | null;
421
+ /**
422
+ * `true` quando o Número não envia pelo teto do plano Free (1 número), ou
423
+ * porque o Cliente dele está suspenso: continua recebendo, mas o envio
424
+ * responde 402 `free_number_cap` (ou `free_cap`, pelo Cliente). Volta sozinho
425
+ * ao assinar ou ao desconectar o outro número. Ausente em servidores antigos.
426
+ */
427
+ plan_suspended?: boolean;
324
428
  [key: string]: unknown;
325
429
  }
326
430
  interface User {
@@ -533,11 +637,23 @@ interface ConnectionBilling {
533
637
  }
534
638
 
535
639
  /** Public /api/v1/ai contracts. Revisions are opaque strings unless the endpoint explicitly uses a number. */
536
- type AiProvider = "anthropic" | "openai" | "google" | "openrouter" | "deepseek" | "xai";
537
- /** Provedores que aceitam credencial NOVA hoje; os demais respondem 422 `provider_not_enabled`. */
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
+ */
538
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";
539
654
  /** Item de `ai.providers.get().providers`. */
540
655
  type AiProviderInfo = {
656
+ /** `GET /ai/providers` lista só os provedores do catálogo (`openai` e `anthropic`). */
541
657
  id: AiProvider;
542
658
  label: string;
543
659
  key_url: string | null;
@@ -563,14 +679,22 @@ type AiPage = AiScope & {
563
679
  page?: number;
564
680
  per_page?: number;
565
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
+ */
566
686
  type AiBindingTarget = {
567
- provider: AiProvider;
687
+ provider: AiEnabledProvider;
568
688
  model: string;
569
689
  credential_id: string;
570
690
  };
571
- type AiBinding = AiBindingTarget & {
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 & {
572
696
  purpose: AiPurpose;
573
- fallback: AiBindingTarget | null;
697
+ fallback: AiBindingTargetRead | null;
574
698
  };
575
699
  type AiCredential = {
576
700
  id: string;
@@ -597,16 +721,21 @@ type AiWindow = {
597
721
  weekdays: number[];
598
722
  };
599
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
+ */
600
729
  interface AiAgentConfig {
601
730
  system_prompt?: string;
602
- provider?: AiProvider;
731
+ provider?: AiEnabledProvider;
603
732
  model?: string;
604
733
  credential_id?: string | null;
605
734
  channel_account_id?: string | null;
606
735
  tool_ids?: AiToolId[];
607
736
  operator?: {
608
737
  enabled?: boolean;
609
- provider?: AiProvider | null;
738
+ provider?: AiEnabledProvider | null;
610
739
  model?: string | null;
611
740
  credential_id?: string | null;
612
741
  tool_ids?: AiToolId[];
@@ -678,6 +807,13 @@ interface AiAgentConfig {
678
807
  instructions?: string;
679
808
  };
680
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
+ };
681
817
  type AiAgentInput = AiScope & {
682
818
  name: string;
683
819
  description?: string;
@@ -709,7 +845,7 @@ type AiAgentVersion = {
709
845
  number: number;
710
846
  revision: string;
711
847
  status: "draft" | "published";
712
- config: AiAgentConfig;
848
+ config: AiAgentConfigRead;
713
849
  created_at: string;
714
850
  published_at: string | null;
715
851
  created_by: string | null;
@@ -859,7 +995,9 @@ type AiRouterConfig = {
859
995
  position?: number;
860
996
  }[];
861
997
  };
862
- 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;
863
1001
  id: string;
864
1002
  revision: string;
865
1003
  active: boolean;
@@ -1078,7 +1216,7 @@ type AiAudioPricing = {
1078
1216
  usd_per_minute: number;
1079
1217
  };
1080
1218
  type AiRateInput = AiScope & {
1081
- provider: AiProvider;
1219
+ provider: AiEnabledProvider;
1082
1220
  model: string;
1083
1221
  input_usd_per_million: number;
1084
1222
  output_usd_per_million: number;
@@ -1231,7 +1369,9 @@ type AiBudget = Omit<AiBudgetInput, "customer_id" | "expected_revision"> & {
1231
1369
  revision: number;
1232
1370
  updated_at: string | null;
1233
1371
  };
1234
- 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;
1235
1375
  audio_pricing: AiAudioPricing | null;
1236
1376
  revision: number;
1237
1377
  updated_at: string;
@@ -2153,9 +2293,9 @@ declare class AiCredentialsResource {
2153
2293
  get(input: AiScope & {
2154
2294
  id: string;
2155
2295
  }): Promise<AiCredential>;
2156
- /** 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. */
2157
2297
  create(input: AiScope & {
2158
- provider: AiProvider;
2298
+ provider: AiEnabledProvider;
2159
2299
  label: string;
2160
2300
  key: string;
2161
2301
  }): Promise<AiCredential>;
@@ -2183,7 +2323,12 @@ declare class AiCredentialsResource {
2183
2323
  declare class AiProvidersResource {
2184
2324
  private readonly client;
2185
2325
  constructor(client: BotoZap);
2186
- /** GET /ai/providers */
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
+ */
2187
2332
  get(input: AiScope): Promise<{
2188
2333
  providers: AiProviderInfo[];
2189
2334
  purposes: Record<string, string>;
@@ -2203,7 +2348,7 @@ declare class AiProvidersResource {
2203
2348
  }): Promise<void>;
2204
2349
  /** GET /ai/providers/:provider/models */
2205
2350
  models(input: AiScope & {
2206
- provider: AiProvider;
2351
+ provider: AiEnabledProvider;
2207
2352
  credential_id: string;
2208
2353
  }): Promise<AiProviderModel[]>;
2209
2354
  /** Último snapshot do catálogo por credencial; nunca contém chaves. */
@@ -2814,7 +2959,7 @@ declare class AiUsageResource {
2814
2959
  saveRate(input: AiRateInput): Promise<AiRate>;
2815
2960
  /** Aplica tarifa própria a medições sem preço; não gera cobrança BotoZap. Exige confirmação. */
2816
2961
  reprice(input: AiScope & {
2817
- provider: AiProvider;
2962
+ provider: AiEnabledProvider;
2818
2963
  model: string;
2819
2964
  expected_revision: number;
2820
2965
  confirm: true;
@@ -3659,6 +3804,14 @@ interface SendTemplateParams {
3659
3804
  template: TemplatePayload;
3660
3805
  /** ID Meta ou UUID interno do Número de origem. */
3661
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;
3662
3815
  }
3663
3816
  interface SendImageParams {
3664
3817
  to: string;
@@ -3870,10 +4023,28 @@ interface CreateCustomerParams {
3870
4023
  external_customer_id?: string;
3871
4024
  [key: string]: unknown;
3872
4025
  }
3873
- /** Campos editáveis de um cliente (`PATCH /v1/customers/:id`). */
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
+ */
3874
4030
  interface UpdateCustomerParams {
3875
4031
  name?: string;
3876
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;
3877
4048
  }
3878
4049
  /**
3879
4050
  * Corpo de `POST /v1/customers/:id/setup_links`.
@@ -3946,9 +4117,16 @@ declare class Customers {
3946
4117
  list(params?: OffsetParams): Promise<OffsetList<Customer>>;
3947
4118
  /** Busca um cliente pelo id. */
3948
4119
  get(id: string): Promise<Customer>;
3949
- /** Cria um cliente. */
4120
+ /**
4121
+ * Cria um cliente. No plano Free, que permite 1 Cliente (com canal ou não), o
4122
+ * segundo responde 402 `free_cap` (veja `isFreeCap`).
4123
+ */
3950
4124
  create(params: CreateCustomerParams): Promise<Customer>;
3951
- /** Atualiza `name` / `external_customer_id` de um cliente. */
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
+ */
3952
4130
  update(id: string, params: UpdateCustomerParams): Promise<Customer>;
3953
4131
  /** Exclui um cliente. Responde 204 (sem corpo). */
3954
4132
  delete(id: string): Promise<void>;
@@ -3969,6 +4147,12 @@ declare class Customers {
3969
4147
  interface Template {
3970
4148
  id: string;
3971
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[];
3972
4156
  [key: string]: unknown;
3973
4157
  }
3974
4158
  /** Filtros de `templates.list` (paginação por offset). Ver GET /v1/templates. */
@@ -3999,6 +4183,20 @@ interface CreateTemplateParams {
3999
4183
  waba_connection_id?: string;
4000
4184
  /** phone_number_id (Meta) → resolve a conexão do número (alternativa). */
4001
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[];
4002
4200
  }
4003
4201
  /** Endpoints de template (GET/POST /v1/templates, GET /v1/templates/:id). */
4004
4202
  declare class Templates {
@@ -4010,6 +4208,13 @@ declare class Templates {
4010
4208
  get(id: string): Promise<Template>;
4011
4209
  /** Cria um template e o submete à Meta para análise. */
4012
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>;
4013
4218
  }
4014
4219
 
4015
4220
  interface ListBroadcastsParams extends OffsetParams {
@@ -4117,6 +4322,22 @@ interface ListContactsParams extends CursorParams {
4117
4322
  /** Criados em ou antes desta data (ISO 8601). */
4118
4323
  created_before?: string;
4119
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
+ }
4120
4341
  interface CreateContactParams {
4121
4342
  /** wa_id canônico (BSUID "BR.1A2B…" ou dígitos E.164). */
4122
4343
  wa_id: string;
@@ -4128,6 +4349,13 @@ interface CreateContactParams {
4128
4349
  display_name?: string | null;
4129
4350
  /** Até 20 tags de 1–40 caracteres; o servidor apara e remove repetidas sem diferenciar maiúsculas. Não combine com metadata.tags. */
4130
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[];
4131
4359
  [key: string]: unknown;
4132
4360
  }
4133
4361
  /**
@@ -4158,10 +4386,33 @@ declare class Contacts {
4158
4386
  /** Lista os contatos da conta (paginação por cursor). */
4159
4387
  list(params?: ListContactsParams): Promise<CursorList<Contact>>;
4160
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
+ */
4161
4395
  create(params: CreateContactParams): Promise<Contact>;
4162
4396
  update(id: string, params: UpdateContactParams | Record<string, unknown>): Promise<Contact>;
4163
- /** Remove um contato. Responde 204 (sem corpo). */
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
+ */
4164
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>;
4165
4416
  }
4166
4417
 
4167
4418
  interface ListConversationsParams extends CursorParams {
@@ -4198,6 +4449,13 @@ interface ReplyConversationParams {
4198
4449
  /** Opções de resposta (só em Conversas do Instagram; ver `messages.send`). */
4199
4450
  quick_replies?: QuickReply[];
4200
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
+ }
4201
4459
  /** Conversas (read + status) e atribuições a membros. */
4202
4460
  declare class Conversations {
4203
4461
  private readonly client;
@@ -4218,6 +4476,31 @@ declare class Conversations {
4218
4476
  * billing antes de chamar a Meta.
4219
4477
  */
4220
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>;
4221
4504
  update(id: string, params: Record<string, unknown>): Promise<Conversation>;
4222
4505
  /** Lista as atribuições da conversa (paginação por offset/página). */
4223
4506
  listAssignments(id: string, params?: OffsetParams): Promise<OffsetList<Assignment>>;
@@ -4726,19 +5009,34 @@ declare class ChannelAccounts {
4726
5009
  listMessageRules(channelAccountId: string, params?: OffsetParams): Promise<OffsetList<MessageRule>>;
4727
5010
  /** Busca uma Regra de mensagem. message-rules:read. */
4728
5011
  getMessageRule(channelAccountId: string, ruleId: string): Promise<MessageRule>;
4729
- /** Cria uma Regra de mensagem. message-rules:write. */
5012
+ /**
5013
+ * Cria uma Regra de mensagem. message-rules:write. Fora do plano (Free)
5014
+ * responde 403 `plan_restricted`.
5015
+ */
4730
5016
  createMessageRule(channelAccountId: string, params: CreateMessageRuleParams): Promise<MessageRule>;
4731
- /** PATCH parcial; a API valida o estado final. message-rules:write. */
5017
+ /**
5018
+ * PATCH parcial; a API valida o estado final. message-rules:write. No Free,
5019
+ * só `{ is_active: false }` (pausar) passa; o resto responde 403
5020
+ * `plan_restricted`.
5021
+ */
4732
5022
  updateMessageRule(channelAccountId: string, ruleId: string, params: UpdateMessageRuleParams): Promise<MessageRule>;
4733
5023
  /** Exclui a Regra preservando Disparos e Eventos. message-rules:write. */
4734
5024
  deleteMessageRule(channelAccountId: string, ruleId: string): Promise<DeleteMessageRuleResult>;
4735
5025
  /** Lê o espelho salvo (sem consultar a Meta). messenger-profile:read; sem sandbox. */
4736
5026
  getMessengerProfile(channelAccountId: string): Promise<MessengerProfile>;
4737
- /** Salva/aplica apenas as seções enviadas. messenger-profile:write; sem sandbox. */
5027
+ /**
5028
+ * Salva/aplica apenas as seções enviadas. messenger-profile:write; sem
5029
+ * sandbox. No Free, só remover seções passa; salvar conteúdo responde 403
5030
+ * `plan_restricted`.
5031
+ */
4738
5032
  updateMessengerProfile(channelAccountId: string, params: UpdateMessengerProfileParams): Promise<MessengerProfile>;
4739
5033
  /** Remove perguntas e menu, conservando configuração vazia. messenger-profile:write. */
4740
5034
  deleteMessengerProfile(channelAccountId: string): Promise<MessengerProfile>;
4741
- /** Verifica/reaplica explicitamente o desejado salvo. messenger-profile:write. */
5035
+ /**
5036
+ * Verifica/reaplica explicitamente o desejado salvo. messenger-profile:write.
5037
+ * No Free, reaplicar uma configuração com conteúdo responde 403
5038
+ * `plan_restricted`.
5039
+ */
4742
5040
  syncMessengerProfile(channelAccountId: string): Promise<MessengerProfile>;
4743
5041
  }
4744
5042
 
@@ -4954,6 +5252,18 @@ interface BusinessSlot {
4954
5252
  /** ISO 8601. */
4955
5253
  created_at: string;
4956
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
+ }
4957
5267
  /** Resposta de `GET /v1/billing`: plano da Conta e slots adicionais. */
4958
5268
  interface Billing {
4959
5269
  plan: BillingPlan;
@@ -4967,6 +5277,12 @@ interface Billing {
4967
5277
  can_add_slot: boolean;
4968
5278
  /** Slots ativos, dos mais antigos aos mais novos. */
4969
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;
4970
5286
  }
4971
5287
  /** Opções de {@link BillingSlots.create}. */
4972
5288
  interface CreateBusinessSlotOptions {
@@ -5006,6 +5322,156 @@ declare class BillingResource {
5006
5322
  get(): Promise<Billing>;
5007
5323
  }
5008
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
+
5009
5475
  /** Membros da conta (somente leitura via API). */
5010
5476
  declare class Users {
5011
5477
  private readonly client;
@@ -5122,6 +5588,10 @@ declare class BotoZap {
5122
5588
  readonly usage: Usage;
5123
5589
  /** Plano da Conta e slots adicionais (só chave de API). */
5124
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;
5125
5595
  readonly users: Users;
5126
5596
  readonly apiLogs: ApiLogs;
5127
5597
  readonly webhookDeliveries: WebhookDeliveries;
@@ -5180,18 +5650,34 @@ declare class BotoZapError extends Error {
5180
5650
  * `reaction_target_not_found`, `reaction_target_invalid`,
5181
5651
  * `reaction_target_expired`, `unsupported_type`, `free_form_limit_reached`
5182
5652
  * (429, limite 1:1 do Free). Plano: `plan_restricted` (403, escritas de IA,
5183
- * Agenda, Calendário e Jornadas fora do plano), `free_number_cap` (402, setup
5184
- * além do teto de Números do Free). IA: `provider_not_enabled` (422, credencial
5185
- * nova de provedor com `accepts_new_credentials: false`). Cobrança:
5653
+ * Agenda, Calendário, Jornadas, Regras de mensagem do Direct e Perguntas e menu
5654
+ * fora do plano), `free_number_cap` (402, setup além do teto de Números do Free
5655
+ * ou envio por um Número suspenso no Free), `free_cap` (402, criar o 2º Cliente
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:
5186
5672
  * `business_payment_required` (402 no envio: o negócio está pausado porque a
5187
5673
  * fatura do slot venceu há mais de 7 dias; pague e envie de novo),
5188
5674
  * `plan_required` (402, comprar slot no Free ou teste), `slot_limit` (402, já há
5189
5675
  * 2 slots com fatura em aberto), `billing_customer_required` (402, conta sem
5190
5676
  * cadastro de cobrança), `slot_in_use` (409, cancelar slot ocupado).
5191
5677
  */
5192
- 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" | "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 & {});
5193
5679
  /** Códigos que indicam limite ou restrição do plano contratado. */
5194
- declare const PLAN_ERROR_CODES: readonly ["plan_restricted", "free_form_limit_reached", "free_number_cap"];
5680
+ declare const PLAN_ERROR_CODES: readonly ["plan_restricted", "free_form_limit_reached", "free_number_cap", "free_cap"];
5195
5681
  /** True quando o erro é recusa por plano (upgrade resolve; retry não). */
5196
5682
  declare function isPlanError(error: unknown): error is BotoZapError;
5197
5683
  /**
@@ -5200,5 +5686,44 @@ declare function isPlanError(error: unknown): error is BotoZapError;
5200
5686
  * disso não adianta. Não é recusa de plano ({@link isPlanError} é `false`).
5201
5687
  */
5202
5688
  declare function isBusinessPaymentRequired(error: unknown): error is BotoZapError;
5689
+ /**
5690
+ * True quando a API recusou por causa do teto de 1 negócio (Cliente) do plano
5691
+ * Free (402 `free_cap`): criar o 2º Cliente (`customers.create`) ou enviar por
5692
+ * um Cliente suspenso. O Cliente suspenso (`plan_suspended: true`) continua
5693
+ * recebendo, mas não conecta canais nem envia. Libera na hora ao assinar; no
5694
+ * Free, apagar o outro Cliente (ou, no envio, desconectar os canais dele)
5695
+ * libera a vaga. Repetir antes disso não adianta. É recusa de plano
5696
+ * ({@link isPlanError} é `true`).
5697
+ */
5698
+ declare function isFreeCap(error: unknown): error is BotoZapError;
5699
+ /**
5700
+ * True quando a API recusou por causa do teto de 1 número do plano Free (402
5701
+ * `free_number_cap`): enviar por um Número suspenso ou conectar outro número
5702
+ * no setup. O Número suspenso (`plan_suspended: true`) continua recebendo, mas
5703
+ * não envia. Libera na hora ao assinar ou ao desconectar o outro número;
5704
+ * repetir antes disso não adianta. É recusa de plano ({@link isPlanError} é
5705
+ * `true`).
5706
+ */
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;
5203
5728
 
5204
- 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, 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 };