@botozap/sdk 0.26.0 → 0.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -4424,13 +4424,43 @@ interface CreateTemplateParams {
4424
4424
  */
4425
4425
  opt_out_buttons?: string[];
4426
4426
  }
4427
+ interface SyncTemplatesParams {
4428
+ /** Só as conexões deste Cliente; sem ele, todas as conexões ativas da conta. */
4429
+ customer_id?: string;
4430
+ }
4431
+ /** Resultado de `templates.sync()`. */
4432
+ interface TemplateSyncResult {
4433
+ /** Conexões ativas do WhatsApp conferidas. */
4434
+ connections: number;
4435
+ /** Templates que a Meta tem e foram gravados aqui. */
4436
+ synced: number;
4437
+ /** Templates tirados daqui porque foram excluídos na Meta. */
4438
+ removed: number;
4439
+ /** Conexões sem autorização guardada, puladas (reconecte o número). */
4440
+ skipped_without_token: number;
4441
+ /** Uma régua de modelo não acompanhou a mudança de status: sincronize de novo. */
4442
+ automations_outdated: boolean;
4443
+ }
4427
4444
  /** Corpo de `PATCH /v1/templates/:id`. */
4428
4445
  interface UpdateTemplateParams {
4429
4446
  /**
4430
- * Textos dos botões de resposta rápida que são de saída; `[]` limpa a marcação.
4431
- * Anotação do BotoZap: não altera o template na Meta.
4447
+ * Componentes novos, no formato da criação: edita o template e o devolve à
4448
+ * análise da Meta (`status` volta a `PENDING`). Nome e idioma não mudam.
4449
+ */
4450
+ components?: unknown[];
4451
+ /** Categoria nova, junto com `components`; ausente mantém a atual. */
4452
+ category?: string;
4453
+ /**
4454
+ * Textos dos botões de resposta rápida que são de saída; `[]` limpa. Sozinho,
4455
+ * é anotação do BotoZap e não altera o template na Meta; com `components`,
4456
+ * ausente mantém a marcação atual.
4432
4457
  */
4433
- opt_out_buttons: string[];
4458
+ opt_out_buttons?: string[];
4459
+ }
4460
+ /** Resultado de `templates.delete()`. */
4461
+ interface DeletedTemplate {
4462
+ id: string;
4463
+ deleted: true;
4434
4464
  }
4435
4465
  /** Endpoints de template (GET/POST /v1/templates, GET /v1/templates/:id). */
