@botozap/sdk 0.17.0 → 0.19.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.cts 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,14 @@ 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;
136
144
  [key: string]: unknown;
137
145
  }
138
146
  /**
@@ -321,6 +329,13 @@ interface PhoneNumber {
321
329
  id: string;
322
330
  /** Nome local do Número no BotoZap (até 100 caracteres); `null` se não definido. */
323
331
  label?: string | null;
332
+ /**
333
+ * `true` quando o Número não envia pelo teto do plano Free (1 número), ou
334
+ * porque o Cliente dele está suspenso: continua recebendo, mas o envio
335
+ * responde 402 `free_number_cap` (ou `free_cap`, pelo Cliente). Volta sozinho
336
+ * ao assinar ou ao desconectar o outro número. Ausente em servidores antigos.
337
+ */
338
+ plan_suspended?: boolean;
324
339
  [key: string]: unknown;
325
340
  }
326
341
  interface User {
@@ -460,15 +475,24 @@ interface MediaAsset {
460
475
  expires_at: string;
461
476
  }
462
477
  /**
463
- * Link de setup de um cliente (Embedded Signup). Shape do contrato
478
+ * Link de setup de um cliente (Embedded Signup no WhatsApp, login do Instagram
479
+ * no Instagram). Shape do contrato
464
480
  * (ver `/v1/customers/:id/setup_links`): a `url` embute o token opaco; o token
465
481
  * cru nunca é exposto separadamente.
466
482
  */
467
483
  interface SetupLink {
468
484
  id: string;
485
+ /** Canal que o link conecta (cada link conecta um canal só). */
486
+ channel: "whatsapp" | "instagram";
469
487
  status: string;
488
+ /**
489
+ * Andamento da conexão. Apesar do nome, vale para os dois canais: num link do
490
+ * Instagram passa a `completed` quando a conta do Instagram conecta.
491
+ */
470
492
  whatsapp_setup_status: string;
493
+ /** `/whatsapp/setup/<token>` ou `/instagram/setup/<token>`, conforme o canal. */
471
494
  url: string;
495
+ /** Modos do WhatsApp; sempre `[]` em links do Instagram. */
472
496
  allowed_connection_types: string[];
473
497
  /**
474
498
  * Legado: `null` em links novos. A página do link é sempre em português,
@@ -3879,13 +3903,26 @@ interface UpdateCustomerParams {
3879
3903
  * link continua válido. A query string que a sua URL já tiver é preservada e o
3880
3904
  * token do link nunca é enviado. Link expirado ou revogado mostra a página de
3881
3905
  * erro, sem redirecionar.
3906
+ *
3907
+ * Cada link conecta um canal só (`channel`). No do Instagram, o Cliente
3908
+ * confirma que a conta é profissional e que as mensagens estão liberadas e
3909
+ * entra com o Instagram; sucesso vai para `success_redirect_url` com
3910
+ * `status=completed` e, numa falha, a página oferece voltar para
3911
+ * `failure_redirect_url` com `status=cancelled`.
3882
3912
  */
3883
3913
  interface CreateSetupLinkParams {
3884
3914
  /**
3885
- * Tipos de conexão liberados: "dedicated" e/ou "coexistence" (padrão
3886
- * "dedicated"). Uma lista sem nenhum tipo válido responde
3915
+ * Canal que o link conecta: "whatsapp" (padrão) ou "instagram". Outro valor
3916
+ * responde `422 invalid_channel`. O link do Instagram volta com
3917
+ * `allowed_connection_types: []` e `url` em `/instagram/setup/<token>`.
3918
+ */
3919
+ channel?: "whatsapp" | "instagram";
3920
+ /**
3921
+ * Só WhatsApp. Tipos de conexão liberados: "dedicated" e/ou "coexistence"
3922
+ * (padrão "dedicated"). Uma lista sem nenhum tipo válido responde
3887
3923
  * `422 invalid_connection_types`; tipos desconhecidos ao lado de válidos são
3888
- * ignorados.
3924
+ * ignorados. Com `channel: "instagram"`, enviar a lista responde
3925
+ * `422 invalid_connection_types`.
3889
3926
  */
3890
3927
  allowed_connection_types?: string[];
3891
3928
  /**
@@ -3924,7 +3961,10 @@ declare class Customers {
3924
3961
  list(params?: OffsetParams): Promise<OffsetList<Customer>>;
3925
3962
  /** Busca um cliente pelo id. */
3926
3963
  get(id: string): Promise<Customer>;
3927
- /** Cria um cliente. */
3964
+ /**
3965
+ * Cria um cliente. No plano Free, que permite 1 Cliente (com canal ou não), o
3966
+ * segundo responde 402 `free_cap` (veja `isFreeCap`).
3967
+ */
3928
3968
  create(params: CreateCustomerParams): Promise<Customer>;
3929
3969
  /** Atualiza `name` / `external_customer_id` de um cliente. */
3930
3970
  update(id: string, params: UpdateCustomerParams): Promise<Customer>;
@@ -3936,7 +3976,8 @@ declare class Customers {
3936
3976
  * Cria um link de setup sob um cliente (expira em 30 dias). Envie a `url`
3937
3977
  * devolvida ao Cliente; veja em {@link CreateSetupLinkParams} como funcionam
3938
3978
  * os redirecionamentos. URL de redirecionamento inválida lança
3939
- * `BotoZapError` com `code: "invalid_redirect_url"` (422).
3979
+ * `BotoZapError` com `code: "invalid_redirect_url"` (422); canal inválido,
3980
+ * `code: "invalid_channel"` (422).
3940
3981
  */
3941
3982
  createSetupLink(customerId: string, params?: CreateSetupLinkParams): Promise<SetupLink>;
3942
3983
  /** Atualiza status/expiração de um link de setup. */
@@ -4703,19 +4744,34 @@ declare class ChannelAccounts {
4703
4744
  listMessageRules(channelAccountId: string, params?: OffsetParams): Promise<OffsetList<MessageRule>>;
4704
4745
  /** Busca uma Regra de mensagem. message-rules:read. */
4705
4746
  getMessageRule(channelAccountId: string, ruleId: string): Promise<MessageRule>;
4706
- /** Cria uma Regra de mensagem. message-rules:write. */
4747
+ /**
4748
+ * Cria uma Regra de mensagem. message-rules:write. Fora do plano (Free)
4749
+ * responde 403 `plan_restricted`.
4750
+ */
4707
4751
  createMessageRule(channelAccountId: string, params: CreateMessageRuleParams): Promise<MessageRule>;
4708
- /** PATCH parcial; a API valida o estado final. message-rules:write. */
4752
+ /**
4753
+ * PATCH parcial; a API valida o estado final. message-rules:write. No Free,
4754
+ * só `{ is_active: false }` (pausar) passa; o resto responde 403
4755
+ * `plan_restricted`.
4756
+ */
4709
4757
  updateMessageRule(channelAccountId: string, ruleId: string, params: UpdateMessageRuleParams): Promise<MessageRule>;
4710
4758
  /** Exclui a Regra preservando Disparos e Eventos. message-rules:write. */
4711
4759
  deleteMessageRule(channelAccountId: string, ruleId: string): Promise<DeleteMessageRuleResult>;
4712
4760
  /** Lê o espelho salvo (sem consultar a Meta). messenger-profile:read; sem sandbox. */
4713
4761
  getMessengerProfile(channelAccountId: string): Promise<MessengerProfile>;
4714
- /** Salva/aplica apenas as seções enviadas. messenger-profile:write; sem sandbox. */
4762
+ /**
4763
+ * Salva/aplica apenas as seções enviadas. messenger-profile:write; sem
4764
+ * sandbox. No Free, só remover seções passa; salvar conteúdo responde 403
4765
+ * `plan_restricted`.
4766
+ */
4715
4767
  updateMessengerProfile(channelAccountId: string, params: UpdateMessengerProfileParams): Promise<MessengerProfile>;
4716
4768
  /** Remove perguntas e menu, conservando configuração vazia. messenger-profile:write. */
4717
4769
  deleteMessengerProfile(channelAccountId: string): Promise<MessengerProfile>;
4718
- /** Verifica/reaplica explicitamente o desejado salvo. messenger-profile:write. */
4770
+ /**
4771
+ * Verifica/reaplica explicitamente o desejado salvo. messenger-profile:write.
4772
+ * No Free, reaplicar uma configuração com conteúdo responde 403
4773
+ * `plan_restricted`.
4774
+ */
4719
4775
  syncMessengerProfile(channelAccountId: string): Promise<MessengerProfile>;
4720
4776
  }
4721
4777
 
@@ -5157,8 +5213,10 @@ declare class BotoZapError extends Error {
5157
5213
  * `reaction_target_not_found`, `reaction_target_invalid`,
5158
5214
  * `reaction_target_expired`, `unsupported_type`, `free_form_limit_reached`
5159
5215
  * (429, limite 1:1 do Free). Plano: `plan_restricted` (403, escritas de IA,
5160
- * Agenda, Calendário e Jornadas fora do plano), `free_number_cap` (402, setup
5161
- * além do teto de Números do Free). IA: `provider_not_enabled` (422, credencial
5216
+ * Agenda, Calendário, Jornadas, Regras de mensagem do Direct e Perguntas e menu
5217
+ * fora do plano), `free_number_cap` (402, setup além do teto de Números do Free
5218
+ * ou envio por um Número suspenso no Free), `free_cap` (402, criar o 2º Cliente
5219
+ * no Free ou enviar por um Cliente suspenso no Free). IA: `provider_not_enabled` (422, credencial
5162
5220
  * nova de provedor com `accepts_new_credentials: false`). Cobrança:
5163
5221
  * `business_payment_required` (402 no envio: o negócio está pausado porque a
5164
5222
  * fatura do slot venceu há mais de 7 dias; pague e envie de novo),
@@ -5166,9 +5224,9 @@ declare class BotoZapError extends Error {
5166
5224
  * 2 slots com fatura em aberto), `billing_customer_required` (402, conta sem
5167
5225
  * cadastro de cobrança), `slot_in_use` (409, cancelar slot ocupado).
5168
5226
  */
5169
- 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 & {});
5227
+ type BotoZapErrorCode = "invalid_request" | "unsupported_type" | "invalid_reaction" | "missing_reaction_target" | "reaction_target_not_found" | "reaction_target_invalid" | "reaction_target_expired" | "free_form_limit_reached" | "quota_exceeded" | "plan_restricted" | "free_number_cap" | "free_cap" | "feature_unavailable" | "provider_not_enabled" | "business_payment_required" | "plan_required" | "slot_limit" | "slot_in_use" | "billing_customer_required" | (string & {});
5170
5228
  /** Códigos que indicam limite ou restrição do plano contratado. */
5171
- declare const PLAN_ERROR_CODES: readonly ["plan_restricted", "free_form_limit_reached", "free_number_cap"];
5229
+ declare const PLAN_ERROR_CODES: readonly ["plan_restricted", "free_form_limit_reached", "free_number_cap", "free_cap"];
5172
5230
  /** True quando o erro é recusa por plano (upgrade resolve; retry não). */
5173
5231
  declare function isPlanError(error: unknown): error is BotoZapError;
5174
5232
  /**
@@ -5177,5 +5235,24 @@ declare function isPlanError(error: unknown): error is BotoZapError;
5177
5235
  * disso não adianta. Não é recusa de plano ({@link isPlanError} é `false`).
5178
5236
  */
5179
5237
  declare function isBusinessPaymentRequired(error: unknown): error is BotoZapError;
5238
+ /**
5239
+ * True quando a API recusou por causa do teto de 1 negócio (Cliente) do plano
5240
+ * Free (402 `free_cap`): criar o 2º Cliente (`customers.create`) ou enviar por
5241
+ * um Cliente suspenso. O Cliente suspenso (`plan_suspended: true`) continua
5242
+ * recebendo, mas não conecta canais nem envia. Libera na hora ao assinar; no
5243
+ * Free, apagar o outro Cliente (ou, no envio, desconectar os canais dele)
5244
+ * libera a vaga. Repetir antes disso não adianta. É recusa de plano
5245
+ * ({@link isPlanError} é `true`).
5246
+ */
5247
+ declare function isFreeCap(error: unknown): error is BotoZapError;
5248
+ /**
5249
+ * True quando a API recusou por causa do teto de 1 número do plano Free (402
5250
+ * `free_number_cap`): enviar por um Número suspenso ou conectar outro número
5251
+ * no setup. O Número suspenso (`plan_suspended: true`) continua recebendo, mas
5252
+ * não envia. Libera na hora ao assinar ou ao desconectar o outro número;
5253
+ * repetir antes disso não adianta. É recusa de plano ({@link isPlanError} é
5254
+ * `true`).
5255
+ */
5256
+ declare function isFreeNumberCap(error: unknown): error is BotoZapError;
5180
5257
 
5181
- 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 };
5258
+ export { AI_CONFIGURABLE_PURPOSES, AI_CREDENTIAL_PROVIDERS, AI_OPERATIONS, AI_PURPOSES, type AddRecipientsError, type AddRecipientsResult, AgendaConfiguration, AgendaExceptions, type AgendaRecord, Ai, type AiAgent, type AiAgentConfig, type AiAgentCoverage, type AiAgentInput, type AiAgentVersion, AiAgentsResource, type AiAlert, type AiAlertBulkFilters, type AiAlertListItem, AiAlertsResource, type AiArtifactUploadInput, type AiAudioPricing, type AiBinding, type AiBindingTarget, type AiBudget, type AiBudgetInput, type AiCapabilitySignal, type AiCapabilityUsage, type AiCapabilityUsageList, type AiCase, type AiCaseChat, type AiCaseEvent, type AiCaseKind, type AiCaseReply, type AiCaseReplyInput, type AiCaseSource, AiCasesResource, type AiCatalogItems, type AiCatalogModel, type AiCatalogProduct, type AiCatalogSyncInput, type AiCatalogSyncResult, type AiChannelGate, type AiCommercialDecision, type AiCommercialEffect, type AiCommercialJob, type AiCommercialProposal, AiCommercialProposalsResource, type AiCommercialRequest, type AiCommercialSettings, type AiConfigurablePurpose, type AiContactAuthorization, type AiConversationCheckpoint, type AiCredential, AiCredentialsResource, type AiDraftResult, type AiEligibilityOverview, AiEligibilityResource, type AiEligibilitySettings, type AiEnrollment, type AiEvolution, AiEvolutionResource, type AiEvolutionSource, type AiExecution, type AiExecutionCitations, type AiExecutionSecurity, AiExecutionsResource, type AiField, type AiFlow, type AiFlowGraph, type AiFlowInput, type AiFlowSettings, type AiFlowVersion, type AiFollowupEffect, type AiFollowupEvent, AiFollowupFlowsResource, type AiFollowupPromise, type AiFollowupPromiseDetail, type AiFollowupPromiseStatus, type AiFollowupQueueFilters, type AiFollowupQueuePage, type AiFollowupQueueRow, AiFollowupsResource, type AiGateMode, type AiInference, type AiInferenceOrigin, type AiInferenceOutcome, type AiInferenceSummary, AiInferencesResource, type AiKnowledgeChunk, type AiKnowledgeCitation, type AiKnowledgeConversation, type AiKnowledgeHit, type AiKnowledgeImport, type AiKnowledgePreview, AiKnowledgeResource, type AiKnowledgeSearchDiagnostics, type AiKnowledgeSource, type AiMemory, type AiMemoryEntry, type AiMemoryEntryEvent, AiMemoryResource, type AiModelCatalogSnapshot, type AiModelCatalogSync, type AiNoticeCheck, type AiNoticeEffect, type AiNoticeField, type AiNoticeJob, type AiNoticeSettings, AiNoticesResource, type AiOperation, type AiOperatorMetrics, AiOperatorResource, type AiPage, type AiPlatformSkill, type AiPlatformSkillComposition, type AiPreparedUpload, type AiProposal, AiProposalsResource, type AiProvider, type AiProviderInfo, type AiProviderModel, AiProvidersResource, type AiPurpose, type AiRate, type AiRateInput, type AiRecord, type AiRevision, type AiRouter, type AiRouterConfig, type AiRouterTest, AiRoutersResource, type AiScope, type AiSkill, type AiSkillInput, type AiSkillNearMiss, type AiSkillVersion, AiSkillsResource, type AiSourceKind, type AiStyleAdjustment, type AiStyleAdjustmentId, AiStyleAdjustmentsResource, type AiToolId, type AiTurnPromise, type AiUploadReceiptCallback, AiUploadsResource, AiUsageResource, type AiUsageSummary, type AiUsageTokens, type AiWindow, type ApiLog, type Appointment, type AppointmentAvailability, type AppointmentExceptionInput, type AppointmentFields, type AppointmentHistory, type AppointmentQuery, type AppointmentScheduleInput, type AppointmentServiceInput, type AppointmentStatus, Appointments, type Assignment, type AvailabilityQuery, type Billing, type BillingPlan, BotoZap, BotoZapError, type BotoZapErrorCode, type BotoZapEvent, type BotoZapOptions, type Broadcast, type BroadcastRecipient, type BroadcastRecipientInput, type BusinessSlot, Calendar, type CalendarConnection, type CalendarJob, type CalendarSelection, type ChannelAccount, type ChannelAccountRef, ChannelAccounts, type CommentAiDeliveryStatus, type CommentRule, type CommentRuleCounters, type CommentRuleMetrics, type CommentRuleMetricsParams, type CommentRuleStatus, type ConnectionBilling, type ConnectionBillingOutcome, type ConnectionBillingRefusal, type Contact, type ContactField, ContactFields, type ContactStage, ContactStages, type Conversation, type ConversationEntryPoint, type ConversationNote, type ConversationReferral, type ConversationReminder, type CreateAppointment, type CreateAssignmentParams, type CreateBroadcastParams, type CreateBusinessSlotOptions, type CreateCommentRuleParams, type CreateContactParams, type CreateCustomerParams, type CreateDemand, type CreateMessageRuleParams, type CreateOpportunity, type CreateSetupLinkParams, type CreateTemplateParams, type CreateWebhookParams, type CrmActivity, type CrmConversation, type CrmFields, type CrmMetadata, type CrmQuery, type CrmRecord, CrmResource, type CursorList, type CursorPaging, type CursorParams, type Customer, type CustomerBusinessSlot, type DeleteCommentRuleResult, type DeleteMessageRuleResult, type Demand, type DemandFields, type EventList, type EventPaging, type FixedRuleMessage, Inbox, type InboxMutation, type InboxMutationResult, type InboxState, type InboxTools, type InstagramCommentAi, type InstagramCommentAiAutomation, type InstagramCommentAiRepliedEvent, type InstagramCommentAiRun, type InstagramConnection, type InstagramGenericElement, type InstagramIceBreaker, type InstagramInteractiveButton, type InstagramInteractiveButtonPayload, type InstagramInteractiveGenericPayload, type InstagramInteractivePayload, type InstagramPersistentMenuItem, type InstagramTokenStatus, type InteractiveButtonPayload, type InteractiveCtaUrlPayload, type InteractiveHeader, type InteractiveListPayload, type InteractivePayload, type Journey, type JourneyConfig, type JourneyEnrollment, type JourneyQuery, type JourneyRun, type JourneyStep, Journeys, type ListApiLogsParams, type ListBroadcastsParams, type ListChannelAccountsParams, type ListContactsParams, type ListConversationsParams, type ListEventsParams, type ListMessagesParams, type ListPhoneNumbersParams, type ListRecipientsParams, type ListTemplatesParams, type ListWebhookDeliveriesParams, type Me, type MediaAsset, type MediaUploadResult, type Message, type MessageChannel, type MessageContent, type MessageEdit, type MessageRule, type MessageRuleAction, type MessageRuleQrParams, type MessageRuleTrigger, type MessageSort, type MessageSource, type MessageStatus, type MessengerProfile, type MessengerProfileConfig, type MetaCostCategory, type MetaCostDay, type MetaCostEstimate, type MetaCostGroup, type MetaCostReport, type MetaCostSource, type MetaCostSync, type MetaCostUnavailableReason, type MetaCostsParams, type OffsetList, type OffsetMeta, type OffsetParams, type Opportunity, type OpportunityFields, PLAN_ERROR_CODES, type PhoneNumber, type QuickReply, Radar, type RadarEntry, type RadarPage, type RadarQuery, type ReplyConversationParams, type RequestOptions, SavedReplies, type SavedReply, type SavedReplyInput, type SavedReplyQuery, type ScheduleBroadcastParams, type SendAudioParams, type SendDocumentParams, type SendFailureDetails, type SendImageParams, type SendInteractiveParams, type SendLocationParams, type SendMediaParams, type SendOptions, type SendReactionParams, type SendReactionResult, type SendResult, type SendTemplateParams, type SendTextParams, type SendVideoParams, type SetupLink, type StageColor, type StageRule, type StageRuleInput, type Template, type TemplatePayload, type UpdateAppointment, type UpdateBroadcastParams, type UpdateCommentAiParams, type UpdateCommentRuleParams, type UpdateContactParams, type UpdateCustomerParams, type UpdateMessageRuleParams, type UpdateMessengerProfileParams, type UpdatePhoneNumberParams, type UpdateSetupLinkParams, type UpdateWebhookParams, type UploadMediaParams, type User, WEBHOOK_CATEGORIES, type Webhook, type WebhookAuthorizationHeaders, type WebhookCategory, type WebhookChannelHealth, type WebhookChannelHealthStatus, type WebhookDelivery, type WebhookDeliveryStatus, isBusinessPaymentRequired, isFreeCap, isFreeNumberCap, isPlanError };
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,14 @@ 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;
136
144
  [key: string]: unknown;
137
145
  }
138
146
  /**
@@ -321,6 +329,13 @@ interface PhoneNumber {
321
329
  id: string;
322
330
  /** Nome local do Número no BotoZap (até 100 caracteres); `null` se não definido. */
323
331
  label?: string | null;
332
+ /**
333
+ * `true` quando o Número não envia pelo teto do plano Free (1 número), ou
334
+ * porque o Cliente dele está suspenso: continua recebendo, mas o envio
335
+ * responde 402 `free_number_cap` (ou `free_cap`, pelo Cliente). Volta sozinho
336
+ * ao assinar ou ao desconectar o outro número. Ausente em servidores antigos.
337
+ */
338
+ plan_suspended?: boolean;
324
339
  [key: string]: unknown;
325
340
  }
326
341
  interface User {
@@ -460,15 +475,24 @@ interface MediaAsset {
460
475
  expires_at: string;
461
476
  }
462
477
  /**
463
- * Link de setup de um cliente (Embedded Signup). Shape do contrato
478
+ * Link de setup de um cliente (Embedded Signup no WhatsApp, login do Instagram
479
+ * no Instagram). Shape do contrato
464
480
  * (ver `/v1/customers/:id/setup_links`): a `url` embute o token opaco; o token
465
481
  * cru nunca é exposto separadamente.
466
482
  */
467
483
  interface SetupLink {
468
484
  id: string;
485
+ /** Canal que o link conecta (cada link conecta um canal só). */
486
+ channel: "whatsapp" | "instagram";
469
487
  status: string;
488
+ /**
489
+ * Andamento da conexão. Apesar do nome, vale para os dois canais: num link do
490
+ * Instagram passa a `completed` quando a conta do Instagram conecta.
491
+ */
470
492
  whatsapp_setup_status: string;
493
+ /** `/whatsapp/setup/<token>` ou `/instagram/setup/<token>`, conforme o canal. */
471
494
  url: string;
495
+ /** Modos do WhatsApp; sempre `[]` em links do Instagram. */
472
496
  allowed_connection_types: string[];
473
497
  /**
474
498
  * Legado: `null` em links novos. A página do link é sempre em português,
@@ -3879,13 +3903,26 @@ interface UpdateCustomerParams {
3879
3903
  * link continua válido. A query string que a sua URL já tiver é preservada e o
3880
3904
  * token do link nunca é enviado. Link expirado ou revogado mostra a página de
3881
3905
  * erro, sem redirecionar.
3906
+ *
3907
+ * Cada link conecta um canal só (`channel`). No do Instagram, o Cliente
3908
+ * confirma que a conta é profissional e que as mensagens estão liberadas e
3909
+ * entra com o Instagram; sucesso vai para `success_redirect_url` com
3910
+ * `status=completed` e, numa falha, a página oferece voltar para
3911
+ * `failure_redirect_url` com `status=cancelled`.
3882
3912
  */
3883
3913
  interface CreateSetupLinkParams {
3884
3914
  /**
3885
- * Tipos de conexão liberados: "dedicated" e/ou "coexistence" (padrão
3886
- * "dedicated"). Uma lista sem nenhum tipo válido responde
3915
+ * Canal que o link conecta: "whatsapp" (padrão) ou "instagram". Outro valor
3916
+ * responde `422 invalid_channel`. O link do Instagram volta com
3917
+ * `allowed_connection_types: []` e `url` em `/instagram/setup/<token>`.
3918
+ */
3919
+ channel?: "whatsapp" | "instagram";
3920
+ /**
3921
+ * Só WhatsApp. Tipos de conexão liberados: "dedicated" e/ou "coexistence"
3922
+ * (padrão "dedicated"). Uma lista sem nenhum tipo válido responde
3887
3923
  * `422 invalid_connection_types`; tipos desconhecidos ao lado de válidos são
3888
- * ignorados.
3924
+ * ignorados. Com `channel: "instagram"`, enviar a lista responde
3925
+ * `422 invalid_connection_types`.
3889
3926
  */
3890
3927
  allowed_connection_types?: string[];
3891
3928
  /**
@@ -3924,7 +3961,10 @@ declare class Customers {
3924
3961
  list(params?: OffsetParams): Promise<OffsetList<Customer>>;
3925
3962
  /** Busca um cliente pelo id. */
3926
3963
  get(id: string): Promise<Customer>;
3927
- /** Cria um cliente. */
3964
+ /**
3965
+ * Cria um cliente. No plano Free, que permite 1 Cliente (com canal ou não), o
3966
+ * segundo responde 402 `free_cap` (veja `isFreeCap`).
3967
+ */
3928
3968
  create(params: CreateCustomerParams): Promise<Customer>;
3929
3969
  /** Atualiza `name` / `external_customer_id` de um cliente. */
3930
3970
  update(id: string, params: UpdateCustomerParams): Promise<Customer>;
@@ -3936,7 +3976,8 @@ declare class Customers {
3936
3976
  * Cria um link de setup sob um cliente (expira em 30 dias). Envie a `url`
3937
3977
  * devolvida ao Cliente; veja em {@link CreateSetupLinkParams} como funcionam
3938
3978
  * os redirecionamentos. URL de redirecionamento inválida lança
3939
- * `BotoZapError` com `code: "invalid_redirect_url"` (422).
3979
+ * `BotoZapError` com `code: "invalid_redirect_url"` (422); canal inválido,
3980
+ * `code: "invalid_channel"` (422).
3940
3981
  */
3941
3982
  createSetupLink(customerId: string, params?: CreateSetupLinkParams): Promise<SetupLink>;
3942
3983
  /** Atualiza status/expiração de um link de setup. */
@@ -4703,19 +4744,34 @@ declare class ChannelAccounts {
4703
4744
  listMessageRules(channelAccountId: string, params?: OffsetParams): Promise<OffsetList<MessageRule>>;
4704
4745
  /** Busca uma Regra de mensagem. message-rules:read. */
4705
4746
  getMessageRule(channelAccountId: string, ruleId: string): Promise<MessageRule>;
4706
- /** Cria uma Regra de mensagem. message-rules:write. */
4747
+ /**
4748
+ * Cria uma Regra de mensagem. message-rules:write. Fora do plano (Free)
4749
+ * responde 403 `plan_restricted`.
4750
+ */
4707
4751
  createMessageRule(channelAccountId: string, params: CreateMessageRuleParams): Promise<MessageRule>;
4708
- /** PATCH parcial; a API valida o estado final. message-rules:write. */
4752
+ /**
4753
+ * PATCH parcial; a API valida o estado final. message-rules:write. No Free,
4754
+ * só `{ is_active: false }` (pausar) passa; o resto responde 403
4755
+ * `plan_restricted`.
4756
+ */
4709
4757
  updateMessageRule(channelAccountId: string, ruleId: string, params: UpdateMessageRuleParams): Promise<MessageRule>;
4710
4758
  /** Exclui a Regra preservando Disparos e Eventos. message-rules:write. */
4711
4759
  deleteMessageRule(channelAccountId: string, ruleId: string): Promise<DeleteMessageRuleResult>;
4712
4760
  /** Lê o espelho salvo (sem consultar a Meta). messenger-profile:read; sem sandbox. */
4713
4761
  getMessengerProfile(channelAccountId: string): Promise<MessengerProfile>;
4714
- /** Salva/aplica apenas as seções enviadas. messenger-profile:write; sem sandbox. */
4762
+ /**
4763
+ * Salva/aplica apenas as seções enviadas. messenger-profile:write; sem
4764
+ * sandbox. No Free, só remover seções passa; salvar conteúdo responde 403
4765
+ * `plan_restricted`.
4766
+ */
4715
4767
  updateMessengerProfile(channelAccountId: string, params: UpdateMessengerProfileParams): Promise<MessengerProfile>;
4716
4768
  /** Remove perguntas e menu, conservando configuração vazia. messenger-profile:write. */
4717
4769
  deleteMessengerProfile(channelAccountId: string): Promise<MessengerProfile>;
4718
- /** Verifica/reaplica explicitamente o desejado salvo. messenger-profile:write. */
4770
+ /**
4771
+ * Verifica/reaplica explicitamente o desejado salvo. messenger-profile:write.
4772
+ * No Free, reaplicar uma configuração com conteúdo responde 403
4773
+ * `plan_restricted`.
4774
+ */
4719
4775
  syncMessengerProfile(channelAccountId: string): Promise<MessengerProfile>;
4720
4776
  }
4721
4777
 
@@ -5157,8 +5213,10 @@ declare class BotoZapError extends Error {
5157
5213
  * `reaction_target_not_found`, `reaction_target_invalid`,
5158
5214
  * `reaction_target_expired`, `unsupported_type`, `free_form_limit_reached`
5159
5215
  * (429, limite 1:1 do Free). Plano: `plan_restricted` (403, escritas de IA,
5160
- * Agenda, Calendário e Jornadas fora do plano), `free_number_cap` (402, setup
5161
- * além do teto de Números do Free). IA: `provider_not_enabled` (422, credencial
5216
+ * Agenda, Calendário, Jornadas, Regras de mensagem do Direct e Perguntas e menu
5217
+ * fora do plano), `free_number_cap` (402, setup além do teto de Números do Free
5218
+ * ou envio por um Número suspenso no Free), `free_cap` (402, criar o 2º Cliente
5219
+ * no Free ou enviar por um Cliente suspenso no Free). IA: `provider_not_enabled` (422, credencial
5162
5220
  * nova de provedor com `accepts_new_credentials: false`). Cobrança:
5163
5221
  * `business_payment_required` (402 no envio: o negócio está pausado porque a
5164
5222
  * fatura do slot venceu há mais de 7 dias; pague e envie de novo),
@@ -5166,9 +5224,9 @@ declare class BotoZapError extends Error {
5166
5224
  * 2 slots com fatura em aberto), `billing_customer_required` (402, conta sem
5167
5225
  * cadastro de cobrança), `slot_in_use` (409, cancelar slot ocupado).
5168
5226
  */
5169
- 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 & {});
5227
+ type BotoZapErrorCode = "invalid_request" | "unsupported_type" | "invalid_reaction" | "missing_reaction_target" | "reaction_target_not_found" | "reaction_target_invalid" | "reaction_target_expired" | "free_form_limit_reached" | "quota_exceeded" | "plan_restricted" | "free_number_cap" | "free_cap" | "feature_unavailable" | "provider_not_enabled" | "business_payment_required" | "plan_required" | "slot_limit" | "slot_in_use" | "billing_customer_required" | (string & {});
5170
5228
  /** Códigos que indicam limite ou restrição do plano contratado. */
5171
- declare const PLAN_ERROR_CODES: readonly ["plan_restricted", "free_form_limit_reached", "free_number_cap"];
5229
+ declare const PLAN_ERROR_CODES: readonly ["plan_restricted", "free_form_limit_reached", "free_number_cap", "free_cap"];
5172
5230
  /** True quando o erro é recusa por plano (upgrade resolve; retry não). */
5173
5231
  declare function isPlanError(error: unknown): error is BotoZapError;
5174
5232
  /**
@@ -5177,5 +5235,24 @@ declare function isPlanError(error: unknown): error is BotoZapError;
5177
5235
  * disso não adianta. Não é recusa de plano ({@link isPlanError} é `false`).
5178
5236
  */
5179
5237
  declare function isBusinessPaymentRequired(error: unknown): error is BotoZapError;
5238
+ /**
5239
+ * True quando a API recusou por causa do teto de 1 negócio (Cliente) do plano
5240
+ * Free (402 `free_cap`): criar o 2º Cliente (`customers.create`) ou enviar por
5241
+ * um Cliente suspenso. O Cliente suspenso (`plan_suspended: true`) continua
5242
+ * recebendo, mas não conecta canais nem envia. Libera na hora ao assinar; no
5243
+ * Free, apagar o outro Cliente (ou, no envio, desconectar os canais dele)
5244
+ * libera a vaga. Repetir antes disso não adianta. É recusa de plano
5245
+ * ({@link isPlanError} é `true`).
5246
+ */
5247
+ declare function isFreeCap(error: unknown): error is BotoZapError;
5248
+ /**
5249
+ * True quando a API recusou por causa do teto de 1 número do plano Free (402
5250
+ * `free_number_cap`): enviar por um Número suspenso ou conectar outro número
5251
+ * no setup. O Número suspenso (`plan_suspended: true`) continua recebendo, mas
5252
+ * não envia. Libera na hora ao assinar ou ao desconectar o outro número;
5253
+ * repetir antes disso não adianta. É recusa de plano ({@link isPlanError} é
5254
+ * `true`).
5255
+ */
5256
+ declare function isFreeNumberCap(error: unknown): error is BotoZapError;
5180
5257
 
5181
- 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 };
5258
+ export { AI_CONFIGURABLE_PURPOSES, AI_CREDENTIAL_PROVIDERS, AI_OPERATIONS, AI_PURPOSES, type AddRecipientsError, type AddRecipientsResult, AgendaConfiguration, AgendaExceptions, type AgendaRecord, Ai, type AiAgent, type AiAgentConfig, type AiAgentCoverage, type AiAgentInput, type AiAgentVersion, AiAgentsResource, type AiAlert, type AiAlertBulkFilters, type AiAlertListItem, AiAlertsResource, type AiArtifactUploadInput, type AiAudioPricing, type AiBinding, type AiBindingTarget, type AiBudget, type AiBudgetInput, type AiCapabilitySignal, type AiCapabilityUsage, type AiCapabilityUsageList, type AiCase, type AiCaseChat, type AiCaseEvent, type AiCaseKind, type AiCaseReply, type AiCaseReplyInput, type AiCaseSource, AiCasesResource, type AiCatalogItems, type AiCatalogModel, type AiCatalogProduct, type AiCatalogSyncInput, type AiCatalogSyncResult, type AiChannelGate, type AiCommercialDecision, type AiCommercialEffect, type AiCommercialJob, type AiCommercialProposal, AiCommercialProposalsResource, type AiCommercialRequest, type AiCommercialSettings, type AiConfigurablePurpose, type AiContactAuthorization, type AiConversationCheckpoint, type AiCredential, AiCredentialsResource, type AiDraftResult, type AiEligibilityOverview, AiEligibilityResource, type AiEligibilitySettings, type AiEnrollment, type AiEvolution, AiEvolutionResource, type AiEvolutionSource, type AiExecution, type AiExecutionCitations, type AiExecutionSecurity, AiExecutionsResource, type AiField, type AiFlow, type AiFlowGraph, type AiFlowInput, type AiFlowSettings, type AiFlowVersion, type AiFollowupEffect, type AiFollowupEvent, AiFollowupFlowsResource, type AiFollowupPromise, type AiFollowupPromiseDetail, type AiFollowupPromiseStatus, type AiFollowupQueueFilters, type AiFollowupQueuePage, type AiFollowupQueueRow, AiFollowupsResource, type AiGateMode, type AiInference, type AiInferenceOrigin, type AiInferenceOutcome, type AiInferenceSummary, AiInferencesResource, type AiKnowledgeChunk, type AiKnowledgeCitation, type AiKnowledgeConversation, type AiKnowledgeHit, type AiKnowledgeImport, type AiKnowledgePreview, AiKnowledgeResource, type AiKnowledgeSearchDiagnostics, type AiKnowledgeSource, type AiMemory, type AiMemoryEntry, type AiMemoryEntryEvent, AiMemoryResource, type AiModelCatalogSnapshot, type AiModelCatalogSync, type AiNoticeCheck, type AiNoticeEffect, type AiNoticeField, type AiNoticeJob, type AiNoticeSettings, AiNoticesResource, type AiOperation, type AiOperatorMetrics, AiOperatorResource, type AiPage, type AiPlatformSkill, type AiPlatformSkillComposition, type AiPreparedUpload, type AiProposal, AiProposalsResource, type AiProvider, type AiProviderInfo, type AiProviderModel, AiProvidersResource, type AiPurpose, type AiRate, type AiRateInput, type AiRecord, type AiRevision, type AiRouter, type AiRouterConfig, type AiRouterTest, AiRoutersResource, type AiScope, type AiSkill, type AiSkillInput, type AiSkillNearMiss, type AiSkillVersion, AiSkillsResource, type AiSourceKind, type AiStyleAdjustment, type AiStyleAdjustmentId, AiStyleAdjustmentsResource, type AiToolId, type AiTurnPromise, type AiUploadReceiptCallback, AiUploadsResource, AiUsageResource, type AiUsageSummary, type AiUsageTokens, type AiWindow, type ApiLog, type Appointment, type AppointmentAvailability, type AppointmentExceptionInput, type AppointmentFields, type AppointmentHistory, type AppointmentQuery, type AppointmentScheduleInput, type AppointmentServiceInput, type AppointmentStatus, Appointments, type Assignment, type AvailabilityQuery, type Billing, type BillingPlan, BotoZap, BotoZapError, type BotoZapErrorCode, type BotoZapEvent, type BotoZapOptions, type Broadcast, type BroadcastRecipient, type BroadcastRecipientInput, type BusinessSlot, Calendar, type CalendarConnection, type CalendarJob, type CalendarSelection, type ChannelAccount, type ChannelAccountRef, ChannelAccounts, type CommentAiDeliveryStatus, type CommentRule, type CommentRuleCounters, type CommentRuleMetrics, type CommentRuleMetricsParams, type CommentRuleStatus, type ConnectionBilling, type ConnectionBillingOutcome, type ConnectionBillingRefusal, type Contact, type ContactField, ContactFields, type ContactStage, ContactStages, type Conversation, type ConversationEntryPoint, type ConversationNote, type ConversationReferral, type ConversationReminder, type CreateAppointment, type CreateAssignmentParams, type CreateBroadcastParams, type CreateBusinessSlotOptions, type CreateCommentRuleParams, type CreateContactParams, type CreateCustomerParams, type CreateDemand, type CreateMessageRuleParams, type CreateOpportunity, type CreateSetupLinkParams, type CreateTemplateParams, type CreateWebhookParams, type CrmActivity, type CrmConversation, type CrmFields, type CrmMetadata, type CrmQuery, type CrmRecord, CrmResource, type CursorList, type CursorPaging, type CursorParams, type Customer, type CustomerBusinessSlot, type DeleteCommentRuleResult, type DeleteMessageRuleResult, type Demand, type DemandFields, type EventList, type EventPaging, type FixedRuleMessage, Inbox, type InboxMutation, type InboxMutationResult, type InboxState, type InboxTools, type InstagramCommentAi, type InstagramCommentAiAutomation, type InstagramCommentAiRepliedEvent, type InstagramCommentAiRun, type InstagramConnection, type InstagramGenericElement, type InstagramIceBreaker, type InstagramInteractiveButton, type InstagramInteractiveButtonPayload, type InstagramInteractiveGenericPayload, type InstagramInteractivePayload, type InstagramPersistentMenuItem, type InstagramTokenStatus, type InteractiveButtonPayload, type InteractiveCtaUrlPayload, type InteractiveHeader, type InteractiveListPayload, type InteractivePayload, type Journey, type JourneyConfig, type JourneyEnrollment, type JourneyQuery, type JourneyRun, type JourneyStep, Journeys, type ListApiLogsParams, type ListBroadcastsParams, type ListChannelAccountsParams, type ListContactsParams, type ListConversationsParams, type ListEventsParams, type ListMessagesParams, type ListPhoneNumbersParams, type ListRecipientsParams, type ListTemplatesParams, type ListWebhookDeliveriesParams, type Me, type MediaAsset, type MediaUploadResult, type Message, type MessageChannel, type MessageContent, type MessageEdit, type MessageRule, type MessageRuleAction, type MessageRuleQrParams, type MessageRuleTrigger, type MessageSort, type MessageSource, type MessageStatus, type MessengerProfile, type MessengerProfileConfig, type MetaCostCategory, type MetaCostDay, type MetaCostEstimate, type MetaCostGroup, type MetaCostReport, type MetaCostSource, type MetaCostSync, type MetaCostUnavailableReason, type MetaCostsParams, type OffsetList, type OffsetMeta, type OffsetParams, type Opportunity, type OpportunityFields, PLAN_ERROR_CODES, type PhoneNumber, type QuickReply, Radar, type RadarEntry, type RadarPage, type RadarQuery, type ReplyConversationParams, type RequestOptions, SavedReplies, type SavedReply, type SavedReplyInput, type SavedReplyQuery, type ScheduleBroadcastParams, type SendAudioParams, type SendDocumentParams, type SendFailureDetails, type SendImageParams, type SendInteractiveParams, type SendLocationParams, type SendMediaParams, type SendOptions, type SendReactionParams, type SendReactionResult, type SendResult, type SendTemplateParams, type SendTextParams, type SendVideoParams, type SetupLink, type StageColor, type StageRule, type StageRuleInput, type Template, type TemplatePayload, type UpdateAppointment, type UpdateBroadcastParams, type UpdateCommentAiParams, type UpdateCommentRuleParams, type UpdateContactParams, type UpdateCustomerParams, type UpdateMessageRuleParams, type UpdateMessengerProfileParams, type UpdatePhoneNumberParams, type UpdateSetupLinkParams, type UpdateWebhookParams, type UploadMediaParams, type User, WEBHOOK_CATEGORIES, type Webhook, type WebhookAuthorizationHeaders, type WebhookCategory, type WebhookChannelHealth, type WebhookChannelHealthStatus, type WebhookDelivery, type WebhookDeliveryStatus, isBusinessPaymentRequired, isFreeCap, isFreeNumberCap, isPlanError };
package/dist/index.js CHANGED
@@ -56,7 +56,8 @@ var BotoZapError = class extends Error {
56
56
  var PLAN_ERROR_CODES = [
57
57
  "plan_restricted",
58
58
  "free_form_limit_reached",
59
- "free_number_cap"
59
+ "free_number_cap",
60
+ "free_cap"
60
61
  ];
61
62
  function isPlanError(error) {
62
63
  return error instanceof BotoZapError && PLAN_ERROR_CODES.includes(error.code);
@@ -64,6 +65,12 @@ function isPlanError(error) {
64
65
  function isBusinessPaymentRequired(error) {
65
66
  return error instanceof BotoZapError && error.code === "business_payment_required";
66
67
  }
68
+ function isFreeCap(error) {
69
+ return error instanceof BotoZapError && error.code === "free_cap";
70
+ }
71
+ function isFreeNumberCap(error) {
72
+ return error instanceof BotoZapError && error.code === "free_number_cap";
73
+ }
67
74
 
68
75
  // src/resources/ai/upload.ts
69
76
  var receipts = /* @__PURE__ */ new WeakMap();
@@ -5253,7 +5260,10 @@ var Customers = class {
5253
5260
  get(id) {
5254
5261
  return this.client.requestItem("GET", `/customers/${enc(id)}`);
5255
5262
  }
5256
- /** Cria um cliente. */
5263
+ /**
5264
+ * Cria um cliente. No plano Free, que permite 1 Cliente (com canal ou não), o
5265
+ * segundo responde 402 `free_cap` (veja `isFreeCap`).
5266
+ */
5257
5267
  create(params) {
5258
5268
  return this.client.requestItem("POST", "/customers", {
5259
5269
  body: params
@@ -5281,7 +5291,8 @@ var Customers = class {
5281
5291
  * Cria um link de setup sob um cliente (expira em 30 dias). Envie a `url`
5282
5292
  * devolvida ao Cliente; veja em {@link CreateSetupLinkParams} como funcionam
5283
5293
  * os redirecionamentos. URL de redirecionamento inválida lança
5284
- * `BotoZapError` com `code: "invalid_redirect_url"` (422).
5294
+ * `BotoZapError` com `code: "invalid_redirect_url"` (422); canal inválido,
5295
+ * `code: "invalid_channel"` (422).
5285
5296
  */
5286
5297
  createSetupLink(customerId, params = {}) {
5287
5298
  return this.client.requestItem(
@@ -5816,11 +5827,18 @@ var ChannelAccounts = class {
5816
5827
  getMessageRule(channelAccountId, ruleId) {
5817
5828
  return this.client.requestItem("GET", messageRulesPath(channelAccountId, ruleId));
5818
5829
  }
5819
- /** Cria uma Regra de mensagem. message-rules:write. */
5830
+ /**
5831
+ * Cria uma Regra de mensagem. message-rules:write. Fora do plano (Free)
5832
+ * responde 403 `plan_restricted`.
5833
+ */
5820
5834
  createMessageRule(channelAccountId, params) {
5821
5835
  return this.client.requestItem("POST", messageRulesPath(channelAccountId), { body: params });
5822
5836
  }
5823
- /** PATCH parcial; a API valida o estado final. message-rules:write. */
5837
+ /**
5838
+ * PATCH parcial; a API valida o estado final. message-rules:write. No Free,
5839
+ * só `{ is_active: false }` (pausar) passa; o resto responde 403
5840
+ * `plan_restricted`.
5841
+ */
5824
5842
  updateMessageRule(channelAccountId, ruleId, params) {
5825
5843
  return this.client.requestItem("PATCH", messageRulesPath(channelAccountId, ruleId), { body: params });
5826
5844
  }
@@ -5832,7 +5850,11 @@ var ChannelAccounts = class {
5832
5850
  getMessengerProfile(channelAccountId) {
5833
5851
  return this.client.requestItem("GET", profilePath(channelAccountId));
5834
5852
  }
5835
- /** Salva/aplica apenas as seções enviadas. messenger-profile:write; sem sandbox. */
5853
+ /**
5854
+ * Salva/aplica apenas as seções enviadas. messenger-profile:write; sem
5855
+ * sandbox. No Free, só remover seções passa; salvar conteúdo responde 403
5856
+ * `plan_restricted`.
5857
+ */
5836
5858
  updateMessengerProfile(channelAccountId, params) {
5837
5859
  return this.client.requestItem("PATCH", profilePath(channelAccountId), { body: params });
5838
5860
  }
@@ -5840,7 +5862,11 @@ var ChannelAccounts = class {
5840
5862
  deleteMessengerProfile(channelAccountId) {
5841
5863
  return this.client.requestItem("DELETE", profilePath(channelAccountId));
5842
5864
  }
5843
- /** Verifica/reaplica explicitamente o desejado salvo. messenger-profile:write. */
5865
+ /**
5866
+ * Verifica/reaplica explicitamente o desejado salvo. messenger-profile:write.
5867
+ * No Free, reaplicar uma configuração com conteúdo responde 403
5868
+ * `plan_restricted`.
5869
+ */
5844
5870
  syncMessengerProfile(channelAccountId) {
5845
5871
  return this.client.requestItem("POST", `${profilePath(channelAccountId)}/sync`);
5846
5872
  }
@@ -6336,6 +6362,8 @@ export {
6336
6362
  SavedReplies,
6337
6363
  WEBHOOK_CATEGORIES,
6338
6364
  isBusinessPaymentRequired,
6365
+ isFreeCap,
6366
+ isFreeNumberCap,
6339
6367
  isPlanError
6340
6368
  };
6341
6369
  //# sourceMappingURL=index.js.map