@botozap/sdk 0.5.0 → 0.8.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
@@ -87,10 +87,33 @@ interface BroadcastRecipient {
87
87
  interface Contact {
88
88
  id: string;
89
89
  wa_id?: string;
90
+ /** Nome do perfil no canal; a ingestão o sobrescreve a cada inbound. */
91
+ profile_name?: string | null;
92
+ /**
93
+ * Nome que a empresa dá ao Contato (1–200 caracteres). Só a API o grava;
94
+ * `null` quando não definido. Não substitui `profile_name`.
95
+ */
96
+ display_name?: string | null;
90
97
  /** Contact tags (stored in metadata.tags); returned by servers with #498. */
91
98
  tags?: string[];
92
99
  [key: string]: unknown;
93
100
  }
101
+ /** Origem da Conversa: anúncio Click-to-WhatsApp, orgânica ou desconhecida (`null`). */
102
+ type ConversationEntryPoint = "ctwa" | "organic";
103
+ /**
104
+ * Último clique em anúncio Click-to-WhatsApp que trouxe o Contato. Só os
105
+ * campos de atribuição; o texto completo do anúncio fica na mensagem.
106
+ */
107
+ interface ConversationReferral {
108
+ /** ID do anúncio ou post na Meta. */
109
+ source_id: string | null;
110
+ source_url: string | null;
111
+ headline: string | null;
112
+ /** Click ID do anúncio (atribuição/conversões). */
113
+ ctwa_clid: string | null;
114
+ /** Quando o BotoZap recebeu o clique (ISO 8601). */
115
+ received_at: string | null;
116
+ }
94
117
  interface Conversation {
95
118
  id: string;
96
119
  /** UUID interno do Número da própria Conversa. */
@@ -101,6 +124,20 @@ interface Conversation {
101
124
  phone?: string | null;
102
125
  [key: string]: unknown;
103
126
  };
127
+ /** `"ctwa"` (anúncio), `"organic"` ou `null` quando desconhecida. */
128
+ entry_point?: ConversationEntryPoint | null;
129
+ /** Último referral de anúncio; `null` se a Conversa nunca veio de anúncio. */
130
+ referral?: ConversationReferral | null;
131
+ /**
132
+ * Fim da janela grátis do Free Entry Point informado pela Meta no status de
133
+ * um envio (ISO 8601); `null` fora dela.
134
+ */
135
+ fep_expires_at?: string | null;
136
+ /**
137
+ * ESTIMATIVA do prazo para responder e abrir a janela grátis (último clique
138
+ * + 24h); `null` sem clique recente. Não altera a regra da janela de 24h.
139
+ */
140
+ fep_reply_by?: string | null;
104
141
  [key: string]: unknown;
105
142
  }
106
143
  interface Assignment {
@@ -122,6 +159,8 @@ interface Webhook {
122
159
  }
123
160
  interface PhoneNumber {
124
161
  id: string;
162
+ /** Nome local do Número no BotoZap (até 100 caracteres); `null` se não definido. */
163
+ label?: string | null;
125
164
  [key: string]: unknown;
126
165
  }
127
166
  interface User {
@@ -226,10 +265,20 @@ interface SetupLink {
226
265
  whatsapp_setup_status: string;
227
266
  url: string;
228
267
  allowed_connection_types: string[];
229
- provision_phone_number: boolean;
268
+ /** Código de idioma da página; `null` = automático. */
230
269
  language: string | null;
270
+ /**
271
+ * Destino depois de concluir; recebe `setup_link_id` e `status=completed`
272
+ * (a query string da URL é preservada, o token nunca é enviado).
273
+ */
231
274
  success_redirect_url: string | null;
275
+ /**
276
+ * Destino com `status=failed` (link esgotado) ou `status=cancelled` (o
277
+ * Cliente voltou num erro recuperável; o link segue válido), mais
278
+ * `setup_link_id`.
279
+ */
232
280
  failure_redirect_url: string | null;
281
+ /** Reservado: hoje sempre `null` (a página de conexão não aplica tema). */
233
282
  theme_config: unknown;
234
283
  expires_at: string | null;
235
284
  created_at: string;
@@ -2689,8 +2738,16 @@ interface Appointment extends Required<AppointmentFields> {
2689
2738
  google_conflict: Record<string, unknown> | null;
2690
2739
  google_event_id: string | null;
2691
2740
  google_selection_id: string | null;
2692
- google_etag: string | null;
2693
- google_base_data: Record<string, unknown> | null;
2741
+ /**
2742
+ * @deprecated Dado interno da sincronização com o Google Calendar. A API deixa de
2743
+ * enviar este campo a partir de 26/10/2026; não dependa dele.
2744
+ */
2745
+ google_etag?: string | null;
2746
+ /**
2747
+ * @deprecated Dado interno da sincronização com o Google Calendar. A API deixa de
2748
+ * enviar este campo a partir de 26/10/2026; não dependa dele.
2749
+ */
2750
+ google_base_data?: Record<string, unknown> | null;
2694
2751
  google_synced_revision: number | null;
2695
2752
  buffer_before_minutes: number;
2696
2753
  buffer_after_minutes: number;
@@ -3368,13 +3425,41 @@ interface UpdateCustomerParams {
3368
3425
  name?: string;
3369
3426
  external_customer_id?: string;
3370
3427
  }
3371
- /** Corpo de `POST /v1/customers/:id/setup_links`. */
3428
+ /**
3429
+ * Corpo de `POST /v1/customers/:id/setup_links`.
3430
+ *
3431
+ * Redirecionamentos: acontecem na página de conexão, só em estado final do
3432
+ * link. Conexão concluída leva a `success_redirect_url` com
3433
+ * `?setup_link_id=<id>&status=completed` (confirme o número em
3434
+ * `phoneNumbers.list`: uma conexão concluída ainda pode ter pendência de
3435
+ * registro). Link esgotado sem concluir leva a `failure_redirect_url` com
3436
+ * `status=failed`. Num erro em que dá para tentar de novo, o Cliente pode
3437
+ * escolher voltar: vai para `failure_redirect_url` com `status=cancelled` e o
3438
+ * link continua válido. A query string que a sua URL já tiver é preservada e o
3439
+ * token do link nunca é enviado. Link expirado ou revogado mostra a página de
3440
+ * erro, sem redirecionar.
3441
+ */
3372
3442
  interface CreateSetupLinkParams {
3373
- /** Tipos de conexão liberados: "dedicated" e/ou "coexistence". */
3443
+ /**
3444
+ * Tipos de conexão liberados: "dedicated" e/ou "coexistence" (padrão
3445
+ * "dedicated"). Uma lista sem nenhum tipo válido responde
3446
+ * `422 invalid_connection_types`; tipos desconhecidos ao lado de válidos são
3447
+ * ignorados.
3448
+ */
3374
3449
  allowed_connection_types?: string[];
3375
- provision_phone_number?: boolean;
3450
+ /** Código de idioma da página (ex.: "pt_BR"); "auto" ou vazio deixa automático. */
3376
3451
  language?: string;
3452
+ /**
3453
+ * Destino depois de concluir (`status=completed`). Precisa ser `https://`,
3454
+ * sem usuário/senha e com até 2048 caracteres; senão a API responde
3455
+ * `422 invalid_redirect_url`.
3456
+ */
3377
3457
  success_redirect_url?: string;
3458
+ /**
3459
+ * Destino quando o link se esgota sem concluir (`status=failed`) ou quando o
3460
+ * Cliente escolhe voltar num erro recuperável (`status=cancelled`; o link
3461
+ * segue válido). Mesmas regras de `success_redirect_url`.
3462
+ */
3378
3463
  failure_redirect_url?: string;
3379
3464
  }
3380
3465
  /** Corpo de `PATCH /v1/customers/:id/setup_links/:linkId`. */
@@ -3403,7 +3488,12 @@ declare class Customers {
3403
3488
  delete(id: string): Promise<void>;
3404
3489
  /** Lista os links de setup de um cliente (paginação por offset/página). */
3405
3490
  listSetupLinks(customerId: string, params?: OffsetParams): Promise<OffsetList<SetupLink>>;
3406
- /** Cria um link de setup sob um cliente. */
3491
+ /**
3492
+ * Cria um link de setup sob um cliente (expira em 30 dias). Envie a `url`
3493
+ * devolvida ao Cliente; veja em {@link CreateSetupLinkParams} como funcionam
3494
+ * os redirecionamentos. URL de redirecionamento inválida lança
3495
+ * `BotoZapError` com `code: "invalid_redirect_url"` (422).
3496
+ */
3407
3497
  createSetupLink(customerId: string, params?: CreateSetupLinkParams): Promise<SetupLink>;
3408
3498
  /** Atualiza status/expiração de um link de setup. */
3409
3499
  updateSetupLink(customerId: string, linkId: string, params: UpdateSetupLinkParams): Promise<SetupLink>;
@@ -3562,6 +3652,11 @@ interface CreateContactParams {
3562
3652
  /** wa_id canônico (BSUID "BR.1A2B…" ou dígitos E.164). */
3563
3653
  wa_id: string;
3564
3654
  phone_number_id?: string;
3655
+ /**
3656
+ * Nome que a empresa dá ao Contato (1–200 caracteres após aparar). `null`
3657
+ * ou `""` não grava nome. Independe de `profile_name`, que vem do canal.
3658
+ */
3659
+ display_name?: string | null;
3565
3660
  /** Até 20 tags de 1–40 caracteres; o servidor apara e remove repetidas sem diferenciar maiúsculas. Não combine com metadata.tags. */
3566
3661
  tags?: string[];
3567
3662
  [key: string]: unknown;
@@ -3573,6 +3668,11 @@ interface CreateContactParams {
3573
3668
  */
3574
3669
  interface UpdateContactParams {
3575
3670
  profile_name?: string;
3671
+ /**
3672
+ * Nome que a empresa dá ao Contato (1–200 caracteres após aparar); `null`
3673
+ * ou `""` limpa. A ingestão de mensagens nunca o sobrescreve.
3674
+ */
3675
+ display_name?: string | null;
3576
3676
  username?: string;
3577
3677
  notes?: string | null;
3578
3678
  stage_id?: string | null;
@@ -3704,6 +3804,14 @@ declare class Webhooks {
3704
3804
  interface ListPhoneNumbersParams extends OffsetParams {
3705
3805
  customer_id?: string;
3706
3806
  }
3807
+ /** Corpo de `PATCH /v1/phone_numbers/:id`. */
3808
+ interface UpdatePhoneNumberParams {
3809
+ /**
3810
+ * Nome local do Número: até 100 caracteres após aparar, sem quebras de
3811
+ * linha nem caracteres de controle. `null` ou `""` limpa.
3812
+ */
3813
+ label: string | null;
3814
+ }
3707
3815
  /** Números conectados de cada cliente. */
3708
3816
  declare class PhoneNumbers {
3709
3817
  private readonly client;
@@ -3711,6 +3819,13 @@ declare class PhoneNumbers {
3711
3819
  /** Lista os números da conta (paginação por offset/página). */
3712
3820
  list(params?: ListPhoneNumbersParams): Promise<OffsetList<PhoneNumber>>;
3713
3821
  get(id: string): Promise<PhoneNumber>;
3822
+ /**
3823
+ * Atualiza o nome local (`label`) do Número. É o único campo editável:
3824
+ * identidade e dados sincronizados da Meta (`display_phone_number`,
3825
+ * `verified_name`, `quality_rating`) não mudam por aqui. `{id}` aceita o
3826
+ * UUID interno ou o `phone_number_id` da Meta.
3827
+ */
3828
+ update(id: string, params: UpdatePhoneNumberParams): Promise<PhoneNumber>;
3714
3829
  /** Remove um número. Responde 204 (sem corpo). */
3715
3830
  delete(id: string): Promise<void>;
3716
3831
  /** Saúde do número (qualidade, limite, status na Meta). */
@@ -3781,6 +3896,122 @@ declare class Events {
3781
3896
  list(params?: ListEventsParams): Promise<EventList>;
3782
3897
  }
3783
3898
 
3899
+ /** Query de `GET /v1/usage/meta-costs`. */
3900
+ interface MetaCostsParams {
3901
+ /**
3902
+ * Recorta pelas WABAs de um Cliente da Conta; sem ele, a Conta inteira.
3903
+ * Cliente inexistente ou de outra Conta responde 404 `not_found`.
3904
+ */
3905
+ customer_id?: string;
3906
+ /** Primeiro dia (UTC, inclusivo, `YYYY-MM-DD`). Padrão: 29 dias antes de `to`. */
3907
+ from?: string;
3908
+ /** Último dia (UTC, inclusivo, `YYYY-MM-DD`). Padrão: hoje. Máximo de 366 dias no intervalo. */
3909
+ to?: string;
3910
+ }
3911
+ /** De onde vem `estimated_cost`: só Meta, só estimativa ou os dois. */
3912
+ type MetaCostSource = "meta" | "estimate" | "mixed";
3913
+ /** Por que algum custo do recorte não está disponível. */
3914
+ type MetaCostUnavailableReason = "not_synced" | "cost_not_returned";
3915
+ /**
3916
+ * Grupo agregado numa moeda. Moedas diferentes nunca são somadas nem
3917
+ * convertidas: cada moeda vira um grupo próprio.
3918
+ */
3919
+ interface MetaCostGroup {
3920
+ /** Moeda da WABA (ex.: "BRL"); `null` quando a Meta não informou. */
3921
+ currency: string | null;
3922
+ /** Mensagens cobráveis e grátis contadas pela Meta. */
3923
+ volume: number;
3924
+ /**
3925
+ * Custo APROXIMADO informado pela Meta. `null` se alguma linha do grupo
3926
+ * veio sem custo — ausência nunca vira 0. A fatura da Meta é a autoridade.
3927
+ */
3928
+ cost: number | null;
3929
+ /**
3930
+ * Custo da Meta onde houver + volume × tarifa publicada onde não houver.
3931
+ * `null` se alguma linha não tem custo nem tarifa conhecida.
3932
+ */
3933
+ estimated_cost: number | null;
3934
+ /** Origem de `estimated_cost`; `null` quando `estimated_cost` é `null`. */
3935
+ cost_source: MetaCostSource | null;
3936
+ }
3937
+ /** Grupo por dia (UTC) e moeda. */
3938
+ interface MetaCostDay extends MetaCostGroup {
3939
+ /** Dia UTC, `YYYY-MM-DD`. */
3940
+ day: string;
3941
+ }
3942
+ /** Grupo por categoria, tipo de preço e moeda. */
3943
+ interface MetaCostCategory extends MetaCostGroup {
3944
+ /** Categoria da Meta (ex.: "MARKETING", "UTILITY", "AUTHENTICATION", "SERVICE"). */
3945
+ pricing_category: string;
3946
+ /** Tipo de preço da Meta (ex.: "REGULAR", "FREE_CUSTOMER_SERVICE", "FREE_ENTRY_POINT"). */
3947
+ pricing_type: string;
3948
+ }
3949
+ /** Base usada em `estimated_cost`. */
3950
+ interface MetaCostEstimate {
3951
+ /**
3952
+ * `true` quando todo o recorte tem custo da Meta ou estimativa (nada
3953
+ * `null`) e todas as Conexões ativas foram sincronizadas.
3954
+ */
3955
+ available: boolean;
3956
+ basis: "published_rates" | (string & {});
3957
+ /** Mercado das tarifas usadas (destinatário). */
3958
+ market: "BR" | (string & {});
3959
+ /** Início de vigência das tarifas publicadas (`YYYY-MM-DD`). */
3960
+ rates_effective_from: string;
3961
+ /** Data em que as tarifas foram conferidas na fonte oficial. */
3962
+ rates_as_of: string;
3963
+ source_url: string;
3964
+ /** O que a estimativa não considera. */
3965
+ excludes: Array<"volume_tiers" | "non_brazil_recipients" | (string & {})>;
3966
+ }
3967
+ /** Frescor e cobertura do sync diário da Pricing Analytics. */
3968
+ interface MetaCostSync {
3969
+ /** Conexões ativas do escopo (as que o sync diário lê). */
3970
+ connections: number;
3971
+ synced_connections: number;
3972
+ /** Leitura completa mais antiga entre as WABAs sincronizadas (ISO 8601). */
3973
+ last_synced_at: string | null;
3974
+ /**
3975
+ * Primeiro dia com leitura da Meta em TODAS as Conexões sincronizadas.
3976
+ * Antes dele, ausência de linha não significa custo zero.
3977
+ */
3978
+ covered_from: string | null;
3979
+ }
3980
+ /** Resposta de `GET /v1/usage/meta-costs`. */
3981
+ interface MetaCostReport {
3982
+ /** Cliente do recorte; `null` quando a consulta cobre a Conta inteira. */
3983
+ customer_id: string | null;
3984
+ source: "meta_pricing_analytics" | (string & {});
3985
+ /** Sempre `true`: o custo é o aproximado que a Meta informa. */
3986
+ approximate: true;
3987
+ /** Dia inicial efetivamente consultado (`YYYY-MM-DD`). */
3988
+ from: string;
3989
+ /** Dia final efetivamente consultado (`YYYY-MM-DD`). */
3990
+ to: string;
3991
+ /** `true` quando algum custo do recorte não está disponível (ver `unavailable_reason`). */
3992
+ unavailable: boolean;
3993
+ unavailable_reason: MetaCostUnavailableReason | null;
3994
+ /** Um grupo por moeda. */
3995
+ totals: MetaCostGroup[];
3996
+ /** Ordenado por dia e moeda. */
3997
+ by_day: MetaCostDay[];
3998
+ /** Ordenado por volume decrescente. */
3999
+ by_category: MetaCostCategory[];
4000
+ estimate: MetaCostEstimate;
4001
+ sync: MetaCostSync;
4002
+ }
4003
+ /** Uso e custos da Conta. */
4004
+ declare class Usage {
4005
+ private readonly client;
4006
+ constructor(client: BotoZap);
4007
+ /**
4008
+ * Custo da Meta por dia, categoria e tipo, lido da Pricing Analytics
4009
+ * sincronizada uma vez por dia por WABA. Scope `customers:read`; o sandbox
4010
+ * fica de fora. Intervalo grande demais responde 422 `range_too_large`.
4011
+ */
4012
+ metaCosts(params?: MetaCostsParams): Promise<MetaCostReport>;
4013
+ }
4014
+
3784
4015
  /** Membros da conta (somente leitura via API). */
3785
4016
  declare class Users {
3786
4017
  private readonly client;
@@ -3863,6 +4094,7 @@ declare class BotoZap {
3863
4094
  readonly radar: Radar;
3864
4095
  readonly media: Media;
3865
4096
  readonly events: Events;
4097
+ readonly usage: Usage;
3866
4098
  readonly users: Users;
3867
4099
  readonly apiLogs: ApiLogs;
3868
4100
  readonly webhookDeliveries: WebhookDeliveries;
@@ -3906,4 +4138,4 @@ declare class BotoZapError extends Error {
3906
4138
  constructor(code: string, message: string, status: number, headers?: Record<string, string>);
3907
4139
  }
3908
4140
 
3909
- export { AI_CONFIGURABLE_PURPOSES, AI_OPERATIONS, AI_PURPOSES, type AddRecipientsError, type AddRecipientsResult, AgendaConfiguration, AgendaExceptions, type AgendaRecord, Ai, type AiAgent, type AiAgentConfig, type AiAgentCoverage, type AiAgentInput, type AiAgentVersion, AiAgentsResource, type AiAlert, type AiAlertBulkFilters, type AiAlertListItem, AiAlertsResource, type AiArtifactUploadInput, type AiAudioPricing, type AiBinding, type AiBindingTarget, type AiBudget, type AiBudgetInput, type AiCapabilitySignal, type AiCapabilityUsage, type AiCapabilityUsageList, type AiCase, type AiCaseChat, type AiCaseEvent, type AiCaseKind, type AiCaseReply, type AiCaseReplyInput, type AiCaseSource, AiCasesResource, type AiCatalogItems, type AiCatalogModel, type AiCatalogProduct, type AiCatalogSyncInput, type AiCatalogSyncResult, type AiChannelGate, type AiCommercialDecision, type AiCommercialEffect, type AiCommercialJob, type AiCommercialProposal, AiCommercialProposalsResource, type AiCommercialRequest, type AiCommercialSettings, type AiConfigurablePurpose, type AiContactAuthorization, type AiConversationCheckpoint, type AiCredential, AiCredentialsResource, type AiDraftResult, type AiEligibilityOverview, AiEligibilityResource, type AiEligibilitySettings, type AiEnrollment, type AiEvolution, AiEvolutionResource, type AiEvolutionSource, type AiExecution, type AiExecutionCitations, type AiExecutionSecurity, AiExecutionsResource, type AiField, type AiFlow, type AiFlowGraph, type AiFlowInput, type AiFlowSettings, type AiFlowVersion, type AiFollowupEffect, type AiFollowupEvent, AiFollowupFlowsResource, type AiFollowupPromise, type AiFollowupPromiseDetail, type AiFollowupPromiseStatus, type AiFollowupQueueFilters, type AiFollowupQueuePage, type AiFollowupQueueRow, AiFollowupsResource, type AiGateMode, type AiInference, type AiInferenceOrigin, type AiInferenceOutcome, type AiInferenceSummary, AiInferencesResource, type AiKnowledgeChunk, type AiKnowledgeCitation, type AiKnowledgeConversation, type AiKnowledgeHit, type AiKnowledgeImport, type AiKnowledgePreview, AiKnowledgeResource, type AiKnowledgeSearchDiagnostics, type AiKnowledgeSource, type AiMemory, type AiMemoryEntry, type AiMemoryEntryEvent, AiMemoryResource, type AiModelCatalogSnapshot, type AiModelCatalogSync, type AiNoticeCheck, type AiNoticeEffect, type AiNoticeField, type AiNoticeJob, type AiNoticeSettings, AiNoticesResource, type AiOperation, type AiOperatorMetrics, AiOperatorResource, type AiPage, type AiPlatformSkill, type AiPlatformSkillComposition, type AiPreparedUpload, type AiProposal, AiProposalsResource, type AiProvider, type AiProviderModel, AiProvidersResource, type AiPurpose, type AiRate, type AiRateInput, type AiRecord, type AiRevision, type AiRouter, type AiRouterConfig, type AiRouterTest, AiRoutersResource, type AiScope, type AiSkill, type AiSkillInput, type AiSkillNearMiss, type AiSkillVersion, AiSkillsResource, type AiSourceKind, type AiStyleAdjustment, type AiStyleAdjustmentId, AiStyleAdjustmentsResource, type AiToolId, type AiTurnPromise, type AiUploadReceiptCallback, AiUploadsResource, AiUsageResource, type AiUsageSummary, type AiUsageTokens, type AiWindow, type ApiLog, type Appointment, type AppointmentAvailability, type AppointmentExceptionInput, type AppointmentFields, type AppointmentHistory, type AppointmentQuery, type AppointmentScheduleInput, type AppointmentServiceInput, type AppointmentStatus, Appointments, type Assignment, type AvailabilityQuery, BotoZap, BotoZapError, type BotoZapEvent, type BotoZapOptions, type Broadcast, type BroadcastRecipient, type BroadcastRecipientInput, Calendar, type CalendarConnection, type CalendarJob, type CalendarSelection, type Contact, type ContactField, ContactFields, type ContactStage, ContactStages, type Conversation, type ConversationNote, type ConversationReminder, type CreateAppointment, type CreateAssignmentParams, type CreateBroadcastParams, type CreateContactParams, type CreateCustomerParams, type CreateDemand, type CreateOpportunity, type CreateSetupLinkParams, type CreateTemplateParams, type CreateWebhookParams, type CrmActivity, type CrmConversation, type CrmFields, type CrmMetadata, type CrmQuery, type CrmRecord, CrmResource, type CursorList, type CursorPaging, type CursorParams, type Customer, type Demand, type DemandFields, type EventList, type EventPaging, Inbox, type InboxMutation, type InboxMutationResult, type InboxState, type InboxTools, type Journey, type JourneyConfig, type JourneyEnrollment, type JourneyQuery, type JourneyRun, type JourneyStep, Journeys, type ListApiLogsParams, type ListBroadcastsParams, type ListContactsParams, type ListConversationsParams, type ListEventsParams, type ListMessagesParams, type ListPhoneNumbersParams, type ListRecipientsParams, type ListTemplatesParams, type ListWebhookDeliveriesParams, type MediaAsset, type MediaUploadResult, type Message, type MessageStatus, type OffsetList, type OffsetMeta, type OffsetParams, type Opportunity, type OpportunityFields, type PhoneNumber, Radar, type RadarEntry, type RadarPage, type RadarQuery, type ReplyConversationParams, type RequestOptions, SavedReplies, type SavedReply, type SavedReplyInput, type SavedReplyQuery, type ScheduleBroadcastParams, type SendAudioParams, type SendDocumentParams, type SendImageParams, type SendMediaParams, type SendResult, type SendTemplateParams, type SendTextParams, type SendVideoParams, type SetupLink, type StageColor, type StageRule, type StageRuleInput, type Template, type TemplatePayload, type UpdateAppointment, type UpdateBroadcastParams, type UpdateContactParams, type UpdateCustomerParams, type UpdateSetupLinkParams, type UpdateWebhookParams, type UploadMediaParams, type User, type Webhook, type WebhookAuthorizationHeaders, type WebhookDelivery };
4141
+ export { AI_CONFIGURABLE_PURPOSES, AI_OPERATIONS, AI_PURPOSES, type AddRecipientsError, type AddRecipientsResult, AgendaConfiguration, AgendaExceptions, type AgendaRecord, Ai, type AiAgent, type AiAgentConfig, type AiAgentCoverage, type AiAgentInput, type AiAgentVersion, AiAgentsResource, type AiAlert, type AiAlertBulkFilters, type AiAlertListItem, AiAlertsResource, type AiArtifactUploadInput, type AiAudioPricing, type AiBinding, type AiBindingTarget, type AiBudget, type AiBudgetInput, type AiCapabilitySignal, type AiCapabilityUsage, type AiCapabilityUsageList, type AiCase, type AiCaseChat, type AiCaseEvent, type AiCaseKind, type AiCaseReply, type AiCaseReplyInput, type AiCaseSource, AiCasesResource, type AiCatalogItems, type AiCatalogModel, type AiCatalogProduct, type AiCatalogSyncInput, type AiCatalogSyncResult, type AiChannelGate, type AiCommercialDecision, type AiCommercialEffect, type AiCommercialJob, type AiCommercialProposal, AiCommercialProposalsResource, type AiCommercialRequest, type AiCommercialSettings, type AiConfigurablePurpose, type AiContactAuthorization, type AiConversationCheckpoint, type AiCredential, AiCredentialsResource, type AiDraftResult, type AiEligibilityOverview, AiEligibilityResource, type AiEligibilitySettings, type AiEnrollment, type AiEvolution, AiEvolutionResource, type AiEvolutionSource, type AiExecution, type AiExecutionCitations, type AiExecutionSecurity, AiExecutionsResource, type AiField, type AiFlow, type AiFlowGraph, type AiFlowInput, type AiFlowSettings, type AiFlowVersion, type AiFollowupEffect, type AiFollowupEvent, AiFollowupFlowsResource, type AiFollowupPromise, type AiFollowupPromiseDetail, type AiFollowupPromiseStatus, type AiFollowupQueueFilters, type AiFollowupQueuePage, type AiFollowupQueueRow, AiFollowupsResource, type AiGateMode, type AiInference, type AiInferenceOrigin, type AiInferenceOutcome, type AiInferenceSummary, AiInferencesResource, type AiKnowledgeChunk, type AiKnowledgeCitation, type AiKnowledgeConversation, type AiKnowledgeHit, type AiKnowledgeImport, type AiKnowledgePreview, AiKnowledgeResource, type AiKnowledgeSearchDiagnostics, type AiKnowledgeSource, type AiMemory, type AiMemoryEntry, type AiMemoryEntryEvent, AiMemoryResource, type AiModelCatalogSnapshot, type AiModelCatalogSync, type AiNoticeCheck, type AiNoticeEffect, type AiNoticeField, type AiNoticeJob, type AiNoticeSettings, AiNoticesResource, type AiOperation, type AiOperatorMetrics, AiOperatorResource, type AiPage, type AiPlatformSkill, type AiPlatformSkillComposition, type AiPreparedUpload, type AiProposal, AiProposalsResource, type AiProvider, type AiProviderModel, AiProvidersResource, type AiPurpose, type AiRate, type AiRateInput, type AiRecord, type AiRevision, type AiRouter, type AiRouterConfig, type AiRouterTest, AiRoutersResource, type AiScope, type AiSkill, type AiSkillInput, type AiSkillNearMiss, type AiSkillVersion, AiSkillsResource, type AiSourceKind, type AiStyleAdjustment, type AiStyleAdjustmentId, AiStyleAdjustmentsResource, type AiToolId, type AiTurnPromise, type AiUploadReceiptCallback, AiUploadsResource, AiUsageResource, type AiUsageSummary, type AiUsageTokens, type AiWindow, type ApiLog, type Appointment, type AppointmentAvailability, type AppointmentExceptionInput, type AppointmentFields, type AppointmentHistory, type AppointmentQuery, type AppointmentScheduleInput, type AppointmentServiceInput, type AppointmentStatus, Appointments, type Assignment, type AvailabilityQuery, BotoZap, BotoZapError, type BotoZapEvent, type BotoZapOptions, type Broadcast, type BroadcastRecipient, type BroadcastRecipientInput, Calendar, type CalendarConnection, type CalendarJob, type CalendarSelection, type Contact, type ContactField, ContactFields, type ContactStage, ContactStages, type Conversation, type ConversationEntryPoint, type ConversationNote, type ConversationReferral, type ConversationReminder, type CreateAppointment, type CreateAssignmentParams, type CreateBroadcastParams, type CreateContactParams, type CreateCustomerParams, type CreateDemand, type CreateOpportunity, type CreateSetupLinkParams, type CreateTemplateParams, type CreateWebhookParams, type CrmActivity, type CrmConversation, type CrmFields, type CrmMetadata, type CrmQuery, type CrmRecord, CrmResource, type CursorList, type CursorPaging, type CursorParams, type Customer, type Demand, type DemandFields, type EventList, type EventPaging, Inbox, type InboxMutation, type InboxMutationResult, type InboxState, type InboxTools, type Journey, type JourneyConfig, type JourneyEnrollment, type JourneyQuery, type JourneyRun, type JourneyStep, Journeys, type ListApiLogsParams, type ListBroadcastsParams, type ListContactsParams, type ListConversationsParams, type ListEventsParams, type ListMessagesParams, type ListPhoneNumbersParams, type ListRecipientsParams, type ListTemplatesParams, type ListWebhookDeliveriesParams, type MediaAsset, type MediaUploadResult, type Message, type MessageStatus, type MetaCostCategory, type MetaCostDay, type MetaCostEstimate, type MetaCostGroup, type MetaCostReport, type MetaCostSource, type MetaCostSync, type MetaCostUnavailableReason, type MetaCostsParams, type OffsetList, type OffsetMeta, type OffsetParams, type Opportunity, type OpportunityFields, type PhoneNumber, Radar, type RadarEntry, type RadarPage, type RadarQuery, type ReplyConversationParams, type RequestOptions, SavedReplies, type SavedReply, type SavedReplyInput, type SavedReplyQuery, type ScheduleBroadcastParams, type SendAudioParams, type SendDocumentParams, type SendImageParams, type SendMediaParams, type SendResult, type SendTemplateParams, type SendTextParams, type SendVideoParams, type SetupLink, type StageColor, type StageRule, type StageRuleInput, type Template, type TemplatePayload, type UpdateAppointment, type UpdateBroadcastParams, type UpdateContactParams, type UpdateCustomerParams, type UpdatePhoneNumberParams, type UpdateSetupLinkParams, type UpdateWebhookParams, type UploadMediaParams, type User, type Webhook, type WebhookAuthorizationHeaders, type WebhookDelivery };
package/dist/index.js CHANGED
@@ -5200,7 +5200,12 @@ var Customers = class {
5200
5200
  { query: { page: params.page, per_page: params.per_page } }
5201
5201
  );
5202
5202
  }
5203
- /** Cria um link de setup sob um cliente. */
5203
+ /**
5204
+ * Cria um link de setup sob um cliente (expira em 30 dias). Envie a `url`
5205
+ * devolvida ao Cliente; veja em {@link CreateSetupLinkParams} como funcionam
5206
+ * os redirecionamentos. URL de redirecionamento inválida lança
5207
+ * `BotoZapError` com `code: "invalid_redirect_url"` (422).
5208
+ */
5204
5209
  createSetupLink(customerId, params = {}) {
5205
5210
  return this.client.requestItem(
5206
5211
  "POST",
@@ -5563,10 +5568,19 @@ var PhoneNumbers = class {
5563
5568
  `/phone_numbers/${enc6(id)}`
5564
5569
  );
5565
5570
  }
5566
- // NOTA: `update` foi removido de propósito. A rota PATCH /v1/phone_numbers/:id
5567
- // responde SEMPRE 422 `no_updatable_fields` — o schema atual só tem campos de
5568
- // identidade e campos sincronizados da Meta, nenhum editável por aqui. Expor o
5569
- // método só entregaria uma chamada garantidamente quebrada.
5571
+ /**
5572
+ * Atualiza o nome local (`label`) do Número. É o único campo editável:
5573
+ * identidade e dados sincronizados da Meta (`display_phone_number`,
5574
+ * `verified_name`, `quality_rating`) não mudam por aqui. `{id}` aceita o
5575
+ * UUID interno ou o `phone_number_id` da Meta.
5576
+ */
5577
+ update(id, params) {
5578
+ return this.client.requestItem(
5579
+ "PATCH",
5580
+ `/phone_numbers/${enc6(id)}`,
5581
+ { body: { label: params.label } }
5582
+ );
5583
+ }
5570
5584
  /** Remove um número. Responde 204 (sem corpo). */
5571
5585
  delete(id) {
5572
5586
  return this.client.request("DELETE", `/phone_numbers/${enc6(id)}`);
@@ -5642,6 +5656,28 @@ var Events = class {
5642
5656
  }
5643
5657
  };
5644
5658
 
5659
+ // src/resources/usage.ts
5660
+ var Usage = class {
5661
+ constructor(client) {
5662
+ this.client = client;
5663
+ }
5664
+ client;
5665
+ /**
5666
+ * Custo da Meta por dia, categoria e tipo, lido da Pricing Analytics
5667
+ * sincronizada uma vez por dia por WABA. Scope `customers:read`; o sandbox
5668
+ * fica de fora. Intervalo grande demais responde 422 `range_too_large`.
5669
+ */
5670
+ metaCosts(params = {}) {
5671
+ return this.client.requestItem("GET", "/usage/meta-costs", {
5672
+ query: {
5673
+ customer_id: params.customer_id,
5674
+ from: params.from,
5675
+ to: params.to
5676
+ }
5677
+ });
5678
+ }
5679
+ };
5680
+
5645
5681
  // src/resources/read-only.ts
5646
5682
  var Users = class {
5647
5683
  constructor(client) {
@@ -5720,6 +5756,7 @@ var BotoZap = class {
5720
5756
  radar;
5721
5757
  media;
5722
5758
  events;
5759
+ usage;
5723
5760
  users;
5724
5761
  apiLogs;
5725
5762
  webhookDeliveries;
@@ -5760,6 +5797,7 @@ var BotoZap = class {
5760
5797
  this.phoneNumbers = new PhoneNumbers(this);
5761
5798
  this.media = new Media(this);
5762
5799
  this.events = new Events(this);
5800
+ this.usage = new Usage(this);
5763
5801
  this.users = new Users(this);
5764
5802
  this.apiLogs = new ApiLogs(this);
5765
5803
  this.webhookDeliveries = new WebhookDeliveries(this);