@botozap/sdk 0.16.0 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/README.md +42 -0
- package/dist/index.cjs +52 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +152 -5
- package/dist/index.d.ts +152 -5
- package/dist/index.js +51 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -115,9 +115,24 @@ interface OffsetParams {
|
|
|
115
115
|
per_page?: number;
|
|
116
116
|
}
|
|
117
117
|
/** Cliente (customer) da sua conta. */
|
|
118
|
+
/** Slot adicional que o Cliente ocupa (ver `billing.get()`). */
|
|
119
|
+
interface CustomerBusinessSlot {
|
|
120
|
+
slot_id: string;
|
|
121
|
+
/**
|
|
122
|
+
* `true` quando o negócio está pausado porque a fatura do slot venceu há
|
|
123
|
+
* mais de 7 dias. Envios respondem 402 `business_payment_required` até o
|
|
124
|
+
* pagamento.
|
|
125
|
+
*/
|
|
126
|
+
paused: boolean;
|
|
127
|
+
}
|
|
118
128
|
interface Customer {
|
|
119
129
|
id: string;
|
|
120
130
|
name?: string;
|
|
131
|
+
/**
|
|
132
|
+
* Slot adicional ocupado pelo Cliente; `null` quando ele está no que o plano
|
|
133
|
+
* inclui. Ausente em servidores antigos.
|
|
134
|
+
*/
|
|
135
|
+
business_slot?: CustomerBusinessSlot | null;
|
|
121
136
|
[key: string]: unknown;
|
|
122
137
|
}
|
|
123
138
|
/**
|
|
@@ -455,7 +470,10 @@ interface SetupLink {
|
|
|
455
470
|
whatsapp_setup_status: string;
|
|
456
471
|
url: string;
|
|
457
472
|
allowed_connection_types: string[];
|
|
458
|
-
/**
|
|
473
|
+
/**
|
|
474
|
+
* Legado: `null` em links novos. A página do link é sempre em português,
|
|
475
|
+
* qualquer que seja o valor.
|
|
476
|
+
*/
|
|
459
477
|
language: string | null;
|
|
460
478
|
/**
|
|
461
479
|
* Destino depois de concluir; recebe `setup_link_id` e `status=completed`
|
|
@@ -473,8 +491,37 @@ interface SetupLink {
|
|
|
473
491
|
expires_at: string | null;
|
|
474
492
|
created_at: string;
|
|
475
493
|
updated_at: string;
|
|
494
|
+
/**
|
|
495
|
+
* O que acontece na cobrança quando o Cliente conectar (conferência só de
|
|
496
|
+
* leitura). `null` quando não deu para conferir agora; ausente em servidores
|
|
497
|
+
* antigos.
|
|
498
|
+
*/
|
|
499
|
+
connection_billing?: ConnectionBilling | null;
|
|
476
500
|
[key: string]: unknown;
|
|
477
501
|
}
|
|
502
|
+
/**
|
|
503
|
+
* Resultado previsto da conexão: `included` (entra no que o plano inclui),
|
|
504
|
+
* `occupies_slot` (usa um slot vazio), `creates_slot` (compra um slot novo de
|
|
505
|
+
* R$ 47/mês) ou `refused` (a conexão será recusada; veja `reason`).
|
|
506
|
+
*/
|
|
507
|
+
type ConnectionBillingOutcome = "included" | "occupies_slot" | "creates_slot" | "refused" | (string & {});
|
|
508
|
+
/**
|
|
509
|
+
* Por que a conexão será recusada: `free_cap` (Free ou teste: assine o plano),
|
|
510
|
+
* `slot_limit` (já há 2 slots com fatura em aberto: pague uma),
|
|
511
|
+
* `billing_customer_required` (conta sem cadastro de cobrança: fale com o
|
|
512
|
+
* suporte) ou `capacity_required` (compre um slot antes de conectar).
|
|
513
|
+
*/
|
|
514
|
+
type ConnectionBillingRefusal = "free_cap" | "slot_limit" | "billing_customer_required" | "capacity_required" | (string & {});
|
|
515
|
+
/** Cobrança prevista para a conexão de um link de setup. */
|
|
516
|
+
interface ConnectionBilling {
|
|
517
|
+
outcome: ConnectionBillingOutcome;
|
|
518
|
+
/** 4700 em `creates_slot`; `null` nos demais. */
|
|
519
|
+
amount_cents: number | null;
|
|
520
|
+
/** Preenchido só em `refused`. */
|
|
521
|
+
reason: ConnectionBillingRefusal | null;
|
|
522
|
+
/** Texto em português para mostrar ao usuário. */
|
|
523
|
+
message: string;
|
|
524
|
+
}
|
|
478
525
|
|
|
479
526
|
/** Public /api/v1/ai contracts. Revisions are opaque strings unless the endpoint explicitly uses a number. */
|
|
480
527
|
type AiProvider = "anthropic" | "openai" | "google" | "openrouter" | "deepseek" | "xai";
|
|
@@ -3841,7 +3888,10 @@ interface CreateSetupLinkParams {
|
|
|
3841
3888
|
* ignorados.
|
|
3842
3889
|
*/
|
|
3843
3890
|
allowed_connection_types?: string[];
|
|
3844
|
-
/**
|
|
3891
|
+
/**
|
|
3892
|
+
* Aceito por compatibilidade e ignorado: a página do link é sempre em
|
|
3893
|
+
* português (o link volta com `language: null`).
|
|
3894
|
+
*/
|
|
3845
3895
|
language?: string;
|
|
3846
3896
|
/**
|
|
3847
3897
|
* Destino depois de concluir (`status=completed`). Precisa ser `https://`,
|
|
@@ -4849,6 +4899,90 @@ declare class Usage {
|
|
|
4849
4899
|
metaCosts(params?: MetaCostsParams): Promise<MetaCostReport>;
|
|
4850
4900
|
}
|
|
4851
4901
|
|
|
4902
|
+
/**
|
|
4903
|
+
* Plano da Conta: `paid` (plano pago), `free`, `trial` (teste grátis) ou
|
|
4904
|
+
* `courtesy` (conta cortesia ou interna, sem cobrança). Valores novos podem surgir.
|
|
4905
|
+
*/
|
|
4906
|
+
type BillingPlan = "paid" | "free" | "trial" | "courtesy" | (string & {});
|
|
4907
|
+
/**
|
|
4908
|
+
* Slot adicional: cada negócio além do que o plano inclui ocupa um slot com
|
|
4909
|
+
* assinatura própria (R$ 47/mês).
|
|
4910
|
+
*/
|
|
4911
|
+
interface BusinessSlot {
|
|
4912
|
+
id: string;
|
|
4913
|
+
/** `open` (ativo) ou `canceled`. */
|
|
4914
|
+
status: "open" | "canceled" | (string & {});
|
|
4915
|
+
/** Cliente que ocupa o slot; `null` quando o slot está vazio. */
|
|
4916
|
+
customer_id: string | null;
|
|
4917
|
+
customer_name: string | null;
|
|
4918
|
+
/** Valor mensal em centavos (4700). */
|
|
4919
|
+
amount_cents: number;
|
|
4920
|
+
/** `true` quando a fatura atual do slot está paga. */
|
|
4921
|
+
paid: boolean;
|
|
4922
|
+
/** Vencimento em aberto (`YYYY-MM-DD`). */
|
|
4923
|
+
next_due_date: string;
|
|
4924
|
+
/** Link da fatura; `null` enquanto ainda não está disponível. */
|
|
4925
|
+
invoice_url: string | null;
|
|
4926
|
+
/**
|
|
4927
|
+
* `true` quando o negócio que ocupa o slot está pausado porque a fatura
|
|
4928
|
+
* venceu há mais de 7 dias. Pagar libera na hora.
|
|
4929
|
+
*/
|
|
4930
|
+
paused: boolean;
|
|
4931
|
+
/** ISO 8601. */
|
|
4932
|
+
created_at: string;
|
|
4933
|
+
}
|
|
4934
|
+
/** Resposta de `GET /v1/billing`: plano da Conta e slots adicionais. */
|
|
4935
|
+
interface Billing {
|
|
4936
|
+
plan: BillingPlan;
|
|
4937
|
+
/** Negócios incluídos no plano; `null` = sem limite. */
|
|
4938
|
+
included_businesses: number | null;
|
|
4939
|
+
/** Negócios extras do contrato antigo (não usam slot). */
|
|
4940
|
+
legacy_extra_businesses: number;
|
|
4941
|
+
/** Valor de cada slot em centavos (4700). */
|
|
4942
|
+
slot_amount_cents: number;
|
|
4943
|
+
/** `true` quando dá para comprar slot (plano pago com cadastro de cobrança). */
|
|
4944
|
+
can_add_slot: boolean;
|
|
4945
|
+
/** Slots ativos, dos mais antigos aos mais novos. */
|
|
4946
|
+
slots: BusinessSlot[];
|
|
4947
|
+
}
|
|
4948
|
+
/** Opções de {@link BillingSlots.create}. */
|
|
4949
|
+
interface CreateBusinessSlotOptions {
|
|
4950
|
+
/**
|
|
4951
|
+
* Chave da compra (8 a 200 caracteres ASCII, sem espaço). Repetir com a
|
|
4952
|
+
* mesma chave devolve o mesmo slot em vez de comprar outro. Sem ela, cada
|
|
4953
|
+
* chamada compra um slot.
|
|
4954
|
+
*/
|
|
4955
|
+
idempotencyKey?: string;
|
|
4956
|
+
}
|
|
4957
|
+
/** Slots adicionais (`/v1/billing/slots`). */
|
|
4958
|
+
declare class BillingSlots {
|
|
4959
|
+
private readonly client;
|
|
4960
|
+
constructor(client: BotoZap);
|
|
4961
|
+
/**
|
|
4962
|
+
* Compra um slot vazio: gera cobrança de R$ 47/mês. Scope `billing:write`.
|
|
4963
|
+
* `invoice_url` pode vir `null`; a fatura chega em instantes em
|
|
4964
|
+
* {@link BillingResource.get}. Recusas: 402 `plan_required` (Free ou teste: assine o
|
|
4965
|
+
* plano), 402 `slot_limit` (já há 2 slots com fatura em aberto: pague uma),
|
|
4966
|
+
* 402 `billing_customer_required` (conta sem cadastro de cobrança: fale com o
|
|
4967
|
+
* suporte), 422 `invalid_idempotency_key`.
|
|
4968
|
+
*/
|
|
4969
|
+
create(options?: CreateBusinessSlotOptions): Promise<BusinessSlot>;
|
|
4970
|
+
/**
|
|
4971
|
+
* Cancela um slot vazio, sem reembolso. Responde 204, também quando o slot
|
|
4972
|
+
* já estava cancelado. Slot ocupado responde 409 `slot_in_use`: desconecte o
|
|
4973
|
+
* negócio antes. Scope `billing:write`.
|
|
4974
|
+
*/
|
|
4975
|
+
cancel(id: string): Promise<void>;
|
|
4976
|
+
}
|
|
4977
|
+
/** Plano da Conta e slots adicionais (`/v1/billing`). Só chave de API. */
|
|
4978
|
+
declare class BillingResource {
|
|
4979
|
+
private readonly client;
|
|
4980
|
+
readonly slots: BillingSlots;
|
|
4981
|
+
constructor(client: BotoZap);
|
|
4982
|
+
/** Plano, negócios incluídos e slots ativos. Scope `billing:read`. */
|
|
4983
|
+
get(): Promise<Billing>;
|
|
4984
|
+
}
|
|
4985
|
+
|
|
4852
4986
|
/** Membros da conta (somente leitura via API). */
|
|
4853
4987
|
declare class Users {
|
|
4854
4988
|
private readonly client;
|
|
@@ -4963,6 +5097,8 @@ declare class BotoZap {
|
|
|
4963
5097
|
readonly media: Media;
|
|
4964
5098
|
readonly events: Events;
|
|
4965
5099
|
readonly usage: Usage;
|
|
5100
|
+
/** Plano da Conta e slots adicionais (só chave de API). */
|
|
5101
|
+
readonly billing: BillingResource;
|
|
4966
5102
|
readonly users: Users;
|
|
4967
5103
|
readonly apiLogs: ApiLogs;
|
|
4968
5104
|
readonly webhookDeliveries: WebhookDeliveries;
|
|
@@ -5023,12 +5159,23 @@ declare class BotoZapError extends Error {
|
|
|
5023
5159
|
* (429, limite 1:1 do Free). Plano: `plan_restricted` (403, escritas de IA,
|
|
5024
5160
|
* Agenda, Calendário e Jornadas fora do plano), `free_number_cap` (402, setup
|
|
5025
5161
|
* além do teto de Números do Free). IA: `provider_not_enabled` (422, credencial
|
|
5026
|
-
* nova de provedor com `accepts_new_credentials: false`).
|
|
5162
|
+
* nova de provedor com `accepts_new_credentials: false`). Cobrança:
|
|
5163
|
+
* `business_payment_required` (402 no envio: o negócio está pausado porque a
|
|
5164
|
+
* fatura do slot venceu há mais de 7 dias; pague e envie de novo),
|
|
5165
|
+
* `plan_required` (402, comprar slot no Free ou teste), `slot_limit` (402, já há
|
|
5166
|
+
* 2 slots com fatura em aberto), `billing_customer_required` (402, conta sem
|
|
5167
|
+
* cadastro de cobrança), `slot_in_use` (409, cancelar slot ocupado).
|
|
5027
5168
|
*/
|
|
5028
|
-
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" | (string & {});
|
|
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 & {});
|
|
5029
5170
|
/** Códigos que indicam limite ou restrição do plano contratado. */
|
|
5030
5171
|
declare const PLAN_ERROR_CODES: readonly ["plan_restricted", "free_form_limit_reached", "free_number_cap"];
|
|
5031
5172
|
/** True quando o erro é recusa por plano (upgrade resolve; retry não). */
|
|
5032
5173
|
declare function isPlanError(error: unknown): error is BotoZapError;
|
|
5174
|
+
/**
|
|
5175
|
+
* True quando o envio foi recusado porque o negócio está pausado: a fatura do
|
|
5176
|
+
* slot venceu há mais de 7 dias. Pagar a fatura libera na hora; repetir antes
|
|
5177
|
+
* disso não adianta. Não é recusa de plano ({@link isPlanError} é `false`).
|
|
5178
|
+
*/
|
|
5179
|
+
declare function isBusinessPaymentRequired(error: unknown): error is BotoZapError;
|
|
5033
5180
|
|
|
5034
|
-
export { AI_CONFIGURABLE_PURPOSES, AI_CREDENTIAL_PROVIDERS, AI_OPERATIONS, AI_PURPOSES, type AddRecipientsError, type AddRecipientsResult, AgendaConfiguration, AgendaExceptions, type AgendaRecord, Ai, type AiAgent, type AiAgentConfig, type AiAgentCoverage, type AiAgentInput, type AiAgentVersion, AiAgentsResource, type AiAlert, type AiAlertBulkFilters, type AiAlertListItem, AiAlertsResource, type AiArtifactUploadInput, type AiAudioPricing, type AiBinding, type AiBindingTarget, type AiBudget, type AiBudgetInput, type AiCapabilitySignal, type AiCapabilityUsage, type AiCapabilityUsageList, type AiCase, type AiCaseChat, type AiCaseEvent, type AiCaseKind, type AiCaseReply, type AiCaseReplyInput, type AiCaseSource, AiCasesResource, type AiCatalogItems, type AiCatalogModel, type AiCatalogProduct, type AiCatalogSyncInput, type AiCatalogSyncResult, type AiChannelGate, type AiCommercialDecision, type AiCommercialEffect, type AiCommercialJob, type AiCommercialProposal, AiCommercialProposalsResource, type AiCommercialRequest, type AiCommercialSettings, type AiConfigurablePurpose, type AiContactAuthorization, type AiConversationCheckpoint, type AiCredential, AiCredentialsResource, type AiDraftResult, type AiEligibilityOverview, AiEligibilityResource, type AiEligibilitySettings, type AiEnrollment, type AiEvolution, AiEvolutionResource, type AiEvolutionSource, type AiExecution, type AiExecutionCitations, type AiExecutionSecurity, AiExecutionsResource, type AiField, type AiFlow, type AiFlowGraph, type AiFlowInput, type AiFlowSettings, type AiFlowVersion, type AiFollowupEffect, type AiFollowupEvent, AiFollowupFlowsResource, type AiFollowupPromise, type AiFollowupPromiseDetail, type AiFollowupPromiseStatus, type AiFollowupQueueFilters, type AiFollowupQueuePage, type AiFollowupQueueRow, AiFollowupsResource, type AiGateMode, type AiInference, type AiInferenceOrigin, type AiInferenceOutcome, type AiInferenceSummary, AiInferencesResource, type AiKnowledgeChunk, type AiKnowledgeCitation, type AiKnowledgeConversation, type AiKnowledgeHit, type AiKnowledgeImport, type AiKnowledgePreview, AiKnowledgeResource, type AiKnowledgeSearchDiagnostics, type AiKnowledgeSource, type AiMemory, type AiMemoryEntry, type AiMemoryEntryEvent, AiMemoryResource, type AiModelCatalogSnapshot, type AiModelCatalogSync, type AiNoticeCheck, type AiNoticeEffect, type AiNoticeField, type AiNoticeJob, type AiNoticeSettings, AiNoticesResource, type AiOperation, type AiOperatorMetrics, AiOperatorResource, type AiPage, type AiPlatformSkill, type AiPlatformSkillComposition, type AiPreparedUpload, type AiProposal, AiProposalsResource, type AiProvider, type AiProviderInfo, type AiProviderModel, AiProvidersResource, type AiPurpose, type AiRate, type AiRateInput, type AiRecord, type AiRevision, type AiRouter, type AiRouterConfig, type AiRouterTest, AiRoutersResource, type AiScope, type AiSkill, type AiSkillInput, type AiSkillNearMiss, type AiSkillVersion, AiSkillsResource, type AiSourceKind, type AiStyleAdjustment, type AiStyleAdjustmentId, AiStyleAdjustmentsResource, type AiToolId, type AiTurnPromise, type AiUploadReceiptCallback, AiUploadsResource, AiUsageResource, type AiUsageSummary, type AiUsageTokens, type AiWindow, type ApiLog, type Appointment, type AppointmentAvailability, type AppointmentExceptionInput, type AppointmentFields, type AppointmentHistory, type AppointmentQuery, type AppointmentScheduleInput, type AppointmentServiceInput, type AppointmentStatus, Appointments, type Assignment, type AvailabilityQuery, BotoZap, BotoZapError, type BotoZapErrorCode, type BotoZapEvent, type BotoZapOptions, type Broadcast, type BroadcastRecipient, type BroadcastRecipientInput, Calendar, type CalendarConnection, type CalendarJob, type CalendarSelection, type ChannelAccount, type ChannelAccountRef, ChannelAccounts, type CommentAiDeliveryStatus, type CommentRule, type CommentRuleCounters, type CommentRuleMetrics, type CommentRuleMetricsParams, type CommentRuleStatus, 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 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 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, isPlanError };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -115,9 +115,24 @@ interface OffsetParams {
|
|
|
115
115
|
per_page?: number;
|
|
116
116
|
}
|
|
117
117
|
/** Cliente (customer) da sua conta. */
|
|
118
|
+
/** Slot adicional que o Cliente ocupa (ver `billing.get()`). */
|
|
119
|
+
interface CustomerBusinessSlot {
|
|
120
|
+
slot_id: string;
|
|
121
|
+
/**
|
|
122
|
+
* `true` quando o negócio está pausado porque a fatura do slot venceu há
|
|
123
|
+
* mais de 7 dias. Envios respondem 402 `business_payment_required` até o
|
|
124
|
+
* pagamento.
|
|
125
|
+
*/
|
|
126
|
+
paused: boolean;
|
|
127
|
+
}
|
|
118
128
|
interface Customer {
|
|
119
129
|
id: string;
|
|
120
130
|
name?: string;
|
|
131
|
+
/**
|
|
132
|
+
* Slot adicional ocupado pelo Cliente; `null` quando ele está no que o plano
|
|
133
|
+
* inclui. Ausente em servidores antigos.
|
|
134
|
+
*/
|
|
135
|
+
business_slot?: CustomerBusinessSlot | null;
|
|
121
136
|
[key: string]: unknown;
|
|
122
137
|
}
|
|
123
138
|
/**
|
|
@@ -455,7 +470,10 @@ interface SetupLink {
|
|
|
455
470
|
whatsapp_setup_status: string;
|
|
456
471
|
url: string;
|
|
457
472
|
allowed_connection_types: string[];
|
|
458
|
-
/**
|
|
473
|
+
/**
|
|
474
|
+
* Legado: `null` em links novos. A página do link é sempre em português,
|
|
475
|
+
* qualquer que seja o valor.
|
|
476
|
+
*/
|
|
459
477
|
language: string | null;
|
|
460
478
|
/**
|
|
461
479
|
* Destino depois de concluir; recebe `setup_link_id` e `status=completed`
|
|
@@ -473,8 +491,37 @@ interface SetupLink {
|
|
|
473
491
|
expires_at: string | null;
|
|
474
492
|
created_at: string;
|
|
475
493
|
updated_at: string;
|
|
494
|
+
/**
|
|
495
|
+
* O que acontece na cobrança quando o Cliente conectar (conferência só de
|
|
496
|
+
* leitura). `null` quando não deu para conferir agora; ausente em servidores
|
|
497
|
+
* antigos.
|
|
498
|
+
*/
|
|
499
|
+
connection_billing?: ConnectionBilling | null;
|
|
476
500
|
[key: string]: unknown;
|
|
477
501
|
}
|
|
502
|
+
/**
|
|
503
|
+
* Resultado previsto da conexão: `included` (entra no que o plano inclui),
|
|
504
|
+
* `occupies_slot` (usa um slot vazio), `creates_slot` (compra um slot novo de
|
|
505
|
+
* R$ 47/mês) ou `refused` (a conexão será recusada; veja `reason`).
|
|
506
|
+
*/
|
|
507
|
+
type ConnectionBillingOutcome = "included" | "occupies_slot" | "creates_slot" | "refused" | (string & {});
|
|
508
|
+
/**
|
|
509
|
+
* Por que a conexão será recusada: `free_cap` (Free ou teste: assine o plano),
|
|
510
|
+
* `slot_limit` (já há 2 slots com fatura em aberto: pague uma),
|
|
511
|
+
* `billing_customer_required` (conta sem cadastro de cobrança: fale com o
|
|
512
|
+
* suporte) ou `capacity_required` (compre um slot antes de conectar).
|
|
513
|
+
*/
|
|
514
|
+
type ConnectionBillingRefusal = "free_cap" | "slot_limit" | "billing_customer_required" | "capacity_required" | (string & {});
|
|
515
|
+
/** Cobrança prevista para a conexão de um link de setup. */
|
|
516
|
+
interface ConnectionBilling {
|
|
517
|
+
outcome: ConnectionBillingOutcome;
|
|
518
|
+
/** 4700 em `creates_slot`; `null` nos demais. */
|
|
519
|
+
amount_cents: number | null;
|
|
520
|
+
/** Preenchido só em `refused`. */
|
|
521
|
+
reason: ConnectionBillingRefusal | null;
|
|
522
|
+
/** Texto em português para mostrar ao usuário. */
|
|
523
|
+
message: string;
|
|
524
|
+
}
|
|
478
525
|
|
|
479
526
|
/** Public /api/v1/ai contracts. Revisions are opaque strings unless the endpoint explicitly uses a number. */
|
|
480
527
|
type AiProvider = "anthropic" | "openai" | "google" | "openrouter" | "deepseek" | "xai";
|
|
@@ -3841,7 +3888,10 @@ interface CreateSetupLinkParams {
|
|
|
3841
3888
|
* ignorados.
|
|
3842
3889
|
*/
|
|
3843
3890
|
allowed_connection_types?: string[];
|
|
3844
|
-
/**
|
|
3891
|
+
/**
|
|
3892
|
+
* Aceito por compatibilidade e ignorado: a página do link é sempre em
|
|
3893
|
+
* português (o link volta com `language: null`).
|
|
3894
|
+
*/
|
|
3845
3895
|
language?: string;
|
|
3846
3896
|
/**
|
|
3847
3897
|
* Destino depois de concluir (`status=completed`). Precisa ser `https://`,
|
|
@@ -4849,6 +4899,90 @@ declare class Usage {
|
|
|
4849
4899
|
metaCosts(params?: MetaCostsParams): Promise<MetaCostReport>;
|
|
4850
4900
|
}
|
|
4851
4901
|
|
|
4902
|
+
/**
|
|
4903
|
+
* Plano da Conta: `paid` (plano pago), `free`, `trial` (teste grátis) ou
|
|
4904
|
+
* `courtesy` (conta cortesia ou interna, sem cobrança). Valores novos podem surgir.
|
|
4905
|
+
*/
|
|
4906
|
+
type BillingPlan = "paid" | "free" | "trial" | "courtesy" | (string & {});
|
|
4907
|
+
/**
|
|
4908
|
+
* Slot adicional: cada negócio além do que o plano inclui ocupa um slot com
|
|
4909
|
+
* assinatura própria (R$ 47/mês).
|
|
4910
|
+
*/
|
|
4911
|
+
interface BusinessSlot {
|
|
4912
|
+
id: string;
|
|
4913
|
+
/** `open` (ativo) ou `canceled`. */
|
|
4914
|
+
status: "open" | "canceled" | (string & {});
|
|
4915
|
+
/** Cliente que ocupa o slot; `null` quando o slot está vazio. */
|
|
4916
|
+
customer_id: string | null;
|
|
4917
|
+
customer_name: string | null;
|
|
4918
|
+
/** Valor mensal em centavos (4700). */
|
|
4919
|
+
amount_cents: number;
|
|
4920
|
+
/** `true` quando a fatura atual do slot está paga. */
|
|
4921
|
+
paid: boolean;
|
|
4922
|
+
/** Vencimento em aberto (`YYYY-MM-DD`). */
|
|
4923
|
+
next_due_date: string;
|
|
4924
|
+
/** Link da fatura; `null` enquanto ainda não está disponível. */
|
|
4925
|
+
invoice_url: string | null;
|
|
4926
|
+
/**
|
|
4927
|
+
* `true` quando o negócio que ocupa o slot está pausado porque a fatura
|
|
4928
|
+
* venceu há mais de 7 dias. Pagar libera na hora.
|
|
4929
|
+
*/
|
|
4930
|
+
paused: boolean;
|
|
4931
|
+
/** ISO 8601. */
|
|
4932
|
+
created_at: string;
|
|
4933
|
+
}
|
|
4934
|
+
/** Resposta de `GET /v1/billing`: plano da Conta e slots adicionais. */
|
|
4935
|
+
interface Billing {
|
|
4936
|
+
plan: BillingPlan;
|
|
4937
|
+
/** Negócios incluídos no plano; `null` = sem limite. */
|
|
4938
|
+
included_businesses: number | null;
|
|
4939
|
+
/** Negócios extras do contrato antigo (não usam slot). */
|
|
4940
|
+
legacy_extra_businesses: number;
|
|
4941
|
+
/** Valor de cada slot em centavos (4700). */
|
|
4942
|
+
slot_amount_cents: number;
|
|
4943
|
+
/** `true` quando dá para comprar slot (plano pago com cadastro de cobrança). */
|
|
4944
|
+
can_add_slot: boolean;
|
|
4945
|
+
/** Slots ativos, dos mais antigos aos mais novos. */
|
|
4946
|
+
slots: BusinessSlot[];
|
|
4947
|
+
}
|
|
4948
|
+
/** Opções de {@link BillingSlots.create}. */
|
|
4949
|
+
interface CreateBusinessSlotOptions {
|
|
4950
|
+
/**
|
|
4951
|
+
* Chave da compra (8 a 200 caracteres ASCII, sem espaço). Repetir com a
|
|
4952
|
+
* mesma chave devolve o mesmo slot em vez de comprar outro. Sem ela, cada
|
|
4953
|
+
* chamada compra um slot.
|
|
4954
|
+
*/
|
|
4955
|
+
idempotencyKey?: string;
|
|
4956
|
+
}
|
|
4957
|
+
/** Slots adicionais (`/v1/billing/slots`). */
|
|
4958
|
+
declare class BillingSlots {
|
|
4959
|
+
private readonly client;
|
|
4960
|
+
constructor(client: BotoZap);
|
|
4961
|
+
/**
|
|
4962
|
+
* Compra um slot vazio: gera cobrança de R$ 47/mês. Scope `billing:write`.
|
|
4963
|
+
* `invoice_url` pode vir `null`; a fatura chega em instantes em
|
|
4964
|
+
* {@link BillingResource.get}. Recusas: 402 `plan_required` (Free ou teste: assine o
|
|
4965
|
+
* plano), 402 `slot_limit` (já há 2 slots com fatura em aberto: pague uma),
|
|
4966
|
+
* 402 `billing_customer_required` (conta sem cadastro de cobrança: fale com o
|
|
4967
|
+
* suporte), 422 `invalid_idempotency_key`.
|
|
4968
|
+
*/
|
|
4969
|
+
create(options?: CreateBusinessSlotOptions): Promise<BusinessSlot>;
|
|
4970
|
+
/**
|
|
4971
|
+
* Cancela um slot vazio, sem reembolso. Responde 204, também quando o slot
|
|
4972
|
+
* já estava cancelado. Slot ocupado responde 409 `slot_in_use`: desconecte o
|
|
4973
|
+
* negócio antes. Scope `billing:write`.
|
|
4974
|
+
*/
|
|
4975
|
+
cancel(id: string): Promise<void>;
|
|
4976
|
+
}
|
|
4977
|
+
/** Plano da Conta e slots adicionais (`/v1/billing`). Só chave de API. */
|
|
4978
|
+
declare class BillingResource {
|
|
4979
|
+
private readonly client;
|
|
4980
|
+
readonly slots: BillingSlots;
|
|
4981
|
+
constructor(client: BotoZap);
|
|
4982
|
+
/** Plano, negócios incluídos e slots ativos. Scope `billing:read`. */
|
|
4983
|
+
get(): Promise<Billing>;
|
|
4984
|
+
}
|
|
4985
|
+
|
|
4852
4986
|
/** Membros da conta (somente leitura via API). */
|
|
4853
4987
|
declare class Users {
|
|
4854
4988
|
private readonly client;
|
|
@@ -4963,6 +5097,8 @@ declare class BotoZap {
|
|
|
4963
5097
|
readonly media: Media;
|
|
4964
5098
|
readonly events: Events;
|
|
4965
5099
|
readonly usage: Usage;
|
|
5100
|
+
/** Plano da Conta e slots adicionais (só chave de API). */
|
|
5101
|
+
readonly billing: BillingResource;
|
|
4966
5102
|
readonly users: Users;
|
|
4967
5103
|
readonly apiLogs: ApiLogs;
|
|
4968
5104
|
readonly webhookDeliveries: WebhookDeliveries;
|
|
@@ -5023,12 +5159,23 @@ declare class BotoZapError extends Error {
|
|
|
5023
5159
|
* (429, limite 1:1 do Free). Plano: `plan_restricted` (403, escritas de IA,
|
|
5024
5160
|
* Agenda, Calendário e Jornadas fora do plano), `free_number_cap` (402, setup
|
|
5025
5161
|
* além do teto de Números do Free). IA: `provider_not_enabled` (422, credencial
|
|
5026
|
-
* nova de provedor com `accepts_new_credentials: false`).
|
|
5162
|
+
* nova de provedor com `accepts_new_credentials: false`). Cobrança:
|
|
5163
|
+
* `business_payment_required` (402 no envio: o negócio está pausado porque a
|
|
5164
|
+
* fatura do slot venceu há mais de 7 dias; pague e envie de novo),
|
|
5165
|
+
* `plan_required` (402, comprar slot no Free ou teste), `slot_limit` (402, já há
|
|
5166
|
+
* 2 slots com fatura em aberto), `billing_customer_required` (402, conta sem
|
|
5167
|
+
* cadastro de cobrança), `slot_in_use` (409, cancelar slot ocupado).
|
|
5027
5168
|
*/
|
|
5028
|
-
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" | (string & {});
|
|
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 & {});
|
|
5029
5170
|
/** Códigos que indicam limite ou restrição do plano contratado. */
|
|
5030
5171
|
declare const PLAN_ERROR_CODES: readonly ["plan_restricted", "free_form_limit_reached", "free_number_cap"];
|
|
5031
5172
|
/** True quando o erro é recusa por plano (upgrade resolve; retry não). */
|
|
5032
5173
|
declare function isPlanError(error: unknown): error is BotoZapError;
|
|
5174
|
+
/**
|
|
5175
|
+
* True quando o envio foi recusado porque o negócio está pausado: a fatura do
|
|
5176
|
+
* slot venceu há mais de 7 dias. Pagar a fatura libera na hora; repetir antes
|
|
5177
|
+
* disso não adianta. Não é recusa de plano ({@link isPlanError} é `false`).
|
|
5178
|
+
*/
|
|
5179
|
+
declare function isBusinessPaymentRequired(error: unknown): error is BotoZapError;
|
|
5033
5180
|
|
|
5034
|
-
export { AI_CONFIGURABLE_PURPOSES, AI_CREDENTIAL_PROVIDERS, AI_OPERATIONS, AI_PURPOSES, type AddRecipientsError, type AddRecipientsResult, AgendaConfiguration, AgendaExceptions, type AgendaRecord, Ai, type AiAgent, type AiAgentConfig, type AiAgentCoverage, type AiAgentInput, type AiAgentVersion, AiAgentsResource, type AiAlert, type AiAlertBulkFilters, type AiAlertListItem, AiAlertsResource, type AiArtifactUploadInput, type AiAudioPricing, type AiBinding, type AiBindingTarget, type AiBudget, type AiBudgetInput, type AiCapabilitySignal, type AiCapabilityUsage, type AiCapabilityUsageList, type AiCase, type AiCaseChat, type AiCaseEvent, type AiCaseKind, type AiCaseReply, type AiCaseReplyInput, type AiCaseSource, AiCasesResource, type AiCatalogItems, type AiCatalogModel, type AiCatalogProduct, type AiCatalogSyncInput, type AiCatalogSyncResult, type AiChannelGate, type AiCommercialDecision, type AiCommercialEffect, type AiCommercialJob, type AiCommercialProposal, AiCommercialProposalsResource, type AiCommercialRequest, type AiCommercialSettings, type AiConfigurablePurpose, type AiContactAuthorization, type AiConversationCheckpoint, type AiCredential, AiCredentialsResource, type AiDraftResult, type AiEligibilityOverview, AiEligibilityResource, type AiEligibilitySettings, type AiEnrollment, type AiEvolution, AiEvolutionResource, type AiEvolutionSource, type AiExecution, type AiExecutionCitations, type AiExecutionSecurity, AiExecutionsResource, type AiField, type AiFlow, type AiFlowGraph, type AiFlowInput, type AiFlowSettings, type AiFlowVersion, type AiFollowupEffect, type AiFollowupEvent, AiFollowupFlowsResource, type AiFollowupPromise, type AiFollowupPromiseDetail, type AiFollowupPromiseStatus, type AiFollowupQueueFilters, type AiFollowupQueuePage, type AiFollowupQueueRow, AiFollowupsResource, type AiGateMode, type AiInference, type AiInferenceOrigin, type AiInferenceOutcome, type AiInferenceSummary, AiInferencesResource, type AiKnowledgeChunk, type AiKnowledgeCitation, type AiKnowledgeConversation, type AiKnowledgeHit, type AiKnowledgeImport, type AiKnowledgePreview, AiKnowledgeResource, type AiKnowledgeSearchDiagnostics, type AiKnowledgeSource, type AiMemory, type AiMemoryEntry, type AiMemoryEntryEvent, AiMemoryResource, type AiModelCatalogSnapshot, type AiModelCatalogSync, type AiNoticeCheck, type AiNoticeEffect, type AiNoticeField, type AiNoticeJob, type AiNoticeSettings, AiNoticesResource, type AiOperation, type AiOperatorMetrics, AiOperatorResource, type AiPage, type AiPlatformSkill, type AiPlatformSkillComposition, type AiPreparedUpload, type AiProposal, AiProposalsResource, type AiProvider, type AiProviderInfo, type AiProviderModel, AiProvidersResource, type AiPurpose, type AiRate, type AiRateInput, type AiRecord, type AiRevision, type AiRouter, type AiRouterConfig, type AiRouterTest, AiRoutersResource, type AiScope, type AiSkill, type AiSkillInput, type AiSkillNearMiss, type AiSkillVersion, AiSkillsResource, type AiSourceKind, type AiStyleAdjustment, type AiStyleAdjustmentId, AiStyleAdjustmentsResource, type AiToolId, type AiTurnPromise, type AiUploadReceiptCallback, AiUploadsResource, AiUsageResource, type AiUsageSummary, type AiUsageTokens, type AiWindow, type ApiLog, type Appointment, type AppointmentAvailability, type AppointmentExceptionInput, type AppointmentFields, type AppointmentHistory, type AppointmentQuery, type AppointmentScheduleInput, type AppointmentServiceInput, type AppointmentStatus, Appointments, type Assignment, type AvailabilityQuery, BotoZap, BotoZapError, type BotoZapErrorCode, type BotoZapEvent, type BotoZapOptions, type Broadcast, type BroadcastRecipient, type BroadcastRecipientInput, Calendar, type CalendarConnection, type CalendarJob, type CalendarSelection, type ChannelAccount, type ChannelAccountRef, ChannelAccounts, type CommentAiDeliveryStatus, type CommentRule, type CommentRuleCounters, type CommentRuleMetrics, type CommentRuleMetricsParams, type CommentRuleStatus, 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 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 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, isPlanError };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -61,6 +61,9 @@ var PLAN_ERROR_CODES = [
|
|
|
61
61
|
function isPlanError(error) {
|
|
62
62
|
return error instanceof BotoZapError && PLAN_ERROR_CODES.includes(error.code);
|
|
63
63
|
}
|
|
64
|
+
function isBusinessPaymentRequired(error) {
|
|
65
|
+
return error instanceof BotoZapError && error.code === "business_payment_required";
|
|
66
|
+
}
|
|
64
67
|
|
|
65
68
|
// src/resources/ai/upload.ts
|
|
66
69
|
var receipts = /* @__PURE__ */ new WeakMap();
|
|
@@ -5933,6 +5936,50 @@ var Usage = class {
|
|
|
5933
5936
|
}
|
|
5934
5937
|
};
|
|
5935
5938
|
|
|
5939
|
+
// src/resources/billing.ts
|
|
5940
|
+
function enc8(id) {
|
|
5941
|
+
return encodeURIComponent(id);
|
|
5942
|
+
}
|
|
5943
|
+
var BillingSlots = class {
|
|
5944
|
+
constructor(client) {
|
|
5945
|
+
this.client = client;
|
|
5946
|
+
}
|
|
5947
|
+
client;
|
|
5948
|
+
/**
|
|
5949
|
+
* Compra um slot vazio: gera cobrança de R$ 47/mês. Scope `billing:write`.
|
|
5950
|
+
* `invoice_url` pode vir `null`; a fatura chega em instantes em
|
|
5951
|
+
* {@link BillingResource.get}. Recusas: 402 `plan_required` (Free ou teste: assine o
|
|
5952
|
+
* plano), 402 `slot_limit` (já há 2 slots com fatura em aberto: pague uma),
|
|
5953
|
+
* 402 `billing_customer_required` (conta sem cadastro de cobrança: fale com o
|
|
5954
|
+
* suporte), 422 `invalid_idempotency_key`.
|
|
5955
|
+
*/
|
|
5956
|
+
create(options = {}) {
|
|
5957
|
+
return this.client.requestItem("POST", "/billing/slots", {
|
|
5958
|
+
idempotencyKey: options.idempotencyKey
|
|
5959
|
+
});
|
|
5960
|
+
}
|
|
5961
|
+
/**
|
|
5962
|
+
* Cancela um slot vazio, sem reembolso. Responde 204, também quando o slot
|
|
5963
|
+
* já estava cancelado. Slot ocupado responde 409 `slot_in_use`: desconecte o
|
|
5964
|
+
* negócio antes. Scope `billing:write`.
|
|
5965
|
+
*/
|
|
5966
|
+
cancel(id) {
|
|
5967
|
+
return this.client.request("DELETE", `/billing/slots/${enc8(id)}`);
|
|
5968
|
+
}
|
|
5969
|
+
};
|
|
5970
|
+
var BillingResource = class {
|
|
5971
|
+
constructor(client) {
|
|
5972
|
+
this.client = client;
|
|
5973
|
+
this.slots = new BillingSlots(client);
|
|
5974
|
+
}
|
|
5975
|
+
client;
|
|
5976
|
+
slots;
|
|
5977
|
+
/** Plano, negócios incluídos e slots ativos. Scope `billing:read`. */
|
|
5978
|
+
get() {
|
|
5979
|
+
return this.client.requestItem("GET", "/billing");
|
|
5980
|
+
}
|
|
5981
|
+
};
|
|
5982
|
+
|
|
5936
5983
|
// src/resources/read-only.ts
|
|
5937
5984
|
var Users = class {
|
|
5938
5985
|
constructor(client) {
|
|
@@ -6026,6 +6073,8 @@ var BotoZap = class {
|
|
|
6026
6073
|
media;
|
|
6027
6074
|
events;
|
|
6028
6075
|
usage;
|
|
6076
|
+
/** Plano da Conta e slots adicionais (só chave de API). */
|
|
6077
|
+
billing;
|
|
6029
6078
|
users;
|
|
6030
6079
|
apiLogs;
|
|
6031
6080
|
webhookDeliveries;
|
|
@@ -6069,6 +6118,7 @@ var BotoZap = class {
|
|
|
6069
6118
|
this.media = new Media(this);
|
|
6070
6119
|
this.events = new Events(this);
|
|
6071
6120
|
this.usage = new Usage(this);
|
|
6121
|
+
this.billing = new BillingResource(this);
|
|
6072
6122
|
this.users = new Users(this);
|
|
6073
6123
|
this.apiLogs = new ApiLogs(this);
|
|
6074
6124
|
this.webhookDeliveries = new WebhookDeliveries(this);
|
|
@@ -6285,6 +6335,7 @@ export {
|
|
|
6285
6335
|
Radar,
|
|
6286
6336
|
SavedReplies,
|
|
6287
6337
|
WEBHOOK_CATEGORIES,
|
|
6338
|
+
isBusinessPaymentRequired,
|
|
6288
6339
|
isPlanError
|
|
6289
6340
|
};
|
|
6290
6341
|
//# sourceMappingURL=index.js.map
|