@botozap/sdk 0.13.0 → 0.15.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 +18 -0
- package/README.md +37 -1
- package/dist/index.cjs +30 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +107 -4
- package/dist/index.d.ts +107 -4
- package/dist/index.js +30 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -171,6 +171,12 @@ interface BroadcastRecipient {
|
|
|
171
171
|
[key: string]: unknown;
|
|
172
172
|
}
|
|
173
173
|
interface Contact {
|
|
174
|
+
/** Perfil Instagram, somente leitura; null quando desconhecido. */
|
|
175
|
+
readonly ig_follows_business?: boolean | null;
|
|
176
|
+
readonly ig_followed_by_business?: boolean | null;
|
|
177
|
+
readonly ig_follower_count?: number | null;
|
|
178
|
+
readonly ig_verified?: boolean | null;
|
|
179
|
+
readonly ig_follow_checked_at?: string | null;
|
|
174
180
|
id: string;
|
|
175
181
|
wa_id?: string;
|
|
176
182
|
/** Nome do perfil no canal; a ingestão o sobrescreve a cada inbound. */
|
|
@@ -248,10 +254,41 @@ interface Assignment {
|
|
|
248
254
|
id: string;
|
|
249
255
|
[key: string]: unknown;
|
|
250
256
|
}
|
|
257
|
+
/**
|
|
258
|
+
* Estado de entrega de um canal com falha. `paused` para só esse canal (na 15ª
|
|
259
|
+
* falha seguida); os outros canais do Endpoint seguem recebendo.
|
|
260
|
+
*/
|
|
261
|
+
type WebhookChannelHealthStatus = "degraded" | "paused" | (string & {});
|
|
262
|
+
/** Saúde de entrega por canal (`Webhook.channels_health`): só canais com falha. */
|
|
263
|
+
interface WebhookChannelHealth {
|
|
264
|
+
/** Conta de canal (`channel_account.id`); `null` = eventos sem canal. */
|
|
265
|
+
channel_account_id: string | null;
|
|
266
|
+
health_status: WebhookChannelHealthStatus;
|
|
267
|
+
failure_streak: number;
|
|
268
|
+
next_attempt_at: string | null;
|
|
269
|
+
paused_at: string | null;
|
|
270
|
+
last_success_at: string | null;
|
|
271
|
+
last_failure_at: string | null;
|
|
272
|
+
last_response_code: number | null;
|
|
273
|
+
}
|
|
251
274
|
interface Webhook {
|
|
252
275
|
id: string;
|
|
253
276
|
/** Cliente cujas entregas o endpoint recebe; `null` = todos os da Conta. */
|
|
254
277
|
customer_id?: string | null;
|
|
278
|
+
/**
|
|
279
|
+
* Canais cujos eventos o Endpoint recebe (ids de `channelAccounts.list`, os
|
|
280
|
+
* mesmos de `channel_account.id` nos payloads). `null` = todos os canais.
|
|
281
|
+
* Vazio quando os canais marcados foram excluídos: o Endpoint não recebe
|
|
282
|
+
* eventos até ser reconfigurado.
|
|
283
|
+
*/
|
|
284
|
+
channel_account_ids?: string[] | null;
|
|
285
|
+
/**
|
|
286
|
+
* Saúde por canal, só dos canais com falha (vazio = tudo saudável). A espera,
|
|
287
|
+
* as falhas seguidas e a pausa contam por canal. `health_status` e
|
|
288
|
+
* `failure_streak` do Endpoint resumem o pior canal: `paused` só quando todos
|
|
289
|
+
* os canais com falha estão pausados.
|
|
290
|
+
*/
|
|
291
|
+
channels_health?: WebhookChannelHealth[];
|
|
255
292
|
url: string;
|
|
256
293
|
events?: (WebhookCategory | (string & {}))[];
|
|
257
294
|
active?: boolean;
|
|
@@ -303,8 +340,9 @@ interface BotoZapEvent {
|
|
|
303
340
|
* `instagram.message.received`). No Instagram, `instagram.message.edited`
|
|
304
341
|
* traz o texto novo em `data.edit` e o conteúdo atualizado (com
|
|
305
342
|
* `content.edited`) em `data.message`; `instagram.message.revoked` traz
|
|
306
|
-
* `data.message.revoked_at`, sem o conteúdo apagado.
|
|
307
|
-
*
|
|
343
|
+
* `data.message.revoked_at`, sem o conteúdo apagado.
|
|
344
|
+
* `instagram.message_rule.failed` registra uma falha de automação e pode
|
|
345
|
+
* ter `message_id: null` (referral sem mensagem). Valores novos podem surgir.
|
|
308
346
|
*/
|
|
309
347
|
type: string;
|
|
310
348
|
/**
|
|
@@ -3959,6 +3997,8 @@ declare class Broadcasts {
|
|
|
3959
3997
|
}
|
|
3960
3998
|
|
|
3961
3999
|
interface ListContactsParams extends CursorParams {
|
|
4000
|
+
/** Só valores conhecidos; null não casa nem com false. */
|
|
4001
|
+
ig_follows_business?: boolean;
|
|
3962
4002
|
/** Filtra pelos números do cliente (derivado da conexão do número). */
|
|
3963
4003
|
customer_id?: string;
|
|
3964
4004
|
/**
|
|
@@ -4023,6 +4063,8 @@ declare class Contacts {
|
|
|
4023
4063
|
}
|
|
4024
4064
|
|
|
4025
4065
|
interface ListConversationsParams extends CursorParams {
|
|
4066
|
+
/** Só valores conhecidos; null não casa nem com false. */
|
|
4067
|
+
ig_follows_business?: boolean;
|
|
4026
4068
|
/** Recorta as conversas pelos canais do negócio autorizado. */
|
|
4027
4069
|
customer_id?: string;
|
|
4028
4070
|
/** true: somente conversas com agente pausado aguardando humano. */
|
|
@@ -4099,6 +4141,13 @@ interface CreateWebhookParams {
|
|
|
4099
4141
|
* de outra Conta → 404 `customer_not_found`.
|
|
4100
4142
|
*/
|
|
4101
4143
|
customer_id?: string | null;
|
|
4144
|
+
/**
|
|
4145
|
+
* Limita as entregas a estes canais (1 a 100 ids de `channelAccounts.list`).
|
|
4146
|
+
* Omitido ou `null` = todos os canais da Conta. Id malformado → 422
|
|
4147
|
+
* `invalid_channel_account_ids`; canal de outra Conta → 404
|
|
4148
|
+
* `channel_account_not_found`.
|
|
4149
|
+
*/
|
|
4150
|
+
channel_account_ids?: string[] | null;
|
|
4102
4151
|
}
|
|
4103
4152
|
interface UpdateWebhookParams {
|
|
4104
4153
|
/**
|
|
@@ -4122,6 +4171,11 @@ interface UpdateWebhookParams {
|
|
|
4122
4171
|
* `null` (ou string vazia) remove o filtro sem invalidar a verificação.
|
|
4123
4172
|
*/
|
|
4124
4173
|
customer_id?: string | null;
|
|
4174
|
+
/**
|
|
4175
|
+
* Omitido = não mexe. `null` volta a receber de todos os canais; um array
|
|
4176
|
+
* (1 a 100 ids) limita as entregas a esses canais.
|
|
4177
|
+
*/
|
|
4178
|
+
channel_account_ids?: string[] | null;
|
|
4125
4179
|
}
|
|
4126
4180
|
/** Webhooks: endpoints assinados que recebem os eventos da conta. */
|
|
4127
4181
|
declare class Webhooks {
|
|
@@ -4232,6 +4286,25 @@ interface ListChannelAccountsParams extends OffsetParams {
|
|
|
4232
4286
|
/** UUID do Cliente dono das Contas de canal. */
|
|
4233
4287
|
customer_id?: string;
|
|
4234
4288
|
}
|
|
4289
|
+
/** Estado confirmado da conexão; nunca inclui tokens. */
|
|
4290
|
+
interface InstagramConnection {
|
|
4291
|
+
status: string;
|
|
4292
|
+
username: string | null;
|
|
4293
|
+
subscribed_at: string | null;
|
|
4294
|
+
token_expires_at: string | null;
|
|
4295
|
+
revoked_reason: string | null;
|
|
4296
|
+
health: "conectado" | "pendente" | "reconexao_necessaria" | "revogado" | (string & {});
|
|
4297
|
+
subscribed_fields: string[];
|
|
4298
|
+
diagnostic: {
|
|
4299
|
+
code: string;
|
|
4300
|
+
message: string;
|
|
4301
|
+
next_step: string;
|
|
4302
|
+
help_url: string;
|
|
4303
|
+
};
|
|
4304
|
+
}
|
|
4305
|
+
interface MessageRuleQrParams {
|
|
4306
|
+
format?: "png" | "svg";
|
|
4307
|
+
}
|
|
4235
4308
|
/** Estado de uma Regra de comentário. `paused_plan`: ativa, mas pausada pelo plano. */
|
|
4236
4309
|
type CommentRuleStatus = "active" | "inactive" | "paused_plan" | (string & {});
|
|
4237
4310
|
/**
|
|
@@ -4251,9 +4324,14 @@ interface CommentRule {
|
|
|
4251
4324
|
reply_variations?: string[];
|
|
4252
4325
|
/** Aguarda o próximo post quando true e media_id é null. */
|
|
4253
4326
|
next_post?: boolean;
|
|
4327
|
+
/** Durante lives; não combinar com media_id ou next_post. Servidor sem suporte: 422 feature_unavailable. */
|
|
4328
|
+
live?: boolean;
|
|
4254
4329
|
next_post_activated_at?: string | null;
|
|
4255
4330
|
/** Abertura: 1000 bytes sem botão; 640 caracteres com botão. */
|
|
4256
4331
|
dm_text: string;
|
|
4332
|
+
require_follow?: boolean;
|
|
4333
|
+
/** Com require_follow, obrigatório (640 caracteres) e exige botão de entrega. */
|
|
4334
|
+
non_follower_text?: string | null;
|
|
4257
4335
|
/** Título do botão (20 caracteres); null mantém direct simples. */
|
|
4258
4336
|
dm_button_title?: string | null;
|
|
4259
4337
|
/** Texto entregue após o toque (1000 bytes). */
|
|
@@ -4279,6 +4357,9 @@ interface CommentRule {
|
|
|
4279
4357
|
interface CreateCommentRuleParams {
|
|
4280
4358
|
/** Texto do direct enviado a quem comentou (obrigatório). */
|
|
4281
4359
|
dm_text: string;
|
|
4360
|
+
require_follow?: boolean;
|
|
4361
|
+
/** Com require_follow, obrigatório (640 caracteres) e exige botão de entrega. */
|
|
4362
|
+
non_follower_text?: string | null;
|
|
4282
4363
|
/** Botão de até 20 caracteres; com botão dm_text aceita até 640 caracteres. */
|
|
4283
4364
|
dm_button_title?: string | null;
|
|
4284
4365
|
/** Obrigatório com botão; até 1000 bytes. null remove. */
|
|
@@ -4295,6 +4376,8 @@ interface CreateCommentRuleParams {
|
|
|
4295
4376
|
reply_variations?: string[];
|
|
4296
4377
|
/** Próximo post; não combinar com media_id explícito. */
|
|
4297
4378
|
next_post?: boolean;
|
|
4379
|
+
/** Durante lives; não combinar com media_id ou next_post. Servidor sem suporte: 422 feature_unavailable. */
|
|
4380
|
+
live?: boolean;
|
|
4298
4381
|
/** Resposta pública ao comentário; `null`/vazio = sem resposta. */
|
|
4299
4382
|
reply_text?: string | null;
|
|
4300
4383
|
/** Id numérico do post; `null`/vazio = todos os posts. */
|
|
@@ -4364,6 +4447,9 @@ interface CreateMessageRuleParams {
|
|
|
4364
4447
|
is_active?: boolean;
|
|
4365
4448
|
/** 1–5 ações; no máximo uma de cada tipo. */
|
|
4366
4449
|
actions: MessageRuleAction[];
|
|
4450
|
+
require_follow?: boolean;
|
|
4451
|
+
/** Até 1000 bytes; null remove. */
|
|
4452
|
+
non_follower_text?: string | null;
|
|
4367
4453
|
}
|
|
4368
4454
|
type UpdateMessageRuleParams = Partial<CreateMessageRuleParams>;
|
|
4369
4455
|
interface MessageRule {
|
|
@@ -4376,10 +4462,15 @@ interface MessageRule {
|
|
|
4376
4462
|
excluded_keywords: string[];
|
|
4377
4463
|
story_contains: string | null;
|
|
4378
4464
|
ref: string | null;
|
|
4465
|
+
/** Link ig.me pronto; null sem ref ou username válido. */
|
|
4466
|
+
ref_link: string | null;
|
|
4379
4467
|
ad_id: string | null;
|
|
4380
4468
|
priority: number;
|
|
4381
4469
|
is_active: boolean;
|
|
4382
4470
|
actions: MessageRuleAction[];
|
|
4471
|
+
require_follow?: boolean;
|
|
4472
|
+
/** Até 1000 bytes; null remove. */
|
|
4473
|
+
non_follower_text?: string | null;
|
|
4383
4474
|
created_at: string;
|
|
4384
4475
|
updated_at: string;
|
|
4385
4476
|
}
|
|
@@ -4407,6 +4498,7 @@ interface CommentRuleMetrics extends CommentRuleMetricsParams {
|
|
|
4407
4498
|
totals: CommentRuleCounters;
|
|
4408
4499
|
posts: (CommentRuleCounters & {
|
|
4409
4500
|
media_id: string | null;
|
|
4501
|
+
live: boolean;
|
|
4410
4502
|
})[];
|
|
4411
4503
|
}
|
|
4412
4504
|
interface InstagramIceBreaker {
|
|
@@ -4450,6 +4542,14 @@ declare class ChannelAccounts {
|
|
|
4450
4542
|
list(params?: ListChannelAccountsParams): Promise<OffsetList<ChannelAccount>>;
|
|
4451
4543
|
/** Busca uma Conta de canal pelo UUID interno ou pelo id na Meta (`external_id`). numbers:read. */
|
|
4452
4544
|
get(id: string): Promise<ChannelAccount>;
|
|
4545
|
+
/** Estado e diagnóstico da conexão Instagram. numbers:read; sem sandbox. */
|
|
4546
|
+
getConnection(id: string): Promise<InstagramConnection>;
|
|
4547
|
+
/** Reassina webhooks usando a autorização existente. numbers:write; sem sandbox. */
|
|
4548
|
+
resubscribeConnection(id: string): Promise<InstagramConnection>;
|
|
4549
|
+
/** Desconecta a conta. numbers:write; por chave de API (OAuth: somente painel). */
|
|
4550
|
+
disconnect(id: string): Promise<InstagramConnection>;
|
|
4551
|
+
/** QR do ref_link, PNG por padrão; 404 sem link. message-rules:read. */
|
|
4552
|
+
getMessageRuleQr(id: string, ruleId: string, params?: MessageRuleQrParams): Promise<ArrayBuffer>;
|
|
4453
4553
|
/** Lista as Regras de comentário de uma Conta do Instagram (UUID). comment-rules:read. */
|
|
4454
4554
|
listCommentRules(channelAccountId: string, params?: OffsetParams): Promise<OffsetList<CommentRule>>;
|
|
4455
4555
|
/** Busca uma Regra de comentário. comment-rules:read. */
|
|
@@ -4795,6 +4895,9 @@ declare class BotoZap {
|
|
|
4795
4895
|
putArtifact(url: string, contentType: string, file: Blob): Promise<void>;
|
|
4796
4896
|
/** Faz uma requisição autenticada e devolve o corpo já parseado. */
|
|
4797
4897
|
request<T>(method: string, path: string, opts?: RequestOptions): Promise<T>;
|
|
4898
|
+
/** Baixa um arquivo autenticado, preservando os erros JSON e headers da API. */
|
|
4899
|
+
requestBinary(method: string, path: string, opts?: RequestOptions): Promise<ArrayBuffer>;
|
|
4900
|
+
private requestResponse;
|
|
4798
4901
|
/**
|
|
4799
4902
|
* Requisição a um endpoint de ITEM (singular). A API embrulha essas respostas
|
|
4800
4903
|
* em `{ data: <obj> }` (helper `ok`); este método desempacota e devolve a
|
|
@@ -4842,10 +4945,10 @@ declare class BotoZapError extends Error {
|
|
|
4842
4945
|
* além do teto de Números do Free). IA: `provider_not_enabled` (422, credencial
|
|
4843
4946
|
* nova de provedor com `accepts_new_credentials: false`).
|
|
4844
4947
|
*/
|
|
4845
|
-
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" | "provider_not_enabled" | (string & {});
|
|
4948
|
+
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 & {});
|
|
4846
4949
|
/** Códigos que indicam limite ou restrição do plano contratado. */
|
|
4847
4950
|
declare const PLAN_ERROR_CODES: readonly ["plan_restricted", "free_form_limit_reached", "free_number_cap"];
|
|
4848
4951
|
/** True quando o erro é recusa por plano (upgrade resolve; retry não). */
|
|
4849
4952
|
declare function isPlanError(error: unknown): error is BotoZapError;
|
|
4850
4953
|
|
|
4851
|
-
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 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 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 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 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 WebhookDelivery, type WebhookDeliveryStatus, isPlanError };
|
|
4954
|
+
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 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 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 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -171,6 +171,12 @@ interface BroadcastRecipient {
|
|
|
171
171
|
[key: string]: unknown;
|
|
172
172
|
}
|
|
173
173
|
interface Contact {
|
|
174
|
+
/** Perfil Instagram, somente leitura; null quando desconhecido. */
|
|
175
|
+
readonly ig_follows_business?: boolean | null;
|
|
176
|
+
readonly ig_followed_by_business?: boolean | null;
|
|
177
|
+
readonly ig_follower_count?: number | null;
|
|
178
|
+
readonly ig_verified?: boolean | null;
|
|
179
|
+
readonly ig_follow_checked_at?: string | null;
|
|
174
180
|
id: string;
|
|
175
181
|
wa_id?: string;
|
|
176
182
|
/** Nome do perfil no canal; a ingestão o sobrescreve a cada inbound. */
|
|
@@ -248,10 +254,41 @@ interface Assignment {
|
|
|
248
254
|
id: string;
|
|
249
255
|
[key: string]: unknown;
|
|
250
256
|
}
|
|
257
|
+
/**
|
|
258
|
+
* Estado de entrega de um canal com falha. `paused` para só esse canal (na 15ª
|
|
259
|
+
* falha seguida); os outros canais do Endpoint seguem recebendo.
|
|
260
|
+
*/
|
|
261
|
+
type WebhookChannelHealthStatus = "degraded" | "paused" | (string & {});
|
|
262
|
+
/** Saúde de entrega por canal (`Webhook.channels_health`): só canais com falha. */
|
|
263
|
+
interface WebhookChannelHealth {
|
|
264
|
+
/** Conta de canal (`channel_account.id`); `null` = eventos sem canal. */
|
|
265
|
+
channel_account_id: string | null;
|
|
266
|
+
health_status: WebhookChannelHealthStatus;
|
|
267
|
+
failure_streak: number;
|
|
268
|
+
next_attempt_at: string | null;
|
|
269
|
+
paused_at: string | null;
|
|
270
|
+
last_success_at: string | null;
|
|
271
|
+
last_failure_at: string | null;
|
|
272
|
+
last_response_code: number | null;
|
|
273
|
+
}
|
|
251
274
|
interface Webhook {
|
|
252
275
|
id: string;
|
|
253
276
|
/** Cliente cujas entregas o endpoint recebe; `null` = todos os da Conta. */
|
|
254
277
|
customer_id?: string | null;
|
|
278
|
+
/**
|
|
279
|
+
* Canais cujos eventos o Endpoint recebe (ids de `channelAccounts.list`, os
|
|
280
|
+
* mesmos de `channel_account.id` nos payloads). `null` = todos os canais.
|
|
281
|
+
* Vazio quando os canais marcados foram excluídos: o Endpoint não recebe
|
|
282
|
+
* eventos até ser reconfigurado.
|
|
283
|
+
*/
|
|
284
|
+
channel_account_ids?: string[] | null;
|
|
285
|
+
/**
|
|
286
|
+
* Saúde por canal, só dos canais com falha (vazio = tudo saudável). A espera,
|
|
287
|
+
* as falhas seguidas e a pausa contam por canal. `health_status` e
|
|
288
|
+
* `failure_streak` do Endpoint resumem o pior canal: `paused` só quando todos
|
|
289
|
+
* os canais com falha estão pausados.
|
|
290
|
+
*/
|
|
291
|
+
channels_health?: WebhookChannelHealth[];
|
|
255
292
|
url: string;
|
|
256
293
|
events?: (WebhookCategory | (string & {}))[];
|
|
257
294
|
active?: boolean;
|
|
@@ -303,8 +340,9 @@ interface BotoZapEvent {
|
|
|
303
340
|
* `instagram.message.received`). No Instagram, `instagram.message.edited`
|
|
304
341
|
* traz o texto novo em `data.edit` e o conteúdo atualizado (com
|
|
305
342
|
* `content.edited`) em `data.message`; `instagram.message.revoked` traz
|
|
306
|
-
* `data.message.revoked_at`, sem o conteúdo apagado.
|
|
307
|
-
*
|
|
343
|
+
* `data.message.revoked_at`, sem o conteúdo apagado.
|
|
344
|
+
* `instagram.message_rule.failed` registra uma falha de automação e pode
|
|
345
|
+
* ter `message_id: null` (referral sem mensagem). Valores novos podem surgir.
|
|
308
346
|
*/
|
|
309
347
|
type: string;
|
|
310
348
|
/**
|
|
@@ -3959,6 +3997,8 @@ declare class Broadcasts {
|
|
|
3959
3997
|
}
|
|
3960
3998
|
|
|
3961
3999
|
interface ListContactsParams extends CursorParams {
|
|
4000
|
+
/** Só valores conhecidos; null não casa nem com false. */
|
|
4001
|
+
ig_follows_business?: boolean;
|
|
3962
4002
|
/** Filtra pelos números do cliente (derivado da conexão do número). */
|
|
3963
4003
|
customer_id?: string;
|
|
3964
4004
|
/**
|
|
@@ -4023,6 +4063,8 @@ declare class Contacts {
|
|
|
4023
4063
|
}
|
|
4024
4064
|
|
|
4025
4065
|
interface ListConversationsParams extends CursorParams {
|
|
4066
|
+
/** Só valores conhecidos; null não casa nem com false. */
|
|
4067
|
+
ig_follows_business?: boolean;
|
|
4026
4068
|
/** Recorta as conversas pelos canais do negócio autorizado. */
|
|
4027
4069
|
customer_id?: string;
|
|
4028
4070
|
/** true: somente conversas com agente pausado aguardando humano. */
|
|
@@ -4099,6 +4141,13 @@ interface CreateWebhookParams {
|
|
|
4099
4141
|
* de outra Conta → 404 `customer_not_found`.
|
|
4100
4142
|
*/
|
|
4101
4143
|
customer_id?: string | null;
|
|
4144
|
+
/**
|
|
4145
|
+
* Limita as entregas a estes canais (1 a 100 ids de `channelAccounts.list`).
|
|
4146
|
+
* Omitido ou `null` = todos os canais da Conta. Id malformado → 422
|
|
4147
|
+
* `invalid_channel_account_ids`; canal de outra Conta → 404
|
|
4148
|
+
* `channel_account_not_found`.
|
|
4149
|
+
*/
|
|
4150
|
+
channel_account_ids?: string[] | null;
|
|
4102
4151
|
}
|
|
4103
4152
|
interface UpdateWebhookParams {
|
|
4104
4153
|
/**
|
|
@@ -4122,6 +4171,11 @@ interface UpdateWebhookParams {
|
|
|
4122
4171
|
* `null` (ou string vazia) remove o filtro sem invalidar a verificação.
|
|
4123
4172
|
*/
|
|
4124
4173
|
customer_id?: string | null;
|
|
4174
|
+
/**
|
|
4175
|
+
* Omitido = não mexe. `null` volta a receber de todos os canais; um array
|
|
4176
|
+
* (1 a 100 ids) limita as entregas a esses canais.
|
|
4177
|
+
*/
|
|
4178
|
+
channel_account_ids?: string[] | null;
|
|
4125
4179
|
}
|
|
4126
4180
|
/** Webhooks: endpoints assinados que recebem os eventos da conta. */
|
|
4127
4181
|
declare class Webhooks {
|
|
@@ -4232,6 +4286,25 @@ interface ListChannelAccountsParams extends OffsetParams {
|
|
|
4232
4286
|
/** UUID do Cliente dono das Contas de canal. */
|
|
4233
4287
|
customer_id?: string;
|
|
4234
4288
|
}
|
|
4289
|
+
/** Estado confirmado da conexão; nunca inclui tokens. */
|
|
4290
|
+
interface InstagramConnection {
|
|
4291
|
+
status: string;
|
|
4292
|
+
username: string | null;
|
|
4293
|
+
subscribed_at: string | null;
|
|
4294
|
+
token_expires_at: string | null;
|
|
4295
|
+
revoked_reason: string | null;
|
|
4296
|
+
health: "conectado" | "pendente" | "reconexao_necessaria" | "revogado" | (string & {});
|
|
4297
|
+
subscribed_fields: string[];
|
|
4298
|
+
diagnostic: {
|
|
4299
|
+
code: string;
|
|
4300
|
+
message: string;
|
|
4301
|
+
next_step: string;
|
|
4302
|
+
help_url: string;
|
|
4303
|
+
};
|
|
4304
|
+
}
|
|
4305
|
+
interface MessageRuleQrParams {
|
|
4306
|
+
format?: "png" | "svg";
|
|
4307
|
+
}
|
|
4235
4308
|
/** Estado de uma Regra de comentário. `paused_plan`: ativa, mas pausada pelo plano. */
|
|
4236
4309
|
type CommentRuleStatus = "active" | "inactive" | "paused_plan" | (string & {});
|
|
4237
4310
|
/**
|
|
@@ -4251,9 +4324,14 @@ interface CommentRule {
|
|
|
4251
4324
|
reply_variations?: string[];
|
|
4252
4325
|
/** Aguarda o próximo post quando true e media_id é null. */
|
|
4253
4326
|
next_post?: boolean;
|
|
4327
|
+
/** Durante lives; não combinar com media_id ou next_post. Servidor sem suporte: 422 feature_unavailable. */
|
|
4328
|
+
live?: boolean;
|
|
4254
4329
|
next_post_activated_at?: string | null;
|
|
4255
4330
|
/** Abertura: 1000 bytes sem botão; 640 caracteres com botão. */
|
|
4256
4331
|
dm_text: string;
|
|
4332
|
+
require_follow?: boolean;
|
|
4333
|
+
/** Com require_follow, obrigatório (640 caracteres) e exige botão de entrega. */
|
|
4334
|
+
non_follower_text?: string | null;
|
|
4257
4335
|
/** Título do botão (20 caracteres); null mantém direct simples. */
|
|
4258
4336
|
dm_button_title?: string | null;
|
|
4259
4337
|
/** Texto entregue após o toque (1000 bytes). */
|
|
@@ -4279,6 +4357,9 @@ interface CommentRule {
|
|
|
4279
4357
|
interface CreateCommentRuleParams {
|
|
4280
4358
|
/** Texto do direct enviado a quem comentou (obrigatório). */
|
|
4281
4359
|
dm_text: string;
|
|
4360
|
+
require_follow?: boolean;
|
|
4361
|
+
/** Com require_follow, obrigatório (640 caracteres) e exige botão de entrega. */
|
|
4362
|
+
non_follower_text?: string | null;
|
|
4282
4363
|
/** Botão de até 20 caracteres; com botão dm_text aceita até 640 caracteres. */
|
|
4283
4364
|
dm_button_title?: string | null;
|
|
4284
4365
|
/** Obrigatório com botão; até 1000 bytes. null remove. */
|
|
@@ -4295,6 +4376,8 @@ interface CreateCommentRuleParams {
|
|
|
4295
4376
|
reply_variations?: string[];
|
|
4296
4377
|
/** Próximo post; não combinar com media_id explícito. */
|
|
4297
4378
|
next_post?: boolean;
|
|
4379
|
+
/** Durante lives; não combinar com media_id ou next_post. Servidor sem suporte: 422 feature_unavailable. */
|
|
4380
|
+
live?: boolean;
|
|
4298
4381
|
/** Resposta pública ao comentário; `null`/vazio = sem resposta. */
|
|
4299
4382
|
reply_text?: string | null;
|
|
4300
4383
|
/** Id numérico do post; `null`/vazio = todos os posts. */
|
|
@@ -4364,6 +4447,9 @@ interface CreateMessageRuleParams {
|
|
|
4364
4447
|
is_active?: boolean;
|
|
4365
4448
|
/** 1–5 ações; no máximo uma de cada tipo. */
|
|
4366
4449
|
actions: MessageRuleAction[];
|
|
4450
|
+
require_follow?: boolean;
|
|
4451
|
+
/** Até 1000 bytes; null remove. */
|
|
4452
|
+
non_follower_text?: string | null;
|
|
4367
4453
|
}
|
|
4368
4454
|
type UpdateMessageRuleParams = Partial<CreateMessageRuleParams>;
|
|
4369
4455
|
interface MessageRule {
|
|
@@ -4376,10 +4462,15 @@ interface MessageRule {
|
|
|
4376
4462
|
excluded_keywords: string[];
|
|
4377
4463
|
story_contains: string | null;
|
|
4378
4464
|
ref: string | null;
|
|
4465
|
+
/** Link ig.me pronto; null sem ref ou username válido. */
|
|
4466
|
+
ref_link: string | null;
|
|
4379
4467
|
ad_id: string | null;
|
|
4380
4468
|
priority: number;
|
|
4381
4469
|
is_active: boolean;
|
|
4382
4470
|
actions: MessageRuleAction[];
|
|
4471
|
+
require_follow?: boolean;
|
|
4472
|
+
/** Até 1000 bytes; null remove. */
|
|
4473
|
+
non_follower_text?: string | null;
|
|
4383
4474
|
created_at: string;
|
|
4384
4475
|
updated_at: string;
|
|
4385
4476
|
}
|
|
@@ -4407,6 +4498,7 @@ interface CommentRuleMetrics extends CommentRuleMetricsParams {
|
|
|
4407
4498
|
totals: CommentRuleCounters;
|
|
4408
4499
|
posts: (CommentRuleCounters & {
|
|
4409
4500
|
media_id: string | null;
|
|
4501
|
+
live: boolean;
|
|
4410
4502
|
})[];
|
|
4411
4503
|
}
|
|
4412
4504
|
interface InstagramIceBreaker {
|
|
@@ -4450,6 +4542,14 @@ declare class ChannelAccounts {
|
|
|
4450
4542
|
list(params?: ListChannelAccountsParams): Promise<OffsetList<ChannelAccount>>;
|
|
4451
4543
|
/** Busca uma Conta de canal pelo UUID interno ou pelo id na Meta (`external_id`). numbers:read. */
|
|
4452
4544
|
get(id: string): Promise<ChannelAccount>;
|
|
4545
|
+
/** Estado e diagnóstico da conexão Instagram. numbers:read; sem sandbox. */
|
|
4546
|
+
getConnection(id: string): Promise<InstagramConnection>;
|
|
4547
|
+
/** Reassina webhooks usando a autorização existente. numbers:write; sem sandbox. */
|
|
4548
|
+
resubscribeConnection(id: string): Promise<InstagramConnection>;
|
|
4549
|
+
/** Desconecta a conta. numbers:write; por chave de API (OAuth: somente painel). */
|
|
4550
|
+
disconnect(id: string): Promise<InstagramConnection>;
|
|
4551
|
+
/** QR do ref_link, PNG por padrão; 404 sem link. message-rules:read. */
|
|
4552
|
+
getMessageRuleQr(id: string, ruleId: string, params?: MessageRuleQrParams): Promise<ArrayBuffer>;
|
|
4453
4553
|
/** Lista as Regras de comentário de uma Conta do Instagram (UUID). comment-rules:read. */
|
|
4454
4554
|
listCommentRules(channelAccountId: string, params?: OffsetParams): Promise<OffsetList<CommentRule>>;
|
|
4455
4555
|
/** Busca uma Regra de comentário. comment-rules:read. */
|
|
@@ -4795,6 +4895,9 @@ declare class BotoZap {
|
|
|
4795
4895
|
putArtifact(url: string, contentType: string, file: Blob): Promise<void>;
|
|
4796
4896
|
/** Faz uma requisição autenticada e devolve o corpo já parseado. */
|
|
4797
4897
|
request<T>(method: string, path: string, opts?: RequestOptions): Promise<T>;
|
|
4898
|
+
/** Baixa um arquivo autenticado, preservando os erros JSON e headers da API. */
|
|
4899
|
+
requestBinary(method: string, path: string, opts?: RequestOptions): Promise<ArrayBuffer>;
|
|
4900
|
+
private requestResponse;
|
|
4798
4901
|
/**
|
|
4799
4902
|
* Requisição a um endpoint de ITEM (singular). A API embrulha essas respostas
|
|
4800
4903
|
* em `{ data: <obj> }` (helper `ok`); este método desempacota e devolve a
|
|
@@ -4842,10 +4945,10 @@ declare class BotoZapError extends Error {
|
|
|
4842
4945
|
* além do teto de Números do Free). IA: `provider_not_enabled` (422, credencial
|
|
4843
4946
|
* nova de provedor com `accepts_new_credentials: false`).
|
|
4844
4947
|
*/
|
|
4845
|
-
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" | "provider_not_enabled" | (string & {});
|
|
4948
|
+
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 & {});
|
|
4846
4949
|
/** Códigos que indicam limite ou restrição do plano contratado. */
|
|
4847
4950
|
declare const PLAN_ERROR_CODES: readonly ["plan_restricted", "free_form_limit_reached", "free_number_cap"];
|
|
4848
4951
|
/** True quando o erro é recusa por plano (upgrade resolve; retry não). */
|
|
4849
4952
|
declare function isPlanError(error: unknown): error is BotoZapError;
|
|
4850
4953
|
|
|
4851
|
-
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 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 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 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 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 WebhookDelivery, type WebhookDeliveryStatus, isPlanError };
|
|
4954
|
+
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 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 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 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 };
|
package/dist/index.js
CHANGED
|
@@ -5434,6 +5434,7 @@ var Contacts = class {
|
|
|
5434
5434
|
return this.client.requestCursorList("GET", "/contacts", {
|
|
5435
5435
|
query: {
|
|
5436
5436
|
limit: params.limit,
|
|
5437
|
+
ig_follows_business: params.ig_follows_business === void 0 ? void 0 : String(params.ig_follows_business),
|
|
5437
5438
|
after: params.after,
|
|
5438
5439
|
before: params.before,
|
|
5439
5440
|
customer_id: params.customer_id,
|
|
@@ -5489,6 +5490,7 @@ var Conversations = class {
|
|
|
5489
5490
|
{
|
|
5490
5491
|
query: {
|
|
5491
5492
|
limit: params.limit,
|
|
5493
|
+
ig_follows_business: params.ig_follows_business === void 0 ? void 0 : String(params.ig_follows_business),
|
|
5492
5494
|
customer_id: params.customer_id,
|
|
5493
5495
|
agent_paused: params.agent_paused === void 0 ? void 0 : String(params.agent_paused),
|
|
5494
5496
|
after: params.after,
|
|
@@ -5710,6 +5712,22 @@ var ChannelAccounts = class {
|
|
|
5710
5712
|
get(id) {
|
|
5711
5713
|
return this.client.requestItem("GET", `/channel_accounts/${enc7(id)}`);
|
|
5712
5714
|
}
|
|
5715
|
+
/** Estado e diagnóstico da conexão Instagram. numbers:read; sem sandbox. */
|
|
5716
|
+
getConnection(id) {
|
|
5717
|
+
return this.client.requestItem("GET", `/channel_accounts/${enc7(id)}/connection`);
|
|
5718
|
+
}
|
|
5719
|
+
/** Reassina webhooks usando a autorização existente. numbers:write; sem sandbox. */
|
|
5720
|
+
resubscribeConnection(id) {
|
|
5721
|
+
return this.client.requestItem("POST", `/channel_accounts/${enc7(id)}/connection/resubscribe`);
|
|
5722
|
+
}
|
|
5723
|
+
/** Desconecta a conta. numbers:write; por chave de API (OAuth: somente painel). */
|
|
5724
|
+
disconnect(id) {
|
|
5725
|
+
return this.client.requestItem("DELETE", `/channel_accounts/${enc7(id)}/connection`);
|
|
5726
|
+
}
|
|
5727
|
+
/** QR do ref_link, PNG por padrão; 404 sem link. message-rules:read. */
|
|
5728
|
+
getMessageRuleQr(id, ruleId, params = {}) {
|
|
5729
|
+
return this.client.requestBinary("GET", `${messageRulesPath(id, ruleId)}/qr`, { query: { format: params.format } });
|
|
5730
|
+
}
|
|
5713
5731
|
/** Lista as Regras de comentário de uma Conta do Instagram (UUID). comment-rules:read. */
|
|
5714
5732
|
listCommentRules(channelAccountId, params = {}) {
|
|
5715
5733
|
return this.client.requestOffsetList(
|
|
@@ -6070,6 +6088,13 @@ var BotoZap = class {
|
|
|
6070
6088
|
}
|
|
6071
6089
|
/** Faz uma requisição autenticada e devolve o corpo já parseado. */
|
|
6072
6090
|
async request(method, path, opts = {}) {
|
|
6091
|
+
return this.requestResponse(method, path, opts);
|
|
6092
|
+
}
|
|
6093
|
+
/** Baixa um arquivo autenticado, preservando os erros JSON e headers da API. */
|
|
6094
|
+
requestBinary(method, path, opts = {}) {
|
|
6095
|
+
return this.requestResponse(method, path, opts, true);
|
|
6096
|
+
}
|
|
6097
|
+
async requestResponse(method, path, opts, binary = false) {
|
|
6073
6098
|
const url = new URL(this.baseUrl + path);
|
|
6074
6099
|
if (opts.query) {
|
|
6075
6100
|
for (const [key, value] of Object.entries(opts.query)) {
|
|
@@ -6087,7 +6112,7 @@ var BotoZap = class {
|
|
|
6087
6112
|
headers: {
|
|
6088
6113
|
Authorization: `Bearer ${credential}`,
|
|
6089
6114
|
...opts.body instanceof FormData ? {} : { "Content-Type": "application/json" },
|
|
6090
|
-
Accept: "application/json",
|
|
6115
|
+
Accept: binary ? "image/png, image/svg+xml, application/json" : "application/json",
|
|
6091
6116
|
...opts.idempotencyKey ? { "Idempotency-Key": opts.idempotencyKey } : {}
|
|
6092
6117
|
},
|
|
6093
6118
|
body: opts.body instanceof FormData ? opts.body : opts.body === void 0 ? void 0 : JSON.stringify(opts.body),
|
|
@@ -6102,6 +6127,9 @@ var BotoZap = class {
|
|
|
6102
6127
|
0
|
|
6103
6128
|
);
|
|
6104
6129
|
}
|
|
6130
|
+
if (binary && res.ok && !res.headers.get("content-type")?.includes("json")) {
|
|
6131
|
+
return await res.arrayBuffer();
|
|
6132
|
+
}
|
|
6105
6133
|
const raw = await res.text();
|
|
6106
6134
|
const data = raw ? safeJson(raw) : void 0;
|
|
6107
6135
|
const envelope = data;
|
|
@@ -6122,6 +6150,7 @@ var BotoZap = class {
|
|
|
6122
6150
|
}
|
|
6123
6151
|
);
|
|
6124
6152
|
}
|
|
6153
|
+
if (binary) throw malformed("resposta JSON em endpoint de arquivo bin\xE1rio");
|
|
6125
6154
|
return data;
|
|
6126
6155
|
}
|
|
6127
6156
|
/**
|