4436
4466
  declare class Templates {
@@ -4443,12 +4473,27 @@ declare class Templates {
4443
4473
  /** Cria um template e o submete à Meta para análise. */
4444
4474
  create(params: CreateTemplateParams): Promise<Template>;
4445
4475
  /**
4446
- * Marca quais botões de resposta rápida são de saída (`opt_out_buttons`). O toque
4447
- * num botão marcado grava a recusa da finalidade do template; botão não marcado
4448
- * não muda nada, qualquer que seja o texto. Não altera o template na Meta.
4449
- * Scope `templates:write`.
4476
+ * Com `components` (e `category`), edita o template e o devolve à análise da
4477
+ * Meta, como o Editar do painel: em análise responde 409 `template_in_review`;
4478
+ * sem id da Meta, 409 `template_not_synced`. Só com `opt_out_buttons`, marca
4479
+ * quais botões de resposta rápida são de saída, sem alterar o template na
4480
+ * Meta. Scope `templates:write`.
4450
4481
  */
4451
4482
  update(id: string, params: UpdateTemplateParams): Promise<Template>;
4483
+ /**
4484
+ * O Sincronizar da tela de Templates: traz da Meta status, categoria,
4485
+ * conteúdo e `rejection_reason` dos templates das conexões ativas (ou de um
4486
+ * Cliente), importa os criados no WhatsApp Manager e tira daqui os excluídos
4487
+ * lá. Use quando um status parecer parado. Autorização recusada pela Meta
4488
+ * responde 409 `reconnect_required`. Scope `templates:write`.
4489
+ */
4490
+ sync(params?: SyncTemplatesParams): Promise<TemplateSyncResult>;
4491
+ /**
4492
+ * Exclui o template na Meta e aqui, como o Excluir do painel. Com o id da Meta
4493
+ * apaga só aquela versão de idioma; sem ele, a Meta apaga todas as do mesmo
4494
+ * nome. Não dá para desfazer. Só chave de produção. Scope `templates:write`.
4495
+ */
4496
+ delete(id: string): Promise<DeletedTemplate>;
4452
4497
  }
4453
4498
 
4454
4499
  interface ListBroadcastsParams extends OffsetParams {
@@ -4997,6 +5042,16 @@ interface UnblockUserResult {
4997
5042
  * (`skipped` quando a escolha foi 0 dias).
4998
5043
  */
4999
5044
  type HistoryImportStatus = "awaiting_choice" | "queued" | "requested" | "declined" | "failed" | "expired" | "unconfirmed" | "skipped";
5045
+ /**
5046
+ * Inscrição do BotoZap para receber as mensagens do número na Meta:
5047
+ * `subscribed` (recebe), `missing` (a Meta parou de mandar) ou `unknown`
5048
+ * (a Meta não respondeu).
5049
+ */
5050
+ type WebhookSubscriptionState = "subscribed" | "missing" | "unknown";
5051
+ /** Resultado de `resubscribeWebhooks`. */
5052
+ interface WebhookSubscription {
5053
+ webhook_subscription: WebhookSubscriptionState;
5054
+ }
5000
5055
  /** Janela de conversas antigas a importar, em dias (0 = não importar). */
5001
5056
  type HistoryImportWindowDays = 0 | 30 | 180;
5002
5057
  /** Importação das conversas antigas do número (`GET|PUT …/history-import`). */
@@ -5161,8 +5216,19 @@ declare class PhoneNumbers {
5161
5216
  * o último mês vale 20 h depois da conexão. Scope `numbers:write`.
5162
5217
  */
5163
5218
  setHistoryImport(id: string, params: SetHistoryImportParams): Promise<HistoryImport>;
5164
- /** Saúde do número (qualidade, limite, status na Meta). */
5219
+ /**
5220
+ * Prontidão do número. Com a conexão ativa, confere ao vivo o token
5221
+ * (`checks.token_validity`) e se a Meta manda as mensagens para o BotoZap
5222
+ * (`checks.webhook_subscription`).
5223
+ */
5165
5224
  health(id: string): Promise<Record<string, unknown>>;
5225
+ /**
5226
+ * Inscreve o BotoZap de novo para receber as mensagens do número, com a
5227
+ * autorização já guardada, sem refazer a conexão. Resolve a prontidão
5228
+ * `webhooks_lost`; autorização recusada pela Meta responde 409
5229
+ * `reconnect_required` (aí só o link de setup resolve). Scope `numbers:write`.
5230
+ */
5231
+ resubscribeWebhooks(id: string): Promise<WebhookSubscription>;
5166
5232
  }
5167
5233
 
5168
5234
  /**
@@ -6333,4 +6399,4 @@ declare function isConsentRevoked(error: unknown): error is BotoZapError;
6333
6399
  */
6334
6400
  declare function isNotConnected(error: unknown): error is BotoZapError;
6335
6401
 
6336
- export { AI_CONFIGURABLE_PURPOSES, AI_CREDENTIAL_PROVIDERS, AI_OPERATIONS, AI_PURPOSES, type AccountExport, type AddRecipientsError, type AddRecipientsResult, AgendaConfiguration, AgendaExceptions, type AgendaRecord, Ai, type AiAgent, type AiAgentConfig, type AiAgentConfigRead, type AiAgentCoverage, type AiAgentDiagnostic, type AiAgentInput, type AiAgentVersion, AiAgentsResource, type AiAlert, type AiAlertBulkFilters, type AiAlertListItem, AiAlertsResource, type AiArtifactUploadInput, type AiAudioPricing, type AiBinding, type AiBindingTarget, type AiBindingTargetRead, type AiBudget, type AiBudgetInput, type AiCapabilitySignal, type AiCapabilityUsage, type AiCapabilityUsageList, type AiCase, type AiCaseChat, type AiCaseEvent, type AiCaseKind, type AiCaseReply, type AiCaseReplyInput, type AiCaseSource, AiCasesResource, type AiCatalogItems, type AiCatalogModel, type AiCatalogProduct, type AiCatalogSyncInput, type AiCatalogSyncResult, type AiChannelGate, type AiCommercialDecision, type AiCommercialEffect, type AiCommercialJob, type AiCommercialProposal, AiCommercialProposalsResource, type AiCommercialRequest, type AiCommercialSettings, type AiConfigurablePurpose, type AiContactAuthorization, type AiConversationCheckpoint, type AiCredential, AiCredentialsResource, type AiDiagnosticCheck, type AiDiagnosticStatus, type AiDraftResult, type AiEligibilityOverview, AiEligibilityResource, type AiEligibilitySettings, type AiEnabledProvider, type AiEnrollment, type AiEvolution, AiEvolutionResource, type AiEvolutionSource, type AiExecution, type AiExecutionCitations, type AiExecutionSecurity, AiExecutionsResource, type AiField, type AiFlow, type AiFlowGraph, type AiFlowInput, type AiFlowSettings, type AiFlowVersion, type AiFollowupEffect, type AiFollowupEvent, AiFollowupFlowsResource, type AiFollowupPromise, type AiFollowupPromiseDetail, type AiFollowupPromiseStatus, type AiFollowupQueueFilters, type AiFollowupQueuePage, type AiFollowupQueueRow, AiFollowupsResource, type AiGateMode, type AiInference, type AiInferenceOrigin, type AiInferenceOutcome, type AiInferenceSummary, AiInferencesResource, type AiKnowledgeChunk, type AiKnowledgeCitation, type AiKnowledgeConversation, type AiKnowledgeHit, type AiKnowledgeImport, type AiKnowledgePreview, AiKnowledgeResource, type AiKnowledgeSearchDiagnostics, type AiKnowledgeSource, type AiMemory, type AiMemoryEntry, type AiMemoryEntryEvent, AiMemoryResource, type AiModelCatalogSnapshot, type AiModelCatalogSync, type AiNoticeCheck, type AiNoticeEffect, type AiNoticeField, type AiNoticeJob, type AiNoticeSettings, AiNoticesResource, type AiOperation, type AiOperatorMetrics, AiOperatorResource, type AiPage, type AiPlatformSkill, type AiPlatformSkillComposition, type AiPreparedUpload, type AiProposal, AiProposalsResource, type AiProvider, type AiProviderInfo, type AiProviderModel, AiProvidersResource, type AiPurpose, type AiRate, type AiRateInput, type AiRecord, type AiRevision, type AiRouter, type AiRouterConfig, type AiRouterTest, AiRoutersResource, type AiScope, type AiSkill, type AiSkillInput, type AiSkillNearMiss, type AiSkillVersion, AiSkillsResource, type AiSourceKind, type AiStyleAdjustment, type AiStyleAdjustmentId, AiStyleAdjustmentsResource, type AiToolId, type AiTurnPromise, type AiUploadReceiptCallback, AiUploadsResource, AiUsageResource, type AiUsageSummary, type AiUsageTokens, type AiWindow, type ApiLog, type Appointment, type AppointmentAvailability, type AppointmentExceptionInput, type AppointmentFields, type AppointmentHistory, type AppointmentQuery, type AppointmentScheduleInput, type AppointmentServiceInput, type AppointmentStatus, Appointments, type Assignment, type AvailabilityQuery, type Billing, type BillingGuarantee, type BillingPlan, type BlockUserParams, type BlockUserResult, type BlockedUser, BotoZap, BotoZapError, type BotoZapErrorCode, type BotoZapEvent, type BotoZapOptions, type Broadcast, type BroadcastRecipient, type BroadcastRecipientInput, type BusinessSlot, Calendar, type CalendarConnection, type CalendarJob, type CalendarSelection, type ChannelAccount, type ChannelAccountRef, ChannelAccounts, type CommentAiDeliveryStatus, type CommentRule, type CommentRuleCounters, type CommentRuleMetrics, type CommentRuleMetricsParams, type CommentRuleStatus, type ConnectionBilling, type ConnectionBillingOutcome, type ConnectionBillingRefusal, type Consent, type ConsentChannel, type ConsentOrigin, type ConsentPurpose, type ConsentRequestResult, type ConsentState, type Contact, type ContactConsents, type ContactField, ContactFields, type ContactStage, ContactStages, type ContactWarning, type Conversation, type ConversationEntryPoint, type ConversationNote, type ConversationReadResult, type ConversationReferral, type ConversationReminder, type ConversationTypingResult, type ConversationalAutomation, type ConversationalCommand, type CreateAppointment, type CreateAssignmentParams, type CreateBroadcastParams, type CreateBusinessSlotOptions, type CreateCommentRuleParams, type CreateContactParams, type CreateCustomerParams, type CreateDemand, type CreateExportParams, type CreateMessageRuleParams, type CreateOpportunity, type CreateQrCodeParams, 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 EnableJourneyModelParams, type EventList, type EventPaging, type ExportDownload, type ExportFormat, type ExportScope, type ExportStatus, type FixedRuleMessage, type HistoryImport, type HistoryImportStatus, type HistoryImportWindowDays, Inbox, type InboxMutation, type InboxMutationResult, type InboxState, type InboxTools, type InitialConsent, type InstagramCommentAi, type InstagramCommentAiAutomation, type InstagramCommentAiRepliedEvent, type InstagramCommentAiRun, type InstagramConnection, type InstagramGenericElement, type InstagramIceBreaker, type InstagramInteractiveButton, type InstagramInteractiveButtonPayload, type InstagramInteractiveGenericPayload, type InstagramInteractivePayload, type InstagramPersistentMenuItem, type InstagramTokenStatus, type InteractiveButtonPayload, type InteractiveCtaUrlPayload, type InteractiveHeader, type InteractiveListPayload, type InteractivePayload, type Journey, type JourneyCatalogItem, type JourneyCatalogSegment, type JourneyCatalogTrigger, type JourneyConfig, type JourneyEnrollment, type JourneyModelEnableResult, type JourneyQuery, type JourneyRun, type JourneyStep, Journeys, type ListApiLogsParams, type ListBroadcastsParams, type ListChannelAccountsParams, type ListContactsParams, type ListConversationsParams, type ListEventsParams, type ListMessagesParams, type ListPhoneNumbersParams, type ListRecipientsParams, type ListTeamEventsParams, type ListTemplatesParams, type ListWebhookDeliveriesParams, type Me, type MediaAsset, type MediaUploadResult, type Message, type MessageChannel, type MessageContent, type MessageEdit, type MessageReplyTo, 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, PhoneNumberBlockedUsers, PhoneNumberQrCodes, type QrImageFormat, type QuickReply, Radar, type RadarEntry, type RadarPage, type RadarQuery, type RecordConsentParams, type ReplyConversationParams, type ReplyToParam, type RequestConsentParams, type RequestOptions, SavedReplies, type SavedReply, type SavedReplyInput, type SavedReplyQuery, type ScheduleBroadcastParams, type SendAudioParams, type SendDocumentParams, type SendFailureDetails, type SendImageParams, type SendInteractiveParams, type SendLocationParams, type SendMediaParams, type SendOptions, type SendReactionParams, type SendReactionResult, type SendResult, type SendTemplateParams, type SendTextParams, type SendVideoParams, type SetHistoryImportParams, type SetupLink, type StageColor, type StageRule, type StageRuleInput, type TeamEvent, type TeamEventActor, type TeamEventTarget, type Template, type TemplatePayload, type UnblockUserResult, type UpdateAppointment, type UpdateBroadcastParams, type UpdateCommentAiParams, type UpdateCommentRuleParams, type UpdateContactParams, type UpdateConversationalAutomationParams, type UpdateCustomerParams, type UpdateMessageRuleParams, type UpdateMessengerProfileParams, type UpdatePhoneNumberParams, type UpdateSetupLinkParams, type UpdateTemplateParams, type UpdateWebhookParams, type UpdateWhatsAppProfileParams, type UploadMediaParams, type UploadProfilePhotoParams, type User, WEBHOOK_CATEGORIES, type Webhook, type WebhookAuthorizationHeaders, type WebhookCategory, type WebhookChannelHealth, type WebhookChannelHealthStatus, type WebhookDelivery, type WebhookDeliveryReplay, type WebhookDeliveryStatus, type WhatsAppBusinessProfile, type WhatsAppBusinessVertical, type WhatsAppQrCode, isBusinessPaymentRequired, isConsentOptedOut, isConsentRevoked, isFreeCap, isFreeNumberCap, isNotConnected, isPlanError };
6402
+ export { AI_CONFIGURABLE_PURPOSES, AI_CREDENTIAL_PROVIDERS, AI_OPERATIONS, AI_PURPOSES, type AccountExport, type AddRecipientsError, type AddRecipientsResult, AgendaConfiguration, AgendaExceptions, type AgendaRecord, Ai, type AiAgent, type AiAgentConfig, type AiAgentConfigRead, type AiAgentCoverage, type AiAgentDiagnostic, type AiAgentInput, type AiAgentVersion, AiAgentsResource, type AiAlert, type AiAlertBulkFilters, type AiAlertListItem, AiAlertsResource, type AiArtifactUploadInput, type AiAudioPricing, type AiBinding, type AiBindingTarget, type AiBindingTargetRead, type AiBudget, type AiBudgetInput, type AiCapabilitySignal, type AiCapabilityUsage, type AiCapabilityUsageList, type AiCase, type AiCaseChat, type AiCaseEvent, type AiCaseKind, type AiCaseReply, type AiCaseReplyInput, type AiCaseSource, AiCasesResource, type AiCatalogItems, type AiCatalogModel, type AiCatalogProduct, type AiCatalogSyncInput, type AiCatalogSyncResult, type AiChannelGate, type AiCommercialDecision, type AiCommercialEffect, type AiCommercialJob, type AiCommercialProposal, AiCommercialProposalsResource, type AiCommercialRequest, type AiCommercialSettings, type AiConfigurablePurpose, type AiContactAuthorization, type AiConversationCheckpoint, type AiCredential, AiCredentialsResource, type AiDiagnosticCheck, type AiDiagnosticStatus, type AiDraftResult, type AiEligibilityOverview, AiEligibilityResource, type AiEligibilitySettings, type AiEnabledProvider, type AiEnrollment, type AiEvolution, AiEvolutionResource, type AiEvolutionSource, type AiExecution, type AiExecutionCitations, type AiExecutionSecurity, AiExecutionsResource, type AiField, type AiFlow, type AiFlowGraph, type AiFlowInput, type AiFlowSettings, type AiFlowVersion, type AiFollowupEffect, type AiFollowupEvent, AiFollowupFlowsResource, type AiFollowupPromise, type AiFollowupPromiseDetail, type AiFollowupPromiseStatus, type AiFollowupQueueFilters, type AiFollowupQueuePage, type AiFollowupQueueRow, AiFollowupsResource, type AiGateMode, type AiInference, type AiInferenceOrigin, type AiInferenceOutcome, type AiInferenceSummary, AiInferencesResource, type AiKnowledgeChunk, type AiKnowledgeCitation, type AiKnowledgeConversation, type AiKnowledgeHit, type AiKnowledgeImport, type AiKnowledgePreview, AiKnowledgeResource, type AiKnowledgeSearchDiagnostics, type AiKnowledgeSource, type AiMemory, type AiMemoryEntry, type AiMemoryEntryEvent, AiMemoryResource, type AiModelCatalogSnapshot, type AiModelCatalogSync, type AiNoticeCheck, type AiNoticeEffect, type AiNoticeField, type AiNoticeJob, type AiNoticeSettings, AiNoticesResource, type AiOperation, type AiOperatorMetrics, AiOperatorResource, type AiPage, type AiPlatformSkill, type AiPlatformSkillComposition, type AiPreparedUpload, type AiProposal, AiProposalsResource, type AiProvider, type AiProviderInfo, type AiProviderModel, AiProvidersResource, type AiPurpose, type AiRate, type AiRateInput, type AiRecord, type AiRevision, type AiRouter, type AiRouterConfig, type AiRouterTest, AiRoutersResource, type AiScope, type AiSkill, type AiSkillInput, type AiSkillNearMiss, type AiSkillVersion, AiSkillsResource, type AiSourceKind, type AiStyleAdjustment, type AiStyleAdjustmentId, AiStyleAdjustmentsResource, type AiToolId, type AiTurnPromise, type AiUploadReceiptCallback, AiUploadsResource, AiUsageResource, type AiUsageSummary, type AiUsageTokens, type AiWindow, type ApiLog, type Appointment, type AppointmentAvailability, type AppointmentExceptionInput, type AppointmentFields, type AppointmentHistory, type AppointmentQuery, type AppointmentScheduleInput, type AppointmentServiceInput, type AppointmentStatus, Appointments, type Assignment, type AvailabilityQuery, type Billing, type BillingGuarantee, type BillingPlan, type BlockUserParams, type BlockUserResult, type BlockedUser, BotoZap, BotoZapError, type BotoZapErrorCode, type BotoZapEvent, type BotoZapOptions, type Broadcast, type BroadcastRecipient, type BroadcastRecipientInput, type BusinessSlot, Calendar, type CalendarConnection, type CalendarJob, type CalendarSelection, type ChannelAccount, type ChannelAccountRef, ChannelAccounts, type CommentAiDeliveryStatus, type CommentRule, type CommentRuleCounters, type CommentRuleMetrics, type CommentRuleMetricsParams, type CommentRuleStatus, type ConnectionBilling, type ConnectionBillingOutcome, type ConnectionBillingRefusal, type Consent, type ConsentChannel, type ConsentOrigin, type ConsentPurpose, type ConsentRequestResult, type ConsentState, type Contact, type ContactConsents, type ContactField, ContactFields, type ContactStage, ContactStages, type ContactWarning, type Conversation, type ConversationEntryPoint, type ConversationNote, type ConversationReadResult, type ConversationReferral, type ConversationReminder, type ConversationTypingResult, type ConversationalAutomation, type ConversationalCommand, type CreateAppointment, type CreateAssignmentParams, type CreateBroadcastParams, type CreateBusinessSlotOptions, type CreateCommentRuleParams, type CreateContactParams, type CreateCustomerParams, type CreateDemand, type CreateExportParams, type CreateMessageRuleParams, type CreateOpportunity, type CreateQrCodeParams, 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 DeletedTemplate, type Demand, type DemandFields, type EnableJourneyModelParams, type EventList, type EventPaging, type ExportDownload, type ExportFormat, type ExportScope, type ExportStatus, type FixedRuleMessage, type HistoryImport, type HistoryImportStatus, type HistoryImportWindowDays, Inbox, type InboxMutation, type InboxMutationResult, type InboxState, type InboxTools, type InitialConsent, type InstagramCommentAi, type InstagramCommentAiAutomation, type InstagramCommentAiRepliedEvent, type InstagramCommentAiRun, type InstagramConnection, type InstagramGenericElement, type InstagramIceBreaker, type InstagramInteractiveButton, type InstagramInteractiveButtonPayload, type InstagramInteractiveGenericPayload, type InstagramInteractivePayload, type InstagramPersistentMenuItem, type InstagramTokenStatus, type InteractiveButtonPayload, type InteractiveCtaUrlPayload, type InteractiveHeader, type InteractiveListPayload, type InteractivePayload, type Journey, type JourneyCatalogItem, type JourneyCatalogSegment, type JourneyCatalogTrigger, type JourneyConfig, type JourneyEnrollment, type JourneyModelEnableResult, type JourneyQuery, type JourneyRun, type JourneyStep, Journeys, type ListApiLogsParams, type ListBroadcastsParams, type ListChannelAccountsParams, type ListContactsParams, type ListConversationsParams, type ListEventsParams, type ListMessagesParams, type ListPhoneNumbersParams, type ListRecipientsParams, type ListTeamEventsParams, type ListTemplatesParams, type ListWebhookDeliveriesParams, type Me, type MediaAsset, type MediaUploadResult, type Message, type MessageChannel, type MessageContent, type MessageEdit, type MessageReplyTo, 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, PhoneNumberBlockedUsers, PhoneNumberQrCodes, type QrImageFormat, type QuickReply, Radar, type RadarEntry, type RadarPage, type RadarQuery, type RecordConsentParams, type ReplyConversationParams, type ReplyToParam, type RequestConsentParams, type RequestOptions, SavedReplies, type SavedReply, type SavedReplyInput, type SavedReplyQuery, type ScheduleBroadcastParams, type SendAudioParams, type SendDocumentParams, type SendFailureDetails, type SendImageParams, type SendInteractiveParams, type SendLocationParams, type SendMediaParams, type SendOptions, type SendReactionParams, type SendReactionResult, type SendResult, type SendTemplateParams, type SendTextParams, type SendVideoParams, type SetHistoryImportParams, type SetupLink, type StageColor, type StageRule, type StageRuleInput, type SyncTemplatesParams, type TeamEvent, type TeamEventActor, type TeamEventTarget, type Template, type TemplatePayload, type TemplateSyncResult, type UnblockUserResult, type UpdateAppointment, type UpdateBroadcastParams, type UpdateCommentAiParams, type UpdateCommentRuleParams, type UpdateContactParams, type UpdateConversationalAutomationParams, type UpdateCustomerParams, type UpdateMessageRuleParams, type UpdateMessengerProfileParams, type UpdatePhoneNumberParams, type UpdateSetupLinkParams, type UpdateTemplateParams, type UpdateWebhookParams, type UpdateWhatsAppProfileParams, type UploadMediaParams, type UploadProfilePhotoParams, type User, WEBHOOK_CATEGORIES, type Webhook, type WebhookAuthorizationHeaders, type WebhookCategory, type WebhookChannelHealth, type WebhookChannelHealthStatus, type WebhookDelivery, type WebhookDeliveryReplay, type WebhookDeliveryStatus, type WebhookSubscription, type WebhookSubscriptionState, type WhatsAppBusinessProfile, type WhatsAppBusinessVertical, type WhatsAppQrCode, isBusinessPaymentRequired, isConsentOptedOut, isConsentRevoked, isFreeCap, isFreeNumberCap, isNotConnected, isPlanError };
package/dist/index.d.ts CHANGED
@@ -4424,13 +4424,43 @@ interface CreateTemplateParams {
4424
4424
  */
4425
4425
  opt_out_buttons?: string[];
4426
4426
  }
4427
+ interface SyncTemplatesParams {
4428
+ /** Só as conexões deste Cliente; sem ele, todas as conexões ativas da conta. */
4429
+ customer_id?: string;
4430
+ }
4431
+ /** Resultado de `templates.sync()`. */
4432
+ interface TemplateSyncResult {
4433
+ /** Conexões ativas do WhatsApp conferidas. */
4434
+ connections: number;
4435
+ /** Templates que a Meta tem e foram gravados aqui. */
4436
+ synced: number;
4437
+ /** Templates tirados daqui porque foram excluídos na Meta. */
4438
+ removed: number;
4439
+ /** Conexões sem autorização guardada, puladas (reconecte o número). */
4440
+ skipped_without_token: number;
4441
+ /** Uma régua de modelo não acompanhou a mudança de status: sincronize de novo. */
4442
+ automations_outdated: boolean;
4443
+ }
4427
4444
  /** Corpo de `PATCH /v1/templates/:id`. */
4428
4445
  interface UpdateTemplateParams {
4429
4446
  /**
4430
- * Textos dos botões de resposta rápida que são de saída; `[]` limpa a marcação.
4431
- * Anotação do BotoZap: não altera o template na Meta.
4447
+ * Componentes novos, no formato da criação: edita o template e o devolve à
4448
+ * análise da Meta (`status` volta a `PENDING`). Nome e idioma não mudam.
4449
+ */
4450
+ components?: unknown[];
4451
+ /** Categoria nova, junto com `components`; ausente mantém a atual. */
4452
+ category?: string;
4453
+ /**
4454
+ * Textos dos botões de resposta rápida que são de saída; `[]` limpa. Sozinho,
4455
+ * é anotação do BotoZap e não altera o template na Meta; com `components`,
4456
+ * ausente mantém a marcação atual.
4432
4457
  */
4433
- opt_out_buttons: string[];
4458
+ opt_out_buttons?: string[];
4459
+ }
4460
+ /** Resultado de `templates.delete()`. */
4461
+ interface DeletedTemplate {
4462
+ id: string;
4463
+ deleted: true;
4434
4464
  }
4435
4465
  /** Endpoints de template (GET/POST /v1/templates, GET /v1/templates/:id). */
4436
4466
  declare class Templates {
@@ -4443,12 +4473,27 @@ declare class Templates {
4443
4473
  /** Cria um template e o submete à Meta para análise. */
4444
4474
  create(params: CreateTemplateParams): Promise<Template>;
4445
4475
  /**
4446
- * Marca quais botões de resposta rápida são de saída (`opt_out_buttons`). O toque
4447
- * num botão marcado grava a recusa da finalidade do template; botão não marcado
4448
- * não muda nada, qualquer que seja o texto. Não altera o template na Meta.
4449
- * Scope `templates:write`.
4476
+ * Com `components` (e `category`), edita o template e o devolve à análise da
4477
+ * Meta, como o Editar do painel: em análise responde 409 `template_in_review`;
4478
+ * sem id da Meta, 409 `template_not_synced`. Só com `opt_out_buttons`, marca
4479
+ * quais botões de resposta rápida são de saída, sem alterar o template na
4480
+ * Meta. Scope `templates:write`.
4450
4481
  */
4451
4482
  update(id: string, params: UpdateTemplateParams): Promise<Template>;
4483
+ /**
4484
+ * O Sincronizar da tela de Templates: traz da Meta status, categoria,
4485
+ * conteúdo e `rejection_reason` dos templates das conexões ativas (ou de um
4486
+ * Cliente), importa os criados no WhatsApp Manager e tira daqui os excluídos
4487
+ * lá. Use quando um status parecer parado. Autorização recusada pela Meta
4488
+ * responde 409 `reconnect_required`. Scope `templates:write`.
4489
+ */
4490
+ sync(params?: SyncTemplatesParams): Promise<TemplateSyncResult>;
4491
+ /**
4492
+ * Exclui o template na Meta e aqui, como o Excluir do painel. Com o id da Meta
4493
+ * apaga só aquela versão de idioma; sem ele, a Meta apaga todas as do mesmo
4494
+ * nome. Não dá para desfazer. Só chave de produção. Scope `templates:write`.
4495
+ */
4496
+ delete(id: string): Promise<DeletedTemplate>;
4452
4497
  }
4453
4498
 
4454
4499
  interface ListBroadcastsParams extends OffsetParams {
@@ -4997,6 +5042,16 @@ interface UnblockUserResult {
4997
5042
  * (`skipped` quando a escolha foi 0 dias).
4998
5043
  */
4999
5044
  type HistoryImportStatus = "awaiting_choice" | "queued" | "requested" | "declined" | "failed" | "expired" | "unconfirmed" | "skipped";
5045
+ /**
5046
+ * Inscrição do BotoZap para receber as mensagens do número na Meta:
5047
+ * `subscribed` (recebe), `missing` (a Meta parou de mandar) ou `unknown`
5048
+ * (a Meta não respondeu).
5049
+ */
5050
+ type WebhookSubscriptionState = "subscribed" | "missing" | "unknown";
5051
+ /** Resultado de `resubscribeWebhooks`. */
5052
+ interface WebhookSubscription {
5053
+ webhook_subscription: WebhookSubscriptionState;
5054
+ }
5000
5055
  /** Janela de conversas antigas a importar, em dias (0 = não importar). */
5001
5056
  type HistoryImportWindowDays = 0 | 30 | 180;
5002
5057
  /** Importação das conversas antigas do número (`GET|PUT …/history-import`). */
@@ -5161,8 +5216,19 @@ declare class PhoneNumbers {
5161
5216
  * o último mês vale 20 h depois da conexão. Scope `numbers:write`.
5162
5217
  */
5163
5218
  setHistoryImport(id: string, params: SetHistoryImportParams): Promise<HistoryImport>;
5164
- /** Saúde do número (qualidade, limite, status na Meta). */
5219
+ /**
5220
+ * Prontidão do número. Com a conexão ativa, confere ao vivo o token
5221
+ * (`checks.token_validity`) e se a Meta manda as mensagens para o BotoZap
5222
+ * (`checks.webhook_subscription`).
5223
+ */
5165
5224
  health(id: string): Promise<Record<string, unknown>>;
5225
+ /**
5226
+ * Inscreve o BotoZap de novo para receber as mensagens do número, com a
5227
+ * autorização já guardada, sem refazer a conexão. Resolve a prontidão
5228
+ * `webhooks_lost`; autorização recusada pela Meta responde 409
5229
+ * `reconnect_required` (aí só o link de setup resolve). Scope `numbers:write`.
5230
+ */
5231
+ resubscribeWebhooks(id: string): Promise<WebhookSubscription>;
5166
5232
  }
5167
5233
 
5168
5234
  /**
@@ -6333,4 +6399,4 @@ declare function isConsentRevoked(error: unknown): error is BotoZapError;
6333
6399
  */
6334
6400
  declare function isNotConnected(error: unknown): error is BotoZapError;
6335
6401
 
6336
- export { AI_CONFIGURABLE_PURPOSES, AI_CREDENTIAL_PROVIDERS, AI_OPERATIONS, AI_PURPOSES, type AccountExport, type AddRecipientsError, type AddRecipientsResult, AgendaConfiguration, AgendaExceptions, type AgendaRecord, Ai, type AiAgent, type AiAgentConfig, type AiAgentConfigRead, type AiAgentCoverage, type AiAgentDiagnostic, type AiAgentInput, type AiAgentVersion, AiAgentsResource, type AiAlert, type AiAlertBulkFilters, type AiAlertListItem, AiAlertsResource, type AiArtifactUploadInput, type AiAudioPricing, type AiBinding, type AiBindingTarget, type AiBindingTargetRead, type AiBudget, type AiBudgetInput, type AiCapabilitySignal, type AiCapabilityUsage, type AiCapabilityUsageList, type AiCase, type AiCaseChat, type AiCaseEvent, type AiCaseKind, type AiCaseReply, type AiCaseReplyInput, type AiCaseSource, AiCasesResource, type AiCatalogItems, type AiCatalogModel, type AiCatalogProduct, type AiCatalogSyncInput, type AiCatalogSyncResult, type AiChannelGate, type AiCommercialDecision, type AiCommercialEffect, type AiCommercialJob, type AiCommercialProposal, AiCommercialProposalsResource, type AiCommercialRequest, type AiCommercialSettings, type AiConfigurablePurpose, type AiContactAuthorization, type AiConversationCheckpoint, type AiCredential, AiCredentialsResource, type AiDiagnosticCheck, type AiDiagnosticStatus, type AiDraftResult, type AiEligibilityOverview, AiEligibilityResource, type AiEligibilitySettings, type AiEnabledProvider, type AiEnrollment, type AiEvolution, AiEvolutionResource, type AiEvolutionSource, type AiExecution, type AiExecutionCitations, type AiExecutionSecurity, AiExecutionsResource, type AiField, type AiFlow, type AiFlowGraph, type AiFlowInput, type AiFlowSettings, type AiFlowVersion, type AiFollowupEffect, type AiFollowupEvent, AiFollowupFlowsResource, type AiFollowupPromise, type AiFollowupPromiseDetail, type AiFollowupPromiseStatus, type AiFollowupQueueFilters, type AiFollowupQueuePage, type AiFollowupQueueRow, AiFollowupsResource, type AiGateMode, type AiInference, type AiInferenceOrigin, type AiInferenceOutcome, type AiInferenceSummary, AiInferencesResource, type AiKnowledgeChunk, type AiKnowledgeCitation, type AiKnowledgeConversation, type AiKnowledgeHit, type AiKnowledgeImport, type AiKnowledgePreview, AiKnowledgeResource, type AiKnowledgeSearchDiagnostics, type AiKnowledgeSource, type AiMemory, type AiMemoryEntry, type AiMemoryEntryEvent, AiMemoryResource, type AiModelCatalogSnapshot, type AiModelCatalogSync, type AiNoticeCheck, type AiNoticeEffect, type AiNoticeField, type AiNoticeJob, type AiNoticeSettings, AiNoticesResource, type AiOperation, type AiOperatorMetrics, AiOperatorResource, type AiPage, type AiPlatformSkill, type AiPlatformSkillComposition, type AiPreparedUpload, type AiProposal, AiProposalsResource, type AiProvider, type AiProviderInfo, type AiProviderModel, AiProvidersResource, type AiPurpose, type AiRate, type AiRateInput, type AiRecord, type AiRevision, type AiRouter, type AiRouterConfig, type AiRouterTest, AiRoutersResource, type AiScope, type AiSkill, type AiSkillInput, type AiSkillNearMiss, type AiSkillVersion, AiSkillsResource, type AiSourceKind, type AiStyleAdjustment, type AiStyleAdjustmentId, AiStyleAdjustmentsResource, type AiToolId, type AiTurnPromise, type AiUploadReceiptCallback, AiUploadsResource, AiUsageResource, type AiUsageSummary, type AiUsageTokens, type AiWindow, type ApiLog, type Appointment, type AppointmentAvailability, type AppointmentExceptionInput, type AppointmentFields, type AppointmentHistory, type AppointmentQuery, type AppointmentScheduleInput, type AppointmentServiceInput, type AppointmentStatus, Appointments, type Assignment, type AvailabilityQuery, type Billing, type BillingGuarantee, type BillingPlan, type BlockUserParams, type BlockUserResult, type BlockedUser, BotoZap, BotoZapError, type BotoZapErrorCode, type BotoZapEvent, type BotoZapOptions, type Broadcast, type BroadcastRecipient, type BroadcastRecipientInput, type BusinessSlot, Calendar, type CalendarConnection, type CalendarJob, type CalendarSelection, type ChannelAccount, type ChannelAccountRef, ChannelAccounts, type CommentAiDeliveryStatus, type CommentRule, type CommentRuleCounters, type CommentRuleMetrics, type CommentRuleMetricsParams, type CommentRuleStatus, type ConnectionBilling, type ConnectionBillingOutcome, type ConnectionBillingRefusal, type Consent, type ConsentChannel, type ConsentOrigin, type ConsentPurpose, type ConsentRequestResult, type ConsentState, type Contact, type ContactConsents, type ContactField, ContactFields, type ContactStage, ContactStages, type ContactWarning, type Conversation, type ConversationEntryPoint, type ConversationNote, type ConversationReadResult, type ConversationReferral, type ConversationReminder, type ConversationTypingResult, type ConversationalAutomation, type ConversationalCommand, type CreateAppointment, type CreateAssignmentParams, type CreateBroadcastParams, type CreateBusinessSlotOptions, type CreateCommentRuleParams, type CreateContactParams, type CreateCustomerParams, type CreateDemand, type CreateExportParams, type CreateMessageRuleParams, type CreateOpportunity, type CreateQrCodeParams, 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 EnableJourneyModelParams, type EventList, type EventPaging, type ExportDownload, type ExportFormat, type ExportScope, type ExportStatus, type FixedRuleMessage, type HistoryImport, type HistoryImportStatus, type HistoryImportWindowDays, Inbox, type InboxMutation, type InboxMutationResult, type InboxState, type InboxTools, type InitialConsent, type InstagramCommentAi, type InstagramCommentAiAutomation, type InstagramCommentAiRepliedEvent, type InstagramCommentAiRun, type InstagramConnection, type InstagramGenericElement, type InstagramIceBreaker, type InstagramInteractiveButton, type InstagramInteractiveButtonPayload, type InstagramInteractiveGenericPayload, type InstagramInteractivePayload, type InstagramPersistentMenuItem, type InstagramTokenStatus, type InteractiveButtonPayload, type InteractiveCtaUrlPayload, type InteractiveHeader, type InteractiveListPayload, type InteractivePayload, type Journey, type JourneyCatalogItem, type JourneyCatalogSegment, type JourneyCatalogTrigger, type JourneyConfig, type JourneyEnrollment, type JourneyModelEnableResult, type JourneyQuery, type JourneyRun, type JourneyStep, Journeys, type ListApiLogsParams, type ListBroadcastsParams, type ListChannelAccountsParams, type ListContactsParams, type ListConversationsParams, type ListEventsParams, type ListMessagesParams, type ListPhoneNumbersParams, type ListRecipientsParams, type ListTeamEventsParams, type ListTemplatesParams, type ListWebhookDeliveriesParams, type Me, type MediaAsset, type MediaUploadResult, type Message, type MessageChannel, type MessageContent, type MessageEdit, type MessageReplyTo, 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, PhoneNumberBlockedUsers, PhoneNumberQrCodes, type QrImageFormat, type QuickReply, Radar, type RadarEntry, type RadarPage, type RadarQuery, type RecordConsentParams, type ReplyConversationParams, type ReplyToParam, type RequestConsentParams, type RequestOptions, SavedReplies, type SavedReply, type SavedReplyInput, type SavedReplyQuery, type ScheduleBroadcastParams, type SendAudioParams, type SendDocumentParams, type SendFailureDetails, type SendImageParams, type SendInteractiveParams, type SendLocationParams, type SendMediaParams, type SendOptions, type SendReactionParams, type SendReactionResult, type SendResult, type SendTemplateParams, type SendTextParams, type SendVideoParams, type SetHistoryImportParams, type SetupLink, type StageColor, type StageRule, type StageRuleInput, type TeamEvent, type TeamEventActor, type TeamEventTarget, type Template, type TemplatePayload, type UnblockUserResult, type UpdateAppointment, type UpdateBroadcastParams, type UpdateCommentAiParams, type UpdateCommentRuleParams, type UpdateContactParams, type UpdateConversationalAutomationParams, type UpdateCustomerParams, type UpdateMessageRuleParams, type UpdateMessengerProfileParams, type UpdatePhoneNumberParams, type UpdateSetupLinkParams, type UpdateTemplateParams, type UpdateWebhookParams, type UpdateWhatsAppProfileParams, type UploadMediaParams, type UploadProfilePhotoParams, type User, WEBHOOK_CATEGORIES, type Webhook, type WebhookAuthorizationHeaders, type WebhookCategory, type WebhookChannelHealth, type WebhookChannelHealthStatus, type WebhookDelivery, type WebhookDeliveryReplay, type WebhookDeliveryStatus, type WhatsAppBusinessProfile, type WhatsAppBusinessVertical, type WhatsAppQrCode, isBusinessPaymentRequired, isConsentOptedOut, isConsentRevoked, isFreeCap, isFreeNumberCap, isNotConnected, isPlanError };
6402
+ export { AI_CONFIGURABLE_PURPOSES, AI_CREDENTIAL_PROVIDERS, AI_OPERATIONS, AI_PURPOSES, type AccountExport, type AddRecipientsError, type AddRecipientsResult, AgendaConfiguration, AgendaExceptions, type AgendaRecord, Ai, type AiAgent, type AiAgentConfig, type AiAgentConfigRead, type AiAgentCoverage, type AiAgentDiagnostic, type AiAgentInput, type AiAgentVersion, AiAgentsResource, type AiAlert, type AiAlertBulkFilters, type AiAlertListItem, AiAlertsResource, type AiArtifactUploadInput, type AiAudioPricing, type AiBinding, type AiBindingTarget, type AiBindingTargetRead, type AiBudget, type AiBudgetInput, type AiCapabilitySignal, type AiCapabilityUsage, type AiCapabilityUsageList, type AiCase, type AiCaseChat, type AiCaseEvent, type AiCaseKind, type AiCaseReply, type AiCaseReplyInput, type AiCaseSource, AiCasesResource, type AiCatalogItems, type AiCatalogModel, type AiCatalogProduct, type AiCatalogSyncInput, type AiCatalogSyncResult, type AiChannelGate, type AiCommercialDecision, type AiCommercialEffect, type AiCommercialJob, type AiCommercialProposal, AiCommercialProposalsResource, type AiCommercialRequest, type AiCommercialSettings, type AiConfigurablePurpose, type AiContactAuthorization, type AiConversationCheckpoint, type AiCredential, AiCredentialsResource, type AiDiagnosticCheck, type AiDiagnosticStatus, type AiDraftResult, type AiEligibilityOverview, AiEligibilityResource, type AiEligibilitySettings, type AiEnabledProvider, type AiEnrollment, type AiEvolution, AiEvolutionResource, type AiEvolutionSource, type AiExecution, type AiExecutionCitations, type AiExecutionSecurity, AiExecutionsResource, type AiField, type AiFlow, type AiFlowGraph, type AiFlowInput, type AiFlowSettings, type AiFlowVersion, type AiFollowupEffect, type AiFollowupEvent, AiFollowupFlowsResource, type AiFollowupPromise, type AiFollowupPromiseDetail, type AiFollowupPromiseStatus, type AiFollowupQueueFilters, type AiFollowupQueuePage, type AiFollowupQueueRow, AiFollowupsResource, type AiGateMode, type AiInference, type AiInferenceOrigin, type AiInferenceOutcome, type AiInferenceSummary, AiInferencesResource, type AiKnowledgeChunk, type AiKnowledgeCitation, type AiKnowledgeConversation, type AiKnowledgeHit, type AiKnowledgeImport, type AiKnowledgePreview, AiKnowledgeResource, type AiKnowledgeSearchDiagnostics, type AiKnowledgeSource, type AiMemory, type AiMemoryEntry, type AiMemoryEntryEvent, AiMemoryResource, type AiModelCatalogSnapshot, type AiModelCatalogSync, type AiNoticeCheck, type AiNoticeEffect, type AiNoticeField, type AiNoticeJob, type AiNoticeSettings, AiNoticesResource, type AiOperation, type AiOperatorMetrics, AiOperatorResource, type AiPage, type AiPlatformSkill, type AiPlatformSkillComposition, type AiPreparedUpload, type AiProposal, AiProposalsResource, type AiProvider, type AiProviderInfo, type AiProviderModel, AiProvidersResource, type AiPurpose, type AiRate, type AiRateInput, type AiRecord, type AiRevision, type AiRouter, type AiRouterConfig, type AiRouterTest, AiRoutersResource, type AiScope, type AiSkill, type AiSkillInput, type AiSkillNearMiss, type AiSkillVersion, AiSkillsResource, type AiSourceKind, type AiStyleAdjustment, type AiStyleAdjustmentId, AiStyleAdjustmentsResource, type AiToolId, type AiTurnPromise, type AiUploadReceiptCallback, AiUploadsResource, AiUsageResource, type AiUsageSummary, type AiUsageTokens, type AiWindow, type ApiLog, type Appointment, type AppointmentAvailability, type AppointmentExceptionInput, type AppointmentFields, type AppointmentHistory, type AppointmentQuery, type AppointmentScheduleInput, type AppointmentServiceInput, type AppointmentStatus, Appointments, type Assignment, type AvailabilityQuery, type Billing, type BillingGuarantee, type BillingPlan, type BlockUserParams, type BlockUserResult, type BlockedUser, BotoZap, BotoZapError, type BotoZapErrorCode, type BotoZapEvent, type BotoZapOptions, type Broadcast, type BroadcastRecipient, type BroadcastRecipientInput, type BusinessSlot, Calendar, type CalendarConnection, type CalendarJob, type CalendarSelection, type ChannelAccount, type ChannelAccountRef, ChannelAccounts, type CommentAiDeliveryStatus, type CommentRule, type CommentRuleCounters, type CommentRuleMetrics, type CommentRuleMetricsParams, type CommentRuleStatus, type ConnectionBilling, type ConnectionBillingOutcome, type ConnectionBillingRefusal, type Consent, type ConsentChannel, type ConsentOrigin, type ConsentPurpose, type ConsentRequestResult, type ConsentState, type Contact, type ContactConsents, type ContactField, ContactFields, type ContactStage, ContactStages, type ContactWarning, type Conversation, type ConversationEntryPoint, type ConversationNote, type ConversationReadResult, type ConversationReferral, type ConversationReminder, type ConversationTypingResult, type ConversationalAutomation, type ConversationalCommand, type CreateAppointment, type CreateAssignmentParams, type CreateBroadcastParams, type CreateBusinessSlotOptions, type CreateCommentRuleParams, type CreateContactParams, type CreateCustomerParams, type CreateDemand, type CreateExportParams, type CreateMessageRuleParams, type CreateOpportunity, type CreateQrCodeParams, 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 DeletedTemplate, type Demand, type DemandFields, type EnableJourneyModelParams, type EventList, type EventPaging, type ExportDownload, type ExportFormat, type ExportScope, type ExportStatus, type FixedRuleMessage, type HistoryImport, type HistoryImportStatus, type HistoryImportWindowDays, Inbox, type InboxMutation, type InboxMutationResult, type InboxState, type InboxTools, type InitialConsent, type InstagramCommentAi, type InstagramCommentAiAutomation, type InstagramCommentAiRepliedEvent, type InstagramCommentAiRun, type InstagramConnection, type InstagramGenericElement, type InstagramIceBreaker, type InstagramInteractiveButton, type InstagramInteractiveButtonPayload, type InstagramInteractiveGenericPayload, type InstagramInteractivePayload, type InstagramPersistentMenuItem, type InstagramTokenStatus, type InteractiveButtonPayload, type InteractiveCtaUrlPayload, type InteractiveHeader, type InteractiveListPayload, type InteractivePayload, type Journey, type JourneyCatalogItem, type JourneyCatalogSegment, type JourneyCatalogTrigger, type JourneyConfig, type JourneyEnrollment, type JourneyModelEnableResult, type JourneyQuery, type JourneyRun, type JourneyStep, Journeys, type ListApiLogsParams, type ListBroadcastsParams, type ListChannelAccountsParams, type ListContactsParams, type ListConversationsParams, type ListEventsParams, type ListMessagesParams, type ListPhoneNumbersParams, type ListRecipientsParams, type ListTeamEventsParams, type ListTemplatesParams, type ListWebhookDeliveriesParams, type Me, type MediaAsset, type MediaUploadResult, type Message, type MessageChannel, type MessageContent, type MessageEdit, type MessageReplyTo, 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, PhoneNumberBlockedUsers, PhoneNumberQrCodes, type QrImageFormat, type QuickReply, Radar, type RadarEntry, type RadarPage, type RadarQuery, type RecordConsentParams, type ReplyConversationParams, type ReplyToParam, type RequestConsentParams, type RequestOptions, SavedReplies, type SavedReply, type SavedReplyInput, type SavedReplyQuery, type ScheduleBroadcastParams, type SendAudioParams, type SendDocumentParams, type SendFailureDetails, type SendImageParams, type SendInteractiveParams, type SendLocationParams, type SendMediaParams, type SendOptions, type SendReactionParams, type SendReactionResult, type SendResult, type SendTemplateParams, type SendTextParams, type SendVideoParams, type SetHistoryImportParams, type SetupLink, type StageColor, type StageRule, type StageRuleInput, type SyncTemplatesParams, type TeamEvent, type TeamEventActor, type TeamEventTarget, type Template, type TemplatePayload, type TemplateSyncResult, type UnblockUserResult, type UpdateAppointment, type UpdateBroadcastParams, type UpdateCommentAiParams, type UpdateCommentRuleParams, type UpdateContactParams, type UpdateConversationalAutomationParams, type UpdateCustomerParams, type UpdateMessageRuleParams, type UpdateMessengerProfileParams, type UpdatePhoneNumberParams, type UpdateSetupLinkParams, type UpdateTemplateParams, type UpdateWebhookParams, type UpdateWhatsAppProfileParams, type UploadMediaParams, type UploadProfilePhotoParams, type User, WEBHOOK_CATEGORIES, type Webhook, type WebhookAuthorizationHeaders, type WebhookCategory, type WebhookChannelHealth, type WebhookChannelHealthStatus, type WebhookDelivery, type WebhookDeliveryReplay, type WebhookDeliveryStatus, type WebhookSubscription, type WebhookSubscriptionState, type WhatsAppBusinessProfile, type WhatsAppBusinessVertical, type WhatsAppQrCode, isBusinessPaymentRequired, isConsentOptedOut, isConsentRevoked, isFreeCap, isFreeNumberCap, isNotConnected, isPlanError };
package/dist/index.js CHANGED
@@ -5432,10 +5432,11 @@ var Templates = class {
5432
5432
  });
5433
5433
  }
5434
5434
  /**
5435
- * Marca quais botões de resposta rápida são de saída (`opt_out_buttons`). O toque
5436
- * num botão marcado grava a recusa da finalidade do template; botão não marcado
5437
- * não muda nada, qualquer que seja o texto. Não altera o template na Meta.
5438
- * Scope `templates:write`.
5435
+ * Com `components` (e `category`), edita o template e o devolve à análise da
5436
+ * Meta, como o Editar do painel: em análise responde 409 `template_in_review`;
5437
+ * sem id da Meta, 409 `template_not_synced`. Só com `opt_out_buttons`, marca
5438
+ * quais botões de resposta rápida são de saída, sem alterar o template na
5439
+ * Meta. Scope `templates:write`.
5439
5440
  */
5440
5441
  update(id, params) {
5441
5442
  return this.client.requestItem(
@@ -5444,6 +5445,24 @@ var Templates = class {
5444
5445
  { body: params }
5445
5446
  );
5446
5447
  }
5448
+ /**
5449
+ * O Sincronizar da tela de Templates: traz da Meta status, categoria,
5450
+ * conteúdo e `rejection_reason` dos templates das conexões ativas (ou de um
5451
+ * Cliente), importa os criados no WhatsApp Manager e tira daqui os excluídos
5452
+ * lá. Use quando um status parecer parado. Autorização recusada pela Meta
5453
+ * responde 409 `reconnect_required`. Scope `templates:write`.
5454
+ */
5455
+ sync(params = {}) {
5456
+ return this.client.requestItem("POST", "/templates/sync", { body: params });
5457
+ }
5458
+ /**
5459
+ * Exclui o template na Meta e aqui, como o Excluir do painel. Com o id da Meta
5460
+ * apaga só aquela versão de idioma; sem ele, a Meta apaga todas as do mesmo
5461
+ * nome. Não dá para desfazer. Só chave de produção. Scope `templates:write`.
5462
+ */
5463
+ delete(id) {
5464
+ return this.client.requestItem("DELETE", `/templates/${encodeURIComponent(id)}`);
5465
+ }
5447
5466
  };
5448
5467
 
5449
5468
  // src/resources/broadcasts.ts
@@ -6080,13 +6099,26 @@ var PhoneNumbers = class {
6080
6099
  body: { window_days: params.window_days }
6081
6100
  });
6082
6101
  }
6083
- /** Saúde do número (qualidade, limite, status na Meta). */
6102
+ /**
6103
+ * Prontidão do número. Com a conexão ativa, confere ao vivo o token
6104
+ * (`checks.token_validity`) e se a Meta manda as mensagens para o BotoZap
6105
+ * (`checks.webhook_subscription`).
6106
+ */
6084
6107
  health(id) {
6085
6108
  return this.client.requestItem(
6086
6109
  "GET",
6087
6110
  `/phone_numbers/${enc6(id)}/health`
6088
6111
  );
6089
6112
  }
6113
+ /**
6114
+ * Inscreve o BotoZap de novo para receber as mensagens do número, com a
6115
+ * autorização já guardada, sem refazer a conexão. Resolve a prontidão
6116
+ * `webhooks_lost`; autorização recusada pela Meta responde 409
6117
+ * `reconnect_required` (aí só o link de setup resolve). Scope `numbers:write`.
6118
+ */
6119
+ resubscribeWebhooks(id) {
6120
+ return this.client.requestItem("POST", `/phone_numbers/${enc6(id)}/webhook-subscription`);
6121
+ }
6090
6122
  };
6091
6123
  function enc6(id) {
6092
6124
  return encodeURIComponent(id);