From fab1222f9742161c5eaf4eadb239a26217e76490 Mon Sep 17 00:00:00 2001 From: Rajeh Taher Date: Sun, 15 Nov 2026 19:56:22 +0200 Subject: [PATCH 01/41] refactor(typescript): begin Connection account surface migration --- .../src/campaign-contract-response.ts | 8 +- .../src/campaign-contract-validation.ts | 8 +- packages/typescript/src/campaign-contracts.ts | 6 +- .../src/campaign-existing-validation.ts | 2 +- packages/typescript/src/client.ts | 20 +-- ...n.ts => connection-delivery-validation.ts} | 10 +- packages/typescript/src/errors.ts | 4 +- packages/typescript/src/index.ts | 125 ++++++------- packages/typescript/src/media/direct-api.ts | 50 +++--- .../typescript/src/media/send-descriptor.ts | 2 +- packages/typescript/src/media/upload.ts | 26 +-- packages/typescript/src/messaging/bansafe.ts | 26 +-- packages/typescript/src/messaging/business.ts | 116 ++++++------- packages/typescript/src/messaging/calls.ts | 4 +- packages/typescript/src/messaging/catalogs.ts | 22 +-- packages/typescript/src/messaging/channels.ts | 68 ++++---- packages/typescript/src/messaging/chats.ts | 60 +++---- .../typescript/src/messaging/client-tokens.ts | 28 +-- packages/typescript/src/messaging/client.ts | 6 +- .../src/messaging/cloud-catalogs.ts | 2 +- .../src/messaging/cloud-marketing.ts | 8 +- .../src/messaging/cloud-templates.ts | 30 ++-- .../typescript/src/messaging/cloud-types.ts | 2 +- ...uration.ts => connection-configuration.ts} | 24 +-- .../messaging/{sessions.ts => connections.ts} | 102 +++++------ packages/typescript/src/messaging/contacts.ts | 56 +++--- packages/typescript/src/messaging/groups.ts | 108 ++++++------ .../typescript/src/messaging/history-sync.ts | 14 +- .../typescript/src/messaging/hybrid-link.ts | 18 +- .../typescript/src/messaging/identities.ts | 4 +- packages/typescript/src/messaging/labels.ts | 36 ++-- packages/typescript/src/messaging/messages.ts | 28 +-- .../src/messaging/observation-policies.ts | 14 +- .../src/messaging/official-groups.ts | 60 +++---- .../typescript/src/messaging/onboarding.ts | 20 +-- packages/typescript/src/messaging/passkeys.ts | 32 ++-- packages/typescript/src/messaging/presence.ts | 24 +-- packages/typescript/src/messaging/privacy.ts | 16 +- packages/typescript/src/messaging/profile.ts | 24 +-- .../typescript/src/messaging/quick-replies.ts | 24 +-- .../typescript/src/messaging/quicklinks.ts | 18 +- .../src/messaging/testing-configuration.ts | 26 +-- packages/typescript/src/messaging/types.ts | 147 ++++++++-------- packages/typescript/src/messaging/users.ts | 4 +- packages/typescript/src/messaging/voip.ts | 60 +++---- packages/typescript/src/platform/analytics.ts | 16 +- packages/typescript/src/platform/bansafe.ts | 16 +- packages/typescript/src/platform/calls.ts | 28 +-- .../{session-bans.ts => connection-bans.ts} | 14 +- ...uration.ts => connection-configuration.ts} | 22 +-- .../platform/{sessions.ts => connections.ts} | 132 +++++++------- packages/typescript/src/platform/customers.ts | 4 +- .../src/platform/developer-resources.ts | 4 +- .../src/platform/developer-types.ts | 14 +- .../typescript/src/platform/event-stream.ts | 2 +- packages/typescript/src/platform/flows.ts | 36 ++-- packages/typescript/src/platform/projects.ts | 4 +- .../typescript/src/platform/request-logs.ts | 4 +- .../typescript/src/platform/sip-trunks.ts | 12 +- packages/typescript/src/platform/types.ts | 164 +++++++++--------- packages/typescript/src/platform/usage.ts | 20 +-- packages/typescript/src/s3.ts | 4 +- packages/typescript/src/transport/http.ts | 2 +- packages/typescript/src/webhooks/events.ts | 92 +++++----- packages/typescript/src/webhooks/index.ts | 18 +- packages/typescript/src/webhooks/verify.ts | 4 +- packages/typescript/test/analytics.test.ts | 16 +- .../typescript/test/bansafe-contract.test.ts | 2 +- packages/typescript/test/bansafe.test.ts | 62 +++---- .../typescript/test/billing-contract.test.ts | 22 +-- .../test/billing-tier-change.test.ts | 22 +-- packages/typescript/test/business.test.ts | 92 +++++----- packages/typescript/test/call-consent.test.ts | 16 +- .../test/calls-coverage-end.test.ts | 6 +- .../calls-simultaneous-calls-contract.test.ts | 14 +- .../test/campaign-20261014-contract.test.ts | 12 +- packages/typescript/test/channels.test.ts | 28 +-- packages/typescript/test/client.test.ts | 6 +- .../typescript/test/cloud-operations.test.ts | 16 +- .../typescript/test/cloud-templates.test.ts | 4 +- ...est.ts => connection-capabilities.test.ts} | 22 +-- ...st.ts => connection-configuration.test.ts} | 8 +- .../typescript/test/contract-shapes.test.ts | 8 +- .../typescript/test/coverage-issues.test.ts | 8 +- .../test/coverage-reconciliation.test.ts | 20 +-- packages/typescript/test/coverage.test.ts | 28 +-- packages/typescript/test/customers.test.ts | 4 +- .../test/delivery-41-contract.test.ts | 40 ++--- .../test/direct-media-upload.test.ts | 6 +- packages/typescript/test/error-body.test.ts | 4 +- packages/typescript/test/event-stream.test.ts | 6 +- packages/typescript/test/exports.test.ts | 24 +-- .../test/feature-evaluation-contract.test.ts | 2 +- .../typescript/test/flow-endpoints.test.ts | 54 +++--- packages/typescript/test/flows.test.ts | 12 +- .../test/group-capabilities.test.ts | 12 +- packages/typescript/test/groups.test.ts | 50 +++--- packages/typescript/test/hybrid-link.test.ts | 6 +- .../test/hybrid-tier-transitions.test.ts | 16 +- packages/typescript/test/labels.test.ts | 2 +- packages/typescript/test/media.test.ts | 4 +- packages/typescript/test/messages.test.ts | 4 +- .../test/messaging-idempotency.test.ts | 6 +- packages/typescript/test/messaging.test.ts | 112 ++++++------ .../typescript/test/nine-41-public.test.ts | 8 +- .../test/observation-policies.test.ts | 28 +-- .../test/official-api-round2.test.ts | 2 +- packages/typescript/test/onboarding.test.ts | 2 +- packages/typescript/test/package.test.ts | 6 +- packages/typescript/test/passkeys.test.ts | 10 +- .../typescript/test/platform-access.test.ts | 22 +-- .../typescript/test/platform-calls.test.ts | 16 +- ...t.ts => platform-connection-start.test.ts} | 16 +- ...ts => platform-widget-connections.test.ts} | 40 ++--- packages/typescript/test/platform.test.ts | 36 ++-- packages/typescript/test/privacy.test.ts | 2 +- packages/typescript/test/profile.test.ts | 2 +- .../typescript/test/quick-replies.test.ts | 2 +- packages/typescript/test/quicklinks.test.ts | 26 +-- packages/typescript/test/request-logs.test.ts | 6 +- .../test/s3-media-store.integration.test.ts | 4 +- .../typescript/test/shared-behavior.test.ts | 8 +- packages/typescript/test/sip-trunks.test.ts | 4 +- .../typescript/test/team-webhook-test.test.ts | 4 +- .../typescript/test/testing-events.test.ts | 46 ++--- .../typescript/test/testing-phone.test.ts | 18 +- packages/typescript/test/transport.test.ts | 4 +- .../typescript/test/unledgered-retry.test.ts | 2 +- packages/typescript/test/usage.test.ts | 20 +-- packages/typescript/test/voice.test.ts | 4 +- .../test/voip-placement-whitespace.test.ts | 2 +- packages/typescript/test/voip.test.ts | 64 +++---- .../typescript/test/webhook-contract.test.ts | 98 +++++------ .../test/webhook-event-types.test.ts | 32 ++-- packages/typescript/test/webhooks.test.ts | 14 +- 135 files changed, 1716 insertions(+), 1712 deletions(-) rename packages/typescript/src/{session-delivery-validation.ts => connection-delivery-validation.ts} (96%) rename packages/typescript/src/messaging/{session-configuration.ts => connection-configuration.ts} (78%) rename packages/typescript/src/messaging/{sessions.ts => connections.ts} (67%) rename packages/typescript/src/platform/{session-bans.ts => connection-bans.ts} (57%) rename packages/typescript/src/platform/{session-configuration.ts => connection-configuration.ts} (68%) rename packages/typescript/src/platform/{sessions.ts => connections.ts} (61%) rename packages/typescript/test/{session-capabilities.test.ts => connection-capabilities.test.ts} (84%) rename packages/typescript/test/{session-configuration.test.ts => connection-configuration.test.ts} (83%) rename packages/typescript/test/{platform-session-start.test.ts => platform-connection-start.test.ts} (71%) rename packages/typescript/test/{platform-widget-sessions.test.ts => platform-widget-connections.test.ts} (61%) diff --git a/packages/typescript/src/campaign-contract-response.ts b/packages/typescript/src/campaign-contract-response.ts index 5aee33ed3..3057d461f 100644 --- a/packages/typescript/src/campaign-contract-response.ts +++ b/packages/typescript/src/campaign-contract-response.ts @@ -147,7 +147,7 @@ const models = { id: string, campaignId: string, status: one("sent"), - from: object({ sessionId: string, phone: string }), + from: object({ connectionId: string, phone: string }), to: string, messageId: nullable(string), variables: map(string), @@ -307,13 +307,13 @@ export async function requestContract( const phoneModels = { phone: object({ - session: string, + connection: string, phone: string, online: boolean, devices: list(object({ deviceId: integer })), }), - send: object({ session: string, to: string, messageId: nullable(string) }), - unlink: object({ session: string, deviceId: integer, unlinked: one(true) }), + send: object({ connection: string, to: string, messageId: nullable(string) }), + unlink: object({ connection: string, deviceId: integer, unlinked: one(true) }), }; /** @internal Testing-phone endpoints return bare JSON, including accepted202. */ export async function requestPhone( diff --git a/packages/typescript/src/campaign-contract-validation.ts b/packages/typescript/src/campaign-contract-validation.ts index 78b2d7d97..04267879d 100644 --- a/packages/typescript/src/campaign-contract-validation.ts +++ b/packages/typescript/src/campaign-contract-validation.ts @@ -335,16 +335,16 @@ export function validateCampaignTestSend( const input = contractFields( value, [ - "sessionId", + "connectionId", "to", "sampleRecipientId", "variables", ...(project ? ["projectId"] : []), ], - ["sessionId", "to", ...(project ? ["projectId"] : [])], + ["connectionId", "to", ...(project ? ["projectId"] : [])], "body", ); - contractUuid(input.sessionId, "body.sessionId"); + contractUuid(input.connectionId, "body.connectionId"); contractString(input.to, "body.to", 1, 32); if (project) contractUuid(input.projectId, "body.projectId"); if (input.sampleRecipientId !== undefined) @@ -413,7 +413,7 @@ export function validateRecipientExport( "cold_held", "campaign_cancelled", "invalid_recipient", - "session_not_connected", + "connection_not_connected", "ack_timeout", "blocked_by_safety", "send_failed", diff --git a/packages/typescript/src/campaign-contracts.ts b/packages/typescript/src/campaign-contracts.ts index 2351302b8..6ef72d859 100644 --- a/packages/typescript/src/campaign-contracts.ts +++ b/packages/typescript/src/campaign-contracts.ts @@ -81,7 +81,7 @@ export interface CampaignReplyFlow { } export interface CampaignTestSendRequest { - readonly sessionId: string; + readonly connectionId: string; readonly to: string; readonly sampleRecipientId?: string; readonly variables?: Readonly>; @@ -95,7 +95,7 @@ export interface CampaignTestSend { readonly id: string; readonly campaignId: string; readonly status: "sent"; - readonly from: { readonly sessionId: string; readonly phone: string }; + readonly from: { readonly connectionId: string; readonly phone: string }; readonly to: string; readonly messageId: string | null; readonly variables: Readonly>; @@ -128,7 +128,7 @@ export type CampaignRecipientFailureReason = | "cold_held" | "campaign_cancelled" | "invalid_recipient" - | "session_not_connected" + | "connection_not_connected" | "ack_timeout" | "blocked_by_safety" | "send_failed" diff --git a/packages/typescript/src/campaign-existing-validation.ts b/packages/typescript/src/campaign-existing-validation.ts index 67703107c..a91b81aef 100644 --- a/packages/typescript/src/campaign-existing-validation.ts +++ b/packages/typescript/src/campaign-existing-validation.ts @@ -320,7 +320,7 @@ export function validateRecipientList(value: unknown, platform = false): void { "cold_held", "campaign_cancelled", "invalid_recipient", - "session_not_connected", + "connection_not_connected", "ack_timeout", "blocked_by_safety", "send_failed", diff --git a/packages/typescript/src/client.ts b/packages/typescript/src/client.ts index 3c7a9ed62..e743d49f9 100644 --- a/packages/typescript/src/client.ts +++ b/packages/typescript/src/client.ts @@ -1,7 +1,7 @@ import { AnalyticsResource } from "./platform/analytics.js"; import { FlowsResource } from "./platform/flows.js"; import { FunctionsResource } from "./platform/functions.js"; -import { SessionConfigurationResource } from "./platform/session-configuration.js"; +import { ConnectionConfigurationResource } from "./platform/connection-configuration.js"; import { assertServerRuntime, validateClientCredential, @@ -48,8 +48,8 @@ import { ProjectTokensResource } from "./platform/project-tokens.js"; import { ProjectsResource } from "./platform/projects.js"; import { QuickLinkSettingsResource } from "./platform/quicklink-settings.js"; import { SecurityIncidentsResource } from "./platform/security-incidents.js"; -import { SessionBansResource } from "./platform/session-bans.js"; -import { PlatformSessionsResource } from "./platform/sessions.js"; +import { ConnectionBansResource } from "./platform/connection-bans.js"; +import { PlatformConnectionsResource } from "./platform/connections.js"; import { SipTrunksResource } from "./platform/sip-trunks.js"; import { VoiceResource } from "./platform/voice.js"; import { UsageResource } from "./platform/usage.js"; @@ -70,7 +70,7 @@ export interface ClientBase { readonly webhooks: WebhooksResourceFor; readonly webhookDeliveries: WebhookDeliveriesResourceFor; readonly operations: OperationsResource; - readonly sessionConfiguration: SessionConfigurationResource; + readonly connectionConfiguration: ConnectionConfigurationResource; readonly quickLinkSettings: QuickLinkSettingsResource; readonly sipTrunks: SipTrunksResource; /** Voice Automation (beta): audio library and provider credentials. */ @@ -107,8 +107,8 @@ export interface TeamControlPlaneResources { readonly projects: ProjectsResource; readonly projectTokens: ProjectTokensResource; readonly securityIncidents: SecurityIncidentsResource; - readonly sessionBans: SessionBansResource; - readonly sessions: PlatformSessionsResource; + readonly connectionBans: ConnectionBansResource; + readonly connections: PlatformConnectionsResource; } export interface ProjectControlPlaneResources { @@ -138,7 +138,7 @@ class ClientImplementation implements ClientBase { readonly webhooks: WebhooksResource; readonly webhookDeliveries: WebhookDeliveriesResource; readonly operations: OperationsResource; - readonly sessionConfiguration: SessionConfigurationResource; + readonly connectionConfiguration: ConnectionConfigurationResource; readonly quickLinkSettings: QuickLinkSettingsResource; readonly sipTrunks: SipTrunksResource; readonly voice: VoiceResource; @@ -190,7 +190,7 @@ class ClientImplementation implements ClientBase { prefix, ); this.operations = new OperationsResource(this.#transport, prefix); - this.sessionConfiguration = new SessionConfigurationResource( + this.connectionConfiguration = new ConnectionConfigurationResource( this.#transport, projectId, ); @@ -246,8 +246,8 @@ class ClientImplementation implements ClientBase { projects: new ProjectsResource(this.#transport), projectTokens: new ProjectTokensResource(this.#transport), securityIncidents: new SecurityIncidentsResource(this.#transport), - sessionBans: new SessionBansResource(this.#transport), - sessions: new PlatformSessionsResource(this.#transport), + connectionBans: new ConnectionBansResource(this.#transport), + connections: new PlatformConnectionsResource(this.#transport), }); } Object.freeze(this); diff --git a/packages/typescript/src/session-delivery-validation.ts b/packages/typescript/src/connection-delivery-validation.ts similarity index 96% rename from packages/typescript/src/session-delivery-validation.ts rename to packages/typescript/src/connection-delivery-validation.ts index 4ce850968..fa28cb49f 100644 --- a/packages/typescript/src/session-delivery-validation.ts +++ b/packages/typescript/src/connection-delivery-validation.ts @@ -8,7 +8,7 @@ import { PolymorfaConfigurationError } from "./errors.js"; const own = (v: object, key: string): boolean => Object.hasOwn(v, key); function invalid(field: string): never { throw new PolymorfaConfigurationError( - "Invalid session configuration field.", + "Invalid connection configuration field.", field, ); } @@ -90,7 +90,7 @@ export function quickLinkIntent(input: unknown): boolean { [ "purpose", "signalMode", - "session", + "connection", "addConnection", "connectionGoal", "projectId", @@ -109,8 +109,8 @@ export function quickLinkIntent(input: unknown): boolean { invalid("signalMode"); if (v.purpose === "add_connection") { if ( - typeof v.session !== "string" || - !v.session || + typeof v.connection !== "string" || + !v.connection || !["linked_devices", "official_api"].includes(v.addConnection as string) || v.connectionGoal === "single" || ["signalMode", "customerId", "externalId", "billingControls"].some( @@ -120,7 +120,7 @@ export function quickLinkIntent(input: unknown): boolean { invalid("purpose"); } else if ( (own(v, "purpose") && v.purpose !== "initial") || - own(v, "session") || + own(v, "connection") || own(v, "addConnection") ) invalid("purpose"); diff --git a/packages/typescript/src/errors.ts b/packages/typescript/src/errors.ts index 9cd5a031e..3051f11bc 100644 --- a/packages/typescript/src/errors.ts +++ b/packages/typescript/src/errors.ts @@ -29,7 +29,7 @@ export const POLYMORFA_ERROR_CODES = [ "campaign_approval_required", "campaign_approval_stale", "campaign_variables_missing", - "zero_knowledge_session", + "zero_knowledge_connection", "billing_credit_required", "safe_mode_not_entitled", "warmup_plan_not_entitled", @@ -55,7 +55,7 @@ export const POLYMORFA_ERROR_CODES = [ "upstream_failure", "service_unavailable", "credential_verification_unavailable", - "session_not_ready", + "connection_not_ready", "hybrid_routing_paused", "hybrid_automation_unavailable", "hybrid_transport_unavailable", diff --git a/packages/typescript/src/index.ts b/packages/typescript/src/index.ts index 2d9ec2f8e..0255b7d19 100644 --- a/packages/typescript/src/index.ts +++ b/packages/typescript/src/index.ts @@ -331,7 +331,7 @@ export { type HybridQuickLinkAvailabilityRequest, type HybridQuickLinkAvailabilityResponse, } from "./messaging/quicklinks.js"; -export { SessionsResource } from "./messaging/sessions.js"; +export { ConnectionsResource } from "./messaging/connections.js"; export { TemplatesResource } from "./messaging/templates.js"; export { CloudTemplatesResource, @@ -452,9 +452,9 @@ export type { CallPermissionSource, CallPermissionState, CallPermissionStatus, - SessionCallSettings, - SessionCallSettingsResponse, - UpdateSessionCallSettingsRequest, + ConnectionCallSettings, + ConnectionCallSettingsResponse, + UpdateConnectionCallSettingsRequest, VoipAcceptCallRequest, VoipWaitingRoomControlRequest, VoipWaitingRoomControlResult, @@ -514,7 +514,7 @@ export type { FlowDataExchangeMessageContent, FlowMessageContent, FlowNavigateMessageContent, - GetSessionAccountResponse, + GetConnectionAccountResponse, GetBlocklistResponse, GetBusinessProfileResponse, GetCampaignResponse, @@ -537,8 +537,8 @@ export type { GetPrivacySettingsResponse, GetQRCodeResponse, GetClientRulesResponse, - GetSessionResponse, - GetSessionObservationPolicyResponse, + GetConnectionResponse, + GetConnectionObservationPolicyResponse, GetUserDevicesResponse, GetUserInfoResponse, GetUserSecurityCodeResponse, @@ -566,7 +566,7 @@ export type { ListChannelMessageUpdatesResponse, ListChannelsResponse, ListLabelsResponse, - ListSessionsResponse, + ListConnectionsResponse, ListContactsResponse, ListGroupsResponse, ListBusinessQuickRepliesResponse, @@ -599,11 +599,12 @@ export type { MessageRoutingMetadata, MessageTemplateSend, MintClientTokenRequest, - MintSessionClientTokenRequest, + MintConnectionClientTokenRequest, MintCustomerClientTokenRequest, CustomerClientTokenAction, MintClientTokenResponse, - MessagingConnection, + ConnectionMethodKind, + ConnectionMethod, MuteChannelResponse, ObservationMode, OperationAccepted, @@ -692,13 +693,13 @@ export type { StandardPrivacyAudience, SetBusinessQuickReplyResponse, SetClientRulesRequest, - Session, - SessionLabelObservationMode, - SessionObservationMode, - SessionObservationPolicy, - SessionObservationPolicyOverrides, - SessionObservationPolicyValues, - SessionOperation, + Connection, + ConnectionLabelObservationMode, + ConnectionObservationMode, + ConnectionObservationPolicy, + ConnectionObservationPolicyOverrides, + ConnectionObservationPolicyValues, + ConnectionOperation, StarMessageResponse, StarRequest, SuccessEnvelope, @@ -718,13 +719,13 @@ export type { TemplateVariable, TemplateVariableType, TypingRequest, - UpdateSessionRequest, - UpdateSessionResponse, + UpdateConnectionRequest, + UpdateConnectionResponse, UpdateLabelRequest, UpdateProjectObservationPolicyRequest, UpdateProjectObservationPolicyResponse, - UpdateSessionObservationPolicyRequest, - UpdateSessionObservationPolicyResponse, + UpdateConnectionObservationPolicyRequest, + UpdateConnectionObservationPolicyResponse, UpdateProjectTemplateRequest, UpdateWebhookRequest, UserSecurityCode, @@ -816,8 +817,8 @@ export { TeamsResource } from "./platform/teams.js"; export { ProjectTokensResource } from "./platform/project-tokens.js"; export { ProjectsResource } from "./platform/projects.js"; export { SecurityIncidentsResource } from "./platform/security-incidents.js"; -export { SessionBansResource } from "./platform/session-bans.js"; -export { PlatformSessionsResource } from "./platform/sessions.js"; +export { ConnectionBansResource } from "./platform/connection-bans.js"; +export { PlatformConnectionsResource } from "./platform/connections.js"; export { PlatformCallsResource } from "./platform/calls.js"; export type { CallDirection, @@ -986,7 +987,7 @@ export type { CreateProjectRequest, DataEnvelope, ListAuditLogsParams, - ListPlatformSessionsParams, + ListPlatformConnectionsParams, DeleteAudienceMemberResult, ListAudienceMembersParams, ListCampaignsParams, @@ -1001,11 +1002,11 @@ export type { PlatformCampaignRecipientsEnvelope, UpdateOptOutSettingsRequest, UpdatePlatformCampaignRequest, - ManagedSession, + ManagedConnection, Team, TeamMember, TeamMemberRole, - PlatformSession, + PlatformConnection, PlatformPayload, ProductionBusiness, ProductionEnrollmentCommandResult, @@ -1020,17 +1021,17 @@ export type { ProjectWithStats, SecurityIncident, SecurityIncidentAcknowledgement, - SessionBatchRemoveResult, - SessionBatchRequest, - SessionBatchStopResult, - SessionBan, - SessionBanStatus, - SessionProjectContext, - SessionRemoveResult, - SessionStartResult, - SessionStopResult, - SessionTier, - SessionTierOverrideRequest, + ConnectionBatchRemoveResult, + ConnectionBatchRequest, + ConnectionBatchStopResult, + ConnectionBan, + ConnectionBanStatus, + ConnectionProjectContext, + ConnectionRemoveResult, + ConnectionStartResult, + ConnectionStopResult, + ConnectionTier, + ConnectionTierOverrideRequest, HybridKeepResolution, HybridMerge, HybridMergeCandidate, @@ -1058,7 +1059,7 @@ export type { BanSafeClaimStatus, BanSafeClaimVerdict, BanSafeCollectionEnvelope, - BanSafeCollectionSession, + BanSafeCollectionConnection, BanSafeCollectionState, BanSafeCollectionStatus, BanSafeEnforcementEnvelope, @@ -1116,7 +1117,7 @@ export type { ListBanSafeTelemetryHistoryParams, ProjectHealthPolicy, ProjectHealthPolicyIntegrations, - ProjectHealthSessionAction, + ProjectHealthConnectionAction, ProjectInsuranceEvidence, ProjectSafeMode, ProjectWarmupPlan, @@ -1128,21 +1129,21 @@ export type { SafeModeReads, SafeModeSettings, SafeModeTyping, - SessionAccountType, - SessionCapabilities, - SessionCapabilitiesStatus, - SessionCapability, - SessionCapabilityKind, - SessionCapabilitySource, - SessionCapabilityUnit, - SessionFeatureCapability, - SessionLimitCapability, - SessionSafeMode, + ConnectionAccountType, + ConnectionCapabilities, + ConnectionCapabilitiesStatus, + ConnectionCapability, + ConnectionCapabilityKind, + ConnectionCapabilitySource, + ConnectionCapabilityUnit, + ConnectionFeatureCapability, + ConnectionLimitCapability, + ConnectionSafeMode, UpdateProjectHealthPolicyRequest, UpdateProjectInsuranceEvidenceRequest, UpdateProjectSafeModeRequest, UpdateProjectWarmupPlanRequest, - UpdateSessionSafeModeRequest, + UpdateConnectionSafeModeRequest, WarmupCurvePoint, WarmupPlanSettings, } from "./platform/types.js"; @@ -1242,14 +1243,14 @@ export { type PollOption, type PollVotePayload, type PresenceUpdatePayload, - type SessionConnectedPayload, - type SessionLoggedOutPayload, - type SessionLoggedOutReason, - type SessionRestrictionType, - type SessionRestrictionUpdatedPayload, - type SessionPhoneOfflinePayload, - type SessionStatusPayload, - type RuntimeSessionStatusPayload, + type ConnectionConnectedPayload, + type ConnectionLoggedOutPayload, + type ConnectionLoggedOutReason, + type ConnectionRestrictionType, + type ConnectionRestrictionUpdatedPayload, + type ConnectionPhoneOfflinePayload, + type ConnectionStatusPayload, + type RuntimeConnectionStatusPayload, type CloudAccountStatusPayload, type UnknownWebhookEvent, type WebhookBody, @@ -1262,7 +1263,7 @@ export { type WebhookEvent, type WebhookEventOf, type WebhookPayloadMap, - type SessionCapabilitiesUpdatedPayload, + type ConnectionCapabilitiesUpdatedPayload, type BanSafeActionPayload, type BanSafeClaimPayload, type BanSafeEventRung, @@ -1315,9 +1316,9 @@ export { type VerifyFlowForwardSignatureOptions, } from "./webhooks/index.js"; -export type * from "./messaging/session-configuration.js"; +export type * from "./messaging/connection-configuration.js"; -export { SessionConfigurationResource } from "./platform/session-configuration.js"; +export { ConnectionConfigurationResource } from "./platform/connection-configuration.js"; export type * from "./messaging/testing-configuration.js"; export { TEST_EVENT_FIXTURES } from "./messaging/testing-configuration.js"; @@ -1411,7 +1412,7 @@ export type { export type { HistorySyncDelivery, HistorySyncPolicyPatch, -} from "./messaging/session-configuration.js"; +} from "./messaging/connection-configuration.js"; export type { CampaignFrequencyCap } from "./messaging/types.js"; export type { diff --git a/packages/typescript/src/media/direct-api.ts b/packages/typescript/src/media/direct-api.ts index 066ef9514..cc8c1f2c2 100644 --- a/packages/typescript/src/media/direct-api.ts +++ b/packages/typescript/src/media/direct-api.ts @@ -26,7 +26,7 @@ import { isWhatsAppMediaUrl } from "./whatsapp.js"; export const CUSTOMER_OWNED_API_VERSION = "2026-10-14"; /** - * `POST /messaging/{session}/media/upload-grants` request. + * `POST /messaging/{connection}/media/upload-grants` request. * @experimental Requires the 2026-10-14 API contract. */ export interface WhatsAppUploadGrantRequest { @@ -38,7 +38,7 @@ export interface WhatsAppUploadGrantRequest { } /** - * A short-lived WhatsApp upload credential for one session. `auth` is a + * A short-lived WhatsApp upload credential for one connection. `auth` is a * bearer secret: never log or store it. * @experimental Requires the 2026-10-14 API contract. */ @@ -54,7 +54,7 @@ export interface WhatsAppUploadGrant { } /** - * `POST /messaging/{session}/media/uploads` response. The request body + * `POST /messaging/{connection}/media/uploads` response. The request body * is `ciphertext || mac10` (`application/octet-stream`) with query * parameters `type`, `fileEncSha256` (base64url) and optional `ptt`. * The encrypted length is carried in `Content-Length`. @@ -68,7 +68,7 @@ export interface WhatsAppRelayUploadResponse { /** * Asks the phone to send a history chunk again (peer data operation - * `HISTORY_SYNC_CHUNK_RETRY`). `POST /messaging/{session}/history/chunks/retry`. + * `HISTORY_SYNC_CHUNK_RETRY`). `POST /messaging/{connection}/history/chunks/retry`. * @experimental Requires the 2026-10-14 API contract. */ export interface HistorySyncChunkRetryRequest { @@ -94,8 +94,8 @@ export interface HistorySyncChunkRetryResponse { } /** - * Asks the session to delete a processed history blob from the WhatsApp CDN. - * `POST /messaging/{session}/history/media/delete`. + * Asks the connection to delete a processed history blob from the WhatsApp CDN. + * `POST /messaging/{connection}/history/media/delete`. * @experimental Requires the 2026-10-14 API contract. */ export interface HistorySyncChunkDeleteRequest { @@ -108,14 +108,14 @@ export interface HistorySyncChunkDeleteRequest { /** @internal */ export const DIRECT_MEDIA_PATHS = Object.freeze({ - uploadGrants: (session: string) => - `/messaging/${encodeURIComponent(session)}/media/upload-grants`, - relayUploads: (session: string) => - `/messaging/${encodeURIComponent(session)}/media/uploads`, - historyChunkRetries: (session: string) => - `/messaging/${encodeURIComponent(session)}/history/chunks/retry`, - historyChunkDeletions: (session: string) => - `/messaging/${encodeURIComponent(session)}/history/media/delete`, + uploadGrants: (connection: string) => + `/messaging/${encodeURIComponent(connection)}/media/upload-grants`, + relayUploads: (connection: string) => + `/messaging/${encodeURIComponent(connection)}/media/uploads`, + historyChunkRetries: (connection: string) => + `/messaging/${encodeURIComponent(connection)}/history/chunks/retry`, + historyChunkDeletions: (connection: string) => + `/messaging/${encodeURIComponent(connection)}/history/media/delete`, }); function uploadRequest( @@ -173,17 +173,17 @@ export class DirectMediaApi { } async createUploadGrant( - session: string, + connection: string, request: WhatsAppUploadGrantRequest, options: RequestOptions = {}, ): Promise { this.assertServerCredential(); // These source-only routes have no server replay ledger, even with a key. options = { ...existingOptions(options), maxNetworkRetries: 0 }; - contractString(session, "session"); + contractString(connection, "connection"); const response = await this.transport.request({ method: "POST", - path: DIRECT_MEDIA_PATHS.uploadGrants(session), + path: DIRECT_MEDIA_PATHS.uploadGrants(connection), body: uploadRequest(request.mediaType, request.fileEncSha256), ...options, apiVersion: options.apiVersion ?? CUSTOMER_OWNED_API_VERSION, @@ -220,7 +220,7 @@ export class DirectMediaApi { } async relayUpload( - session: string, + connection: string, request: WhatsAppUploadGrantRequest & { readonly body: ReadableStream | Uint8Array; }, @@ -238,7 +238,7 @@ export class DirectMediaApi { ...options, apiVersion: options.apiVersion ?? CUSTOMER_OWNED_API_VERSION, method: "POST", - path: DIRECT_MEDIA_PATHS.relayUploads(session), + path: DIRECT_MEDIA_PATHS.relayUploads(connection), query, headers: { ...options.headers, @@ -259,12 +259,12 @@ export class DirectMediaApi { } async requestHistoryChunkRetry( - session: string, + connection: string, request: HistorySyncChunkRetryRequest, options: RequestOptions = {}, ): Promise { this.assertServerCredential(); - contractString(session, "session"); + contractString(connection, "connection"); const value = contractFields( request, ["syncType", "chunkOrder", "chunkMessageId", "regenerate"], @@ -308,7 +308,7 @@ export class DirectMediaApi { options = { ...existingOptions(options), maxNetworkRetries: 0 }; const response = await this.transport.request({ method: "POST", - path: DIRECT_MEDIA_PATHS.historyChunkRetries(session), + path: DIRECT_MEDIA_PATHS.historyChunkRetries(connection), body: { ...request }, ...options, apiVersion: options.apiVersion ?? CUSTOMER_OWNED_API_VERSION, @@ -320,12 +320,12 @@ export class DirectMediaApi { } async deleteHistoryChunk( - session: string, + connection: string, request: HistorySyncChunkDeleteRequest, options: RequestOptions = {}, ): Promise { this.assertServerCredential(); - contractString(session, "session"); + contractString(connection, "connection"); const value = contractFields( request, ["directPath", "fileEncSha256", "encHandle", "companionMetaNonce"], @@ -358,7 +358,7 @@ export class DirectMediaApi { options = { ...existingOptions(options), maxNetworkRetries: 0 }; const response = await this.transport.request({ method: "POST", - path: DIRECT_MEDIA_PATHS.historyChunkDeletions(session), + path: DIRECT_MEDIA_PATHS.historyChunkDeletions(connection), body: { ...request }, ...options, apiVersion: options.apiVersion ?? CUSTOMER_OWNED_API_VERSION, diff --git a/packages/typescript/src/media/send-descriptor.ts b/packages/typescript/src/media/send-descriptor.ts index f055398c5..fe5be6857 100644 --- a/packages/typescript/src/media/send-descriptor.ts +++ b/packages/typescript/src/media/send-descriptor.ts @@ -5,7 +5,7 @@ import { contractFields } from "../campaign-contract-validation.js"; /** * A pre-uploaded attachment for a message send. Binary fields are standard - * base64. `mediaKey` decrypts the file: standard sessions send it to Polymorfa's send API + * base64. `mediaKey` decrypts the file: standard connections send it to Polymorfa's send API * and never log it. * @experimental Requires the 2026-10-14 API contract. */ diff --git a/packages/typescript/src/media/upload.ts b/packages/typescript/src/media/upload.ts index cd9a2344d..1fa5ed4fd 100644 --- a/packages/typescript/src/media/upload.ts +++ b/packages/typescript/src/media/upload.ts @@ -61,12 +61,12 @@ export interface WhatsAppUploadLocation { /** * Moves encrypted bytes to WhatsApp's media hosts. The SDK ships `relay` - * (through the session's own connection) and `direct` (from your network). + * (through the connection's own connection) and `direct` (from your network). */ export interface WhatsAppMediaUploadTransport { readonly name: string; upload( - session: string, + connection: string, body: WhatsAppEncryptedUploadBody, options: { readonly signal?: AbortSignal }, ): Promise; @@ -79,7 +79,7 @@ export interface UploadWhatsAppMediaOptions { readonly mimetype?: string; /** * `relay` (default) sends ciphertext to Polymorfa, which forwards it to - * WhatsApp over the session's connection. `direct` uploads from this + * WhatsApp over the connection's connection. `direct` uploads from this * process with a short-lived grant. Pass a transport to use your own. */ readonly egress?: WhatsAppMediaEgress | WhatsAppMediaUploadTransport; @@ -369,7 +369,7 @@ export function base64UrlUnpadded(bytes: Uint8Array): string { /** * Relay egress: streams ciphertext to Polymorfa, which uploads it through the - * session's connection. Polymorfa receives ciphertext only, never the key. + * connection's connection. Polymorfa receives ciphertext only, never the key. */ export function createRelayUploadTransport( api: DirectMediaApi, @@ -378,12 +378,12 @@ export function createRelayUploadTransport( return Object.freeze({ name: "relay", async upload( - session: string, + connection: string, body: WhatsAppEncryptedUploadBody, options: { readonly signal?: AbortSignal }, ) { return api.relayUpload( - session, + connection, { mediaType: body.mediaType, fileEncSha256: base64UrlUnpadded(body.fileEncSha256), @@ -556,7 +556,7 @@ export function createDirectUploadTransport( return Object.freeze({ name: "direct", async upload( - session: string, + connection: string, body: WhatsAppEncryptedUploadBody, uploadOptions: { readonly signal?: AbortSignal }, ) { @@ -564,7 +564,7 @@ export function createDirectUploadTransport( const signal = uploadOptions.signal; const requestGrant = () => api.createUploadGrant( - session, + connection, { mediaType: body.mediaType, fileEncSha256: base64UrlUnpadded(body.fileEncSha256), @@ -774,14 +774,14 @@ export class WhatsAppMediaResource { } async upload( - session: string, + connection: string, source: WhatsAppMediaSource, options: UploadWhatsAppMediaOptions, ): Promise { - if (typeof session !== "string" || session.length === 0) { + if (typeof connection !== "string" || connection.length === 0) { throw new PolymorfaConfigurationError( - "session must be a non-empty string.", - "session", + "connection must be a non-empty string.", + "connection", ); } const egress = options.egress ?? "relay"; @@ -805,7 +805,7 @@ export class WhatsAppMediaResource { ); } const { info, body } = await prepareWhatsAppUpload(source, options); - const location = await transport.upload(session, body, { + const location = await transport.upload(connection, body, { ...(options.signal === undefined ? {} : { signal: options.signal }), }); return Object.freeze({ ...info, ...location, egress: transport.name }); diff --git a/packages/typescript/src/messaging/bansafe.ts b/packages/typescript/src/messaging/bansafe.ts index cb8a4051a..314aba460 100644 --- a/packages/typescript/src/messaging/bansafe.ts +++ b/packages/typescript/src/messaging/bansafe.ts @@ -5,12 +5,12 @@ import type { ProjectInsuranceEvidence, ProjectSafeMode, ProjectWarmupPlan, - SessionSafeMode, + ConnectionSafeMode, UpdateProjectHealthPolicyRequest, UpdateProjectInsuranceEvidenceRequest, UpdateProjectSafeModeRequest, UpdateProjectWarmupPlanRequest, - UpdateSessionSafeModeRequest, + UpdateConnectionSafeModeRequest, } from "../platform/types.js"; import { HttpTransport } from "../transport/http.js"; import type { ApiResponse, RequestOptions } from "../transport/types.js"; @@ -91,27 +91,27 @@ export class MessagingBanSafeResource { return this.updateSetting(projectId, "health-policy", body, options); } - getSessionSafeMode( - session: string, + getConnectionSafeMode( + connection: string, options: RequestOptions = {}, - ): Promise>> { + ): Promise>> { this.assertServerCredential(); return this.transport.request({ method: "GET", - path: sessionSafeModePath(session), + path: connectionSafeModePath(connection), ...options, }); } - updateSessionSafeMode( - session: string, - body: UpdateSessionSafeModeRequest, + updateConnectionSafeMode( + connection: string, + body: UpdateConnectionSafeModeRequest, options: RequestOptions = {}, - ): Promise>> { + ): Promise>> { this.assertServerCredential(); return this.transport.request({ method: "PUT", - path: sessionSafeModePath(session), + path: connectionSafeModePath(connection), body, ...options, }); @@ -162,6 +162,6 @@ function projectSettingPath( return `/messaging/projects/${encodeURIComponent(projectId)}/${setting}`; } -function sessionSafeModePath(session: string): string { - return `/messaging/${encodeURIComponent(session)}/safe-mode`; +function connectionSafeModePath(connection: string): string { + return `/messaging/${encodeURIComponent(connection)}/safe-mode`; } diff --git a/packages/typescript/src/messaging/business.ts b/packages/typescript/src/messaging/business.ts index 674a23b34..ea1edc55b 100644 --- a/packages/typescript/src/messaging/business.ts +++ b/packages/typescript/src/messaging/business.ts @@ -48,54 +48,54 @@ export class BusinessResource { constructor(private readonly transport: HttpTransport) {} getProfile( - session: string, + connection: string, options: RequestOptions = {}, ): Promise> { - return this.get(profilePath(session), options); + return this.get(profilePath(connection), options); } updateProfile( - session: string, + connection: string, body: BusinessProfileUpdateRequest, options: RequestOptions = {}, ): Promise> { - return this.mutate("PATCH", profilePath(session), body, options); + return this.mutate("PATCH", profilePath(connection), body, options); } setCoverPhoto( - session: string, + connection: string, body: BusinessCoverPhotoRequest, options: RequestOptions = {}, ): Promise> { return this.mutate( "PUT", - `${profilePath(session)}/cover-photo`, + `${profilePath(connection)}/cover-photo`, body, options, ); } deleteCoverPhoto( - session: string, + connection: string, coverPhotoId: string, options: RequestOptions = {}, ): Promise> { return this.mutate( "DELETE", - `${profilePath(session)}/cover-photo/${encodeURIComponent(coverPhotoId)}`, + `${profilePath(connection)}/cover-photo/${encodeURIComponent(coverPhotoId)}`, undefined, options, ); } getCatalog( - session: string, + connection: string, params: BusinessCatalogParams, options: RequestOptions = {}, ): Promise> { return this.transport.request({ method: "GET", - path: `${businessPath(session)}/catalog`, + path: `${businessPath(connection)}/catalog`, query: { id: params.id, after: params.after, @@ -108,115 +108,115 @@ export class BusinessResource { } createCatalog( - session: string, + connection: string, options: RequestOptions = {}, ): Promise> { return this.mutate( "POST", - `${businessPath(session)}/catalog`, + `${businessPath(connection)}/catalog`, undefined, options, ); } setCartEnabled( - session: string, + connection: string, body: BusinessCartSettingRequest, options: RequestOptions = {}, ): Promise> { return this.mutate( "PATCH", - `${businessPath(session)}/catalog/cart`, + `${businessPath(connection)}/catalog/cart`, body, options, ); } getProduct( - session: string, + connection: string, productId: string, params: BusinessProductParams, options: RequestOptions = {}, ): Promise> { return this.transport.request({ method: "GET", - path: productPath(session, productId), + path: productPath(connection, productId), query: { id: params.id }, ...options, }); } createProduct( - session: string, + connection: string, body: BusinessProductMutationRequest, options: RequestOptions = {}, ): Promise> { return this.mutate( "POST", - `${businessPath(session)}/products`, + `${businessPath(connection)}/products`, body, options, ); } updateProduct( - session: string, + connection: string, productId: string, body: BusinessProductMutationRequest, options: RequestOptions = {}, ): Promise> { - return this.mutate("PUT", productPath(session, productId), body, options); + return this.mutate("PUT", productPath(connection, productId), body, options); } deleteProduct( - session: string, + connection: string, productId: string, options: RequestOptions = {}, ): Promise> { return this.mutate( "DELETE", - productPath(session, productId), + productPath(connection, productId), undefined, options, ); } setProductVisibility( - session: string, + connection: string, productId: string, body: BusinessProductVisibilityRequest, options: RequestOptions = {}, ): Promise> { return this.mutate( "PATCH", - `${productPath(session, productId)}/visibility`, + `${productPath(connection, productId)}/visibility`, body, options, ); } appealProduct( - session: string, + connection: string, productId: string, body: BusinessCatalogAppealRequest, options: RequestOptions = {}, ): Promise> { return this.mutate( "POST", - `${productPath(session, productId)}/appeal`, + `${productPath(connection, productId)}/appeal`, body, options, ); } listCollections( - session: string, + connection: string, params: BusinessCollectionsParams, options: RequestOptions = {}, ): Promise> { return this.transport.request({ method: "GET", - path: `${businessPath(session)}/collections`, + path: `${businessPath(connection)}/collections`, query: { id: params.id, after: params.after, @@ -230,14 +230,14 @@ export class BusinessResource { } getCollection( - session: string, + connection: string, collectionId: string, params: BusinessCollectionParams, options: RequestOptions = {}, ): Promise> { return this.transport.request({ method: "GET", - path: collectionPath(session, collectionId), + path: collectionPath(connection, collectionId), query: { id: params.id, after: params.after, @@ -250,118 +250,118 @@ export class BusinessResource { } createCollection( - session: string, + connection: string, body: BusinessCollectionCreateRequest, options: RequestOptions = {}, ): Promise> { return this.mutate( "POST", - `${businessPath(session)}/collections`, + `${businessPath(connection)}/collections`, body, options, ); } updateCollection( - session: string, + connection: string, collectionId: string, body: BusinessCollectionUpdateRequest, options: RequestOptions = {}, ): Promise> { return this.mutate( "PATCH", - collectionPath(session, collectionId), + collectionPath(connection, collectionId), body, options, ); } deleteCollection( - session: string, + connection: string, collectionId: string, options: RequestOptions = {}, ): Promise> { return this.mutate( "DELETE", - collectionPath(session, collectionId), + collectionPath(connection, collectionId), undefined, options, ); } reorderCollections( - session: string, + connection: string, body: BusinessCollectionReorderRequest, options: RequestOptions = {}, ): Promise> { return this.mutate( "POST", - `${businessPath(session)}/collections/reorder`, + `${businessPath(connection)}/collections/reorder`, body, options, ); } appealCollection( - session: string, + connection: string, collectionId: string, body: BusinessCatalogAppealRequest, options: RequestOptions = {}, ): Promise> { return this.mutate( "POST", - `${collectionPath(session, collectionId)}/appeal`, + `${collectionPath(connection, collectionId)}/appeal`, body, options, ); } getOrder( - session: string, + connection: string, orderId: string, body: BusinessOrderLookupRequest, options: RequestOptions = {}, ): Promise> { return this.mutate( "POST", - `${businessPath(session)}/orders/${encodeURIComponent(orderId)}/lookup`, + `${businessPath(connection)}/orders/${encodeURIComponent(orderId)}/lookup`, body, options, ); } getMerchantCompliance( - session: string, + connection: string, options: RequestOptions = {}, ): Promise> { - return this.get(`${businessPath(session)}/compliance`, options); + return this.get(`${businessPath(connection)}/compliance`, options); } setMerchantCompliance( - session: string, + connection: string, body: BusinessMerchantCompliance, options: RequestOptions = {}, ): Promise> { return this.mutate( "PUT", - `${businessPath(session)}/compliance`, + `${businessPath(connection)}/compliance`, body, options, ); } getLinkedAccounts( - session: string, + connection: string, options: RequestOptions = {}, ): Promise> { - return this.get(`${businessPath(session)}/linked-accounts`, options); + return this.get(`${businessPath(connection)}/linked-accounts`, options); } getEligibility( - session: string, + connection: string, options: RequestOptions = {}, ): Promise> { - return this.get(`${businessPath(session)}/eligibility`, options); + return this.get(`${businessPath(connection)}/eligibility`, options); } private get( @@ -386,18 +386,18 @@ export class BusinessResource { } } -function businessPath(session: string): string { - return `/messaging/${encodeURIComponent(session)}/business`; +function businessPath(connection: string): string { + return `/messaging/${encodeURIComponent(connection)}/business`; } -function profilePath(session: string): string { - return `${businessPath(session)}/profile`; +function profilePath(connection: string): string { + return `${businessPath(connection)}/profile`; } -function productPath(session: string, productId: string): string { - return `${businessPath(session)}/products/${encodeURIComponent(productId)}`; +function productPath(connection: string, productId: string): string { + return `${businessPath(connection)}/products/${encodeURIComponent(productId)}`; } -function collectionPath(session: string, collectionId: string): string { - return `${businessPath(session)}/collections/${encodeURIComponent(collectionId)}`; +function collectionPath(connection: string, collectionId: string): string { + return `${businessPath(connection)}/collections/${encodeURIComponent(collectionId)}`; } diff --git a/packages/typescript/src/messaging/calls.ts b/packages/typescript/src/messaging/calls.ts index 8c71a65d7..1e106ba6a 100644 --- a/packages/typescript/src/messaging/calls.ts +++ b/packages/typescript/src/messaging/calls.ts @@ -6,14 +6,14 @@ export class CallsResource { constructor(private readonly transport: HttpTransport) {} reject( - session: string, + connection: string, callId: string, body: RejectCallRequest, options: RequestOptions = {}, ): Promise> { return this.transport.request({ method: "POST", - path: `/messaging/${encodeURIComponent(session)}/calls/${encodeURIComponent(callId)}/reject`, + path: `/messaging/${encodeURIComponent(connection)}/calls/${encodeURIComponent(callId)}/reject`, body, ...options, }); diff --git a/packages/typescript/src/messaging/catalogs.ts b/packages/typescript/src/messaging/catalogs.ts index 6a2a29b45..a1494391e 100644 --- a/packages/typescript/src/messaging/catalogs.ts +++ b/packages/typescript/src/messaging/catalogs.ts @@ -61,25 +61,25 @@ export class CatalogsResource { ) {} list( - session: string, + connection: string, options: RequestOptions = {}, ): Promise< ApiResponse> > { return this.transport.request({ method: "GET", - path: this.path(session), + path: this.path(connection), ...options, }); } retrieve( - session: string, + connection: string, catalogId: string, options: RequestOptions = {}, ): Promise>> { return this.transport.request({ method: "GET", - path: this.path(session, catalogId), + path: this.path(connection, catalogId), ...options, }); } @@ -88,20 +88,20 @@ export class CatalogsResource { * A full sync can take 50 seconds; this method allows 60 seconds by default. */ sync( - session: string, + connection: string, catalogId: string, options: RequestOptions = {}, ): Promise>> { return this.transport.request({ method: "POST", - path: `${this.path(session, catalogId)}/sync`, + path: `${this.path(connection, catalogId)}/sync`, timeoutMs: 60_000, ...options, maxNetworkRetries: 0, }); } listProducts( - session: string, + connection: string, catalogId: string, params: ListCatalogProductsParams = {}, options: RequestOptions = {}, @@ -124,23 +124,23 @@ export class CatalogsResource { ); return this.transport.request({ method: "GET", - path: `${this.path(session, catalogId)}/products`, + path: `${this.path(connection, catalogId)}/products`, query: { ...params }, ...options, }); } - private path(session: string, catalogId?: string): string { + private path(connection: string, catalogId?: string): string { if (this.credentialType === "clientToken") throw new PolymorfaConfigurationError( "Catalog sync requires a team API key or project token.", "credential", ); - if (!session.trim()) + if (!connection.trim()) throw new PolymorfaValidationError("Provide a Number ID."); if (catalogId !== undefined && !/^[0-9]{1,32}$/.test(catalogId)) throw new PolymorfaValidationError( "catalogId must contain 1 to 32 digits.", ); - return `/messaging/${encodeURIComponent(session)}/catalogs${catalogId === undefined ? "" : `/${encodeURIComponent(catalogId)}`}`; + return `/messaging/${encodeURIComponent(connection)}/catalogs${catalogId === undefined ? "" : `/${encodeURIComponent(catalogId)}`}`; } } diff --git a/packages/typescript/src/messaging/channels.ts b/packages/typescript/src/messaging/channels.ts index e2cebe0c4..2475c8fdd 100644 --- a/packages/typescript/src/messaging/channels.ts +++ b/packages/typescript/src/messaging/channels.ts @@ -27,76 +27,76 @@ export class ChannelsResource { constructor(private readonly transport: HttpTransport) {} list( - session: string, + connection: string, options: RequestOptions = {}, ): Promise> { return this.transport.request({ method: "GET", - path: channelsPath(session), + path: channelsPath(connection), ...options, }); } create( - session: string, + connection: string, body: CreateChannelRequest, options: RequestOptions = {}, ): Promise> { return this.transport.request({ method: "POST", - path: channelsPath(session), + path: channelsPath(connection), body, ...options, }); } retrieve( - session: string, + connection: string, channelId: string, options: RequestOptions = {}, ): Promise> { return this.transport.request({ method: "GET", - path: channelPath(session, channelId), + path: channelPath(connection, channelId), ...options, }); } delete( - session: string, + connection: string, channelId: string, options: RequestOptions = {}, ): Promise> { return this.transport.request({ method: "DELETE", - path: channelPath(session, channelId), + path: channelPath(connection, channelId), ...options, }); } listMessages( - session: string, + connection: string, channelId: string, params: ChannelMessagesParams = {}, options: RequestOptions = {}, ): Promise> { return this.transport.request({ method: "GET", - path: `${channelPath(session, channelId)}/messages`, + path: `${channelPath(connection, channelId)}/messages`, query: { count: params.count, before: params.before }, ...options, }); } listMessageUpdates( - session: string, + connection: string, channelId: string, params: ChannelMessageUpdatesParams = {}, options: RequestOptions = {}, ): Promise> { return this.transport.request({ method: "GET", - path: `${channelPath(session, channelId)}/message-updates`, + path: `${channelPath(connection, channelId)}/message-updates`, query: { count: params.count, since: params.since, @@ -107,13 +107,13 @@ export class ChannelsResource { } markMessageViewed( - session: string, + connection: string, channelId: string, messageId: string, options: RequestOptions = {}, ): Promise> { return this.messageAction( - session, + connection, channelId, messageId, "viewed", @@ -123,14 +123,14 @@ export class ChannelsResource { } reactToMessage( - session: string, + connection: string, channelId: string, messageId: string, body: ChannelReactionRequest, options: RequestOptions = {}, ): Promise> { return this.messageAction( - session, + connection, channelId, messageId, "reaction", @@ -140,64 +140,64 @@ export class ChannelsResource { } subscribeToLiveUpdates( - session: string, + connection: string, channelId: string, options: RequestOptions = {}, ): Promise> { return this.transport.request({ method: "POST", - path: `${channelPath(session, channelId)}/live-updates`, + path: `${channelPath(connection, channelId)}/live-updates`, ...options, }); } follow( - session: string, + connection: string, channelId: string, options: RequestOptions = {}, ): Promise> { - return this.channelAction(session, channelId, "follow", options); + return this.channelAction(connection, channelId, "follow", options); } unfollow( - session: string, + connection: string, channelId: string, options: RequestOptions = {}, ): Promise> { - return this.channelAction(session, channelId, "unfollow", options); + return this.channelAction(connection, channelId, "unfollow", options); } mute( - session: string, + connection: string, channelId: string, options: RequestOptions = {}, ): Promise> { - return this.channelAction(session, channelId, "mute", options); + return this.channelAction(connection, channelId, "mute", options); } unmute( - session: string, + connection: string, channelId: string, options: RequestOptions = {}, ): Promise> { - return this.channelAction(session, channelId, "unmute", options); + return this.channelAction(connection, channelId, "unmute", options); } private channelAction( - session: string, + connection: string, channelId: string, action: "follow" | "unfollow" | "mute" | "unmute", options: RequestOptions, ): Promise>> { return this.transport.request({ method: "POST", - path: `${channelPath(session, channelId)}/${action}`, + path: `${channelPath(connection, channelId)}/${action}`, ...options, }); } private messageAction( - session: string, + connection: string, channelId: string, messageId: string, action: "viewed" | "reaction", @@ -206,17 +206,17 @@ export class ChannelsResource { ): Promise>> { return this.transport.request({ method: "POST", - path: `${channelPath(session, channelId)}/messages/${encodeURIComponent(messageId)}/${action}`, + path: `${channelPath(connection, channelId)}/messages/${encodeURIComponent(messageId)}/${action}`, ...(body === undefined ? {} : { body }), ...options, }); } } -function channelsPath(session: string): string { - return `/messaging/${encodeURIComponent(session)}/channels`; +function channelsPath(connection: string): string { + return `/messaging/${encodeURIComponent(connection)}/channels`; } -function channelPath(session: string, channelId: string): string { - return `${channelsPath(session)}/${encodeURIComponent(channelId)}`; +function channelPath(connection: string, channelId: string): string { + return `${channelsPath(connection)}/${encodeURIComponent(channelId)}`; } diff --git a/packages/typescript/src/messaging/chats.ts b/packages/typescript/src/messaging/chats.ts index 172027744..b1cefe437 100644 --- a/packages/typescript/src/messaging/chats.ts +++ b/packages/typescript/src/messaging/chats.ts @@ -31,7 +31,7 @@ export class ChatsResource { /** Official API beta. Requires chats:read and team enrollment; no HMS requirement. */ getServiceWindow( - session: string, + connection: string, conversation: string, options: RequestOptions = {}, ): Promise< @@ -47,21 +47,21 @@ export class ChatsResource { } return this.transport.request({ method: "GET", - path: `${chatPath(session, conversation)}/service-window`, + path: `${chatPath(connection, conversation)}/service-window`, ...options, }); } /** Lists one page of stored conversations. Requires `chats:read` and enrolled HMS history access. */ list( - session: string, + connection: string, params: ListHistoryChatsParams = {}, options: RequestOptions = {}, ): Promise>> { this.assertHistoryCredential(); return this.transport.request({ method: "GET", - path: `/messaging/${encodeURIComponent(session)}/chats`, + path: `/messaging/${encodeURIComponent(connection)}/chats`, query: { ...params }, ...options, }); @@ -69,7 +69,7 @@ export class ChatsResource { /** Reads a stored conversation by public ID or E.164 phone number. */ retrieve( - session: string, + connection: string, conversation: string, options: RequestOptions = {}, ): Promise< @@ -78,14 +78,14 @@ export class ChatsResource { this.assertHistoryCredential(); return this.transport.request({ method: "GET", - path: chatPath(session, conversation), + path: chatPath(connection, conversation), ...options, }); } /** Lists stored messages, newest first unless `order: "asc"` is supplied. */ listMessages( - session: string, + connection: string, conversation: string, params: ListHistoryMessagesParams = {}, options: RequestOptions = {}, @@ -93,7 +93,7 @@ export class ChatsResource { this.assertHistoryCredential(); return this.transport.request({ method: "GET", - path: `${chatPath(session, conversation)}/messages`, + path: `${chatPath(connection, conversation)}/messages`, query: { ...params }, ...options, }); @@ -101,7 +101,7 @@ export class ChatsResource { /** Reads one stored message by its opaque Polymorfa ID. */ retrieveMessage( - session: string, + connection: string, conversation: string, messageId: string, options: RequestOptions = {}, @@ -111,14 +111,14 @@ export class ChatsResource { this.assertHistoryCredential(); return this.transport.request({ method: "GET", - path: chatMessagePath(session, conversation, messageId), + path: chatMessagePath(connection, conversation, messageId), ...options, }); } /** Downloads a stored Official API message copy. Requires `messages:read`, `media:read`, and enrolled HMS history access. */ downloadMessageMedia( - session: string, + connection: string, conversation: string, messageId: string, options: RequestOptions = {}, @@ -126,14 +126,14 @@ export class ChatsResource { this.assertHistoryCredential(); return this.transport.requestBinary({ method: "GET", - path: `${chatMessagePath(session, conversation, messageId)}/media`, + path: `${chatMessagePath(connection, conversation, messageId)}/media`, ...options, }); } /** Streams a stored Official API message copy without buffering the file. */ async downloadMessageMediaStream( - session: string, + connection: string, conversation: string, messageId: string, options: RequestOptions = {}, @@ -141,7 +141,7 @@ export class ChatsResource { this.assertHistoryCredential(); const response = await this.transport.requestStream({ method: "GET", - path: `${chatMessagePath(session, conversation, messageId)}/media`, + path: `${chatMessagePath(connection, conversation, messageId)}/media`, ...options, }); return Object.freeze({ @@ -164,7 +164,7 @@ export class ChatsResource { } editMessage( - session: string, + connection: string, chatId: string, messageId: string, body: EditMessageRequest, @@ -172,65 +172,65 @@ export class ChatsResource { ): Promise> { return this.transport.request({ method: "PUT", - path: chatMessagePath(session, chatId, messageId), + path: chatMessagePath(connection, chatId, messageId), body, ...withIdempotencyKey(options), }); } deleteMessage( - session: string, + connection: string, chatId: string, messageId: string, options: DeleteMessageOptions = {}, ): Promise> { return this.transport.request({ method: "DELETE", - path: chatMessagePath(session, chatId, messageId), + path: chatMessagePath(connection, chatId, messageId), query: { transport: options.transport }, ...withIdempotencyKey(options), }); } archive( - session: string, + connection: string, chatId: string, options: RequestOptions = {}, ): Promise> { - return this.updateArchiveState(session, chatId, "archive", options); + return this.updateArchiveState(connection, chatId, "archive", options); } unarchive( - session: string, + connection: string, chatId: string, options: RequestOptions = {}, ): Promise> { - return this.updateArchiveState(session, chatId, "unarchive", options); + return this.updateArchiveState(connection, chatId, "unarchive", options); } setDisappearingTimer( - session: string, + connection: string, chatId: string, body: DisappearingTimerRequest, options: RequestOptions = {}, ): Promise> { return this.transport.request({ method: "PUT", - path: `${chatPath(session, chatId)}/disappearing`, + path: `${chatPath(connection, chatId)}/disappearing`, body, ...options, }); } private updateArchiveState( - session: string, + connection: string, chatId: string, action: "archive" | "unarchive", options: RequestOptions, ): Promise> { return this.transport.request({ method: "POST", - path: `${chatPath(session, chatId)}/${action}`, + path: `${chatPath(connection, chatId)}/${action}`, ...options, }); } @@ -245,14 +245,14 @@ export class ChatsResource { } } -function chatPath(session: string, chatId: string): string { - return `/messaging/${encodeURIComponent(session)}/chats/${encodeURIComponent(chatId)}`; +function chatPath(connection: string, chatId: string): string { + return `/messaging/${encodeURIComponent(connection)}/chats/${encodeURIComponent(chatId)}`; } function chatMessagePath( - session: string, + connection: string, chatId: string, messageId: string, ): string { - return `${chatPath(session, chatId)}/messages/${encodeURIComponent(messageId)}`; + return `${chatPath(connection, chatId)}/messages/${encodeURIComponent(messageId)}`; } diff --git a/packages/typescript/src/messaging/client-tokens.ts b/packages/typescript/src/messaging/client-tokens.ts index a413ae3d2..379243484 100644 --- a/packages/typescript/src/messaging/client-tokens.ts +++ b/packages/typescript/src/messaging/client-tokens.ts @@ -31,46 +31,46 @@ export class ClientTokensResource { } retrieveRules( - session: string, + connection: string, options: RequestOptions = {}, ): Promise> { this.assertServerCredential(); return this.transport.request({ method: "GET", - path: rulesPath(session), + path: rulesPath(connection), ...options, }); } updateRules( - session: string, + connection: string, body: SetClientRulesRequest, options: RequestOptions = {}, ): Promise> { this.assertServerCredential(); return this.transport.request({ method: "PUT", - path: rulesPath(session), + path: rulesPath(connection), body, ...options, }); } deleteRules( - session: string, + connection: string, options: RequestOptions = {}, ): Promise> { this.assertServerCredential(); return this.transport.request({ method: "DELETE", - path: rulesPath(session), + path: rulesPath(connection), ...options, }); } private assertServerCredential(): void { if (this.credentialType === "clientToken") { throw new PolymorfaConfigurationError( - "Platform session administration requires a server API key.", + "Platform connection administration requires a server API key.", "credential", ); } @@ -78,18 +78,18 @@ export class ClientTokensResource { } function assertMintTarget(body: MintClientTokenRequest): void { - const hasSession = - typeof body.session === "string" && body.session.length > 0; + const hasConnection = + typeof body.connection === "string" && body.connection.length > 0; const hasCustomer = typeof body.customer === "string" && body.customer.length > 0; - if (hasSession === hasCustomer) { + if (hasConnection === hasCustomer) { throw new PolymorfaConfigurationError( - "Provide exactly one of session or customer to mint a client token.", - hasSession ? "customer" : "session", + "Provide exactly one of connection or customer to mint a client token.", + hasConnection ? "customer" : "connection", ); } } -function rulesPath(session: string): string { - return `/platform/sessions/${encodeURIComponent(session)}/client-rules`; +function rulesPath(connection: string): string { + return `/platform/connections/${encodeURIComponent(connection)}/client-rules`; } diff --git a/packages/typescript/src/messaging/client.ts b/packages/typescript/src/messaging/client.ts index 6fd758ea2..1606237e9 100644 --- a/packages/typescript/src/messaging/client.ts +++ b/packages/typescript/src/messaging/client.ts @@ -29,7 +29,7 @@ import { PrivacyResource } from "./privacy.js"; import { PresenceResource } from "./presence.js"; import { QuickRepliesResource } from "./quick-replies.js"; import { QuickLinksResource } from "./quicklinks.js"; -import { SessionsResource } from "./sessions.js"; +import { ConnectionsResource } from "./connections.js"; import { TemplatesResource } from "./templates.js"; import { CloudTemplatesResource } from "./cloud-templates.js"; import { OfficialGroupsResource } from "./official-groups.js"; @@ -60,7 +60,7 @@ export class MessagingClient { /** Direct history commands: chunk retry and CDN deletion. */ readonly historySync: HistorySyncResource; readonly observationPolicies: ObservationPoliciesResource; - readonly sessions: SessionsResource; + readonly connections: ConnectionsResource; readonly messages: MessagesResource; readonly hybridLink: HybridLinkResource; readonly profile: ProfileResource; @@ -111,7 +111,7 @@ export class MessagingClient { this.whatsappMedia = new WhatsAppMediaResource(transport, credential.type); this.historySync = new HistorySyncResource(transport, credential.type); this.observationPolicies = new ObservationPoliciesResource(transport); - this.sessions = new SessionsResource(transport, credential.type); + this.connections = new ConnectionsResource(transport, credential.type); this.hybridLink = new HybridLinkResource(transport, credential.type); this.messages = new MessagesResource(transport, credential.type); this.profile = new ProfileResource(transport); diff --git a/packages/typescript/src/messaging/cloud-catalogs.ts b/packages/typescript/src/messaging/cloud-catalogs.ts index abe3ecab0..cf68c45e9 100644 --- a/packages/typescript/src/messaging/cloud-catalogs.ts +++ b/packages/typescript/src/messaging/cloud-catalogs.ts @@ -34,7 +34,7 @@ export interface ListCloudCatalogProductsResponse { }; } -/** Reads catalog links visible to the authenticated WABA. Requires sessions:read. */ +/** Reads catalog links visible to the authenticated WABA. Requires connections:read. */ export class CloudCatalogsResource { constructor( private readonly transport: HttpTransport, diff --git a/packages/typescript/src/messaging/cloud-marketing.ts b/packages/typescript/src/messaging/cloud-marketing.ts index 576cf5880..6f355f9c0 100644 --- a/packages/typescript/src/messaging/cloud-marketing.ts +++ b/packages/typescript/src/messaging/cloud-marketing.ts @@ -47,11 +47,11 @@ export class CloudMarketingResource { private readonly credentialType: MessagingCredential["type"], ) {} - /** Beta, sessions:read. Terms acceptance happens in WhatsApp Manager. + /** Beta, connections:read. Terms acceptance happens in WhatsApp Manager. * feature_unavailable means the team has no access; unknown never means eligible. */ getStatus( - session: string, + connection: string, options: RequestOptions = {}, ): Promise< ApiResponse<{ @@ -64,13 +64,13 @@ export class CloudMarketingResource { "Marketing Messages status requires a team API key or project token.", "credential", ); - if (!session.trim() || session.length > 128) + if (!connection.trim() || connection.length > 128) throw new PolymorfaValidationError( "Provide a Number ID of 1 to 128 characters.", ); return this.transport.request({ method: "GET", - path: `/messaging/${encodeURIComponent(session)}/marketing-messages/status`, + path: `/messaging/${encodeURIComponent(connection)}/marketing-messages/status`, ...options, }); } diff --git a/packages/typescript/src/messaging/cloud-templates.ts b/packages/typescript/src/messaging/cloud-templates.ts index a09b36dcc..10f48ade5 100644 --- a/packages/typescript/src/messaging/cloud-templates.ts +++ b/packages/typescript/src/messaging/cloud-templates.ts @@ -23,7 +23,7 @@ export type CloudTemplateStatus = export interface CloudTemplate { readonly id: string; readonly tenantId: string; - readonly session: string; + readonly connection: string; readonly wabaId: string; readonly name: string; readonly language: string; @@ -82,19 +82,19 @@ export class CloudTemplatesResource { /** Refresh the complete Meta catalog before returning the saved templates. */ list( - session: string, + connection: string, options: RequestOptions = {}, ): Promise> { this.requireServerCredential(); return this.transport.request({ method: "GET", - path: templatesPath(session), + path: templatesPath(connection), ...options, }); } retrieve( - session: string, + connection: string, name: string, params: RetrieveCloudTemplateParams = {}, options: RequestOptions = {}, @@ -102,7 +102,7 @@ export class CloudTemplatesResource { this.requireServerCredential(); return this.transport.request({ method: "GET", - path: templatePath(session, name), + path: templatePath(connection, name), query: { language: params.language }, ...options, }); @@ -115,14 +115,14 @@ export class CloudTemplatesResource { * unknown, list templates before deciding whether another write is safe. */ create( - session: string, + connection: string, body: CreateCloudTemplateRequest, options: RequestOptions = {}, ): Promise> { this.requireServerCredential(); return this.transport.request({ method: "POST", - path: templatesPath(session), + path: templatesPath(connection), body, ...options, maxNetworkRetries: 0, @@ -131,7 +131,7 @@ export class CloudTemplatesResource { /** Acceptance is not approval. Read the template before retrying an uncertain edit. */ update( - session: string, + connection: string, name: string, body: EditCloudTemplateRequest, params: RetrieveCloudTemplateParams = {}, @@ -140,7 +140,7 @@ export class CloudTemplatesResource { this.requireServerCredential(); return this.transport.request({ method: "PATCH", - path: templatePath(session, name), + path: templatePath(connection, name), query: { language: params.language }, body, ...options, @@ -154,24 +154,24 @@ export class CloudTemplatesResource { * templates to reconcile an unknown outcome. */ delete( - session: string, + connection: string, name: string, options: RequestOptions = {}, ): Promise> { this.requireServerCredential(); return this.transport.request({ method: "DELETE", - path: templatePath(session, name), + path: templatePath(connection, name), ...options, maxNetworkRetries: 0, }); } } -function templatesPath(session: string): string { - return `/messaging/${encodeURIComponent(session)}/templates`; +function templatesPath(connection: string): string { + return `/messaging/${encodeURIComponent(connection)}/templates`; } -function templatePath(session: string, name: string): string { - return `${templatesPath(session)}/${encodeURIComponent(name)}`; +function templatePath(connection: string, name: string): string { + return `${templatesPath(connection)}/${encodeURIComponent(name)}`; } diff --git a/packages/typescript/src/messaging/cloud-types.ts b/packages/typescript/src/messaging/cloud-types.ts index 0fdee9c92..5b99781fc 100644 --- a/packages/typescript/src/messaging/cloud-types.ts +++ b/packages/typescript/src/messaging/cloud-types.ts @@ -68,5 +68,5 @@ export interface CloudReauthorization { readonly quicklinkId: string; /** Share only with the person who manages this Number's Meta assets. */ readonly url: string; - readonly session: string; + readonly connection: string; } diff --git a/packages/typescript/src/messaging/session-configuration.ts b/packages/typescript/src/messaging/connection-configuration.ts similarity index 78% rename from packages/typescript/src/messaging/session-configuration.ts rename to packages/typescript/src/messaging/connection-configuration.ts index 9670e75a0..a0822e5b4 100644 --- a/packages/typescript/src/messaging/session-configuration.ts +++ b/packages/typescript/src/messaging/connection-configuration.ts @@ -30,22 +30,22 @@ export interface ObservationConfiguration { labelMode: "off" | "events" | "cache" | "project"; quickReplyMode: "off" | "events" | "cache"; } -export interface SessionConfigurationOverrides { +export interface ConnectionConfigurationOverrides { observation?: Partial; historySync?: HistorySyncPolicyPatch; /** Atomic policy replacement; enabling requires separate live authorization. */ hms?: HmsConfiguration; } -export interface EffectiveSessionConfiguration { +export interface EffectiveConnectionConfiguration { observation: ObservationConfiguration; historySync: HistorySyncPolicy; hms: HmsConfiguration; } -export type ConfigurationSource = "platform" | "team" | "project" | "session"; +export type ConfigurationSource = "platform" | "team" | "project" | "connection"; export type ConfigurationValueSource = ConfigurationSource | "consent"; -export type SessionConfigurationReset = +export type ConnectionConfigurationReset = | "historySync" | "historySync.mode" | "historySync.requestFull" @@ -53,13 +53,13 @@ export type SessionConfigurationReset = | "hms" | "observation" | `observation.${keyof ObservationConfiguration}`; -export interface SessionConfigurationPatch { - set?: SessionConfigurationOverrides; - reset?: SessionConfigurationReset[]; +export interface ConnectionConfigurationPatch { + set?: ConnectionConfigurationOverrides; + reset?: ConnectionConfigurationReset[]; } -export interface ResolvedSessionConfiguration { - effective: EffectiveSessionConfiguration; - overrides: SessionConfigurationOverrides; +export interface ResolvedConnectionConfiguration { + effective: EffectiveConnectionConfiguration; + overrides: ConnectionConfigurationOverrides; sources: { "historySync.mode": ConfigurationValueSource; "historySync.requestFull": ConfigurationValueSource; @@ -72,10 +72,10 @@ export interface ResolvedSessionConfiguration { }; } -export interface SessionConfigurationView extends ResolvedSessionConfiguration { +export interface ConnectionConfigurationView extends ResolvedConnectionConfiguration { requestedHistory: HistorySyncPolicy; historyConsent?: "pending" | "accepted" | "declined"; - revisions: { team: number; project: number; session: number }; + revisions: { team: number; project: number; connection: number }; application?: { desiredGeneration: number; appliedGeneration: number; diff --git a/packages/typescript/src/messaging/sessions.ts b/packages/typescript/src/messaging/connections.ts similarity index 67% rename from packages/typescript/src/messaging/sessions.ts rename to packages/typescript/src/messaging/connections.ts index 45ec908cd..61de9d518 100644 --- a/packages/typescript/src/messaging/sessions.ts +++ b/packages/typescript/src/messaging/connections.ts @@ -1,5 +1,5 @@ import { campaignContractBody } from "../campaign-contract-validation.js"; -import { configurationIntent } from "../session-delivery-validation.js"; +import { configurationIntent } from "../connection-delivery-validation.js"; import { existingOptions } from "../campaign-existing-validation.js"; import type { MessagingCredential } from "../credentials.js"; import type { @@ -12,41 +12,41 @@ import { PolymorfaConfigurationError } from "../errors.js"; import { HttpTransport } from "../transport/http.js"; import type { ApiResponse, RequestOptions } from "../transport/types.js"; import type { - GetSessionAccountResponse, - GetSessionResponse, + GetConnectionAccountResponse, + GetConnectionResponse, GetQRCodeResponse, OperationAccepted, PairCodeRequest, RequestPairCodeResponse, SuccessEnvelope, - UpdateSessionRequest, - UpdateSessionResponse, + UpdateConnectionRequest, + UpdateConnectionResponse, } from "./types.js"; import type { DataEnvelope, - PlatformSession, - SessionStartResult, - SessionStopResult, - SessionRemoveResult, + PlatformConnection, + ConnectionStartResult, + ConnectionStopResult, + ConnectionRemoveResult, } from "../platform/types.js"; -export class SessionsResource { +export class ConnectionsResource { constructor( private readonly transport: HttpTransport, private readonly credentialType: MessagingCredential["type"], ) {} - /** Official API beta. Requires sessions:read; counts carry no price or charge. */ + /** Official API beta. Requires connections:read; counts carry no price or charge. */ getMetaPricing( - session: string, + connection: string, params: MetaPricingParams = {}, options: RequestOptions = {}, ): Promise>> { this.assertServerCredential(); return this.transport.request({ method: "GET", - path: `/messaging/${encodeURIComponent(session)}/meta-pricing`, + path: `/messaging/${encodeURIComponent(connection)}/meta-pricing`, query: { ...params }, ...existingOptions(options), }); @@ -54,26 +54,26 @@ export class SessionsResource { /** Latest redacted provider checks; a healthy token does not grant beta access. */ getCloudCredentialHealth( - session: string, + connection: string, options: RequestOptions = {}, ): Promise>> { this.assertServerCredential(); return this.transport.request({ method: "GET", - path: `/messaging/${encodeURIComponent(session)}/cloud-credentials`, + path: `/messaging/${encodeURIComponent(connection)}/cloud-credentials`, ...existingOptions(options), }); } /** Create one reauthorization link for a stopped standalone Official API Number. Never stops it. */ reauthorizeCloudCredentials( - session: string, + connection: string, options: RequestOptions = {}, ): Promise>> { this.assertServerCredential(); return this.transport.request({ method: "POST", - path: `/messaging/${encodeURIComponent(session)}/cloud-credentials/reauthorize`, + path: `/messaging/${encodeURIComponent(connection)}/cloud-credentials/reauthorize`, ...existingOptions(options), maxNetworkRetries: 0, }); @@ -81,112 +81,112 @@ export class SessionsResource { list( options: RequestOptions = {}, - ): Promise>> { + ): Promise>> { this.assertServerCredential(); return this.transport.request({ method: "GET", - path: "/platform/sessions", + path: "/platform/connections", ...existingOptions(options), }); } retrieve( - session: string, + connection: string, options: RequestOptions = {}, - ): Promise> { + ): Promise> { this.assertServerCredential(); return this.transport.request({ method: "GET", - path: sessionPath(session), + path: connectionPath(connection), ...existingOptions(options), }); } update( - session: string, - body: UpdateSessionRequest, + connection: string, + body: UpdateConnectionRequest, options: RequestOptions = {}, - ): Promise> { + ): Promise> { options = existingOptions(options, configurationIntent(body)); this.assertServerCredential(); return this.transport.request({ method: "PUT", - path: sessionPath(session), + path: connectionPath(connection), body: campaignContractBody(body), ...existingOptions(options), }); } delete( - session: string, + connection: string, options: RequestOptions = {}, - ): Promise>> { + ): Promise>> { this.assertServerCredential(); return this.transport.request({ method: "DELETE", - path: sessionPath(session), + path: connectionPath(connection), ...existingOptions(options), }); } start( - session: string, + connection: string, options: RequestOptions = {}, - ): Promise>> { + ): Promise>> { this.assertServerCredential(); return this.transport.request({ method: "POST", - path: `${sessionPath(session)}/start`, + path: `${connectionPath(connection)}/start`, ...existingOptions(options), }); } stop( - session: string, + connection: string, options: RequestOptions = {}, - ): Promise>> { + ): Promise>> { this.assertServerCredential(); return this.transport.request({ method: "POST", - path: `${sessionPath(session)}/stop`, + path: `${connectionPath(connection)}/stop`, ...existingOptions(options), }); } restart( - session: string, + connection: string, options: RequestOptions = {}, ): Promise> { - return this.action(session, "restart", options); + return this.action(connection, "restart", options); } logout( - session: string, + connection: string, options: RequestOptions = {}, ): Promise> { - return this.action(session, "logout", options); + return this.action(connection, "logout", options); } account( - session: string, + connection: string, options: RequestOptions = {}, - ): Promise> { + ): Promise> { this.assertServerCredential(); return this.transport.request({ method: "GET", - path: `${sessionPath(session)}/me`, + path: `${connectionPath(connection)}/me`, ...existingOptions(options), }); } /** Direct pairing is entitlement-gated. Use QuickLink for the standard flow. */ qr( - session: string, + connection: string, options: RequestOptions = {}, ): Promise> { return this.transport.request({ method: "GET", - path: `/messaging/${encodeURIComponent(session)}/pair/qr`, + path: `/messaging/${encodeURIComponent(connection)}/pair/qr`, query: { format: "json" }, ...existingOptions(options), }); @@ -194,40 +194,40 @@ export class SessionsResource { /** Direct pairing is entitlement-gated. Use QuickLink for the standard flow. */ requestPairingCode( - session: string, + connection: string, body: PairCodeRequest, options: RequestOptions = {}, ): Promise> { return this.transport.request({ method: "POST", - path: `/messaging/${encodeURIComponent(session)}/pair/code`, + path: `/messaging/${encodeURIComponent(connection)}/pair/code`, body, ...existingOptions(options), }); } private action( - session: string, + connection: string, action: "restart" | "logout", options: RequestOptions, ): Promise> { this.assertServerCredential(); return this.transport.request({ method: "POST", - path: `${sessionPath(session)}/${action}`, + path: `${connectionPath(connection)}/${action}`, ...existingOptions(options), }); } private assertServerCredential(): void { if (this.credentialType === "clientToken") { throw new PolymorfaConfigurationError( - "Platform session administration requires a server API key.", + "Platform connection administration requires a server API key.", "credential", ); } } } -function sessionPath(session: string): string { - return `/platform/sessions/${encodeURIComponent(session)}`; +function connectionPath(connection: string): string { + return `/platform/connections/${encodeURIComponent(connection)}`; } diff --git a/packages/typescript/src/messaging/contacts.ts b/packages/typescript/src/messaging/contacts.ts index ac68cc52f..a53cb8677 100644 --- a/packages/typescript/src/messaging/contacts.ts +++ b/packages/typescript/src/messaging/contacts.ts @@ -16,83 +16,83 @@ export class ContactsResource { constructor(private readonly transport: HttpTransport) {} list( - session: string, + connection: string, options: RequestOptions = {}, ): Promise> { return this.transport.request({ method: "GET", - path: contactsPath(session), + path: contactsPath(connection), ...options, }); } check( - session: string, + connection: string, phone: string | readonly string[], options: RequestOptions = {}, ): Promise> { return this.transport.request({ method: "GET", - path: `${contactsPath(session)}/check`, + path: `${contactsPath(connection)}/check`, query: { phone: typeof phone === "string" ? phone : phone.join(",") }, ...options, }); } blocklist( - session: string, + connection: string, options: RequestOptions = {}, ): Promise> { return this.transport.request({ method: "GET", - path: `${contactsPath(session)}/blocked`, + path: `${contactsPath(connection)}/blocked`, ...options, }); } retrieve( - session: string, + connection: string, contactId: string, options: RequestOptions = {}, ): Promise> { return this.transport.request({ method: "GET", - path: contactPath(session, contactId), + path: contactPath(connection, contactId), ...options, }); } picture( - session: string, + connection: string, contactId: string, options: RequestOptions = {}, ): Promise> { - return this.getContactSubresource(session, contactId, "picture", options); + return this.getContactSubresource(connection, contactId, "picture", options); } info( - session: string, + connection: string, contactId: string, options: RequestOptions = {}, ): Promise> { - return this.getContactSubresource(session, contactId, "info", options); + return this.getContactSubresource(connection, contactId, "info", options); } devices( - session: string, + connection: string, contactId: string, options: RequestOptions = {}, ): Promise> { - return this.getContactSubresource(session, contactId, "devices", options); + return this.getContactSubresource(connection, contactId, "devices", options); } businessProfile( - session: string, + connection: string, contactId: string, options: RequestOptions = {}, ): Promise> { return this.getContactSubresource( - session, + connection, contactId, "business-profile", options, @@ -100,52 +100,52 @@ export class ContactsResource { } block( - session: string, + connection: string, contactId: string, options: RequestOptions = {}, ): Promise> { - return this.updateBlockState(session, contactId, "block", options); + return this.updateBlockState(connection, contactId, "block", options); } unblock( - session: string, + connection: string, contactId: string, options: RequestOptions = {}, ): Promise> { - return this.updateBlockState(session, contactId, "unblock", options); + return this.updateBlockState(connection, contactId, "unblock", options); } private getContactSubresource( - session: string, + connection: string, contactId: string, resource: "picture" | "info" | "devices" | "business-profile", options: RequestOptions, ): Promise> { return this.transport.request({ method: "GET", - path: `${contactPath(session, contactId)}/${resource}`, + path: `${contactPath(connection, contactId)}/${resource}`, ...options, }); } private updateBlockState( - session: string, + connection: string, contactId: string, action: "block" | "unblock", options: RequestOptions, ): Promise> { return this.transport.request({ method: "POST", - path: `${contactPath(session, contactId)}/${action}`, + path: `${contactPath(connection, contactId)}/${action}`, ...options, }); } } -function contactsPath(session: string): string { - return `/messaging/${encodeURIComponent(session)}/contacts`; +function contactsPath(connection: string): string { + return `/messaging/${encodeURIComponent(connection)}/contacts`; } -function contactPath(session: string, contactId: string): string { - return `${contactsPath(session)}/${encodeURIComponent(contactId)}`; +function contactPath(connection: string, contactId: string): string { + return `${contactsPath(connection)}/${encodeURIComponent(contactId)}`; } diff --git a/packages/typescript/src/messaging/groups.ts b/packages/typescript/src/messaging/groups.ts index d589ae6fe..2db049dfd 100644 --- a/packages/typescript/src/messaging/groups.ts +++ b/packages/typescript/src/messaging/groups.ts @@ -26,52 +26,52 @@ export class GroupsResource { constructor(private readonly transport: HttpTransport) {} list( - session: string, + connection: string, options: RequestOptions = {}, ): Promise> { - return this.get(groupsPath(session), options); + return this.get(groupsPath(connection), options); } create( - session: string, + connection: string, body: CreateGroupRequest, options: RequestOptions = {}, ): Promise> { - return this.mutate("POST", groupsPath(session), body, options); + return this.mutate("POST", groupsPath(connection), body, options); } getJoinInfo( - session: string, + connection: string, code: string, options: RequestOptions = {}, ): Promise> { return this.transport.request({ method: "GET", - path: `${groupsPath(session)}/join-info`, + path: `${groupsPath(connection)}/join-info`, query: { code }, ...options, }); } join( - session: string, + connection: string, body: JoinGroupRequest, options: RequestOptions = {}, ): Promise> { - return this.mutate("POST", `${groupsPath(session)}/join`, body, options); + return this.mutate("POST", `${groupsPath(connection)}/join`, body, options); } retrieve( - session: string, + connection: string, groupId: string, options: RequestOptions = {}, ): Promise> { - return this.get(groupPath(session, groupId), options); + return this.get(groupPath(connection, groupId), options); } /** Enrolled number-capabilities beta. Unknown until a group sync; no chat open. */ getCapabilities( - session: string, + connection: string, groupId: string, options: RequestOptions = {}, ): Promise> { @@ -80,7 +80,7 @@ export class GroupsResource { { ...existingOptions(options), method: "GET", - path: `${groupPath(session, groupId)}/capabilities`, + path: `${groupPath(connection, groupId)}/capabilities`, }, "groupCapabilities", true, @@ -88,48 +88,48 @@ export class GroupsResource { } delete( - session: string, + connection: string, groupId: string, options: RequestOptions = {}, ): Promise> { return this.mutate( "DELETE", - groupPath(session, groupId), + groupPath(connection, groupId), undefined, options, ); } leave( - session: string, + connection: string, groupId: string, options: RequestOptions = {}, ): Promise> { return this.mutate( "POST", - `${groupPath(session, groupId)}/leave`, + `${groupPath(connection, groupId)}/leave`, undefined, options, ); } setSubject( - session: string, + connection: string, groupId: string, body: SetGroupFieldRequest, options: RequestOptions = {}, ): Promise> { - return this.putGroupSubresource(session, groupId, "subject", body, options); + return this.putGroupSubresource(connection, groupId, "subject", body, options); } setDescription( - session: string, + connection: string, groupId: string, body: SetGroupFieldRequest, options: RequestOptions = {}, ): Promise> { return this.putGroupSubresource( - session, + connection, groupId, "description", body, @@ -138,87 +138,87 @@ export class GroupsResource { } getInviteCode( - session: string, + connection: string, groupId: string, options: RequestOptions = {}, ): Promise> { - return this.get(`${groupPath(session, groupId)}/invite-code`, options); + return this.get(`${groupPath(connection, groupId)}/invite-code`, options); } revokeInviteCode( - session: string, + connection: string, groupId: string, options: RequestOptions = {}, ): Promise> { return this.mutate( "POST", - `${groupPath(session, groupId)}/invite-code/revoke`, + `${groupPath(connection, groupId)}/invite-code/revoke`, undefined, options, ); } listParticipants( - session: string, + connection: string, groupId: string, options: RequestOptions = {}, ): Promise> { - return this.get(`${groupPath(session, groupId)}/participants`, options); + return this.get(`${groupPath(connection, groupId)}/participants`, options); } addParticipants( - session: string, + connection: string, groupId: string, body: GroupParticipantsRequest, options: RequestOptions = {}, ): Promise> { - return this.participantAction(session, groupId, "add", body, options); + return this.participantAction(connection, groupId, "add", body, options); } removeParticipants( - session: string, + connection: string, groupId: string, body: GroupParticipantsRequest, options: RequestOptions = {}, ): Promise> { - return this.participantAction(session, groupId, "remove", body, options); + return this.participantAction(connection, groupId, "remove", body, options); } promoteParticipants( - session: string, + connection: string, groupId: string, body: GroupParticipantsRequest, options: RequestOptions = {}, ): Promise> { - return this.adminAction(session, groupId, "promote", body, options); + return this.adminAction(connection, groupId, "promote", body, options); } demoteParticipants( - session: string, + connection: string, groupId: string, body: GroupParticipantsRequest, options: RequestOptions = {}, ): Promise> { - return this.adminAction(session, groupId, "demote", body, options); + return this.adminAction(connection, groupId, "demote", body, options); } setPicture( - session: string, + connection: string, groupId: string, body: SetGroupPictureRequest, options: RequestOptions = {}, ): Promise> { - return this.putGroupSubresource(session, groupId, "picture", body, options); + return this.putGroupSubresource(connection, groupId, "picture", body, options); } setInfoEditing( - session: string, + connection: string, groupId: string, body: GroupAdminOnlySettingRequest, options: RequestOptions = {}, ): Promise> { return this.putGroupSubresource( - session, + connection, groupId, "settings/info-edit", body, @@ -227,13 +227,13 @@ export class GroupsResource { } setMessaging( - session: string, + connection: string, groupId: string, body: GroupAdminOnlySettingRequest, options: RequestOptions = {}, ): Promise> { return this.putGroupSubresource( - session, + connection, groupId, "settings/messages", body, @@ -242,13 +242,13 @@ export class GroupsResource { } setMemberAddMode( - session: string, + connection: string, groupId: string, body: GroupMemberAddModeRequest, options: RequestOptions = {}, ): Promise> { return this.putGroupSubresource( - session, + connection, groupId, "settings/member-add", body, @@ -257,13 +257,13 @@ export class GroupsResource { } setJoinApproval( - session: string, + connection: string, groupId: string, body: GroupJoinApprovalRequest, options: RequestOptions = {}, ): Promise> { return this.putGroupSubresource( - session, + connection, groupId, "settings/join-approval", body, @@ -279,7 +279,7 @@ export class GroupsResource { } private putGroupSubresource( - session: string, + connection: string, groupId: string, resource: | "subject" @@ -294,14 +294,14 @@ export class GroupsResource { ): Promise> { return this.mutate( "PUT", - `${groupPath(session, groupId)}/${resource}`, + `${groupPath(connection, groupId)}/${resource}`, body, options, ); } private participantAction( - session: string, + connection: string, groupId: string, action: "add" | "remove", body: GroupParticipantsRequest, @@ -309,14 +309,14 @@ export class GroupsResource { ): Promise> { return this.mutate( "POST", - `${groupPath(session, groupId)}/participants/${action}`, + `${groupPath(connection, groupId)}/participants/${action}`, body, options, ); } private adminAction( - session: string, + connection: string, groupId: string, action: "promote" | "demote", body: GroupParticipantsRequest, @@ -324,7 +324,7 @@ export class GroupsResource { ): Promise> { return this.mutate( "POST", - `${groupPath(session, groupId)}/admin/${action}`, + `${groupPath(connection, groupId)}/admin/${action}`, body, options, ); @@ -340,10 +340,10 @@ export class GroupsResource { } } -function groupsPath(session: string): string { - return `/messaging/${encodeURIComponent(session)}/groups`; +function groupsPath(connection: string): string { + return `/messaging/${encodeURIComponent(connection)}/groups`; } -function groupPath(session: string, groupId: string): string { - return `${groupsPath(session)}/${encodeURIComponent(groupId)}`; +function groupPath(connection: string, groupId: string): string { + return `${groupsPath(connection)}/${encodeURIComponent(groupId)}`; } diff --git a/packages/typescript/src/messaging/history-sync.ts b/packages/typescript/src/messaging/history-sync.ts index 3bd430ae3..b3447d8c0 100644 --- a/packages/typescript/src/messaging/history-sync.ts +++ b/packages/typescript/src/messaging/history-sync.ts @@ -9,7 +9,7 @@ import type { MessagingCredential } from "../credentials.js"; import type { RequestOptions } from "../transport/types.js"; /** - * Session commands for direct history. Download and decode chunks with + * Connection commands for direct history. Download and decode chunks with * `downloadHistoryChunk` from `@polymorfa/sdk/history`. * @experimental Pending backend alignment. */ @@ -24,27 +24,27 @@ export class HistorySyncResource { } /** - * Asks the session's phone to send a missed or failed chunk again. The + * Asks the connection's phone to send a missed or failed chunk again. The * chunk arrives as a new `history.sync` event. */ requestChunkRetry( - session: string, + connection: string, request: HistorySyncChunkRetryRequest, options: RequestOptions = {}, ): Promise { - return this.#api.requestHistoryChunkRetry(session, request, options); + return this.#api.requestHistoryChunkRetry(connection, request, options); } /** - * Asks the session to delete a processed chunk from the WhatsApp CDN, as + * Asks the connection to delete a processed chunk from the WhatsApp CDN, as * WhatsApp Web does after applying a chunk. Call it only after the chunk * is stored. */ deleteChunk( - session: string, + connection: string, request: HistorySyncChunkDeleteRequest, options: RequestOptions = {}, ): Promise { - return this.#api.deleteHistoryChunk(session, request, options); + return this.#api.deleteHistoryChunk(connection, request, options); } } diff --git a/packages/typescript/src/messaging/hybrid-link.ts b/packages/typescript/src/messaging/hybrid-link.ts index df1c3f028..6de2c3f7e 100644 --- a/packages/typescript/src/messaging/hybrid-link.ts +++ b/packages/typescript/src/messaging/hybrid-link.ts @@ -9,12 +9,12 @@ export type HybridRoutingPolicyScope = | { readonly scope: "team" } | { readonly scope: "project"; readonly projectId: string } | { - readonly scope: "session"; + readonly scope: "connection"; readonly projectId: string; - readonly session: string; + readonly connection: string; }; export interface HybridRoutingPolicy { - readonly scope: "team" | "project" | "session"; + readonly scope: "team" | "project" | "connection"; readonly revision: string; readonly prefer: HybridConnectionKind | null; readonly allowedTransports: readonly HybridConnectionKind[]; @@ -71,18 +71,18 @@ export class HybridLinkResource { }); } state( - session: string, + connection: string, options: RequestOptions = {}, ): Promise>> { this.assertServerCredential(); return this.transport.request({ method: "GET", - path: this.path(session), + path: this.path(connection), ...options, }); } setPaused( - session: string, + connection: string, body: SetHybridLinkPausedRequest, options: RequestOptions = {}, ): Promise< @@ -91,13 +91,13 @@ export class HybridLinkResource { this.assertServerCredential(); return this.transport.request({ method: "PUT", - path: this.path(session), + path: this.path(connection), body, ...options, }); } - private path(session: string): string { - return `/messaging/${encodeURIComponent(session)}/hybrid-link`; + private path(connection: string): string { + return `/messaging/${encodeURIComponent(connection)}/hybrid-link`; } private assertServerCredential(): void { if (this.credentialType === "clientToken") diff --git a/packages/typescript/src/messaging/identities.ts b/packages/typescript/src/messaging/identities.ts index 5806ffb64..b5e0ad572 100644 --- a/packages/typescript/src/messaging/identities.ts +++ b/packages/typescript/src/messaging/identities.ts @@ -9,13 +9,13 @@ export class IdentitiesResource { constructor(private readonly transport: HttpTransport) {} resolve( - session: string, + connection: string, params: ResolveIdentityParams, options: RequestOptions = {}, ): Promise> { return this.transport.request({ method: "GET", - path: `/messaging/${encodeURIComponent(session)}/identities/resolve`, + path: `/messaging/${encodeURIComponent(connection)}/identities/resolve`, query: { phoneNumber: params.phoneNumber, id: params.id, diff --git a/packages/typescript/src/messaging/labels.ts b/packages/typescript/src/messaging/labels.ts index f5afe4916..33e87b52f 100644 --- a/packages/typescript/src/messaging/labels.ts +++ b/packages/typescript/src/messaging/labels.ts @@ -15,71 +15,71 @@ export class LabelsResource { constructor(private readonly transport: HttpTransport) {} list( - session: string, + connection: string, params: ListLabelsParams = {}, options: RequestOptions = {}, ): Promise> { - return this.read(labelsPath(session), params, options); + return this.read(labelsPath(connection), params, options); } create( - session: string, + connection: string, body: CreateLabelRequest, options: RequestOptions = {}, ): Promise> { return this.transport.request({ method: "POST", - path: labelsPath(session), + path: labelsPath(connection), body, ...options, }); } update( - session: string, + connection: string, labelId: string, body: UpdateLabelRequest, options: RequestOptions = {}, ): Promise> { return this.transport.request({ method: "PUT", - path: labelPath(session, labelId), + path: labelPath(connection, labelId), body, ...options, }); } delete( - session: string, + connection: string, labelId: string, options: RequestOptions = {}, ): Promise> { return this.transport.request({ method: "DELETE", - path: labelPath(session, labelId), + path: labelPath(connection, labelId), ...options, }); } listForChat( - session: string, + connection: string, chatId: string, params: ListLabelsParams = {}, options: RequestOptions = {}, ): Promise> { - return this.read(chatLabelsPath(session, chatId), params, options); + return this.read(chatLabelsPath(connection, chatId), params, options); } /** Replaces the chat's complete label set. Pass an empty array to detach all labels. */ replaceForChat( - session: string, + connection: string, chatId: string, body: ReplaceChatLabelsRequest, options: RequestOptions = {}, ): Promise> { return this.transport.request({ method: "PUT", - path: chatLabelsPath(session, chatId), + path: chatLabelsPath(connection, chatId), body, ...options, }); @@ -101,14 +101,14 @@ export class LabelsResource { } } -function labelsPath(session: string): string { - return `/messaging/${encodeURIComponent(session)}/labels`; +function labelsPath(connection: string): string { + return `/messaging/${encodeURIComponent(connection)}/labels`; } -function labelPath(session: string, labelId: string): string { - return `${labelsPath(session)}/${encodeURIComponent(labelId)}`; +function labelPath(connection: string, labelId: string): string { + return `${labelsPath(connection)}/${encodeURIComponent(labelId)}`; } -function chatLabelsPath(session: string, chatId: string): string { - return `${labelsPath(session)}/chats/${encodeURIComponent(chatId)}`; +function chatLabelsPath(connection: string, chatId: string): string { + return `${labelsPath(connection)}/chats/${encodeURIComponent(chatId)}`; } diff --git a/packages/typescript/src/messaging/messages.ts b/packages/typescript/src/messaging/messages.ts index fd943ce41..c83220216 100644 --- a/packages/typescript/src/messaging/messages.ts +++ b/packages/typescript/src/messaging/messages.ts @@ -28,7 +28,7 @@ export class MessagesResource { /** Read the issuing principal's durable attempt. This method never resends. */ operationStatus( - session: string, + connection: string, operationId: string, options: RequestOptions = {}, ): Promise> { @@ -39,14 +39,14 @@ export class MessagesResource { ); return this.transport.request({ method: "GET", - path: `/messaging/${encodeURIComponent(session)}/operations/${encodeURIComponent(operationId)}`, + path: `/messaging/${encodeURIComponent(connection)}/operations/${encodeURIComponent(operationId)}`, ...options, }); } /** Validate interactive unions before transport and preserve idempotency and descriptor options. */ send( - session: string, + connection: string, body: SendMessageRequest, options: RequestOptions = {}, ): Promise> { @@ -66,7 +66,7 @@ export class MessagesResource { typeof value === "object" && value !== null && "descriptor" in value, ); return this.post( - session, + connection, "send", descriptor ? campaignContractBody(body) : body, withIdempotencyKey( @@ -78,47 +78,47 @@ export class MessagesResource { } markSeen( - session: string, + connection: string, body: SeenRequest, options: RequestOptions = {}, ): Promise>> { - return this.post(session, "seen", body, options); + return this.post(connection, "seen", body, options); } /** Official Numbers require an inbound id and state typing; marks it read for an indicator lasting at most 25 seconds. */ setTyping( - session: string, + connection: string, body: TypingRequest, options: RequestOptions = {}, ): Promise>> { - return this.post(session, "typing", body, options); + return this.post(connection, "typing", body, options); } react( - session: string, + connection: string, body: ReactRequest, options: RequestOptions = {}, ): Promise> { - return this.post(session, "react", body, withIdempotencyKey(options)); + return this.post(connection, "react", body, withIdempotencyKey(options)); } star( - session: string, + connection: string, body: StarRequest, options: RequestOptions = {}, ): Promise> { - return this.post(session, "star", body, options); + return this.post(connection, "star", body, options); } private post( - session: string, + connection: string, action: "send" | "seen" | "typing" | "react" | "star", body: unknown, options: RequestOptions, ): Promise> { return this.transport.request({ method: "POST", - path: `/messaging/${encodeURIComponent(session)}/messages/${action}`, + path: `/messaging/${encodeURIComponent(connection)}/messages/${action}`, body, ...options, }); diff --git a/packages/typescript/src/messaging/observation-policies.ts b/packages/typescript/src/messaging/observation-policies.ts index 4871c3ec2..01a50630d 100644 --- a/packages/typescript/src/messaging/observation-policies.ts +++ b/packages/typescript/src/messaging/observation-policies.ts @@ -2,7 +2,7 @@ import { HttpTransport } from "../transport/http.js"; import type { ApiResponse, RequestOptions } from "../transport/types.js"; import type { UpdateProjectObservationPolicyResponse, - UpdateSessionObservationPolicyResponse, + UpdateConnectionObservationPolicyResponse, } from "./types.js"; export class ObservationPoliciesResource { @@ -19,13 +19,13 @@ export class ObservationPoliciesResource { }); } - retrieveForSession( - session: string, + retrieveForConnection( + connection: string, options: RequestOptions = {}, - ): Promise> { + ): Promise> { return this.transport.request({ method: "GET", - path: sessionPolicyPath(session), + path: connectionPolicyPath(connection), ...options, }); } @@ -35,6 +35,6 @@ function projectPolicyPath(projectId: string): string { return `/messaging/projects/${encodeURIComponent(projectId)}/observation-policy`; } -function sessionPolicyPath(session: string): string { - return `/messaging/${encodeURIComponent(session)}/observation-policy`; +function connectionPolicyPath(connection: string): string { + return `/messaging/${encodeURIComponent(connection)}/observation-policy`; } diff --git a/packages/typescript/src/messaging/official-groups.ts b/packages/typescript/src/messaging/official-groups.ts index ef820a4cc..eead5484f 100644 --- a/packages/typescript/src/messaging/official-groups.ts +++ b/packages/typescript/src/messaging/official-groups.ts @@ -172,12 +172,12 @@ export class OfficialGroupsResource { } list( - session: string, + connection: string, params: ListOfficialGroupsParams = {}, options: RequestOptions = {}, ): Promise>> { return this.read( - groupsPath(session), + groupsPath(connection), { limit: params.limit, before: params.before, after: params.after }, options, ); @@ -185,56 +185,56 @@ export class OfficialGroupsResource { /** Asks WhatsApp to create a group; see `CreateOfficialGroupResult`. */ create( - session: string, + connection: string, body: CreateOfficialGroupRequest, options: RequestOptions = {}, ): Promise>> { - return this.write("POST", groupsPath(session), body, options); + return this.write("POST", groupsPath(connection), body, options); } retrieve( - session: string, + connection: string, group: string, options: RequestOptions = {}, ): Promise>> { - return this.read(groupPath(session, group), {}, options); + return this.read(groupPath(connection, group), {}, options); } update( - session: string, + connection: string, group: string, body: UpdateOfficialGroupRequest, options: RequestOptions = {}, ): Promise>> { - return this.write("PATCH", groupPath(session, group), body, options); + return this.write("PATCH", groupPath(connection, group), body, options); } /** Deletes the group and removes every participant, including your business. */ delete( - session: string, + connection: string, group: string, options: RequestOptions = {}, ): Promise>> { - return this.write("DELETE", groupPath(session, group), undefined, options); + return this.write("DELETE", groupPath(connection, group), undefined, options); } getInviteLink( - session: string, + connection: string, group: string, options: RequestOptions = {}, ): Promise>> { - return this.read(`${groupPath(session, group)}/invite-link`, {}, options); + return this.read(`${groupPath(connection, group)}/invite-link`, {}, options); } /** Creates a new invite link; every earlier link stops working. */ resetInviteLink( - session: string, + connection: string, group: string, options: RequestOptions = {}, ): Promise>> { return this.write( "POST", - `${groupPath(session, group)}/invite-link/reset`, + `${groupPath(connection, group)}/invite-link/reset`, undefined, options, ); @@ -242,55 +242,55 @@ export class OfficialGroupsResource { /** Removes up to eight participants (conversation IDs or E.164 numbers). A removed participant cannot rejoin with the link. */ removeParticipants( - session: string, + connection: string, group: string, participants: readonly string[], options: RequestOptions = {}, ): Promise>> { return this.write( "POST", - `${groupPath(session, group)}/participants/remove`, + `${groupPath(connection, group)}/participants/remove`, { participants }, options, ); } listJoinRequests( - session: string, + connection: string, group: string, params: OfficialGroupCursorParams = {}, options: RequestOptions = {}, ): Promise>> { return this.read( - `${groupPath(session, group)}/join-requests`, + `${groupPath(connection, group)}/join-requests`, { before: params.before, after: params.after }, options, ); } approveJoinRequests( - session: string, + connection: string, group: string, joinRequestIds: readonly string[], options: RequestOptions = {}, ): Promise>> { return this.write( "POST", - `${groupPath(session, group)}/join-requests/approve`, + `${groupPath(connection, group)}/join-requests/approve`, { joinRequestIds }, options, ); } rejectJoinRequests( - session: string, + connection: string, group: string, joinRequestIds: readonly string[], options: RequestOptions = {}, ): Promise>> { return this.write( "POST", - `${groupPath(session, group)}/join-requests/reject`, + `${groupPath(connection, group)}/join-requests/reject`, { joinRequestIds }, options, ); @@ -301,7 +301,7 @@ export class OfficialGroupsResource { * validates image bytes and dimensions. An event confirms the applied change. */ setPicture( - session: string, + connection: string, group: string, file: Blob, options: RequestOptions = {}, @@ -320,7 +320,7 @@ export class OfficialGroupsResource { body.set("file", file, "picture.jpg"); return this.transport.request({ method: "PUT", - path: `${groupPath(session, group)}/picture`, + path: `${groupPath(connection, group)}/picture`, body, ...options, maxNetworkRetries: 0, @@ -329,24 +329,24 @@ export class OfficialGroupsResource { /** Pins a group message for 1 to 30 days, or unpins it. At most three stay pinned. */ pin( - session: string, + connection: string, group: string, body: PinOfficialGroupMessageRequest, options: RequestOptions = {}, ): Promise>> { return this.write( "POST", - `${groupPath(session, group)}/pins`, + `${groupPath(connection, group)}/pins`, body, options, ); } } -function groupsPath(session: string): string { - return `/messaging/${encodeURIComponent(session)}/official-groups`; +function groupsPath(connection: string): string { + return `/messaging/${encodeURIComponent(connection)}/official-groups`; } -function groupPath(session: string, group: string): string { - return `${groupsPath(session)}/${encodeURIComponent(group)}`; +function groupPath(connection: string, group: string): string { + return `${groupsPath(connection)}/${encodeURIComponent(group)}`; } diff --git a/packages/typescript/src/messaging/onboarding.ts b/packages/typescript/src/messaging/onboarding.ts index 5cd9c5535..ada63c25f 100644 --- a/packages/typescript/src/messaging/onboarding.ts +++ b/packages/typescript/src/messaging/onboarding.ts @@ -34,7 +34,7 @@ export interface EmbeddedSignupResponse { data: { stage: string }; } -/** Trusted-server continuation of an issued QuickLink; never direct session creation. */ +/** Trusted-server continuation of an issued QuickLink; never direct connection creation. */ export class CloudOnboardingResource { constructor( private readonly transport: HttpTransport, @@ -75,7 +75,7 @@ export class TestingResource { /** * Fire a named, signed test event for a Test number. Generated events reach - * webhooks and event history with `source: "test"`. With `fromSession`, a + * webhooks and event history with `source: "test"`. With `fromConnection`, a * `message.received` request sends a simulated message from another Test * number instead. Real numbers are refused with a 400 error. Pass * `options.idempotencyKey` to make retries safe: repeating the request with @@ -115,7 +115,7 @@ export class TestingResource { */ getPhone( projectId: string, - session: string, + connection: string, options: RequestOptions = {}, ): Promise> { assertServerCredential(this.credentialType); @@ -123,7 +123,7 @@ export class TestingResource { this.transport, { method: "GET", - path: phonePath(projectId, session), + path: phonePath(projectId, connection), ...existingOptions(options), }, "phone", @@ -139,7 +139,7 @@ export class TestingResource { */ sendPhoneMessage( projectId: string, - session: string, + connection: string, input: SendTestingPhoneMessageRequest, options: RequestOptions = {}, ): Promise> { @@ -148,7 +148,7 @@ export class TestingResource { this.transport, { method: "POST", - path: `${phonePath(projectId, session)}/messages`, + path: `${phonePath(projectId, connection)}/messages`, body: input, ...existingOptions(options), }, @@ -164,7 +164,7 @@ export class TestingResource { */ unlinkPhoneDevice( projectId: string, - session: string, + connection: string, deviceId: number, options: RequestOptions = {}, ): Promise> { @@ -177,7 +177,7 @@ export class TestingResource { this.transport, { method: "POST", - path: `${phonePath(projectId, session)}/devices/${deviceId}/unlink`, + path: `${phonePath(projectId, connection)}/devices/${deviceId}/unlink`, ...existingOptions(options), }, "unlink", @@ -185,8 +185,8 @@ export class TestingResource { ); } } -function phonePath(projectId: string, session: string): string { - return `/messaging/testing/${encodeURIComponent(projectId)}/numbers/${encodeURIComponent(session)}/phone`; +function phonePath(projectId: string, connection: string): string { + return `/messaging/testing/${encodeURIComponent(projectId)}/numbers/${encodeURIComponent(connection)}/phone`; } function assertServerCredential(type: MessagingCredential["type"]): void { if (type === "clientToken") diff --git a/packages/typescript/src/messaging/passkeys.ts b/packages/typescript/src/messaging/passkeys.ts index 5c807eb0c..3d46f28d0 100644 --- a/packages/typescript/src/messaging/passkeys.ts +++ b/packages/typescript/src/messaging/passkeys.ts @@ -16,7 +16,7 @@ export interface IssuePasskeyChallengeRequest { export interface PasskeyTicket { readonly version: 2; readonly ticket: string; - readonly session: string; + readonly connection: string; readonly rpId: string; readonly challengeB64Url: string; readonly userVerification: "required" | "preferred" | "discouraged"; @@ -41,7 +41,7 @@ export interface SubmitPasskeyAssertionRequest { export interface PasskeyAssertionResult { readonly ok: true; readonly ticket: string; - readonly session: string; + readonly connection: string; } export interface ConfirmPasskeyRequest { readonly ticketId: string; @@ -74,20 +74,20 @@ function invalid(): never { function nonempty(s: unknown): s is string { return typeof s === "string" && s.length > 0; } -/** Direct customer relay. All five operations require sessions:manage server credentials. */ +/** Direct customer relay. All five operations require connections:manage server credentials. */ export class PasskeysResource { constructor( private readonly transport: HttpTransport, private readonly credentialType: MessagingCredential["type"], ) {} - private path(session: string): string { + private path(connection: string): string { if (this.credentialType === "clientToken") throw new PolymorfaConfigurationError( "Passkeys require a server credential.", "credential", ); - if (!nonempty(session)) invalid(); - return `/messaging/${encodeURIComponent(session)}/passkey`; + if (!nonempty(connection)) invalid(); + return `/messaging/${encodeURIComponent(connection)}/passkey`; } private write( path: string, @@ -110,11 +110,11 @@ export class PasskeysResource { }); } issueChallenge( - session: string, + connection: string, body: IssuePasskeyChallengeRequest = {}, options: RequestOptions = {}, ): Promise>> { - const path = this.path(session); + const path = this.path(connection); if (!body || typeof body !== "object") invalid(); if ( (body.challengeB64Url !== undefined && !nonempty(body.challengeB64Url)) || @@ -131,11 +131,11 @@ export class PasskeysResource { return this.write(path + "/challenge", body, options); } getChallenge( - session: string, + connection: string, ticketId: string, options: RequestOptions = {}, ): Promise>> { - const path = this.path(session); + const path = this.path(connection); if (!nonempty(ticketId)) invalid(); return this.transport.request({ method: "GET", @@ -144,11 +144,11 @@ export class PasskeysResource { }); } submitAssertion( - session: string, + connection: string, body: SubmitPasskeyAssertionRequest, options: RequestOptions = {}, ): Promise>> { - const path = this.path(session); + const path = this.path(connection); const a = body?.assertion; const v = a?.response; if ( @@ -168,22 +168,22 @@ export class PasskeysResource { return this.write(path + "/assertion", body, options); } getConfirmation( - session: string, + connection: string, options: RequestOptions = {}, ): Promise>> { return this.transport.request({ method: "GET", - path: this.path(session) + "/confirmation", + path: this.path(connection) + "/confirmation", ...options, }); } /** Confirm only after comparison; an accepted receipt is not pairing completion. */ confirm( - session: string, + connection: string, body: ConfirmPasskeyRequest, options: RequestOptions = {}, ): Promise>> { - const path = this.path(session); + const path = this.path(connection); if ( !nonempty(body?.ticketId) || (body.code !== undefined && diff --git a/packages/typescript/src/messaging/presence.ts b/packages/typescript/src/messaging/presence.ts index b0a0c6c2e..cf4d634a1 100644 --- a/packages/typescript/src/messaging/presence.ts +++ b/packages/typescript/src/messaging/presence.ts @@ -12,58 +12,58 @@ export class PresenceResource { constructor(private readonly transport: HttpTransport) {} set( - session: string, + connection: string, body: SetPresenceRequest, options: RequestOptions = {}, ): Promise> { return this.transport.request({ method: "POST", - path: presencePath(session), + path: presencePath(connection), body, ...options, }); } get( - session: string, + connection: string, options: RequestOptions = {}, ): Promise> { return this.transport.request({ method: "GET", - path: presencePath(session), + path: presencePath(connection), ...options, }); } getForChat( - session: string, + connection: string, chatId: string, options: RequestOptions = {}, ): Promise> { return this.transport.request({ method: "GET", - path: chatPresencePath(session, chatId), + path: chatPresencePath(connection, chatId), ...options, }); } subscribe( - session: string, + connection: string, chatId: string, options: RequestOptions = {}, ): Promise> { return this.transport.request({ method: "POST", - path: `${chatPresencePath(session, chatId)}/subscribe`, + path: `${chatPresencePath(connection, chatId)}/subscribe`, ...options, }); } } -function presencePath(session: string): string { - return `/messaging/${encodeURIComponent(session)}/presence`; +function presencePath(connection: string): string { + return `/messaging/${encodeURIComponent(connection)}/presence`; } -function chatPresencePath(session: string, chatId: string): string { - return `${presencePath(session)}/${encodeURIComponent(chatId)}`; +function chatPresencePath(connection: string, chatId: string): string { + return `${presencePath(connection)}/${encodeURIComponent(chatId)}`; } diff --git a/packages/typescript/src/messaging/privacy.ts b/packages/typescript/src/messaging/privacy.ts index c8b5f21d9..afc238c6a 100644 --- a/packages/typescript/src/messaging/privacy.ts +++ b/packages/typescript/src/messaging/privacy.ts @@ -12,43 +12,43 @@ export class PrivacyResource { constructor(private readonly transport: HttpTransport) {} get( - session: string, + connection: string, options: RequestOptions = {}, ): Promise> { return this.transport.request({ method: "GET", - path: privacyPath(session), + path: privacyPath(connection), ...options, }); } set( - session: string, + connection: string, mutation: PrivacySettingMutation, options: RequestOptions = {}, ): Promise> { return this.transport.request({ method: "PUT", - path: `${privacyPath(session)}/${encodeURIComponent(mutation.setting)}`, + path: `${privacyPath(connection)}/${encodeURIComponent(mutation.setting)}`, body: { value: mutation.value }, ...options, }); } setDefaultDisappearingTimer( - session: string, + connection: string, body: DefaultDisappearingTimerRequest, options: RequestOptions = {}, ): Promise> { return this.transport.request({ method: "PUT", - path: `${privacyPath(session)}/disappearing/default`, + path: `${privacyPath(connection)}/disappearing/default`, body, ...options, }); } } -function privacyPath(session: string): string { - return `/messaging/${encodeURIComponent(session)}/privacy`; +function privacyPath(connection: string): string { + return `/messaging/${encodeURIComponent(connection)}/privacy`; } diff --git a/packages/typescript/src/messaging/profile.ts b/packages/typescript/src/messaging/profile.ts index 0e75cf154..4e53e258f 100644 --- a/packages/typescript/src/messaging/profile.ts +++ b/packages/typescript/src/messaging/profile.ts @@ -15,67 +15,67 @@ export class ProfileResource { constructor(private readonly transport: HttpTransport) {} get( - session: string, + connection: string, options: RequestOptions = {}, ): Promise> { return this.transport.request({ method: "GET", - path: profilePath(session), + path: profilePath(connection), ...options, }); } setName( - session: string, + connection: string, body: SetProfileNameRequest, options: RequestOptions = {}, ): Promise> { return this.transport.request({ method: "PUT", - path: `${profilePath(session)}/name`, + path: `${profilePath(connection)}/name`, body, ...options, }); } setStatus( - session: string, + connection: string, body: SetProfileStatusRequest, options: RequestOptions = {}, ): Promise> { return this.transport.request({ method: "PUT", - path: `${profilePath(session)}/status`, + path: `${profilePath(connection)}/status`, body, ...options, }); } setPicture( - session: string, + connection: string, body: SetProfilePictureRequest, options: RequestOptions = {}, ): Promise> { return this.transport.request({ method: "PUT", - path: `${profilePath(session)}/picture`, + path: `${profilePath(connection)}/picture`, body, ...options, }); } deletePicture( - session: string, + connection: string, options: RequestOptions = {}, ): Promise> { return this.transport.request({ method: "DELETE", - path: `${profilePath(session)}/picture`, + path: `${profilePath(connection)}/picture`, ...options, }); } } -function profilePath(session: string): string { - return `/messaging/${encodeURIComponent(session)}/profile`; +function profilePath(connection: string): string { + return `/messaging/${encodeURIComponent(connection)}/profile`; } diff --git a/packages/typescript/src/messaging/quick-replies.ts b/packages/typescript/src/messaging/quick-replies.ts index 9f64ebaa6..332835415 100644 --- a/packages/typescript/src/messaging/quick-replies.ts +++ b/packages/typescript/src/messaging/quick-replies.ts @@ -12,24 +12,24 @@ export class QuickRepliesResource { constructor(private readonly transport: HttpTransport) {} list( - session: string, + connection: string, options: RequestOptions = {}, ): Promise> { return this.transport.request({ method: "GET", - path: quickRepliesPath(session), + path: quickRepliesPath(connection), ...options, }); } create( - session: string, + connection: string, body: BusinessQuickReplyMutation, options: RequestOptions = {}, ): Promise> { return this.transport.request({ method: "POST", - path: quickRepliesPath(session), + path: quickRepliesPath(connection), body, ...options, }); @@ -37,36 +37,36 @@ export class QuickRepliesResource { /** Replaces the complete quick reply identified by quickReplyId. */ replace( - session: string, + connection: string, quickReplyId: string, body: BusinessQuickReplyMutation, options: RequestOptions = {}, ): Promise> { return this.transport.request({ method: "PUT", - path: quickReplyPath(session, quickReplyId), + path: quickReplyPath(connection, quickReplyId), body, ...options, }); } delete( - session: string, + connection: string, quickReplyId: string, options: RequestOptions = {}, ): Promise> { return this.transport.request({ method: "DELETE", - path: quickReplyPath(session, quickReplyId), + path: quickReplyPath(connection, quickReplyId), ...options, }); } } -function quickRepliesPath(session: string): string { - return `/messaging/${encodeURIComponent(session)}/business/quick-replies`; +function quickRepliesPath(connection: string): string { + return `/messaging/${encodeURIComponent(connection)}/business/quick-replies`; } -function quickReplyPath(session: string, quickReplyId: string): string { - return `${quickRepliesPath(session)}/${encodeURIComponent(quickReplyId)}`; +function quickReplyPath(connection: string, quickReplyId: string): string { + return `${quickRepliesPath(connection)}/${encodeURIComponent(quickReplyId)}`; } diff --git a/packages/typescript/src/messaging/quicklinks.ts b/packages/typescript/src/messaging/quicklinks.ts index 88cf716dd..58eb0fc20 100644 --- a/packages/typescript/src/messaging/quicklinks.ts +++ b/packages/typescript/src/messaging/quicklinks.ts @@ -1,9 +1,9 @@ -import { quickLinkIntent } from "../session-delivery-validation.js"; +import { quickLinkIntent } from "../connection-delivery-validation.js"; import { existingOptions } from "../campaign-existing-validation.js"; import type { SignalCustodyMode } from "../campaign-contracts.js"; import { campaignContractBody } from "../campaign-contract-validation.js"; import { billingLimit, billingPriority } from "../platform/billing-controls.js"; -import type { SessionConfigurationOverrides } from "./session-configuration.js"; +import type { ConnectionConfigurationOverrides } from "./connection-configuration.js"; import { PolymorfaConfigurationError } from "../errors.js"; import type { QuickLinkHistorySync, @@ -13,7 +13,7 @@ import { HttpTransport } from "../transport/http.js"; import type { ApiResponse, RequestOptions } from "../transport/types.js"; import type { MessagingCredential } from "../credentials.js"; -export interface QuickLinkConfiguration extends SessionConfigurationOverrides { +export interface QuickLinkConfiguration extends ConnectionConfigurationOverrides { readonly testing?: { readonly country?: string; readonly configuration?: import("./testing-configuration.js").TestingConfiguration; @@ -48,7 +48,7 @@ export type CreateQuickLinkRequest = CreateQuickLinkBase & | { readonly purpose?: "initial"; readonly signalMode?: SignalCustodyMode; - readonly session?: never; + readonly connection?: never; readonly addConnection?: never; readonly connectionGoal?: QuickLinkConnectionGoal; readonly customerId?: string; @@ -60,7 +60,7 @@ export type CreateQuickLinkRequest = CreateQuickLinkBase & } | { readonly purpose: "add_connection"; - readonly session: string; + readonly connection: string; readonly addConnection: QuickLinkConnectionKind; readonly signalMode?: never; readonly connectionGoal?: "hybrid"; @@ -76,7 +76,7 @@ export interface QuickLink { readonly addConnection?: QuickLinkConnectionKind; readonly id: string; readonly url: string; - readonly session: string; + readonly connection: string; readonly expiresAt: string | null; } @@ -130,7 +130,7 @@ export interface QuickLinkStatus { } | null; readonly id: string; readonly status: QuickLinkStatusValue; - readonly session: string; + readonly connection: string; readonly expiresAt: string | null; readonly openedAt: string | null; readonly connectedAt: string | null; @@ -155,7 +155,7 @@ export interface CancelQuickLinkResponse { export interface HybridQuickLinkAvailabilityRequest { readonly projectId: string; - readonly session: string; + readonly connection: string; } export interface HybridQuickLinkAvailability { @@ -212,7 +212,7 @@ export class QuickLinksResource { return this.transport.request({ method: "GET", path: "/messaging/quicklinks/availability", - query: { projectId: input.projectId, session: input.session }, + query: { projectId: input.projectId, connection: input.connection }, ...existingOptions(options), }); } diff --git a/packages/typescript/src/messaging/testing-configuration.ts b/packages/typescript/src/messaging/testing-configuration.ts index 167da4bf9..22fb81637 100644 --- a/packages/typescript/src/messaging/testing-configuration.ts +++ b/packages/typescript/src/messaging/testing-configuration.ts @@ -30,8 +30,8 @@ export const TEST_EVENT_FIXTURES = [ "call.received", "call.missed", "call.ended", - "session.status", - "session.restriction_updated", + "connection.status", + "connection.restriction_updated", "template.status", ] as const; @@ -57,7 +57,7 @@ export interface TestEventOverrides { /** message.failed: sanitized failure class. */ failureReason?: | "invalid_recipient" - | "session_not_connected" + | "connection_not_connected" | "ack_timeout" | "send_failed" | "blocked_by_safety"; @@ -72,11 +72,11 @@ export interface TestEventOverrides { | "lost_connection" | "rejected" | "call_restricted"; - /** session.restriction_updated: whether the restriction starts (true) or ends (false). */ + /** connection.restriction_updated: whether the restriction starts (true) or ends (false). */ restrictionActive?: boolean; - /** session.status: status. */ + /** connection.status: status. */ status?: "CONNECTING" | "CONNECTED" | "DISCONNECTED"; - /** session.status: reason. */ + /** connection.status: reason. */ statusReason?: | "SCAN_QR" | "AUTO_RECONNECT" @@ -95,20 +95,20 @@ export interface TestEventOverrides { } export interface TriggerTestEventRequest { - /** Test number session name in the project. */ - session: string; + /** Test number connection name in the project. */ + connection: string; event: TestEventFixture; overrides?: TestEventOverrides; /** * message.received only: deliver a real simulated message from this other * Test number in the same project instead of a generated event. */ - fromSession?: string; + fromConnection?: string; } export interface TriggerTestEventResponse { event: TestEventFixture; - session: string; + connection: string; /** `generated`: a test event was published. `simulated`: a simulated message was sent. */ delivery: "generated" | "simulated"; /** Event ID for generated events. Simulated messages produce their event asynchronously. */ @@ -125,7 +125,7 @@ export interface TestEventFixtureInfo { /** A Test number's simulated phone, which acts as its main device. */ export interface TestingPhone { - session: string; + connection: string; /** The Test number, in E.164 format. */ phone: string; /** True while the simulated phone is running. */ @@ -142,14 +142,14 @@ export interface SendTestingPhoneMessageRequest { } export interface SendTestingPhoneMessageResponse { - session: string; + connection: string; to: string; /** WhatsApp message ID when the phone reports one. */ messageId: string | null; } export interface UnlinkTestingPhoneDeviceResponse { - session: string; + connection: string; deviceId: number; unlinked: true; } diff --git a/packages/typescript/src/messaging/types.ts b/packages/typescript/src/messaging/types.ts index e48d66f0b..98e005d64 100644 --- a/packages/typescript/src/messaging/types.ts +++ b/packages/typescript/src/messaging/types.ts @@ -16,7 +16,8 @@ export type WhatsAppMessageIds = | { readonly linked_devices: string; readonly official_api?: string } | { readonly linked_devices?: string; readonly official_api: string }; -export type MessagingConnection = "linked_device" | "cloud_api"; +export type ConnectionMethodKind = "linked_device" | "cloud_api"; +export type ConnectionMethod = ConnectionMethodKind | "hybrid"; export type BartenderMode = "magic" | "passthrough" | "passthrough_plus"; export interface CloudApiCredentials { @@ -29,21 +30,23 @@ export interface CloudApiCredentials { readonly webhookVerifyToken: string; } -export type { HistorySyncPolicy } from "./session-configuration.js"; +export type { HistorySyncPolicy } from "./connection-configuration.js"; -export interface Session { +export interface Connection { readonly signalMode?: SignalCustodyMode; - readonly sessionId: string; + readonly connectionId: string; readonly name: string; readonly externalId?: string; readonly tenantId: string; - readonly type: MessagingConnection; + readonly type: "whatsapp"; + readonly method: ConnectionMethod; + readonly phoneNumberId?: string; readonly testMode: boolean; readonly status: string; readonly statusReason?: string; - readonly configuration?: import("./session-configuration.js").SessionConfigurationView; + readonly configuration?: import("./connection-configuration.js").ConnectionConfigurationView; /** - * WhatsApp's per-number new-chat cap. Returned by `sessions.retrieve` for + * WhatsApp's per-number new-chat cap. Returned by `connections.retrieve` for * linked-device numbers only; `null` until Polymorfa observed the number. */ readonly newChatCapping?: NewChatCapping | null; @@ -70,12 +73,12 @@ export interface NewChatCapping { readonly observedAt: string; } -export interface UpdateSessionRequest { - readonly configuration: import("./session-configuration.js").SessionConfigurationPatch; +export interface UpdateConnectionRequest { + readonly configuration: import("./connection-configuration.js").ConnectionConfigurationPatch; readonly revision: number; } -export interface SessionOperation extends Session { +export interface ConnectionOperation extends Connection { readonly operationId?: string; } @@ -1360,7 +1363,7 @@ export type GetBusinessProfileResponse = SuccessEnvelope; export interface MessagingMediaInfo { readonly id: string; - readonly session: string; + readonly connection: string; readonly messageId: string; readonly mimeType: string; readonly fileLength: number; @@ -1372,8 +1375,8 @@ export type GetMessagingMediaInfoResponse = SuccessEnvelope; export type ObservationMode = "off" | "events" | "cache"; export type LabelObservationMode = ObservationMode | "project"; -export type SessionObservationMode = ObservationMode | "inherit"; -export type SessionLabelObservationMode = LabelObservationMode | "inherit"; +export type ConnectionObservationMode = ObservationMode | "inherit"; +export type ConnectionLabelObservationMode = LabelObservationMode | "inherit"; export const PRESENCE_STATES = ["available", "unavailable"] as const; export const PRESENCE_OBSERVATION_STATUSES = [ @@ -1610,26 +1613,26 @@ export interface ProjectObservationPolicy { readonly quickReplyMode?: ObservationMode; } -export interface SessionObservationPolicyValues { +export interface ConnectionObservationPolicyValues { readonly presenceMode: ObservationMode; readonly typingMode: ObservationMode; readonly labelMode: LabelObservationMode; readonly quickReplyMode?: ObservationMode; } -export interface SessionObservationPolicyOverrides { - readonly presenceMode: SessionObservationMode; - readonly typingMode: SessionObservationMode; - readonly labelMode: SessionLabelObservationMode; - readonly quickReplyMode?: SessionObservationMode; +export interface ConnectionObservationPolicyOverrides { + readonly presenceMode: ConnectionObservationMode; + readonly typingMode: ConnectionObservationMode; + readonly labelMode: ConnectionLabelObservationMode; + readonly quickReplyMode?: ConnectionObservationMode; } -export interface SessionObservationPolicy { - readonly sessionName: string; +export interface ConnectionObservationPolicy { + readonly connectionName: string; readonly projectId: string; - readonly project: SessionObservationPolicyValues; - readonly override: SessionObservationPolicyOverrides; - readonly effective: SessionObservationPolicyValues; + readonly project: ConnectionObservationPolicyValues; + readonly override: ConnectionObservationPolicyOverrides; + readonly effective: ConnectionObservationPolicyValues; } export interface UpdateProjectObservationPolicyRequest { @@ -1638,20 +1641,20 @@ export interface UpdateProjectObservationPolicyRequest { readonly labelMode?: LabelObservationMode; } -export interface UpdateSessionObservationPolicyRequest { - readonly presenceMode: SessionObservationMode; - readonly typingMode: SessionObservationMode; - readonly labelMode?: SessionLabelObservationMode; +export interface UpdateConnectionObservationPolicyRequest { + readonly presenceMode: ConnectionObservationMode; + readonly typingMode: ConnectionObservationMode; + readonly labelMode?: ConnectionLabelObservationMode; } export type GetProjectObservationPolicyResponse = SuccessEnvelope; export type UpdateProjectObservationPolicyResponse = SuccessEnvelope; -export type GetSessionObservationPolicyResponse = - SuccessEnvelope; -export type UpdateSessionObservationPolicyResponse = - SuccessEnvelope; +export type GetConnectionObservationPolicyResponse = + SuccessEnvelope; +export type UpdateConnectionObservationPolicyResponse = + SuccessEnvelope; export interface BusinessQuickReplyMutation { readonly shortcut: string; @@ -1781,7 +1784,7 @@ export type MessageRoutingReason = | "template" | "target_reference" | "only_eligible_transport" - | "session_rule" + | "connection_rule" | "project_rule" | "team_rule" | "default_linked_devices"; @@ -1861,9 +1864,9 @@ interface MintClientTokenBase { readonly ttlSeconds?: number; } -/** A token limited to one session. */ -export interface MintSessionClientTokenRequest extends MintClientTokenBase { - readonly session: string; +/** A token limited to one connection. */ +export interface MintConnectionClientTokenRequest extends MintClientTokenBase { + readonly connection: string; readonly customer?: never; readonly allow?: readonly ( | CustomerClientTokenAction @@ -1877,18 +1880,18 @@ export interface MintSessionClientTokenRequest extends MintClientTokenBase { /** * A token covering the numbers one Customer owns when it is minted (beta). * Each request also requires that the Customer still owns the number and - * passes that session's client rules. Requires `customers:read`. + * passes that connection's client rules. Requires `customers:read`. */ export interface MintCustomerClientTokenRequest extends MintClientTokenBase { /** Polymorfa Customer ID. Never pass your own external ID. */ readonly customer: string; /** Immutable action ceiling. Omission uses the original Customer action set. */ readonly allow?: readonly CustomerClientTokenAction[]; - readonly session?: never; + readonly connection?: never; } export type MintClientTokenRequest = - MintSessionClientTokenRequest | MintCustomerClientTokenRequest; + MintConnectionClientTokenRequest | MintCustomerClientTokenRequest; export interface ClientTokenValue { readonly token: string; @@ -1928,7 +1931,7 @@ export type ClientAction = | "voip_answer" | "voip_signal"; -/** Rules as returned by `GET /platform/sessions/{session}/client-rules`. */ +/** Rules as returned by `GET /platform/connections/{connection}/client-rules`. */ export interface ClientRules { /** * Who client tokens may send to. Rules saved before `verified` was retired @@ -1998,8 +2001,8 @@ export interface VoipPlaceCallRequest { readonly participants?: readonly string[]; /** Public group ID; mutually exclusive with to and participants. */ readonly groupId?: string; - /** Session that places the call. Required with a server credential. */ - readonly session?: string; + /** Connection that places the call. Required with a server credential. */ + readonly connection?: string; readonly video?: boolean; /** Claim the call for the placing participant. */ readonly exclusive?: boolean; @@ -2008,7 +2011,7 @@ export interface VoipPlaceCallRequest { export interface VoipPlaceCallResult { readonly callId: string; - readonly session: string; + readonly connection: string; readonly video: boolean; } @@ -2016,7 +2019,7 @@ export type VoipPlaceCallResponse = SuccessEnvelope; /** Server credentials only. Creates a reusable link without joining a call. */ export interface VoipCreateCallLinkRequest { - readonly session: string; + readonly connection: string; readonly video?: boolean; } @@ -2026,14 +2029,14 @@ export interface VoipPreviewCallLinkRequest extends VoipCreateCallLinkRequest { } export interface VoipCreatedCallLink { - readonly session: string; + readonly connection: string; readonly token: string; readonly url: string; readonly video: boolean; } export interface VoipPreviewedCallLink { - readonly session: string; + readonly connection: string; readonly video: boolean; readonly creator: ConversationIdentity; readonly approvalRequired: boolean; @@ -2169,14 +2172,14 @@ export interface VoipParticipant { export type VoipAddParticipantResponse = SuccessEnvelope; -/** Call settings for one session (`/platform/sessions/{session}/call-settings`). */ -export interface SessionCallSettings { +/** Call settings for one connection (`/platform/connections/{connection}/call-settings`). */ +export interface ConnectionCallSettings { /** Read-only RFC3339 exclusion end, or null. Null is not a coverage guarantee. */ readonly simultaneousCallsCoverageExcludedUntil: string | null; /** - * Whether the session can place, answer and receive calls. While `false`, + * Whether the connection can place, answer and receive calls. While `false`, * those actions fail with `calls_disabled`, incoming calls are declined and - * SIP trunks cannot call through the session. Calls in progress continue. + * SIP trunks cannot call through the connection. Calls in progress continue. */ readonly callsEnabled: boolean; /** @@ -2198,8 +2201,8 @@ export interface SessionCallSettings { /** Whether an answer from the SIP trunk claims the call. `true` by default. */ readonly sipClaim: boolean; /** - * On a Cloud API session, whether Polymorfa Calls answers incoming calls. - * `false` by default: your Graph API integration answers them. Sessions on a + * On a Cloud API connection, whether Polymorfa Calls answers incoming calls. + * `false` by default: your Graph API integration answers them. Connections on a * linked device ignore it. */ readonly hostCloudApiCalls: boolean; @@ -2213,11 +2216,11 @@ export interface SessionCallSettings { */ readonly simultaneousCalls: boolean; /** - * Increases on every change; `0` while the session uses the defaults. Send + * Increases on every change; `0` while the connection uses the defaults. Send * it as `expectedRevision` so an update cannot overwrite another change. */ readonly revision: number; - /** ISO 8601 timestamp of the last change, or `null` while the session uses the defaults. */ + /** ISO 8601 timestamp of the last change, or `null` while the connection uses the defaults. */ readonly updatedAt: string | null; } @@ -2227,8 +2230,8 @@ export type CallInboundRoute = "clients" | "sip_trunk"; * Changes the settings you send; omitted settings keep their values. Send at * least one setting. */ -export interface UpdateSessionCallSettingsRequest { - /** `false` turns calling off for the session; `true` turns it back on. */ +export interface UpdateConnectionCallSettingsRequest { + /** `false` turns calling off for the connection; `true` turns it back on. */ readonly callsEnabled?: boolean; /** * `true` lets the participants you connect hear each other as well as the @@ -2238,12 +2241,12 @@ export interface UpdateSessionCallSettingsRequest { /** Where incoming WhatsApp calls ring. `clients` clears the trunk. */ readonly inboundRoute?: CallInboundRoute; /** - * A trunk of the session's project with direction `outbound` or `both`. + * A trunk of the connection's project with direction `outbound` or `both`. * Required when switching to `sip_trunk`; omit it to keep the stored trunk. */ readonly sipTrunkId?: string | null; readonly sipClaim?: boolean; - /** `true` has Polymorfa Calls answer a Cloud API session's incoming calls. */ + /** `true` has Polymorfa Calls answer a Cloud API connection's incoming calls. */ readonly hostCloudApiCalls?: boolean; /** * `true` lets this linked-device Number hold unlimited concurrent calls; @@ -2268,7 +2271,7 @@ export interface UpdateSessionCallSettingsRequest { readonly expectedRevision?: number; } -export type SessionCallSettingsResponse = SuccessEnvelope; +export type ConnectionCallSettingsResponse = SuccessEnvelope; /** A person's call permission on a Cloud API number. */ export type CallPermissionStatus = @@ -2327,7 +2330,7 @@ export interface CallPermissionState { } | null; } -/** `GET /messaging/{session}/call-permissions/{to}`. */ +/** `GET /messaging/{connection}/call-permissions/{to}`. */ export interface CallPermission extends CallPermissionState { readonly conversation: ConversationIdentity; } @@ -2336,8 +2339,8 @@ export type CallPermissionResponse = SuccessEnvelope; /** Body for `POST /messaging/voip/calls/check`. */ export interface VoipCheckCallRequest { - /** The session (number) that would place the call. */ - readonly session: string; + /** The connection (number) that would place the call. */ + readonly connection: string; /** User ID or phone number in E.164 format. */ readonly to: string; } @@ -2360,10 +2363,10 @@ export interface VoipCallCheck { export type VoipCheckCallResponse = SuccessEnvelope; -export type ListSessionsResponse = SuccessEnvelope; -export type GetSessionResponse = SuccessEnvelope; -export type UpdateSessionResponse = SuccessEnvelope; -export type GetSessionAccountResponse = SuccessEnvelope; +export type ListConnectionsResponse = SuccessEnvelope; +export type GetConnectionResponse = SuccessEnvelope; +export type UpdateConnectionResponse = SuccessEnvelope; +export type GetConnectionAccountResponse = SuccessEnvelope; export type MessageKind = | "text" @@ -2976,7 +2979,7 @@ export interface WebhookHeader { export interface Webhook { readonly id: string; readonly tenantId: string; - readonly session?: string; + readonly connection?: string; readonly url: string; readonly events: readonly string[]; readonly retries: WebhookRetryConfig; @@ -2985,7 +2988,7 @@ export interface Webhook { readonly format?: "native" | "meta"; /** * First day without the phone on which this webhook receives - * `session.phone_offline` (7-13, default 10). WhatsApp signs the linked + * `connection.phone_offline` (7-13, default 10). WhatsApp signs the linked * device out on day 14. To stop the warning, leave the event out of * the webhook's events. */ @@ -2994,7 +2997,7 @@ export interface Webhook { } export interface CreateWebhookRequest { - readonly session?: string; + readonly connection?: string; readonly url: string; readonly events?: readonly string[]; readonly hmacKey?: string; @@ -3003,7 +3006,7 @@ export interface CreateWebhookRequest { readonly format?: "native" | "meta"; /** * First day without the phone on which this webhook receives - * `session.phone_offline` (7-13, default 10). WhatsApp signs the linked + * `connection.phone_offline` (7-13, default 10). WhatsApp signs the linked * device out on day 14. To stop the warning, leave the event out of * the webhook's events. */ @@ -3020,7 +3023,7 @@ export interface UpdateWebhookRequest { readonly format?: "native" | "meta"; /** * First day without the phone on which this webhook receives - * `session.phone_offline` (7-13, default 10). WhatsApp signs the linked + * `connection.phone_offline` (7-13, default 10). WhatsApp signs the linked * device out on day 14. To stop the warning, leave the event out of * the webhook's events. */ @@ -3145,7 +3148,7 @@ export interface PreviewProjectTemplateRequest { } export interface SubmitProjectTemplateRequest { - readonly session: string; + readonly connection: string; } export type ListProjectTemplatesResponse = SuccessEnvelope< diff --git a/packages/typescript/src/messaging/users.ts b/packages/typescript/src/messaging/users.ts index f521d95cc..857c91f06 100644 --- a/packages/typescript/src/messaging/users.ts +++ b/packages/typescript/src/messaging/users.ts @@ -6,13 +6,13 @@ export class UsersResource { constructor(private readonly transport: HttpTransport) {} getSecurityCode( - session: string, + connection: string, userId: string, options: RequestOptions = {}, ): Promise> { return this.transport.request({ method: "GET", - path: `/messaging/${encodeURIComponent(session)}/users/${encodeURIComponent(userId)}/security-code`, + path: `/messaging/${encodeURIComponent(connection)}/users/${encodeURIComponent(userId)}/security-code`, ...options, }); } diff --git a/packages/typescript/src/messaging/voip.ts b/packages/typescript/src/messaging/voip.ts index 656e6e11c..bedc51014 100644 --- a/packages/typescript/src/messaging/voip.ts +++ b/packages/typescript/src/messaging/voip.ts @@ -7,9 +7,9 @@ import { HttpTransport } from "../transport/http.js"; import type { ApiResponse, RequestOptions } from "../transport/types.js"; import type { CallPermissionResponse, - SessionCallSettingsResponse, + ConnectionCallSettingsResponse, SuccessResponse, - UpdateSessionCallSettingsRequest, + UpdateConnectionCallSettingsRequest, VoipCheckCallRequest, VoipCheckCallResponse, VoipCallReportRequest, @@ -73,7 +73,7 @@ const QUALITY_INTEGERS = { * Polymorfa Calls control routes. Every incoming call rings until a * participant accepts or rejects it. Server credentials act as * `server:` (default `default`); a client token acts as its own - * participant. Mint browser tokens with `clientTokens.mint`; the session's + * participant. Mint browser tokens with `clientTokens.mint`; the connection's * client rules must grant `voip_place`, `voip_answer`, and `voip_signal`. */ export class VoipResource { @@ -124,12 +124,12 @@ export class VoipResource { ): void { this.assertServerCredential("Call links"); if ( - !nonEmpty(body?.session) || - body.session.length > 128 || + !nonEmpty(body?.connection) || + body.connection.length > 128 || (body.video !== undefined && typeof body.video !== "boolean") ) { throw new PolymorfaValidationError( - "Call links require a session and an optional boolean video flag.", + "Call links require a connection and an optional boolean video flag.", ); } if ( @@ -149,9 +149,9 @@ export class VoipResource { body: VoipPlaceCallRequest, options: RequestOptions = {}, ): Promise> { - if (this.credentialType !== "clientToken" && !nonEmpty(body?.session)) { + if (this.credentialType !== "clientToken" && !nonEmpty(body?.connection)) { throw new PolymorfaValidationError( - "Placing a call with a server credential requires a session.", + "Placing a call with a server credential requires a connection.", ); } assertPlacementTargets(body.to, body.participants, body.groupId); @@ -368,18 +368,18 @@ export class VoipResource { * asked during the request: `fresh` is `false` when it could not be reached * and the stored state is returned instead. Linked-device numbers answer * `409 unsupported_for_connection`. Requires a server credential with - * `sessions:read`. + * `connections:read`. */ retrieveCallPermission( - session: string, + connection: string, to: string, options: RequestOptions = {}, ): Promise> { this.assertServerCredential("Call permissions"); - if (!nonEmpty(session)) { + if (!nonEmpty(connection)) { throw new PolymorfaConfigurationError( - "A session is required to read a call permission.", - "session", + "A connection is required to read a call permission.", + "connection", ); } if (!nonEmpty(to)) { @@ -390,7 +390,7 @@ export class VoipResource { } return this.transport.request({ method: "GET", - path: `/messaging/${encodeURIComponent(session)}/call-permissions/${encodeURIComponent(to)}`, + path: `/messaging/${encodeURIComponent(connection)}/call-permissions/${encodeURIComponent(to)}`, ...options, }); } @@ -399,7 +399,7 @@ export class VoipResource { * Runs the checks a placement runs, without placing a call or reserving * anything. `refusal` names the first reason the call would fail: the team's * call policy (`call_recipient_opted_out`, `call_destination_blocked`), the - * session's calling switch (`calls_disabled`), or WhatsApp + * connection's calling switch (`calls_disabled`), or WhatsApp * (`call_permission_required`, `call_limit_reached`). Requires a server * credential. If required call-check state is unavailable, the API answers * `503 service_unavailable` rather than a possibly incomplete check. @@ -412,9 +412,9 @@ export class VoipResource { if (typeof body !== "object" || body === null) { throw new PolymorfaValidationError("A call check must be an object."); } - if (!nonEmpty(body.session)) { + if (!nonEmpty(body.connection)) { throw new PolymorfaValidationError( - "session names the number that would place the call.", + "connection names the number that would place the call.", ); } if (!nonEmpty(body.to)) { @@ -430,32 +430,32 @@ export class VoipResource { }); } - /** Reads a session's call settings. Requires a server credential. */ + /** Reads a connection's call settings. Requires a server credential. */ retrieveCallSettings( - session: string, + connection: string, options: RequestOptions = {}, - ): Promise> { - this.assertServerCredential("Session call settings"); + ): Promise> { + this.assertServerCredential("Connection call settings"); return this.transport.request({ method: "GET", - path: callSettingsPath(session), + path: callSettingsPath(connection), ...options, }); } /** - * Changes a session's call settings; omitted settings keep their values. + * Changes a connection's call settings; omitted settings keep their values. * Requires a server credential. Turning `simultaneousCalls` on (unlimited * concurrent calls on a linked-device Number) requires * `acknowledgeRisk: true` and a team API key, and voids Ban Insurance for * the Number. */ updateCallSettings( - session: string, - body: UpdateSessionCallSettingsRequest, + connection: string, + body: UpdateConnectionCallSettingsRequest, options: RequestOptions = {}, - ): Promise> { - this.assertServerCredential("Session call settings"); + ): Promise> { + this.assertServerCredential("Connection call settings"); if (typeof body !== "object" || body === null) { throw new PolymorfaValidationError("Call settings must be an object."); } @@ -529,7 +529,7 @@ export class VoipResource { } return this.transport.request({ method: "PUT", - path: callSettingsPath(session), + path: callSettingsPath(connection), body, ...options, }); @@ -654,8 +654,8 @@ function callPath(callId: string): string { return `/messaging/voip/calls/${encodeURIComponent(callId)}`; } -function callSettingsPath(session: string): string { - return `/platform/sessions/${encodeURIComponent(session)}/call-settings`; +function callSettingsPath(connection: string): string { + return `/platform/connections/${encodeURIComponent(connection)}/call-settings`; } function assertPlacementTargets( diff --git a/packages/typescript/src/platform/analytics.ts b/packages/typescript/src/platform/analytics.ts index 3d4d5bfee..54bb4429d 100644 --- a/packages/typescript/src/platform/analytics.ts +++ b/packages/typescript/src/platform/analytics.ts @@ -256,7 +256,7 @@ export interface WhatsAppMetrics { } | null; } export interface WhatsAppAnalytics { - callSeries: (CallOutcomeMetrics & { sessionId: string; ts: number })[]; + callSeries: (CallOutcomeMetrics & { connectionId: string; ts: number })[]; enabled: boolean; period: { start: number; end: number }; requestVitals: { @@ -272,7 +272,7 @@ export interface WhatsAppAnalytics { }) | null; numbers: (WhatsAppMetrics & { - sessionId: string; + connectionId: string; projectId: string; projectName: string; name: string; @@ -290,7 +290,7 @@ export interface WhatsAppAnalytics { phoneActivityMs: number; phoneQuietGaps: number; phoneQuietMs: number; - sessionId: string; + connectionId: string; ts: number; outgoingMessages: number; incomingMessages: number; @@ -307,21 +307,21 @@ export interface AnalyticsSettings { export interface AnalyticsParams { readonly projectId?: string; - readonly sessionId?: string; + readonly connectionId?: string; /** Unix milliseconds; defaults to the preceding 30 days. Maximum range 366 days. */ readonly start?: number; readonly end?: number; } export interface AnalyticsMetricsParams { readonly projectId?: string; - readonly sessionId?: string; + readonly connectionId?: string; /** Completed UTC hours, 1-168. Default 24. */ readonly windowHours?: number; /** Include bounded metadata breakdowns. Default false. */ readonly segments?: boolean; readonly format?: "prometheus" | "openmetrics"; } -/** Message aggregates from Linked Devices telemetry and retained call outcomes. Requires sessions:read. +/** Message aggregates from Linked Devices telemetry and retained call outcomes. Requires connections:read. * Owners/admins enable Analytics in the Console. Disabled results contain no * business data. Read/reply percentages are completed 24-hour direct-chat * cohorts; null means there is no denominator or coverage is incomplete. */ @@ -336,7 +336,7 @@ export class AnalyticsResource { params: AnalyticsMetricsParams = {}, options: RequestOptions = {}, ): Promise> { - for (const key of ["projectId", "sessionId"] as const) { + for (const key of ["projectId", "connectionId"] as const) { if ( params[key] !== undefined && !/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test( @@ -414,7 +414,7 @@ export class AnalyticsResource { params: AnalyticsParams = {}, options: RequestOptions = {}, ): Promise> { - for (const key of ["projectId", "sessionId"] as const) { + for (const key of ["projectId", "connectionId"] as const) { const value = params[key]; if ( value !== undefined && diff --git a/packages/typescript/src/platform/bansafe.ts b/packages/typescript/src/platform/bansafe.ts index 1adf608fc..1e3966118 100644 --- a/packages/typescript/src/platform/bansafe.ts +++ b/packages/typescript/src/platform/bansafe.ts @@ -44,23 +44,23 @@ export class BanSafeResource { } getHealth( - session: string, + connection: string, options: RequestOptions = {}, ): Promise>> { return this.get( - `/platform/bansafe/health/${encodeURIComponent(session)}`, + `/platform/bansafe/health/${encodeURIComponent(connection)}`, {}, options, ); } listHealthHistory( - session: string, + connection: string, params: ListBanSafeHealthHistoryParams = {}, options: RequestOptions = {}, ): Promise>> { return this.get( - `/platform/bansafe/health/${encodeURIComponent(session)}/history`, + `/platform/bansafe/health/${encodeURIComponent(connection)}/history`, params, options, ); @@ -73,23 +73,23 @@ export class BanSafeResource { } getTelemetry( - session: string, + connection: string, options: RequestOptions = {}, ): Promise>> { return this.get( - `/platform/bansafe/telemetry/${encodeURIComponent(session)}`, + `/platform/bansafe/telemetry/${encodeURIComponent(connection)}`, {}, options, ); } listTelemetryHistory( - session: string, + connection: string, params: ListBanSafeTelemetryHistoryParams = {}, options: RequestOptions = {}, ): Promise> { return this.get( - `/platform/bansafe/telemetry/${encodeURIComponent(session)}/history`, + `/platform/bansafe/telemetry/${encodeURIComponent(connection)}/history`, params, options, ); diff --git a/packages/typescript/src/platform/calls.ts b/packages/typescript/src/platform/calls.ts index 9e48490c7..0d0b52e43 100644 --- a/packages/typescript/src/platform/calls.ts +++ b/packages/typescript/src/platform/calls.ts @@ -36,7 +36,7 @@ export type CallOutcome = /** Call state. `offered` and `accepted` calls may still be live. */ export type CallRecordState = "offered" | "accepted" | "rejected" | "missed" | "ended"; -export type CallStatsGroupBy = "day" | "hour" | "session" | "outcome"; +export type CallStatsGroupBy = "day" | "hour" | "connection" | "outcome"; export type CallExportFormat = "csv" | "ndjson"; /** One call detail record. The other party appears only as `peerRef`. */ @@ -44,8 +44,8 @@ export interface CallRecord { readonly callId: string; /** Owning project when known, preserved after the number is deleted. */ readonly projectId: string | null; - /** Session name of the number that placed or received the call. */ - readonly sessionId: string; + /** Connection name of the number that placed or received the call. */ + readonly connectionId: string; readonly direction: CallDirection; readonly upstream: CallUpstream; readonly outcome: CallOutcome; @@ -161,7 +161,7 @@ export interface CallRecordAppReports { /** A call summary in the stored detail. */ export interface CallRecordSummary { callId: string; - sessionId: string; + connectionId: string; projectId: string | null; direction: "inbound" | "outbound"; state: "offered" | "accepted" | "rejected" | "missed" | "ended"; @@ -193,7 +193,7 @@ export interface CallRecordDetail { events: Array<{ eventId: string; type: string; occurredAt: string }>; truncated: boolean; }; - correlation: { callId: string; sessionId: string }; + correlation: { callId: string; connectionId: string }; } export interface CallStatsMetrics { @@ -216,10 +216,10 @@ export interface CallStatsMetrics { export interface CallStatsGroup extends CallStatsMetrics { /** * Local date (`2026-09-18`) for `day`, local hour (`2026-09-18T14:00`) for - * `hour`, session name for `session`, or the outcome for `outcome`. + * `hour`, connection name for `connection`, or the outcome for `outcome`. */ readonly key: string; - /** Start of the day or hour bucket; `null` for `session` and `outcome` groups. */ + /** Start of the day or hour bucket; `null` for `connection` and `outcome` groups. */ readonly start: string | null; } @@ -239,7 +239,7 @@ export interface CallStats { readonly groupBy: CallStatsGroupBy; readonly totals: CallStatsMetrics; readonly groups: readonly CallStatsGroup[]; - /** True when a `session` grouping left out numbers beyond the first 500. Totals still count every call. */ + /** True when a `connection` grouping left out numbers beyond the first 500. Totals still count every call. */ readonly groupsTruncated: boolean; /** 168 cells, Monday 00:00 first. */ readonly heatmap: readonly CallStatsHeatmapCell[]; @@ -247,8 +247,8 @@ export interface CallStats { /** Filters shared by call statistics, call records and the export. */ export interface CallFilters { - /** Session name of one number (1 to 128 characters). */ - readonly sessionId?: string; + /** Connection name of one number (1 to 128 characters). */ + readonly connectionId?: string; readonly direction?: CallDirection; readonly upstream?: CallUpstream; readonly outcome?: CallOutcome; @@ -329,7 +329,7 @@ const OUTCOMES: readonly CallOutcome[] = [ const GROUP_BY: readonly CallStatsGroupBy[] = [ "day", "hour", - "session", + "connection", "outcome", ]; const FORMATS: readonly CallExportFormat[] = ["csv", "ndjson"]; @@ -339,7 +339,7 @@ const CONTENT_TYPES: Readonly> = { }; /** - * Call analytics and call detail records (`sessions:read`). Team clients + * Call analytics and call detail records (`connections:read`). Team clients * cover every project unless they pass `projectId`; project clients read * their own project. */ @@ -551,8 +551,8 @@ export class PlatformCallsResource { } else if (params.projectId !== undefined) { query.projectId = text(params.projectId, "projectId", 64); } - if (params.sessionId !== undefined) { - query.sessionId = text(params.sessionId, "sessionId", 128); + if (params.connectionId !== undefined) { + query.connectionId = text(params.connectionId, "connectionId", 128); } if (params.direction !== undefined) { query.direction = oneOf(params.direction, DIRECTIONS, "direction"); diff --git a/packages/typescript/src/platform/session-bans.ts b/packages/typescript/src/platform/connection-bans.ts similarity index 57% rename from packages/typescript/src/platform/session-bans.ts rename to packages/typescript/src/platform/connection-bans.ts index c3e998621..b217ad203 100644 --- a/packages/typescript/src/platform/session-bans.ts +++ b/packages/typescript/src/platform/connection-bans.ts @@ -1,26 +1,26 @@ import { HttpTransport } from "../transport/http.js"; import type { ApiResponse, RequestOptions } from "../transport/types.js"; -import type { DataEnvelope, SessionBan } from "./types.js"; +import type { DataEnvelope, ConnectionBan } from "./types.js"; -type SessionBansResponse = Promise< - ApiResponse> +type ConnectionBansResponse = Promise< + ApiResponse> >; -export class SessionBansResource { +export class ConnectionBansResource { constructor(private readonly transport: HttpTransport) {} - list(options: RequestOptions = {}): SessionBansResponse { + list(options: RequestOptions = {}): ConnectionBansResponse { return this.get("", options); } - listActive(options: RequestOptions = {}): SessionBansResponse { + listActive(options: RequestOptions = {}): ConnectionBansResponse { return this.get("/active", options); } private get( suffix: "" | "/active", options: RequestOptions, - ): SessionBansResponse { + ): ConnectionBansResponse { return this.transport.request({ method: "GET", path: `/platform/bans${suffix}`, diff --git a/packages/typescript/src/platform/session-configuration.ts b/packages/typescript/src/platform/connection-configuration.ts similarity index 68% rename from packages/typescript/src/platform/session-configuration.ts rename to packages/typescript/src/platform/connection-configuration.ts index 8c65bd401..5829f085b 100644 --- a/packages/typescript/src/platform/session-configuration.ts +++ b/packages/typescript/src/platform/connection-configuration.ts @@ -1,16 +1,16 @@ import { campaignContractBody } from "../campaign-contract-validation.js"; -import { configurationIntent } from "../session-delivery-validation.js"; +import { configurationIntent } from "../connection-delivery-validation.js"; import { existingOptions } from "../campaign-existing-validation.js"; import { HttpTransport } from "../transport/http.js"; import type { ApiResponse, RequestOptions } from "../transport/types.js"; import type { - SessionConfigurationPatch, - SessionConfigurationView, -} from "../messaging/session-configuration.js"; + ConnectionConfigurationPatch, + ConnectionConfigurationView, +} from "../messaging/connection-configuration.js"; import { type DataEnvelope, unwrapResponse } from "./response.js"; -/** Saved team or project defaults. Session overrides use sessions.update. */ -export class SessionConfigurationResource { +/** Saved team or project defaults. Connection overrides use connections.update. */ +export class ConnectionConfigurationResource { readonly #transport: HttpTransport; readonly #projectId: string | null; constructor(transport: HttpTransport, projectId: string | null) { @@ -20,9 +20,9 @@ export class SessionConfigurationResource { } retrieve( options: RequestOptions = {}, - ): Promise> { + ): Promise> { return this.#transport - .request>({ + .request>({ method: "GET", path: "/platform/session-configuration", ...(this.#projectId === null @@ -33,12 +33,12 @@ export class SessionConfigurationResource { .then(unwrapResponse); } update( - input: { configuration: SessionConfigurationPatch; revision: number }, + input: { configuration: ConnectionConfigurationPatch; revision: number }, options: RequestOptions = {}, - ): Promise> { + ): Promise> { options = existingOptions(options, configurationIntent(input)); return this.#transport - .request>({ + .request>({ method: "PUT", path: "/platform/session-configuration", body: diff --git a/packages/typescript/src/platform/sessions.ts b/packages/typescript/src/platform/connections.ts similarity index 61% rename from packages/typescript/src/platform/sessions.ts rename to packages/typescript/src/platform/connections.ts index e36aed93d..4b03423e3 100644 --- a/packages/typescript/src/platform/sessions.ts +++ b/packages/typescript/src/platform/connections.ts @@ -1,43 +1,43 @@ import { campaignContractBody } from "../campaign-contract-validation.js"; -import { configurationIntent } from "../session-delivery-validation.js"; +import { configurationIntent } from "../connection-delivery-validation.js"; import { existingOptions } from "../campaign-existing-validation.js"; import { HttpTransport } from "../transport/http.js"; import { PolymorfaValidationError } from "../errors.js"; import type { - GetSessionResponse, - UpdateSessionRequest, - UpdateSessionResponse, + GetConnectionResponse, + UpdateConnectionRequest, + UpdateConnectionResponse, } from "../messaging/types.js"; import type { ApiResponse, RequestOptions } from "../transport/types.js"; import type { DataEnvelope, - ListPlatformSessionsParams, + ListPlatformConnectionsParams, NumberTierChange, NumberTierQuoteRequest, - PlatformSession, - SessionBatchRemoveResult, - SessionBatchRequest, - SessionBatchStopResult, - SessionCapabilities, - SessionProjectContext, - SessionRemoveResult, - SessionStartResult, - SessionStopResult, - SessionTierOverrideRequest, - SessionSafeMode, - UpdateSessionSafeModeRequest, + PlatformConnection, + ConnectionBatchRemoveResult, + ConnectionBatchRequest, + ConnectionBatchStopResult, + ConnectionCapabilities, + ConnectionProjectContext, + ConnectionRemoveResult, + ConnectionStartResult, + ConnectionStopResult, + ConnectionTierOverrideRequest, + ConnectionSafeMode, + UpdateConnectionSafeModeRequest, } from "./types.js"; -export class PlatformSessionsResource { +export class PlatformConnectionsResource { constructor(private readonly transport: HttpTransport) {} list( - params: ListPlatformSessionsParams = {}, + params: ListPlatformConnectionsParams = {}, options: RequestOptions = {}, - ): Promise>> { + ): Promise>> { return this.transport.request({ method: "GET", - path: "/platform/sessions", + path: "/platform/connections", ...(params.projectId === undefined ? {} : { query: { projectId: params.projectId } }), @@ -46,64 +46,64 @@ export class PlatformSessionsResource { } retrieve( - sessionId: string, + connectionId: string, options: RequestOptions = {}, - ): Promise> { + ): Promise> { return this.transport.request({ method: "GET", - path: sessionPath(sessionId), + path: connectionPath(connectionId), ...existingOptions(options), }); } update( - sessionId: string, - body: UpdateSessionRequest, + connectionId: string, + body: UpdateConnectionRequest, options: RequestOptions = {}, - ): Promise> { + ): Promise> { options = existingOptions(options, configurationIntent(body)); return this.transport.request({ method: "PUT", - path: sessionPath(sessionId), + path: connectionPath(connectionId), body: campaignContractBody(body), ...existingOptions(options), }); } start( - sessionId: string, - body: SessionProjectContext = {}, + connectionId: string, + body: ConnectionProjectContext = {}, options: RequestOptions = {}, - ): Promise>> { + ): Promise>> { return this.transport.request({ method: "POST", - path: `${sessionPath(sessionId)}/start`, + path: `${connectionPath(connectionId)}/start`, body, ...existingOptions(options), }); } stop( - sessionId: string, - body: SessionProjectContext = {}, + connectionId: string, + body: ConnectionProjectContext = {}, options: RequestOptions = {}, - ): Promise>> { + ): Promise>> { return this.transport.request({ method: "POST", - path: `${sessionPath(sessionId)}/stop`, + path: `${connectionPath(connectionId)}/stop`, body, ...existingOptions(options), }); } - /** Requests asynchronous stops for the matching 1 through 100 sessions. */ + /** Requests asynchronous stops for the matching 1 through 100 connections. */ stopMany( - body: SessionBatchRequest, + body: ConnectionBatchRequest, options: RequestOptions = {}, - ): Promise>> { + ): Promise>> { return this.transport.request({ method: "POST", - path: "/platform/sessions/stop", + path: "/platform/connections/stop", body, ...existingOptions(options), }); @@ -111,12 +111,12 @@ export class PlatformSessionsResource { /** Removes a testing Number. Production Numbers return HTTP 409. */ delete( - sessionId: string, + connectionId: string, options: RequestOptions = {}, - ): Promise>> { + ): Promise>> { return this.transport.request({ method: "DELETE", - path: sessionPath(sessionId), + path: connectionPath(connectionId), ...existingOptions(options), }); } @@ -126,12 +126,12 @@ export class PlatformSessionsResource { * the API returns HTTP 409 before removing any Number in the batch. */ deleteMany( - body: SessionBatchRequest, + body: ConnectionBatchRequest, options: RequestOptions = {}, - ): Promise>> { + ): Promise>> { return this.transport.request({ method: "POST", - path: "/platform/sessions/delete", + path: "/platform/connections/delete", body, ...existingOptions(options), }); @@ -143,11 +143,11 @@ export class PlatformSessionsResource { * A Hybrid Link Number leaving Pro needs `hybridResolution` (keep one * connection or split the Number); without it the API returns * `hybrid_choice_required`. An upgrade to Pro can merge a same-number - * pair with `hybridMerge`; `sessionId` keeps its ID. The quote echoes the + * pair with `hybridMerge`; `connectionId` keeps its ID. The quote echoes the * plan in `quote.hybridTransition`. */ quoteTierChange( - sessionId: string, + connectionId: string, body: NumberTierQuoteRequest, options: RequestOptions = {}, ): Promise>> { @@ -161,28 +161,28 @@ export class PlatformSessionsResource { } return this.transport.request({ method: "POST", - path: `${sessionPath(sessionId)}/tier-quotes`, + path: `${connectionPath(connectionId)}/tier-quotes`, body, ...existingOptions(options), }); } retrieveTierChange( - sessionId: string, + connectionId: string, quoteId: string, options: RequestOptions = {}, ): Promise>> { return this.transport.request({ method: "GET", - path: `${sessionPath(sessionId)}/tier-quotes/${encodeURIComponent(quoteId)}`, + path: `${connectionPath(connectionId)}/tier-quotes/${encodeURIComponent(quoteId)}`, ...existingOptions(options), }); } /** Confirms a reviewed quote. Poll retrieveTierChange until applied or rejected. */ setTierOverride( - sessionId: string, - body: SessionTierOverrideRequest, + connectionId: string, + body: ConnectionTierOverrideRequest, options: RequestOptions = {}, ): Promise>> { if (typeof body?.quoteId !== "string" || !body.quoteId.trim()) { @@ -192,7 +192,7 @@ export class PlatformSessionsResource { } return this.transport.request({ method: "PATCH", - path: sessionPath(sessionId), + path: connectionPath(connectionId), body, ...existingOptions(options), }); @@ -203,41 +203,41 @@ export class PlatformSessionsResource { * its last configuration sync. Beta: returns 403 until the team enrolls. */ getCapabilities( - sessionId: string, + connectionId: string, options: RequestOptions = {}, - ): Promise>> { + ): Promise>> { return this.transport.request({ method: "GET", - path: `${sessionPath(sessionId)}/capabilities`, + path: `${connectionPath(connectionId)}/capabilities`, ...existingOptions(options), }); } getSafeMode( - sessionId: string, + connectionId: string, options: RequestOptions = {}, - ): Promise>> { + ): Promise>> { return this.transport.request({ method: "GET", - path: `${sessionPath(sessionId)}/safe-mode`, + path: `${connectionPath(connectionId)}/safe-mode`, ...existingOptions(options), }); } updateSafeMode( - sessionId: string, - body: UpdateSessionSafeModeRequest, + connectionId: string, + body: UpdateConnectionSafeModeRequest, options: RequestOptions = {}, - ): Promise>> { + ): Promise>> { return this.transport.request({ method: "PUT", - path: `${sessionPath(sessionId)}/safe-mode`, + path: `${connectionPath(connectionId)}/safe-mode`, body, ...existingOptions(options), }); } } -function sessionPath(sessionId: string): string { - return `/platform/sessions/${encodeURIComponent(sessionId)}`; +function connectionPath(connectionId: string): string { + return `/platform/connections/${encodeURIComponent(connectionId)}`; } diff --git a/packages/typescript/src/platform/customers.ts b/packages/typescript/src/platform/customers.ts index 754746789..3103565a3 100644 --- a/packages/typescript/src/platform/customers.ts +++ b/packages/typescript/src/platform/customers.ts @@ -232,13 +232,13 @@ export class CustomersResource { transferNumber( customerId: string, - sessionId: string, + connectionId: string, body: TransferCustomerNumberRequest, options: RequestOptions, ): Promise>> { return this.transport.request({ method: "POST", - path: `${customerPath(customerId)}/numbers/${encodeURIComponent(sessionId)}/transfer`, + path: `${customerPath(customerId)}/numbers/${encodeURIComponent(connectionId)}/transfer`, body, ...options, }); diff --git a/packages/typescript/src/platform/developer-resources.ts b/packages/typescript/src/platform/developer-resources.ts index 662a5ff15..ecec87b48 100644 --- a/packages/typescript/src/platform/developer-resources.ts +++ b/packages/typescript/src/platform/developer-resources.ts @@ -433,11 +433,11 @@ export class WebhooksResource extends ResourceBase { ): Promise>> { if ( this.prefix === "/platform" && - ("body" in input || "sessionId" in input) + ("body" in input || "connectionId" in input) ) { return Promise.reject( new PolymorfaValidationError( - "Team webhook tests do not accept body or sessionId.", + "Team webhook tests do not accept body or connectionId.", ), ); } diff --git a/packages/typescript/src/platform/developer-types.ts b/packages/typescript/src/platform/developer-types.ts index 8c354a339..090b89742 100644 --- a/packages/typescript/src/platform/developer-types.ts +++ b/packages/typescript/src/platform/developer-types.ts @@ -139,7 +139,7 @@ interface WebhookBase { readonly retryPolicy: WebhookRetryPolicy; /** * First day without the phone on which this webhook receives - * `session.phone_offline` (7-13, default 10). WhatsApp signs the linked + * `connection.phone_offline` (7-13, default 10). WhatsApp signs the linked * device out on day 14. To stop the warning, leave the event out of * the webhook's events. */ @@ -166,7 +166,7 @@ interface CreateWebhookInputBase { readonly retryPolicy?: WebhookRetryPolicyInput; /** * First day without the phone on which this webhook receives - * `session.phone_offline` (7-13, default 10). WhatsApp signs the linked + * `connection.phone_offline` (7-13, default 10). WhatsApp signs the linked * device out on day 14. To stop the warning, leave the event out of * the webhook's events. */ @@ -184,7 +184,7 @@ interface UpdateWebhookInputBase { readonly retryPolicy?: WebhookRetryPolicyInput; /** * First day without the phone on which this webhook receives - * `session.phone_offline` (7-13, default 10). WhatsApp signs the linked + * `connection.phone_offline` (7-13, default 10). WhatsApp signs the linked * device out on day 14. To stop the warning, leave the event out of * the webhook's events. */ @@ -207,18 +207,18 @@ export type RetryWebhookDeliveryInput = Readonly>; export interface TeamWebhookTestInput { readonly eventType?: string; readonly body?: never; - readonly sessionId?: never; + readonly connectionId?: never; } export type TestWebhookInput = | { readonly eventType?: string; readonly body?: never; - readonly sessionId?: never; + readonly connectionId?: never; } | { readonly eventType?: string; readonly body: EncodedEventPayload; - readonly sessionId: string; + readonly connectionId: string; }; export type TestTeamWebhookInput = TeamWebhookTestInput; @@ -353,7 +353,7 @@ export type OperationStatus = | "cancelled"; export type OperationKind = | "auth_projection_repair" - | "session_lifecycle" + | "connection_lifecycle" | "auth_session_purge" | "label_projection_purge" | "billing_reconciliation" diff --git a/packages/typescript/src/platform/event-stream.ts b/packages/typescript/src/platform/event-stream.ts index d0b7d66b3..0e39faab5 100644 --- a/packages/typescript/src/platform/event-stream.ts +++ b/packages/typescript/src/platform/event-stream.ts @@ -29,7 +29,7 @@ export interface StreamedEvent { /** The decoded webhook body carried in `payload`, when available. */ export interface WebhookEnvelope { readonly id: string; - readonly session: string; + readonly connection: string; readonly externalId?: string; readonly timestamp: string; readonly event: string; diff --git a/packages/typescript/src/platform/flows.ts b/packages/typescript/src/platform/flows.ts index e42c8b5c3..e17d2f71e 100644 --- a/packages/typescript/src/platform/flows.ts +++ b/packages/typescript/src/platform/flows.ts @@ -37,9 +37,9 @@ export interface FlowValidationIssue extends Omit< readonly pointers?: readonly FlowValidationPointer[]; } export interface FlowNumberLink { - readonly session: string; - /** Number session UUID, when the API reports it. */ - readonly sessionId?: string; + readonly connection: string; + /** Number connection UUID, when the API reports it. */ + readonly connectionId?: string; readonly wabaId: string; readonly metaFlowId: string; readonly status: string; @@ -78,7 +78,7 @@ export interface UpdateFlowRequest { readonly definition?: Readonly>; } export interface FlowProviderRequest { - readonly sessionId: string; + readonly connectionId: string; readonly categories?: readonly FlowCategory[]; /** Reuse for the exact same operation; an uncertain operation is reconciled by sync. */ readonly requestId?: string; @@ -88,8 +88,8 @@ export interface FlowProviderOperation { readonly requestId: string | null; readonly flowId: string; readonly flowName: string; - readonly sessionId: string; - readonly session: string; + readonly connectionId: string; + readonly connection: string; readonly action: "create" | "upload" | "publish" | "deprecate" | "delete"; readonly state: "pending" | "succeeded" | "rejected" | "uncertain" | "superseded"; @@ -117,7 +117,7 @@ export interface FlowEndpoint { readonly teamId: string; readonly projectId: string; readonly flowId: string; - readonly sessionId: string; + readonly connectionId: string; readonly mode: FlowEndpointMode; readonly url: string | null; readonly functionId: string | null; @@ -165,8 +165,8 @@ export interface FlowEndpointSetResult { readonly encryption: FlowEncryptionCustody; } interface FlowEndpointCommon { - /** Number (session) name or id in the Flow's project. */ - readonly sessionId: string; + /** Number (connection) name or id in the Flow's project. */ + readonly connectionId: string; readonly enabled?: boolean; /** Replace only when the stored revision matches. */ readonly expectedRevision?: number; @@ -194,11 +194,11 @@ export type SetFlowEndpointRequest = | FunctionFlowEndpointRequest | DirectFlowEndpointRequest; export interface FlowNumberRequest { - /** Number (session) name or id in the Flow's project. */ - readonly sessionId: string; + /** Number (connection) name or id in the Flow's project. */ + readonly connectionId: string; } export interface ListFlowEndpointReceiptsRequest { - readonly sessionId?: string; + readonly connectionId?: string; /** 1 to 100; defaults to 50. */ readonly limit?: number; } @@ -207,7 +207,7 @@ export interface FlowEndpointReceipt { readonly id: string; readonly flowId: string; readonly endpointId: string; - readonly sessionId: string; + readonly connectionId: string; readonly mode: "forward" | "function"; readonly action: "ping" | "INIT" | "data_exchange" | "BACK" | "error_notification" | null; @@ -447,13 +447,13 @@ function flowPath(id: string): string { } function numberInput(params: FlowNumberRequest): FlowNumberRequest { - if (typeof params?.sessionId !== "string" || !params.sessionId.trim()) - throw new PolymorfaValidationError("sessionId is required."); - return { sessionId: params.sessionId }; + if (typeof params?.connectionId !== "string" || !params.connectionId.trim()) + throw new PolymorfaValidationError("connectionId is required."); + return { connectionId: params.connectionId }; } function validateEndpointRequest(body: SetFlowEndpointRequest): void { - if (typeof body?.sessionId !== "string" || !body.sessionId.trim()) - throw new PolymorfaValidationError("sessionId is required."); + if (typeof body?.connectionId !== "string" || !body.connectionId.trim()) + throw new PolymorfaValidationError("connectionId is required."); if (body.mode === "forward" || body.mode === "direct") { if (!isHttpsUrl(body.url)) throw new PolymorfaValidationError( diff --git a/packages/typescript/src/platform/projects.ts b/packages/typescript/src/platform/projects.ts index 0418086f8..5fd6ab9db 100644 --- a/packages/typescript/src/platform/projects.ts +++ b/packages/typescript/src/platform/projects.ts @@ -162,9 +162,9 @@ export class ProjectsResource { /** * Lists same-number pairs (one Linked Devices Number and one Official API * coexistence Number) that can merge into one Hybrid Link Number. Merge an - * eligible pair with `sessions.quoteTierChange(keepId, { tierOverride: "pro", + * eligible pair with `connections.quoteTierChange(keepId, { tierOverride: "pro", * hybridMerge: { absorbNumberId } })`; the absorbed Number must have - * `canBeAbsorbed: true`. Requires `sessions:read` and live Hybrid Link + * `canBeAbsorbed: true`. Requires `connections:read` and live Hybrid Link * access (otherwise `403 feature_unavailable`). */ listHybridMergeCandidates( diff --git a/packages/typescript/src/platform/request-logs.ts b/packages/typescript/src/platform/request-logs.ts index a2046c78c..ecca749d3 100644 --- a/packages/typescript/src/platform/request-logs.ts +++ b/packages/typescript/src/platform/request-logs.ts @@ -24,7 +24,7 @@ export interface RequestLog { /** RFC 3339 time the request was recorded. */ readonly createdAt: string; readonly method: string; - /** Matched route pattern, for example `/messaging/:session/messages`. */ + /** Matched route pattern, for example `/messaging/:connection/messages`. */ readonly route: string; readonly status: number | null; readonly durationMs: number | null; @@ -51,7 +51,7 @@ export interface RequestLogFilters { number | `${1 | 2 | 3 | 4 | 5}xx` | `${number}` )[]; readonly method?: readonly RequestLogMethod[]; - /** Exact route pattern, for example `/messaging/:session/messages`. */ + /** Exact route pattern, for example `/messaging/:connection/messages`. */ readonly route?: string; readonly source?: RequestLogSource; /** ID of the team key or project token that made the request. */ diff --git a/packages/typescript/src/platform/sip-trunks.ts b/packages/typescript/src/platform/sip-trunks.ts index f15626322..4104d10e3 100644 --- a/packages/typescript/src/platform/sip-trunks.ts +++ b/packages/typescript/src/platform/sip-trunks.ts @@ -27,8 +27,8 @@ export interface SipTrunkOutbound { export interface SipTrunkInbound { readonly username: string; readonly realm: string; - /** Session that places the calls, or `null` while calls are refused. */ - readonly session: string | null; + /** Connection that places the calls, or `null` while calls are refused. */ + readonly connection: string | null; readonly allowedAddresses: readonly string[]; /** E.164 prefixes your PBX may call. Empty allows every destination. */ readonly allowedDestinations: readonly string[]; @@ -125,7 +125,7 @@ export interface SipTrunkOutboundInput { } export interface SipTrunkInboundInput { - readonly session?: string | null; + readonly connection?: string | null; readonly allowedAddresses: readonly string[]; readonly allowedDestinations?: readonly string[]; } @@ -177,7 +177,7 @@ type ProjectArgument = O extends "project" /** * SIP trunks connect a PBX or carrier trunk to the WhatsApp calls of a - * project's sessions. Team clients name the project on `list` and `create`; + * project's connections. Team clients name the project on `list` and `create`; * project clients use their own project. */ export class SipTrunksResource { @@ -208,7 +208,7 @@ export class SipTrunksResource { /** * Returns the SIP address your PBX points at. Narrow the result on `status` * to read the host, transports and RTP range; `sip_not_hosted` is data, not - * an error, when the environment has no SIP address. Needs `sessions:read`; + * an error, when the environment has no SIP address. Needs `connections:read`; * client tokens are refused. */ endpoint(options: RequestOptions = {}): Promise> { @@ -268,7 +268,7 @@ export class SipTrunksResource { .then(unwrapResponse); } - /** Fails with `sip_trunk_in_use` while a session routes incoming calls to the trunk. */ + /** Fails with `sip_trunk_in_use` while a connection routes incoming calls to the trunk. */ async delete( trunkId: string, options: RequestOptions = {}, diff --git a/packages/typescript/src/platform/types.ts b/packages/typescript/src/platform/types.ts index 58d5ea67c..91566c7f9 100644 --- a/packages/typescript/src/platform/types.ts +++ b/packages/typescript/src/platform/types.ts @@ -105,7 +105,7 @@ export interface CustomerListEnvelope { export interface CustomerNumber { readonly id: string; readonly customerId: string; - readonly sessionId: string; + readonly connectionId: string; readonly name: string | null; readonly phoneMasked: string | null; readonly status: string; @@ -122,7 +122,7 @@ export interface CustomerEvent { readonly action: string; readonly fromStatus: string | null; readonly toStatus: string | null; - readonly sessionId: string | null; + readonly connectionId: string | null; readonly pairingLinkId: string | null; readonly metadata: CustomerEventMetadata; readonly occurredAt: number; @@ -153,7 +153,7 @@ export interface CustomerPairingLink { readonly status: CustomerPairingLinkStatus; readonly attemptCount: number; readonly maxAttempts: number; - readonly pendingSessionId: string | null; + readonly pendingConnectionId: string | null; readonly createdBy: string | null; readonly reservedAt: number | null; readonly openedAt: number | null; @@ -570,7 +570,7 @@ export interface BillingTransaction { readonly balanceAfterCents: number; readonly type: string; readonly description: string; - readonly sessionId: string | null; + readonly connectionId: string | null; readonly projectId: string | null; readonly tier: string | null; readonly currency: string | null; @@ -650,16 +650,16 @@ export interface AuditLog { readonly createdAt: number; } -export type SessionBanStatus = "active" | "lifted"; +export type ConnectionBanStatus = "active" | "lifted"; -export interface SessionBan { +export interface ConnectionBan { readonly id: string; - readonly sessionName: string; + readonly connectionName: string; readonly banCode: number | null; readonly banReason: string | null; readonly banExpiresAt: number | null; readonly occurredAt: number; - readonly status: SessionBanStatus; + readonly status: ConnectionBanStatus; } export interface SecurityIncident { @@ -726,8 +726,8 @@ export interface ProjectWithStats { readonly defaultTier: string; readonly isActive: boolean; readonly stage: "development" | "production"; - readonly activeSessions: number; - readonly totalSessions: number; + readonly activeConnections: number; + readonly totalConnections: number; readonly totalMessages: number; readonly lastActivity: number | null; readonly iconUrl: string | null; @@ -790,19 +790,19 @@ export interface ProductionEnrollmentCommandResult { readonly accepted: true; } -export type SessionTier = "free" | "standard" | "pro" | "scale"; +export type ConnectionTier = "free" | "standard" | "pro" | "scale"; -export interface PlatformSession { +export interface PlatformConnection { readonly _id: string; readonly _creationTime: number; readonly projectId: string; - readonly sessionId: string; + readonly connectionId: string; readonly name: string; readonly phone: string | null; readonly platform: string | null; readonly isBusiness: boolean; readonly testMode: boolean; - readonly tierOverride: SessionTier | null; + readonly tierOverride: ConnectionTier | null; readonly status: string; readonly messageCount: number; readonly lastActiveAt: number | null; @@ -810,53 +810,53 @@ export interface PlatformSession { readonly paidUntil: number | null; } -export interface ManagedSession { +export interface ManagedConnection { readonly id: string; - readonly sessionId: string; + readonly connectionId: string; readonly status: string; - readonly tierOverride: SessionTier | null; + readonly tierOverride: ConnectionTier | null; } -export interface ListPlatformSessionsParams { +export interface ListPlatformConnectionsParams { readonly projectId?: string; } -export interface SessionProjectContext { +export interface ConnectionProjectContext { readonly projectId?: string; } -export interface SessionStartResult { +export interface ConnectionStartResult { readonly starting: true; - readonly sessionId: string; + readonly connectionId: string; } -export interface SessionStopResult { +export interface ConnectionStopResult { readonly stopping: true; - readonly sessionId: string; + readonly connectionId: string; } -export interface SessionRemoveResult { +export interface ConnectionRemoveResult { readonly removed: true; - readonly sessionId: string; + readonly connectionId: string; } -/** A source-bounded batch of 1 through 100 session UUIDs or stable slugs. */ -export interface SessionBatchRequest { +/** A source-bounded batch of 1 through 100 connection UUIDs or stable slugs. */ +export interface ConnectionBatchRequest { readonly projectId?: string; - readonly sessionIds: readonly string[]; + readonly connectionIds: readonly string[]; } -/** Number of matching sessions for which an asynchronous stop was requested. */ -export interface SessionBatchStopResult { +/** Number of matching connections for which an asynchronous stop was requested. */ +export interface ConnectionBatchStopResult { readonly stopping: number; } -/** Number of matching sessions permanently removed from management storage. */ -export interface SessionBatchRemoveResult { +/** Number of matching connections permanently removed from management storage. */ +export interface ConnectionBatchRemoveResult { readonly removed: number; } -export interface SessionTierOverrideRequest { +export interface ConnectionTierOverrideRequest { readonly projectId?: string; readonly quoteId: string; } @@ -1116,8 +1116,8 @@ export interface BanSafeNumberEnforcement { } export interface BanSafeNumber extends BanSafeHealthProjection { - readonly sessionId: string; - readonly session: string; + readonly connectionId: string; + readonly connection: string; readonly phoneNumber: string; readonly projectId: string; readonly enforcement: BanSafeNumberEnforcement | null; @@ -1154,8 +1154,8 @@ export interface BanSafeHealthPoint extends Omit< } export interface BanSafeHealthHistory { - readonly sessionId: string; - readonly session: string; + readonly connectionId: string; + readonly connection: string; readonly points: readonly BanSafeHealthPoint[]; } @@ -1174,8 +1174,8 @@ export interface BanSafeFinding { readonly occurrences: number; readonly reopenedCount: number; readonly evidence: Readonly>; - readonly sessionId: string; - readonly session: string; + readonly connectionId: string; + readonly connection: string; readonly phoneNumber: string; readonly firstSeenAt: string | null; readonly lastSeenAt: string | null; @@ -1189,8 +1189,8 @@ export interface BanSafeFinding { } export interface BanSafeEnforcementSummary extends BanSafeHealthProjection { - readonly sessionId: string; - readonly session: string; + readonly connectionId: string; + readonly connection: string; readonly phoneNumber: string; readonly projectId: string; readonly rung: BanSafeEnforcementRung; @@ -1223,8 +1223,8 @@ export type BanSafeIncidentKind = export interface BanSafeIncident { readonly id: string; - readonly sessionId: string; - readonly session: string; + readonly connectionId: string; + readonly connection: string; readonly phoneNumber: string; readonly projectId: string; readonly kind: BanSafeIncidentKind; @@ -1242,7 +1242,7 @@ export interface BanSafeIncident { } export interface ReportBanSafeIncidentRequest { - readonly session: string; + readonly connection: string; readonly occurredAt?: string; readonly note?: string; } @@ -1250,8 +1250,8 @@ export interface ReportBanSafeIncidentRequest { export interface BanSafeIncidentReceipt { readonly incidentId: string; readonly created: boolean; - readonly sessionId: string; - readonly session: string; + readonly connectionId: string; + readonly connection: string; readonly occurredAt: string; } @@ -1289,8 +1289,8 @@ export interface BanSafeClaimEvidence { export interface BanSafeClaim { readonly id: string; readonly incidentId: string; - readonly sessionId: string; - readonly session: string; + readonly connectionId: string; + readonly connection: string; readonly phoneNumber: string; readonly projectId: string; readonly status: BanSafeClaimStatus; @@ -1323,7 +1323,7 @@ export interface ListBanSafeHealthHistoryParams { } export interface ListBanSafeFindingsParams extends ListBanSafeHealthParams { - readonly session?: string; + readonly connection?: string; readonly status?: Exclude; readonly severity?: BanSafeFindingSeverity; } @@ -1333,11 +1333,11 @@ export interface ListBanSafeEnforcementParams extends ListBanSafeHealthParams { } export interface ListBanSafeIncidentsParams extends ListBanSafeHealthParams { - readonly session?: string; + readonly connection?: string; } export interface ListBanSafeClaimsParams extends ListBanSafeHealthParams { - readonly session?: string; + readonly connection?: string; readonly status?: BanSafeClaimStatus; } @@ -1386,14 +1386,14 @@ export interface BanSafeTelemetrySnapshot { readonly signals: readonly BanSafeSignal[]; } -export interface BanSafeCollectionSession { - readonly sessionId: string; - readonly session: string; +export interface BanSafeCollectionConnection { + readonly connectionId: string; + readonly connection: string; readonly projectId: string; readonly collection: BanSafeCollectionStatus; } -export interface BanSafeTelemetryDetail extends BanSafeCollectionSession { +export interface BanSafeTelemetryDetail extends BanSafeCollectionConnection { readonly snapshot: BanSafeTelemetrySnapshot | null; } @@ -1422,8 +1422,8 @@ export type BanSafeHealthActionOutcome = export interface BanSafeHealthAction { readonly id: string; - readonly sessionId: string; - readonly session: string; + readonly connectionId: string; + readonly connection: string; readonly projectId: string; readonly mode: BanSafeHealthActionMode; readonly action: BanSafeHealthActionKind; @@ -1441,7 +1441,7 @@ export interface BanSafeHealthAction { } export interface ListBanSafeHealthActionsParams extends ListBanSafeHealthParams { - readonly session?: string; + readonly connection?: string; readonly status?: BanSafeHealthActionStatus; } @@ -1454,7 +1454,7 @@ export type BanSafeClaimsEnvelope = CursorEnvelope; export type BanSafeTelemetryHistoryEnvelope = CursorEnvelope; export type BanSafeCollectionEnvelope = - CursorEnvelope; + CursorEnvelope; export type BanSafeHealthActionsEnvelope = CursorEnvelope; export type SafeModePresence = "dark" | "online_while_sending" | "online_hours"; @@ -1503,62 +1503,62 @@ export interface SafeModeApplied { } /** `feature`: `value` is a boolean. `limit`: `value` is an integer in `unit`. */ -export type SessionCapabilityKind = "feature" | "limit"; -export type SessionCapabilityUnit = +export type ConnectionCapabilityKind = "feature" | "limit"; +export type ConnectionCapabilityUnit = "seconds" | "count" | "characters" | "members"; /** * `server`: WhatsApp sent a setting the value depends on. `client_default`: * WhatsApp sent none, so its default applies. `account_type`: the capability * does not apply to this account type. */ -export type SessionCapabilitySource = +export type ConnectionCapabilitySource = "server" | "client_default" | "account_type"; -interface SessionCapabilityBase { +interface ConnectionCapabilityBase { /** Stable key such as `channels` or `messageEdit.windowSeconds`. New keys can be added. */ readonly key: string; /** Null when `value` is null. */ - readonly source: SessionCapabilitySource | null; + readonly source: ConnectionCapabilitySource | null; } /** A WhatsApp feature: enabled (`true`), off (`false`) or unknown (`null`). */ -export interface SessionFeatureCapability extends SessionCapabilityBase { +export interface ConnectionFeatureCapability extends ConnectionCapabilityBase { readonly kind: "feature"; readonly unit: null; readonly value: boolean | null; } /** A WhatsApp limit: an integer in `unit`, or `null` when unknown. */ -export interface SessionLimitCapability extends SessionCapabilityBase { +export interface ConnectionLimitCapability extends ConnectionCapabilityBase { readonly kind: "limit"; - readonly unit: SessionCapabilityUnit; + readonly unit: ConnectionCapabilityUnit; readonly value: number | null; } /** Narrow on `kind` to type `value` and `unit`. */ -export type SessionCapability = - SessionFeatureCapability | SessionLimitCapability; +export type ConnectionCapability = + ConnectionFeatureCapability | ConnectionLimitCapability; /** `unknown` before the first sync, after a logout, while waiting to be paired, and after another account is linked; every value is then null. */ -export type SessionCapabilitiesStatus = "synced" | "unknown"; -export type SessionAccountType = "business" | "personal"; +export type ConnectionCapabilitiesStatus = "synced" | "unknown"; +export type ConnectionAccountType = "business" | "personal"; /** * WhatsApp features and limits WhatsApp has enabled for one number, as of the * number's last configuration sync (`syncedAt`). Beta: teams must enroll. */ -export interface SessionCapabilities { - readonly session: string; +export interface ConnectionCapabilities { + readonly connection: string; readonly projectId: string; - readonly status: SessionCapabilitiesStatus; + readonly status: ConnectionCapabilitiesStatus; readonly syncedAt: string | null; readonly checkedAt: string | null; - readonly accountType: SessionAccountType | null; - readonly capabilities: readonly SessionCapability[]; + readonly accountType: ConnectionAccountType | null; + readonly capabilities: readonly ConnectionCapability[]; } -export interface SessionSafeMode { - readonly session: string; +export interface ConnectionSafeMode { + readonly connection: string; readonly projectId: string; readonly project: SafeModeSettings; readonly override: SafeModeOverride; @@ -1569,7 +1569,7 @@ export interface SessionSafeMode { readonly entitlementReason: string | null; } -export interface UpdateSessionSafeModeRequest { +export interface UpdateConnectionSafeModeRequest { readonly presence?: SafeModePresence | "inherit"; readonly typing?: SafeModeTyping | "inherit"; readonly reads?: SafeModeReads | "inherit"; @@ -1607,7 +1607,7 @@ export interface UpdateProjectInsuranceEvidenceRequest { readonly enabled: boolean; } -export type ProjectHealthSessionAction = +export type ProjectHealthConnectionAction = "none" | "stop" | "slow_down" | "log_out"; export interface ProjectHealthPolicyIntegrations { @@ -1620,7 +1620,7 @@ export interface ProjectHealthPolicy { readonly version: number; readonly enabled: boolean; readonly threshold: number; - readonly sessionAction: ProjectHealthSessionAction; + readonly connectionAction: ProjectHealthConnectionAction; readonly slowDownMps: number | null; readonly emailNotification: boolean; readonly webhookNotification: boolean; @@ -1631,7 +1631,7 @@ export interface UpdateProjectHealthPolicyRequest { readonly version: number; readonly enabled: boolean; readonly threshold: number; - readonly sessionAction: ProjectHealthSessionAction; + readonly connectionAction: ProjectHealthConnectionAction; readonly slowDownMps: number | null; readonly emailNotification: boolean; readonly webhookNotification: boolean; diff --git a/packages/typescript/src/platform/usage.ts b/packages/typescript/src/platform/usage.ts index 2b0c6efd1..ec902e5c1 100644 --- a/packages/typescript/src/platform/usage.ts +++ b/packages/typescript/src/platform/usage.ts @@ -65,8 +65,8 @@ export interface UsageRecord { /** The call id for call meters. */ readonly sourceId: string; readonly projectId: string | null; - /** The number (session name) the usage belongs to. */ - readonly session: string | null; + /** The number (connection name) the usage belongs to. */ + readonly connection: string | null; readonly occurredAt: string; readonly recordedAt: string; /** Increases when a later observation corrects the record. Keep the highest. */ @@ -97,13 +97,13 @@ export interface UsageSummary { readonly start: string; readonly end: string; readonly projectId: string | null; - readonly session: string | null; + readonly connection: string | null; /** Always `false` while usage is measured but not charged. */ readonly billingEnabled: boolean; readonly meters: readonly UsageMeterTotal[]; /** Totals per number, most call time first (at most 100). */ readonly numbers: readonly { - readonly session: string; + readonly connection: string; readonly projectId: string | null; readonly meters: readonly UsageMeterTotal[]; }[]; @@ -143,7 +143,7 @@ export interface UsageGate { readonly mode: UsageGateMode; /** Whether an action checks this gate today. */ readonly active: boolean; - /** `-1` for no limit; `null` when the limit applies per number and no `session` was given. */ + /** `-1` for no limit; `null` when the limit applies per number and no `connection` was given. */ readonly limit: number | null; readonly used: number | null; readonly unit: UsageUnit | "count" | "minute" | null; @@ -157,15 +157,15 @@ export interface UsageGate { } export interface UsageGateList { - readonly session: string | null; + readonly connection: string | null; readonly gates: readonly UsageGate[]; } export interface UsageSummaryParams { /** Team keys only; a project client always reads its own project. */ readonly projectId?: string; - /** One number (session name). */ - readonly session?: string; + /** One number (connection name). */ + readonly connection?: string; /** Calendar month in UTC, `YYYY-MM`. Defaults to the current month. */ readonly period?: string; } @@ -184,12 +184,12 @@ export interface UsageRecordParams extends UsageSummaryParams { export interface UsageGateParams { readonly projectId?: string; /** Include limits that apply per number. */ - readonly session?: string; + readonly connection?: string; } /** * Metered usage and usage gates. Usage is measured, not charged. Requires the - * `sessions:read` scope; a project token reads only its own project's usage, + * `connections:read` scope; a project token reads only its own project's usage, * and gate state needs a team key. */ export class UsageResource { diff --git a/packages/typescript/src/s3.ts b/packages/typescript/src/s3.ts index a8ba2c103..32fda391f 100644 --- a/packages/typescript/src/s3.ts +++ b/packages/typescript/src/s3.ts @@ -51,7 +51,7 @@ export interface S3UploadToWhatsAppOptions extends Pick< > { /** Anything with the Messaging client's `whatsappMedia` resource. */ readonly messaging: { readonly whatsappMedia: WhatsAppMediaResource }; - readonly session: string; + readonly connection: string; /** Object key, relative to `prefix`. */ readonly key: string; readonly mediaType: WhatsAppUploadMediaType; @@ -165,7 +165,7 @@ export class S3MediaStore { }, }; const mimetype = options.mimetype ?? head.ContentType; - return options.messaging.whatsappMedia.upload(options.session, source, { + return options.messaging.whatsappMedia.upload(options.connection, source, { mediaType: options.mediaType, encryptor: nodeMediaEncryptor, ...(mimetype === undefined ? {} : { mimetype }), diff --git a/packages/typescript/src/transport/http.ts b/packages/typescript/src/transport/http.ts index 4993f0759..987bccfeb 100644 --- a/packages/typescript/src/transport/http.ts +++ b/packages/typescript/src/transport/http.ts @@ -985,7 +985,7 @@ function responseMetadata( "template", "target_reference", "only_eligible_transport", - "session_rule", + "connection_rule", "project_rule", "team_rule", "default_linked_devices", diff --git a/packages/typescript/src/webhooks/events.ts b/packages/typescript/src/webhooks/events.ts index 228b4daa6..a59f442bb 100644 --- a/packages/typescript/src/webhooks/events.ts +++ b/packages/typescript/src/webhooks/events.ts @@ -2,7 +2,7 @@ import type { IncomingOrderCart } from "../messaging/order-cart.js"; import type { CallPermissionSource, CallPermissionStatus, - MessagingConnection, + ConnectionMethodKind, WhatsAppMessageIds, PhonePlatform, WhatsAppAccountType, @@ -20,7 +20,7 @@ import type { VoiceAudioSource, } from "../platform/voice.js"; -import type { SessionCapabilities } from "../platform/types.js"; +import type { ConnectionCapabilities } from "../platform/types.js"; export const KNOWN_WEBHOOK_EVENT_TYPES = [ "bansafe.action", @@ -99,12 +99,12 @@ export const KNOWN_WEBHOOK_EVENT_TYPES = [ "newsletter.update", "order.payment_updated", "presence.update", - "session.capabilities_updated", - "session.connected", - "session.logged_out", - "session.phone_offline", - "session.restriction_updated", - "session.status", + "connection.capabilities_updated", + "connection.connected", + "connection.logged_out", + "connection.phone_offline", + "connection.restriction_updated", + "connection.status", "template.status", "usage.recorded", "voice.asset_failed", @@ -293,7 +293,7 @@ export interface PollVotePayload { readonly timestamp: number; } -export interface RuntimeSessionStatusPayload { +export interface RuntimeConnectionStatusPayload { readonly status: string; readonly statusReason?: string; readonly banCode?: number; @@ -312,20 +312,20 @@ export interface CloudAccountStatusPayload { readonly value: Readonly>; } -export type SessionStatusPayload = - RuntimeSessionStatusPayload | CloudAccountStatusPayload; +export type ConnectionStatusPayload = + RuntimeConnectionStatusPayload | CloudAccountStatusPayload; -export type SessionRestrictionType = "reachout_timelock"; +export type ConnectionRestrictionType = "reachout_timelock"; -export interface SessionRestrictionUpdatedPayload { - readonly type: SessionRestrictionType; +export interface ConnectionRestrictionUpdatedPayload { + readonly type: ConnectionRestrictionType; readonly active: boolean; readonly enforcementType: string | null; readonly expiresAt: string | null; readonly observedAt: string; } -export interface SessionConnectedPayload { +export interface ConnectionConnectedPayload { readonly phoneNumber: string; readonly id?: string; readonly pushName: string; @@ -335,14 +335,14 @@ export interface SessionConnectedPayload { } /** - * Why a session was logged out: `banned` (WhatsApp banned the account), + * Why a connection was logged out: `banned` (WhatsApp banned the account), * `device_removed` (the linked device was removed from the phone or another * device) or `unknown`. */ -export type SessionLoggedOutReason = "banned" | "device_removed" | "unknown"; +export type ConnectionLoggedOutReason = "banned" | "device_removed" | "unknown"; -export interface SessionLoggedOutPayload { - readonly reason: SessionLoggedOutReason; +export interface ConnectionLoggedOutPayload { + readonly reason: ConnectionLoggedOutReason; /** WhatsApp's logout code (401, 403 or 406), or 0 when none was given. */ readonly code: number; } @@ -357,7 +357,7 @@ export const PHONE_OFFLINE_START_DAY = { default: 10, } as const; -export interface SessionPhoneOfflinePayload { +export interface ConnectionPhoneOfflinePayload { readonly daysSinceLastSeen: number; readonly daysRemaining: number; readonly lastSeen: string; @@ -442,8 +442,8 @@ export interface ContactOptPayload { readonly source: "stop-keyword"; /** The matched keyword, normalized to upper case. */ readonly keyword: string; - /** Session name of the number that received the reply. */ - readonly session: string; + /** Connection name of the number that received the reply. */ + readonly connection: string; /** Project that owns the receiving number, when known. */ readonly projectId?: string; } @@ -515,7 +515,7 @@ export interface ChatDeletePayload { readonly from: IdentityReference; } -/** What a call supports, as reported by the session that carries it. */ +/** What a call supports, as reported by the connection that carries it. */ export interface WebhookCallCapabilities { readonly video: boolean; /** Other parties can be invited, turning the call into a group call. */ @@ -526,8 +526,8 @@ export interface CallReceivedPayload { readonly from: IdentityReference; readonly callId: string; readonly hasVideo: boolean; - /** How the session is connected to WhatsApp. */ - readonly sessionConnection?: MessagingConnection; + /** How the connection is connected to WhatsApp. */ + readonly connectionConnection?: ConnectionMethodKind; readonly capabilities?: WebhookCallCapabilities; } @@ -544,7 +544,7 @@ export interface CallAcceptedPayload { readonly answeredBy?: string; /** The answer claimed the call: other participants stopped ringing. */ readonly exclusive?: boolean; - readonly sessionConnection?: MessagingConnection; + readonly connectionConnection?: ConnectionMethodKind; readonly capabilities?: WebhookCallCapabilities; } @@ -562,7 +562,7 @@ export interface CallEndedPayload { readonly reason: string; readonly direction: "inbound" | "outbound"; readonly hadVideo: boolean; - readonly sessionConnection?: MessagingConnection; + readonly connectionConnection?: ConnectionMethodKind; } export interface CallTelemetryPayload { @@ -826,7 +826,7 @@ export type CustomerPairingLinkOpenedPayload = CustomerPairingLinkPayload; export type CustomerPairingLinkExpiredPayload = CustomerPairingLinkPayload; export interface CustomerPairingLinkConnectedPayload extends CustomerPairingLinkPayload { - readonly sessionId: string; + readonly connectionId: string; } export interface CustomerPairingLinkFailedPayload extends CustomerPairingLinkPayload { @@ -842,17 +842,17 @@ export interface CustomerPairingLinkRevokedPayload extends CustomerPairingLinkPa } export interface CustomerNumberAttachedPayload extends CustomerEventPayload { - readonly sessionId: string; + readonly connectionId: string; readonly pairingLinkId?: string; } export interface CustomerNumberTransferredPayload extends CustomerEventPayload { - readonly sessionId: string; + readonly connectionId: string; readonly sourceCustomerId: string; } export interface CustomerNumberDisconnectedPayload extends CustomerEventPayload { - readonly sessionId: string; + readonly connectionId: string; readonly reason: string; } @@ -869,7 +869,7 @@ export type BanSafeEventRung = "none" | "notify" | "throttle" | "block_cold" | "suspend"; export interface BanSafeHealthThresholdPayload { - readonly sessionId: string; + readonly connectionId: string; readonly projectId: string; /** Health from 0 to 100. */ readonly health: number; @@ -1021,7 +1021,7 @@ export type OrderPaymentUpdatedPayload = export type MessageFailedReason = | "invalid_recipient" - | "session_not_connected" + | "connection_not_connected" | "ack_timeout" | "send_failed" | "blocked_by_safety"; @@ -1143,7 +1143,7 @@ export interface CampaignRecipientSentPayload { readonly campaignId: string; readonly recipientId: string; readonly phone: string; - readonly sessionKey: string; + readonly connectionKey: string; readonly externalMessageId: string; readonly variantKey: string; readonly attempt: number; @@ -1178,7 +1178,7 @@ export interface CampaignRecipientSkippedPayload { export interface CampaignThrottledPayload { readonly campaignId: string; - readonly sessionKey: string; + readonly connectionKey: string; readonly reason: string; readonly deferredCount: number; readonly at: number; @@ -1186,7 +1186,7 @@ export interface CampaignThrottledPayload { export interface CampaignCapReachedPayload { readonly campaignId: string; - readonly sessionKey: string; + readonly connectionKey: string; readonly phone: string; readonly capType: string; readonly capLimit: number; @@ -1243,7 +1243,7 @@ export interface UsageRecordedPayload { /** The call id for call meters. */ readonly sourceId: string; readonly projectId: string | null; - readonly session: string | null; + readonly connection: string | null; readonly occurredAt: string; readonly recordedAt: string; readonly revision: number; @@ -1329,12 +1329,12 @@ export interface WebhookPayloadMap { readonly "message.vote": PollVotePayload; readonly "newsletter.update": NewsletterUpdatePayload; readonly "presence.update": PresenceUpdatePayload; - readonly "session.capabilities_updated": SessionCapabilitiesUpdatedPayload; - readonly "session.connected": SessionConnectedPayload; - readonly "session.logged_out": SessionLoggedOutPayload; - readonly "session.phone_offline": SessionPhoneOfflinePayload; - readonly "session.restriction_updated": SessionRestrictionUpdatedPayload; - readonly "session.status": SessionStatusPayload; + readonly "connection.capabilities_updated": ConnectionCapabilitiesUpdatedPayload; + readonly "connection.connected": ConnectionConnectedPayload; + readonly "connection.logged_out": ConnectionLoggedOutPayload; + readonly "connection.phone_offline": ConnectionPhoneOfflinePayload; + readonly "connection.restriction_updated": ConnectionRestrictionUpdatedPayload; + readonly "connection.status": ConnectionStatusPayload; readonly "template.status": TemplateStatusPayload; readonly "usage.recorded": UsageRecordedPayload; readonly "voice.asset_failed": VoiceAssetFailedPayload; @@ -1343,8 +1343,8 @@ export interface WebhookPayloadMap { export interface WebhookEventOf { readonly id: string; - readonly session: string; - /** Integrator reference from the QuickLink that created the session, when supplied. */ + readonly connection: string; + /** Integrator reference from the QuickLink that created the connection, when supplied. */ readonly externalId?: string; readonly timestamp: string; readonly event: TEvent; @@ -1373,6 +1373,6 @@ export function isEvent( } /** Canonical capability view after a semantic change, plus the changed keys. */ -export interface SessionCapabilitiesUpdatedPayload extends SessionCapabilities { +export interface ConnectionCapabilitiesUpdatedPayload extends ConnectionCapabilities { readonly changedKeys: readonly string[]; } diff --git a/packages/typescript/src/webhooks/index.ts b/packages/typescript/src/webhooks/index.ts index 2a5ac701f..a5192673b 100644 --- a/packages/typescript/src/webhooks/index.ts +++ b/packages/typescript/src/webhooks/index.ts @@ -104,14 +104,14 @@ export { type PollOption, type PollVotePayload, type PresenceUpdatePayload, - type SessionConnectedPayload, - type SessionLoggedOutPayload, - type SessionLoggedOutReason, - type SessionRestrictionType, - type SessionRestrictionUpdatedPayload, - type SessionPhoneOfflinePayload, - type SessionStatusPayload, - type RuntimeSessionStatusPayload, + type ConnectionConnectedPayload, + type ConnectionLoggedOutPayload, + type ConnectionLoggedOutReason, + type ConnectionRestrictionType, + type ConnectionRestrictionUpdatedPayload, + type ConnectionPhoneOfflinePayload, + type ConnectionStatusPayload, + type RuntimeConnectionStatusPayload, type CloudAccountStatusPayload, type TemplateStatusPayload, type RuntimeTemplateStatusPayload, @@ -124,7 +124,7 @@ export { type WebhookEvent, type WebhookEventOf, type WebhookPayloadMap, - type SessionCapabilitiesUpdatedPayload, + type ConnectionCapabilitiesUpdatedPayload, } from "./events.js"; export { FLOW_FORWARD_SIGNATURE_HEADER, diff --git a/packages/typescript/src/webhooks/verify.ts b/packages/typescript/src/webhooks/verify.ts index 52f715c28..64b33fe7f 100644 --- a/packages/typescript/src/webhooks/verify.ts +++ b/packages/typescript/src/webhooks/verify.ts @@ -111,8 +111,8 @@ function isEventEnvelope(value: unknown): value is UnknownWebhookEvent { const record = value as Record; return ( isNonEmptyString(record.id) && - // Project-scoped events (`customer.*`, `voice.*`) carry an empty session. - typeof record.session === "string" && + // Project-scoped events (`customer.*`, `voice.*`) carry an empty connection. + typeof record.connection === "string" && isNonEmptyString(record.timestamp) && isNonEmptyString(record.event) && Object.hasOwn(record, "payload") diff --git a/packages/typescript/test/analytics.test.ts b/packages/typescript/test/analytics.test.ts index 3046b657e..7c630119e 100644 --- a/packages/typescript/test/analytics.test.ts +++ b/packages/typescript/test/analytics.test.ts @@ -31,11 +31,11 @@ it("reads enabled or disabled analytics and confines a project token without wid projectId: id, baseUrl: server.url, }); - expect((await project.analytics.get({ sessionId: id })).data.enabled).toBe( + expect((await project.analytics.get({ connectionId: id })).data.enabled).toBe( false, ); expect(server.requests[1]?.path).toBe( - `/platform/projects/${id}/analytics?sessionId=${id}`, + `/platform/projects/${id}/analytics?connectionId=${id}`, ); expect(server.requests[1]?.headers.authorization).toContain(PROJECT_TOKEN); expect( @@ -51,7 +51,7 @@ it("reads enabled or disabled analytics and confines a project token without wid root.analytics.get({ start: 10, end: 1 }), ).rejects.toBeInstanceOf(PolymorfaValidationError); await expect( - root.analytics.get({ sessionId: "name" }), + root.analytics.get({ connectionId: "name" }), ).rejects.toBeInstanceOf(PolymorfaValidationError); }); @@ -79,9 +79,9 @@ it("preserves nullable call quality, follow-up coverage and per-number call seri const body = { enabled: true, summary: { calls, accountActivity }, - numbers: [{ sessionId: "number", calls }], + numbers: [{ connectionId: "number", calls }], series: [], - callSeries: [{ sessionId: "number", ts: 1, answered: 1, missed: 1 }], + callSeries: [{ connectionId: "number", ts: 1, answered: 1, missed: 1 }], }; const server = await startTestServer(() => ({ headers: { "content-type": "application/json" }, @@ -121,7 +121,7 @@ it("returns collector text and metadata with validated project filters", async ( windowHours: 6, segments: true, format: "openmetrics", - sessionId: id, + connectionId: id, }); expect(response.data).toBe(body); expect(response.metadata.requestId).toBe("metrics-1"); @@ -136,7 +136,7 @@ it("returns collector text and metadata with validated project filters", async ( { windowHours: 0 }, { windowHours: 169 }, { windowHours: 1.5 }, - { sessionId: "phone" }, + { connectionId: "phone" }, { projectId: "22222222-2222-4333-8444-555555555555" }, ]) await expect(client.analytics.metrics(params)).rejects.toBeInstanceOf( @@ -268,7 +268,7 @@ it("preserves country/count/device receipt activity without changing nullable co const body = { enabled: true, summary: { recipientActivity }, - numbers: [{ sessionId: "number", recipientActivity }], + numbers: [{ connectionId: "number", recipientActivity }], series: [], callSeries: [], }; diff --git a/packages/typescript/test/bansafe-contract.test.ts b/packages/typescript/test/bansafe-contract.test.ts index ed922b517..879b3d71e 100644 --- a/packages/typescript/test/bansafe-contract.test.ts +++ b/packages/typescript/test/bansafe-contract.test.ts @@ -93,7 +93,7 @@ describe("BanSafe canonical contract coverage", () => { ).toEqual([ { method: "POST", - path: "/console/bansafe/enforcement/{session}/appeal", + path: "/console/bansafe/enforcement/{connection}/appeal", operationId: "appealBanSafeEnforcement", }, { diff --git a/packages/typescript/test/bansafe.test.ts b/packages/typescript/test/bansafe.test.ts index 26c7aa1cf..1f56d528d 100644 --- a/packages/typescript/test/bansafe.test.ts +++ b/packages/typescript/test/bansafe.test.ts @@ -15,7 +15,7 @@ import { type BanSafeTelemetryHistoryEnvelope, type DataEnvelope, type ProjectHealthPolicy, - type SessionSafeMode, + type ConnectionSafeMode, type SuccessEnvelope, MessagingBanSafeResource, MessagingClient, @@ -68,15 +68,15 @@ describe("Client BanSafe resources", () => { cursor: "cursor/a", limit: 25, }); - const detail = await client.banSafe.getHealth("session/a"); - const history = await client.banSafe.listHealthHistory("session/a", { + const detail = await client.banSafe.getHealth("connection/a"); + const history = await client.banSafe.listHealthHistory("connection/a", { since: "2026-09-07T00:00:00.000Z", limit: 12, }); const signals = await client.banSafe.listSignals(); - const telemetry = await client.banSafe.getTelemetry("session/a"); + const telemetry = await client.banSafe.getTelemetry("connection/a"); const telemetryHistory = await client.banSafe.listTelemetryHistory( - "session/a", + "connection/a", { since: "2026-09-07T00:00:00.000Z", until: "2026-09-08T00:00:00.000Z", @@ -91,7 +91,7 @@ describe("Client BanSafe resources", () => { }); const actions = await client.banSafe.listHealthActions({ projectId: "project/a", - session: "session/a", + connection: "connection/a", status: "succeeded", cursor: "cursor/d", limit: 25, @@ -122,13 +122,13 @@ describe("Client BanSafe resources", () => { >(); expect(requests.map(({ method, path }) => `${method} ${path}`)).toEqual([ "GET /platform/bansafe/health?projectId=project%2Fa&cursor=cursor%2Fa&limit=25", - "GET /platform/bansafe/health/session%2Fa", - "GET /platform/bansafe/health/session%2Fa/history?since=2026-09-07T00%3A00%3A00.000Z&limit=12", + "GET /platform/bansafe/health/connection%2Fa", + "GET /platform/bansafe/health/connection%2Fa/history?since=2026-09-07T00%3A00%3A00.000Z&limit=12", "GET /platform/bansafe/signals", - "GET /platform/bansafe/telemetry/session%2Fa", - "GET /platform/bansafe/telemetry/session%2Fa/history?since=2026-09-07T00%3A00%3A00.000Z&until=2026-09-08T00%3A00%3A00.000Z&cursor=cursor%2Fb&limit=10", + "GET /platform/bansafe/telemetry/connection%2Fa", + "GET /platform/bansafe/telemetry/connection%2Fa/history?since=2026-09-07T00%3A00%3A00.000Z&until=2026-09-08T00%3A00%3A00.000Z&cursor=cursor%2Fb&limit=10", "GET /platform/bansafe/collection?projectId=project%2Fa&cursor=cursor%2Fc&limit=25", - "GET /platform/bansafe/health-actions?projectId=project%2Fa&session=session%2Fa&status=succeeded&cursor=cursor%2Fd&limit=25", + "GET /platform/bansafe/health-actions?projectId=project%2Fa&connection=connection%2Fa&status=succeeded&cursor=cursor%2Fd&limit=25", ]); }); @@ -136,7 +136,7 @@ describe("Client BanSafe resources", () => { const { client, requests } = await testClient(); await client.banSafe.listFindings({ projectId: "project/a", - session: "session/a", + connection: "connection/a", status: "open", severity: "critical", limit: 5, @@ -147,11 +147,11 @@ describe("Client BanSafe resources", () => { }); await client.banSafe.listIncidents({ projectId: "project/a", - session: "session/a", + connection: "connection/a", }); await client.banSafe.createIncident( { - session: "session/a", + connection: "connection/a", occurredAt: "2026-09-08T00:00:00.000Z", note: "WhatsApp restricted sending", }, @@ -160,29 +160,29 @@ describe("Client BanSafe resources", () => { await client.banSafe.retractIncident("incident/a"); await client.banSafe.listClaims({ projectId: "project/a", - session: "session/a", + connection: "connection/a", status: "under_review", }); await client.banSafe.getClaim("claim/a"); expect(requests.map(({ method, path }) => `${method} ${path}`)).toEqual([ - "GET /platform/bansafe/findings?projectId=project%2Fa&session=session%2Fa&status=open&severity=critical&limit=5", + "GET /platform/bansafe/findings?projectId=project%2Fa&connection=connection%2Fa&status=open&severity=critical&limit=5", "GET /platform/bansafe/enforcement?projectId=project%2Fa&rung=throttle", - "GET /platform/bansafe/incidents?projectId=project%2Fa&session=session%2Fa", + "GET /platform/bansafe/incidents?projectId=project%2Fa&connection=connection%2Fa", "POST /platform/bansafe/incidents", "POST /platform/bansafe/incidents/incident%2Fa/retract", - "GET /platform/bansafe/claims?projectId=project%2Fa&session=session%2Fa&status=under_review", + "GET /platform/bansafe/claims?projectId=project%2Fa&connection=connection%2Fa&status=under_review", "GET /platform/bansafe/claims/claim%2Fa", ]); expect(requests[3]?.headers["idempotency-key"]).toBe("incident/a"); expect(JSON.parse(requests[3]!.body)).toEqual({ - session: "session/a", + connection: "connection/a", occurredAt: "2026-09-08T00:00:00.000Z", note: "WhatsApp restricted sending", }); }); - it("maps project and session safety settings to their typed owners", async () => { + it("maps project and connection safety settings to their typed owners", async () => { const { client, requests } = await testClient(); await client.projects.getSafeMode("project/a"); await client.projects.updateSafeMode("project/a", { pacing: "jittered" }); @@ -201,13 +201,13 @@ describe("Client BanSafe resources", () => { version: 4, enabled: true, threshold: 50, - sessionAction: "slow_down", + connectionAction: "slow_down", slowDownMps: 0.5, emailNotification: true, webhookNotification: true, }); - await client.sessions.getSafeMode("session/a"); - await client.sessions.updateSafeMode("session/a", { typing: "inherit" }); + await client.connections.getSafeMode("connection/a"); + await client.connections.updateSafeMode("connection/a", { typing: "inherit" }); expectTypeOf(policy).toEqualTypeOf< ApiResponse> @@ -221,8 +221,8 @@ describe("Client BanSafe resources", () => { "PUT /platform/projects/project%2Fa/insurance-evidence", "GET /platform/projects/project%2Fa/health-policy", "PUT /platform/projects/project%2Fa/health-policy", - "GET /platform/sessions/session%2Fa/safe-mode", - "PUT /platform/sessions/session%2Fa/safe-mode", + "GET /platform/connections/connection%2Fa/safe-mode", + "PUT /platform/connections/connection%2Fa/safe-mode", ]); }); }); @@ -269,18 +269,18 @@ describe("MessagingClient BanSafe settings", () => { version: 2, enabled: true, threshold: 40, - sessionAction: "stop", + connectionAction: "stop", slowDownMps: null, emailNotification: false, webhookNotification: true, }); - const session = await client.banSafe.getSessionSafeMode("support/eu"); - await client.banSafe.updateSessionSafeMode("support/eu", { + const connection = await client.banSafe.getConnectionSafeMode("support/eu"); + await client.banSafe.updateConnectionSafeMode("support/eu", { reads: "off", }); - expectTypeOf(session).toEqualTypeOf< - ApiResponse> + expectTypeOf(connection).toEqualTypeOf< + ApiResponse> >(); expect(requests.map(({ method, path }) => `${method} ${path}`)).toEqual([ "GET /messaging/projects/project%2Fa/safe-mode", @@ -312,7 +312,7 @@ describe("MessagingClient BanSafe settings", () => { PolymorfaConfigurationError, ); expect(() => - client.banSafe.updateSessionSafeMode("support", { pacing: "off" }), + client.banSafe.updateConnectionSafeMode("support", { pacing: "off" }), ).toThrow(PolymorfaConfigurationError); expect(requests).toEqual([]); diff --git a/packages/typescript/test/billing-contract.test.ts b/packages/typescript/test/billing-contract.test.ts index 5943e708c..0861dcb4b 100644 --- a/packages/typescript/test/billing-contract.test.ts +++ b/packages/typescript/test/billing-contract.test.ts @@ -1,7 +1,7 @@ import { readFileSync } from "node:fs"; import { expect, it } from "vitest"; -it("keeps reviewed billing and session administration in the canonical Platform contract", () => { +it("keeps reviewed billing and connection administration in the canonical Platform contract", () => { const spec = JSON.parse( readFileSync( new URL("../../../contracts/openapi.platform.json", import.meta.url), @@ -9,28 +9,28 @@ it("keeps reviewed billing and session administration in the canonical Platform ), ); expect(spec.paths["/platform/billing/reminders"]).toBeUndefined(); - expect(spec.components.schemas.PlatformSession.required).toContain( + expect(spec.components.schemas.PlatformConnection.required).toContain( "paidUntil", ); expect( - spec.components.schemas.PlatformSession.properties.paidUntil, + spec.components.schemas.PlatformConnection.properties.paidUntil, ).toMatchObject({ type: "number", nullable: true }); expect( - spec.paths["/platform/sessions/{sessionId}/start"].post.responses["402"], + spec.paths["/platform/connections/{connectionId}/start"].post.responses["402"], ).toBeDefined(); - expect(spec.components.schemas.SessionTierOverrideRequest.required).toEqual([ + expect(spec.components.schemas.ConnectionTierOverrideRequest.required).toEqual([ "quoteId", ]); expect(spec.components.schemas.NumberTierQuoteRequest.required).toEqual([ "tierOverride", ]); - expect(spec.paths["/platform/sessions/{sessionId}"].get.operationId).toBe( - "getSession", + expect(spec.paths["/platform/connections/{connectionId}"].get.operationId).toBe( + "getConnection", ); - expect(spec.paths["/platform/sessions/{sessionId}"].put.operationId).toBe( - "updateSession", + expect(spec.paths["/platform/connections/{connectionId}"].put.operationId).toBe( + "updateConnection", ); expect( - spec.paths["/platform/sessions/{sessionId}/tier-quotes"].post.operationId, - ).toBe("quoteSessionTierChange"); + spec.paths["/platform/connections/{connectionId}/tier-quotes"].post.operationId, + ).toBe("quoteConnectionTierChange"); }); diff --git a/packages/typescript/test/billing-tier-change.test.ts b/packages/typescript/test/billing-tier-change.test.ts index 58b0ab688..1353ab657 100644 --- a/packages/typescript/test/billing-tier-change.test.ts +++ b/packages/typescript/test/billing-tier-change.test.ts @@ -5,7 +5,7 @@ import { PolymorfaPaymentRequiredError, PolymorfaValidationError, } from "../src/errors.js"; -import type { SessionTierOverrideRequest } from "../src/platform/types.js"; +import type { ConnectionTierOverrideRequest } from "../src/platform/types.js"; import { TEAM_API_KEY } from "./support/credentials.js"; import { startTestServer, type TestServer } from "./support/http-server.js"; @@ -47,23 +47,23 @@ it("reviews, explicitly confirms, and reads the durable tier result without roun }), })); const sdk = client(server); - const reviewed = await sdk.sessions.quoteTierChange("number/a", { + const reviewed = await sdk.connections.quoteTierChange("number/a", { tierOverride: "pro", }); expect(reviewed.data.data.quote.amountCents).toBe(25.2); expect(server.requests).toHaveLength(1); - const queued = await sdk.sessions.setTierOverride( + const queued = await sdk.connections.setTierOverride( "number/a", { quoteId: reviewed.data.data.id }, { idempotencyKey: "confirm-1" }, ); expect(queued.data.data.status).toBe("queued"); - const applied = await sdk.sessions.retrieveTierChange("number/a", quote.id); + const applied = await sdk.connections.retrieveTierChange("number/a", quote.id); expect(applied.data.data.status).toBe("applied"); expect(server.requests.map((r) => `${r.method} ${r.path}`)).toEqual([ - "POST /platform/sessions/number%2Fa/tier-quotes", - "PATCH /platform/sessions/number%2Fa", - `GET /platform/sessions/number%2Fa/tier-quotes/${quote.id}`, + "POST /platform/connections/number%2Fa/tier-quotes", + "PATCH /platform/connections/number%2Fa", + `GET /platform/connections/number%2Fa/tier-quotes/${quote.id}`, ]); expect(server.requests[1]?.body).toBe(JSON.stringify({ quoteId: quote.id })); expect(server.requests[1]?.headers["idempotency-key"]).toBe("confirm-1"); @@ -73,9 +73,9 @@ it("rejects the old unquoted JavaScript call before making a request", async () const server = await startTestServer(() => ({ body: "{}" })); const sdk = client(server); expect(() => - sdk.sessions.setTierOverride("number", { + sdk.connections.setTierOverride("number", { tierOverride: "pro", - } as unknown as SessionTierOverrideRequest), + } as unknown as ConnectionTierOverrideRequest), ).toThrow(PolymorfaValidationError); expect(server.requests).toHaveLength(0); }); @@ -89,7 +89,7 @@ it("preserves quote expiry conflicts without creating or confirming a replacemen })); const sdk = client(server); await expect( - sdk.sessions.setTierOverride("number", { quoteId: quote.id }), + sdk.connections.setTierOverride("number", { quoteId: quote.id }), ).rejects.toBeInstanceOf(PolymorfaConflictError); expect(server.requests).toHaveLength(1); }); @@ -112,7 +112,7 @@ it("exposes insufficient funding as a payment-required error without retrying a }, body: '{"error":{"type":"permission_error","code":"entitlement_required","message":"The account needs the required entitlement for this action.","param":null},"data":null,"docs":"https://docs.polymorfa.com/api/errors#entitlement-required"}', })); - await expect(client(server).sessions.start("number")).rejects.toMatchObject({ + await expect(client(server).connections.start("number")).rejects.toMatchObject({ name: PolymorfaPaymentRequiredError.name, status: 402, code: "entitlement_required", diff --git a/packages/typescript/test/business.test.ts b/packages/typescript/test/business.test.ts index 25b5d6a58..6aabbc01b 100644 --- a/packages/typescript/test/business.test.ts +++ b/packages/typescript/test/business.test.ts @@ -52,11 +52,11 @@ describe("MessagingClient business", () => { it("maps profile, compliance, linked-account, and eligibility operations", async () => { const { client, requests } = await businessServer(); const business = client.business; - const session = "sales/eu"; + const connection = "sales/eu"; - const profile = await business.getProfile(session); + const profile = await business.getProfile(connection); await business.updateProfile( - session, + connection, { address: "12 Market Street", email: "care@example.com", @@ -77,11 +77,11 @@ describe("MessagingClient business", () => { mutationOptions, ); await business.setCoverPhoto( - session, + connection, { url: "https://cdn.example/cover.jpg" }, mutationOptions, ); - await business.deleteCoverPhoto(session, "cover/100", mutationOptions); + await business.deleteCoverPhoto(connection, "cover/100", mutationOptions); const compliance = { entityName: "Example Tea SARL", entityType: "PRIVATE_COMPANY", @@ -99,10 +99,10 @@ describe("MessagingClient business", () => { mobileNumber: "+96170000000", }, } as const; - await business.getMerchantCompliance(session); - await business.setMerchantCompliance(session, compliance, mutationOptions); - await business.getLinkedAccounts(session); - const eligibility = await business.getEligibility(session); + await business.getMerchantCompliance(connection); + await business.setMerchantCompliance(connection, compliance, mutationOptions); + await business.getLinkedAccounts(connection); + const eligibility = await business.getEligibility(connection); expectTypeOf< MessagingClient["business"] @@ -164,22 +164,22 @@ describe("MessagingClient business", () => { it("maps catalog and product reads and mutations without inventing uploads", async () => { const { client, requests } = await businessServer(); const business = client.business; - const session = "sales/eu"; + const connection = "sales/eu"; const id = "15551234567@s.whatsapp.net"; const productId = "tea/1"; - await business.getCatalog(session, { + await business.getCatalog(connection, { id, after: "next page", limit: 25, width: 640, height: 480, }); - await business.createCatalog(session, mutationOptions); - await business.setCartEnabled(session, { enabled: false }, mutationOptions); - await business.getProduct(session, productId, { id }); + await business.createCatalog(connection, mutationOptions); + await business.setCartEnabled(connection, { enabled: false }, mutationOptions); + await business.getProduct(connection, productId, { id }); await business.createProduct( - session, + connection, { name: "Mint tea", currency: "USD", @@ -189,7 +189,7 @@ describe("MessagingClient business", () => { mutationOptions, ); await business.updateProduct( - session, + connection, productId, { name: "Mint tea", @@ -201,15 +201,15 @@ describe("MessagingClient business", () => { }, mutationOptions, ); - await business.deleteProduct(session, productId, mutationOptions); + await business.deleteProduct(connection, productId, mutationOptions); await business.setProductVisibility( - session, + connection, productId, { hidden: false }, mutationOptions, ); await business.appealProduct( - session, + connection, productId, { reason: "Incorrect rejection" }, mutationOptions, @@ -269,11 +269,11 @@ describe("MessagingClient business", () => { it("maps collection cursors, mutations, and authenticated order lookup", async () => { const { client, requests } = await businessServer(); const business = client.business; - const session = "sales/eu"; + const connection = "sales/eu"; const id = "15551234567@lid"; const collectionId = "summer/1"; - await business.listCollections(session, { + await business.listCollections(connection, { id, after: "collections next", collectionLimit: 10, @@ -281,7 +281,7 @@ describe("MessagingClient business", () => { width: 512, height: 512, }); - await business.getCollection(session, collectionId, { + await business.getCollection(connection, collectionId, { id, after: "items next", limit: 20, @@ -289,12 +289,12 @@ describe("MessagingClient business", () => { height: 240, }); await business.createCollection( - session, + connection, { name: "Summer", productIds: ["tea/1"] }, mutationOptions, ); await business.updateCollection( - session, + connection, collectionId, { name: "Cold drinks", @@ -303,22 +303,22 @@ describe("MessagingClient business", () => { }, mutationOptions, ); - await business.deleteCollection(session, collectionId, mutationOptions); + await business.deleteCollection(connection, collectionId, mutationOptions); await business.reorderCollections( - session, + connection, { moves: [{ collectionId, fromIndex: 2, toIndex: 0 }], }, mutationOptions, ); await business.appealCollection( - session, + connection, collectionId, { reason: "Products comply" }, mutationOptions, ); await business.getOrder( - session, + connection, "order/1", { token: "opaque order token" }, mutationOptions, @@ -373,72 +373,72 @@ describe("MessagingClient business", () => { it("preserves idempotency on every non-GET Business App operation", async () => { const { client, requests } = await businessServer(); const business = client.business; - const session = "sales"; + const connection = "sales"; - await business.updateProfile(session, { address: "" }, mutationOptions); + await business.updateProfile(connection, { address: "" }, mutationOptions); await business.setCoverPhoto( - session, + connection, { base64: "aW1hZ2U=" }, mutationOptions, ); - await business.deleteCoverPhoto(session, "cover", mutationOptions); - await business.createCatalog(session, mutationOptions); - await business.setCartEnabled(session, { enabled: true }, mutationOptions); + await business.deleteCoverPhoto(connection, "cover", mutationOptions); + await business.createCatalog(connection, mutationOptions); + await business.setCartEnabled(connection, { enabled: true }, mutationOptions); await business.createProduct( - session, + connection, { name: "Tea", images: [{ base64: "aW1hZ2U=" }] }, mutationOptions, ); await business.updateProduct( - session, + connection, "tea", { name: "Tea", images: [{ base64: "aW1hZ2U=" }] }, mutationOptions, ); - await business.deleteProduct(session, "tea", mutationOptions); + await business.deleteProduct(connection, "tea", mutationOptions); await business.setProductVisibility( - session, + connection, "tea", { hidden: true }, mutationOptions, ); await business.appealProduct( - session, + connection, "tea", { reason: "Review" }, mutationOptions, ); await business.createCollection( - session, + connection, { name: "Tea", productIds: ["tea"] }, mutationOptions, ); await business.updateCollection( - session, + connection, "tea", { name: "Tea" }, mutationOptions, ); - await business.deleteCollection(session, "tea", mutationOptions); + await business.deleteCollection(connection, "tea", mutationOptions); await business.reorderCollections( - session, + connection, { moves: [{ collectionId: "tea", fromIndex: 0, toIndex: 1 }] }, mutationOptions, ); await business.appealCollection( - session, + connection, "tea", { reason: "Review" }, mutationOptions, ); await business.getOrder( - session, + connection, "order", { token: "token" }, mutationOptions, ); await business.setMerchantCompliance( - session, + connection, { entityName: "Tea", entityType: "SOLE_PROPRIETORSHIP", diff --git a/packages/typescript/test/call-consent.test.ts b/packages/typescript/test/call-consent.test.ts index 67bac8fd2..c40c69c39 100644 --- a/packages/typescript/test/call-consent.test.ts +++ b/packages/typescript/test/call-consent.test.ts @@ -488,7 +488,7 @@ describe("call permissions", () => { expect(state.actions?.startCall?.allowed).toBe(true); }); - it("requires a server credential and a session", () => { + it("requires a server credential and a connection", () => { const fetch = vi.fn(); expect(() => messagingClient(fetch, "clientToken").voip.retrieveCallPermission( @@ -523,7 +523,7 @@ describe("call permissions", () => { Response.json({ success: true, data: check }), ); const result = await messagingClient(fetch).voip.check({ - session: "support", + connection: "support", to: "+14155550123", }); @@ -531,7 +531,7 @@ describe("call permissions", () => { const sent = request(fetch); expect(sent.method).toBe("POST"); expect(sent.url.pathname).toBe("/messaging/voip/calls/check"); - expect(sent.body).toEqual({ session: "support", to: "+14155550123" }); + expect(sent.body).toEqual({ connection: "support", to: "+14155550123" }); }); it("surfaces unavailable call-check state as a typed server error", async () => { @@ -546,7 +546,7 @@ describe("call permissions", () => { ), ); const failure = await messagingClient(fetch) - .voip.check({ session: "support", to: "+14155550123" }) + .voip.check({ connection: "support", to: "+14155550123" }) .catch((error: unknown) => error); expect(failure).toBeInstanceOf(PolymorfaServerError); @@ -562,14 +562,14 @@ describe("call permissions", () => { const fetch = vi.fn(); const messaging = messagingClient(fetch); expect(() => - messaging.voip.check({ session: "", to: "+14155550123" }), + messaging.voip.check({ connection: "", to: "+14155550123" }), ).toThrow(PolymorfaValidationError); - expect(() => messaging.voip.check({ session: "support", to: "" })).toThrow( + expect(() => messaging.voip.check({ connection: "support", to: "" })).toThrow( PolymorfaValidationError, ); expect(() => messagingClient(fetch, "clientToken").voip.check({ - session: "support", + connection: "support", to: "+14155550123", }), ).toThrow(PolymorfaConfigurationError); @@ -691,7 +691,7 @@ describe("refused placements", () => { }), ); const failure = await messagingClient(fetch) - .voip.place({ session: "support", to: "+14155550123" }) + .voip.place({ connection: "support", to: "+14155550123" }) .catch((error: unknown) => error); expect(failure).toBeInstanceOf(PolymorfaAuthorizationError); diff --git a/packages/typescript/test/calls-coverage-end.test.ts b/packages/typescript/test/calls-coverage-end.test.ts index 51910bcda..2d13e141c 100644 --- a/packages/typescript/test/calls-coverage-end.test.ts +++ b/packages/typescript/test/calls-coverage-end.test.ts @@ -3,7 +3,7 @@ import { describe, expect, it } from "vitest"; import { MessagingClient, PolymorfaValidationError, - type UpdateSessionCallSettingsRequest, + type UpdateConnectionCallSettingsRequest, } from "../src/index.js"; import { TEAM_API_KEY } from "./support/credentials.js"; @@ -31,7 +31,7 @@ describe("call settings coverage end is response-only", () => { maxNetworkRetries: 0, fetch: async (input, init) => { expect(String(input)).toBe( - "https://api.example/platform/sessions/support/call-settings", + "https://api.example/platform/connections/support/call-settings", ); expect(init?.method).toBe(method); if (method === "PUT") @@ -76,7 +76,7 @@ describe("call settings coverage end is response-only", () => { const body = { callsEnabled: false, ...extra, - } as unknown as UpdateSessionCallSettingsRequest; + } as unknown as UpdateConnectionCallSettingsRequest; expect(() => client.voip.updateCallSettings("support", body)).toThrow( PolymorfaValidationError, ); diff --git a/packages/typescript/test/calls-simultaneous-calls-contract.test.ts b/packages/typescript/test/calls-simultaneous-calls-contract.test.ts index 908fc0301..561bfb409 100644 --- a/packages/typescript/test/calls-simultaneous-calls-contract.test.ts +++ b/packages/typescript/test/calls-simultaneous-calls-contract.test.ts @@ -5,8 +5,8 @@ import type { BanSafeClaim, BanSafeClaimEvidence, BanSafeClaimVerdict, - SessionCallSettings, - UpdateSessionCallSettingsRequest, + ConnectionCallSettings, + UpdateConnectionCallSettingsRequest, WebhookPayloadMap, } from "../src/index.js"; @@ -80,7 +80,7 @@ describe("simultaneous calls contract supplement", () => { "simultaneousCalls", "revision", "updatedAt", - ] satisfies (keyof SessionCallSettings)[] + ] satisfies (keyof ConnectionCallSettings)[] ).sort(), ); expect(platform.PlatformAccessCallSettings!.required).toContain( @@ -98,17 +98,17 @@ describe("simultaneous calls contract supplement", () => { "simultaneousCalls", "acknowledgeRisk", "expectedRevision", - ] satisfies (keyof UpdateSessionCallSettingsRequest)[] + ] satisfies (keyof UpdateConnectionCallSettingsRequest)[] ).sort(), ); expectTypeOf< - SessionCallSettings["simultaneousCalls"] + ConnectionCallSettings["simultaneousCalls"] >().toEqualTypeOf(); expectTypeOf< - UpdateSessionCallSettingsRequest["simultaneousCalls"] + UpdateConnectionCallSettingsRequest["simultaneousCalls"] >().toEqualTypeOf(); expectTypeOf< - UpdateSessionCallSettingsRequest["acknowledgeRisk"] + UpdateConnectionCallSettingsRequest["acknowledgeRisk"] >().toEqualTypeOf(); }); diff --git a/packages/typescript/test/campaign-20261014-contract.test.ts b/packages/typescript/test/campaign-20261014-contract.test.ts index 65242162c..abca55ebc 100644 --- a/packages/typescript/test/campaign-20261014-contract.test.ts +++ b/packages/typescript/test/campaign-20261014-contract.test.ts @@ -31,7 +31,7 @@ import { startTestServer, type TestServer } from "./support/http-server.js"; const projectId = "018f0000-0000-7000-8000-000000000001"; const campaignId = "018f0000-0000-7000-8000-000000000002"; const flowId = "018f0000-0000-7000-8000-000000000003"; -const sessionId = "018f0000-0000-7000-8000-000000000004"; +const connectionId = "018f0000-0000-7000-8000-000000000004"; const customerId = "018f0000-0000-7000-8000-000000000005"; const jobId = "018f0000-0000-7000-8000-000000000006"; const phone = "+15551234567"; @@ -61,7 +61,7 @@ const profile = { tags: ["interested"], attributes: { plan: "pro", count: 1, enabled: false, empty: null }, }; -const testSend = { sessionId, to: phone, variables: {} }; +const testSend = { connectionId, to: phone, variables: {} }; const custody: SignalCustodyDefault = { signalModeDefault: null, effectiveSignalMode: "standard", @@ -176,7 +176,7 @@ function successFixture(operation: string): unknown { id: jobId, campaignId, status: "sent", - from: { sessionId, phone }, + from: { connectionId, phone }, to: phone, messageId: null, variables: {}, @@ -1084,7 +1084,7 @@ describe("2026-10-14 typed campaign and custody consumers", () => { id: jobId, campaignId, status: "sent", - from: { sessionId, phone }, + from: { connectionId, phone }, messageId: null, createdAt: 1, }, @@ -1147,7 +1147,7 @@ describe("2026-10-14 typed campaign and custody consumers", () => { "idempotent-replayed": "true", }, body: JSON.stringify({ - error: { code, message: "Refused", param: "sessionId" }, + error: { code, message: "Refused", param: "connectionId" }, }), })); servers.push(server); @@ -1160,7 +1160,7 @@ describe("2026-10-14 typed campaign and custody consumers", () => { await expect(result).rejects.toMatchObject({ code, requestId: "failed-request", - param: "sessionId", + param: "connectionId", metadata: { headers: { "retry-after": "3", diff --git a/packages/typescript/test/channels.test.ts b/packages/typescript/test/channels.test.ts index 20efbb0a3..4b0662b52 100644 --- a/packages/typescript/test/channels.test.ts +++ b/packages/typescript/test/channels.test.ts @@ -59,13 +59,13 @@ describe("MessagingClient channels", () => { it("maps the complete Channels tag with exact query, body, and identifier shapes", async () => { const { client, requests } = await channelsServer(); const channels = client.channels; - const session = "support/eu"; + const connection = "support/eu"; const channelId = "120363/7@newsletter"; const mutationOptions = { idempotencyKey: "channel-action-1" }; - const listed = await channels.list(session); + const listed = await channels.list(connection); const created = await channels.create( - session, + connection, { name: "Product updates", description: "New releases", @@ -73,39 +73,39 @@ describe("MessagingClient channels", () => { }, mutationOptions, ); - const retrieved = await channels.retrieve(session, channelId); - const deleted = await channels.delete(session, channelId, mutationOptions); - const messages = await channels.listMessages(session, channelId, { + const retrieved = await channels.retrieve(connection, channelId); + const deleted = await channels.delete(connection, channelId, mutationOptions); + const messages = await channels.listMessages(connection, channelId, { count: 25, before: 91, }); - const updates = await channels.listMessageUpdates(session, channelId, { + const updates = await channels.listMessageUpdates(connection, channelId, { count: 10, since: 1_787_212_800, after: 92, }); const viewed = await channels.markMessageViewed( - session, + connection, channelId, "93", mutationOptions, ); const reacted = await channels.reactToMessage( - session, + connection, channelId, "94", { reaction: "🔥" }, mutationOptions, ); const liveUpdates = await channels.subscribeToLiveUpdates( - session, + connection, channelId, mutationOptions, ); - await channels.follow(session, channelId, mutationOptions); - await channels.unfollow(session, channelId, mutationOptions); - await channels.mute(session, channelId, mutationOptions); - await channels.unmute(session, channelId, mutationOptions); + await channels.follow(connection, channelId, mutationOptions); + await channels.unfollow(connection, channelId, mutationOptions); + await channels.mute(connection, channelId, mutationOptions); + await channels.unmute(connection, channelId, mutationOptions); expectTypeOf< MessagingClient["channels"] diff --git a/packages/typescript/test/client.test.ts b/packages/typescript/test/client.test.ts index da1758bad..9ab94f8ec 100644 --- a/packages/typescript/test/client.test.ts +++ b/packages/typescript/test/client.test.ts @@ -246,7 +246,7 @@ describe("durable developer resources", () => { await expect( client.webhooks.test("team-hook", { body, - sessionId: "session-id", + connectionId: "session-id", } as unknown as TestTeamWebhookInput), ).rejects.toBeInstanceOf(PolymorfaValidationError); expect(requests).toEqual([]); @@ -258,7 +258,7 @@ describe("durable developer resources", () => { ); await project.webhooks.test( "project-hook", - { eventType: "message.received", body, sessionId: "session-id" }, + { eventType: "message.received", body, connectionId: "session-id" }, { idempotencyKey: "project-test-1" }, ); @@ -268,7 +268,7 @@ describe("durable developer resources", () => { ]); expect(requests.map(({ body }) => JSON.parse(body))).toEqual([ { eventType: "customer.created" }, - { eventType: "message.received", body, sessionId: "session-id" }, + { eventType: "message.received", body, connectionId: "session-id" }, ]); expect(requests.map(({ headers }) => headers["idempotency-key"])).toEqual([ "team-test-1", diff --git a/packages/typescript/test/cloud-operations.test.ts b/packages/typescript/test/cloud-operations.test.ts index ce3cdbddd..a0b55bf82 100644 --- a/packages/typescript/test/cloud-operations.test.ts +++ b/packages/typescript/test/cloud-operations.test.ts @@ -70,7 +70,7 @@ describe("Official API operations", () => { const link = { quicklinkId: "ql_123", url: "https://pair.example/secret-link", - session: "support/eu", + connection: "support/eu", }; const data = [state, pricing, health, link]; let index = 0; @@ -85,17 +85,17 @@ describe("Official API operations", () => { ).toEqual(state); expect( ( - await sdk.sessions.getMetaPricing("support/eu", { + await sdk.connections.getMetaPricing("support/eu", { since: pricing.since, until: pricing.until, }) ).data.data, ).toEqual(pricing); expect( - (await sdk.sessions.getCloudCredentialHealth("support/eu")).data.data, + (await sdk.connections.getCloudCredentialHealth("support/eu")).data.data, ).toEqual(health); expect( - (await sdk.sessions.reauthorizeCloudCredentials("support/eu")).data + (await sdk.connections.reauthorizeCloudCredentials("support/eu")).data .data, ).toEqual(link); expect(server.requests.map((r) => `${r.method} ${r.path}`)).toEqual([ @@ -113,9 +113,9 @@ describe("Official API operations", () => { const sdk = client(server, "clientToken"); for (const request of [ () => sdk.chats.getServiceWindow("support", "+5511999999999"), - () => sdk.sessions.getMetaPricing("support"), - () => sdk.sessions.getCloudCredentialHealth("support"), - () => sdk.sessions.reauthorizeCloudCredentials("support"), + () => sdk.connections.getMetaPricing("support"), + () => sdk.connections.getCloudCredentialHealth("support"), + () => sdk.connections.reauthorizeCloudCredentials("support"), ]) expect(request).toThrow(); expect(server.requests).toHaveLength(0); @@ -130,7 +130,7 @@ describe("Official API operations", () => { })); servers.push(server); await expect( - client(server).sessions.reauthorizeCloudCredentials("support", { + client(server).connections.reauthorizeCloudCredentials("support", { idempotencyKey: "same-key", maxNetworkRetries: 4, }), diff --git a/packages/typescript/test/cloud-templates.test.ts b/packages/typescript/test/cloud-templates.test.ts index 33d08ff42..15cea72d5 100644 --- a/packages/typescript/test/cloud-templates.test.ts +++ b/packages/typescript/test/cloud-templates.test.ts @@ -47,7 +47,7 @@ describe("Cloud templates", () => { const template = { id: "tpl_1", tenantId: "team_1", - session: "support/eu", + connection: "support/eu", wabaId: "12345678901234567890", name: "delivery/name", language: "pt_BR", @@ -175,7 +175,7 @@ describe("Cloud templates", () => { client(server).templates.submit( "support", "tpl/1", - { session: "number_123" }, + { connection: "number_123" }, { idempotencyKey: "customer-key", maxNetworkRetries: 3 }, ), ).rejects.toMatchObject({ status: 500 }); diff --git a/packages/typescript/test/session-capabilities.test.ts b/packages/typescript/test/connection-capabilities.test.ts similarity index 84% rename from packages/typescript/test/session-capabilities.test.ts rename to packages/typescript/test/connection-capabilities.test.ts index 09bbcc631..3724800e7 100644 --- a/packages/typescript/test/session-capabilities.test.ts +++ b/packages/typescript/test/connection-capabilities.test.ts @@ -5,8 +5,8 @@ import { PolymorfaAuthorizationError, type ApiResponse, type DataEnvelope, - type SessionCapabilities, - type SessionCapability, + type ConnectionCapabilities, + type ConnectionCapability, } from "../src/index.js"; import { TEAM_API_KEY } from "./support/credentials.js"; import { startTestServer, type TestServer } from "./support/http-server.js"; @@ -34,10 +34,10 @@ async function client(status: number, body: unknown) { }; } -describe("Client.sessions.getCapabilities", () => { +describe("Client.connections.getCapabilities", () => { it("reads a number's capabilities and narrows values by kind", async () => { const data = { - session: "support", + connection: "support", projectId: "11111111-2222-4333-8444-555555555555", status: "synced", syncedAt: "2026-09-24T10:00:00.000Z", @@ -61,18 +61,18 @@ describe("Client.sessions.getCapabilities", () => { ], }; const { client: platform, requests } = await client(200, { data }); - const response = await platform.sessions.getCapabilities("support/a"); + const response = await platform.connections.getCapabilities("support/a"); expectTypeOf(response).toEqualTypeOf< - ApiResponse> + ApiResponse> >(); expect(requests.map(({ method, path }) => `${method} ${path}`)).toEqual([ - "GET /platform/sessions/support%2Fa/capabilities", + "GET /platform/connections/support%2Fa/capabilities", ]); expect(response.data.data).toEqual(data); const limits = response.data.data.capabilities.filter( ( capability, - ): capability is Extract => + ): capability is Extract => capability.kind === "limit", ); expectTypeOf(limits[0]!.value).toEqualTypeOf(); @@ -82,7 +82,7 @@ describe("Client.sessions.getCapabilities", () => { it("returns unknown values as null before the first sync", async () => { const { client: platform } = await client(200, { data: { - session: "support", + connection: "support", projectId: "11111111-2222-4333-8444-555555555555", status: "unknown", syncedAt: null, @@ -99,7 +99,7 @@ describe("Client.sessions.getCapabilities", () => { ], }, }); - const response = await platform.sessions.getCapabilities("support"); + const response = await platform.connections.getCapabilities("support"); expect(response.data.data.status).toBe("unknown"); expect(response.data.data.capabilities[0]!.value).toBeNull(); }); @@ -112,7 +112,7 @@ describe("Client.sessions.getCapabilities", () => { }, }); await expect( - platform.sessions.getCapabilities("support"), + platform.connections.getCapabilities("support"), ).rejects.toBeInstanceOf(PolymorfaAuthorizationError); }); }); diff --git a/packages/typescript/test/session-configuration.test.ts b/packages/typescript/test/connection-configuration.test.ts similarity index 83% rename from packages/typescript/test/session-configuration.test.ts rename to packages/typescript/test/connection-configuration.test.ts index 95e4656cf..aa269740d 100644 --- a/packages/typescript/test/session-configuration.test.ts +++ b/packages/typescript/test/connection-configuration.test.ts @@ -2,7 +2,7 @@ import { describe, expect, it, vi } from "vitest"; import { Client, MessagingClient } from "../src/index.js"; import { TEAM_API_KEY } from "./support/credentials.js"; -describe("session configuration", () => { +describe("connection configuration", () => { it("binds defaults to the selected project and preserves resets and revisions", async () => { const fetch = vi.fn(async () => Response.json({ data: { effective: {}, revisions: { project: 2 } } }), @@ -11,8 +11,8 @@ describe("session configuration", () => { credential: { type: "teamApiKey", value: TEAM_API_KEY }, fetch, }); - await client.sessionConfiguration.retrieve(); - await client.project("project-a").sessionConfiguration.update({ + await client.connectionConfiguration.retrieve(); + await client.project("project-a").connectionConfiguration.update({ revision: 2, configuration: { reset: ["historySync.mode"] }, }); @@ -29,7 +29,7 @@ describe("session configuration", () => { const client = new MessagingClient({ credential: { type: "apiKey", value: TEAM_API_KEY }, }); - expect(client.sessions).not.toHaveProperty("create"); + expect(client.connections).not.toHaveProperty("create"); expect(client.quickLinks.create).toBeTypeOf("function"); }); }); diff --git a/packages/typescript/test/contract-shapes.test.ts b/packages/typescript/test/contract-shapes.test.ts index 5c0d31a90..d21e6bf74 100644 --- a/packages/typescript/test/contract-shapes.test.ts +++ b/packages/typescript/test/contract-shapes.test.ts @@ -196,7 +196,7 @@ describe("SDK types match the pinned contract snapshots", () => { billingControls: true, purpose: true, connectionGoal: true, - session: true, + connection: true, addConnection: true, projectId: true, customerId: true, @@ -230,7 +230,7 @@ describe("SDK types match the pinned contract snapshots", () => { addConnection: true, id: true, url: true, - session: true, + connection: true, expiresAt: true, }), ).toEqual(properties(messaging, "QuickLink")); @@ -243,7 +243,7 @@ describe("SDK types match the pinned contract snapshots", () => { onboarding: true, id: true, status: true, - session: true, + connection: true, expiresAt: true, openedAt: true, connectedAt: true, @@ -314,7 +314,7 @@ describe("SDK types match the pinned contract snapshots", () => { template: true, target_reference: true, only_eligible_transport: true, - session_rule: true, + connection_rule: true, project_rule: true, team_rule: true, default_linked_devices: true, diff --git a/packages/typescript/test/coverage-issues.test.ts b/packages/typescript/test/coverage-issues.test.ts index b7bb9b563..9dca71aba 100644 --- a/packages/typescript/test/coverage-issues.test.ts +++ b/packages/typescript/test/coverage-issues.test.ts @@ -67,7 +67,7 @@ describe("coverage issue synchronizer", () => { "dev", "messaging", "GET", - "/messaging/sessions", + "/messaging/connections", ); const staleMarker = marker("dev", "platform", "GET", "/platform/old"); const server = await startTestServer((request) => { @@ -143,13 +143,13 @@ describe("coverage issue synchronizer", () => { { family: "messaging", method: "GET", - path: "/messaging/sessions", - operationId: "listSessions", + path: "/messaging/connections", + operationId: "listConnections", fingerprint: "a".repeat(64), status: "changed", typescript: { status: "covered", - method: "MessagingClient.sessions.list", + method: "MessagingClient.connections.list", }, }, { diff --git a/packages/typescript/test/coverage-reconciliation.test.ts b/packages/typescript/test/coverage-reconciliation.test.ts index fd0fb4bac..652931bcb 100644 --- a/packages/typescript/test/coverage-reconciliation.test.ts +++ b/packages/typescript/test/coverage-reconciliation.test.ts @@ -58,7 +58,7 @@ const calls = [ method: "place", args: [ { - session: "support", + connection: "support", to: "+15550100", video: false, exclusive: true, @@ -67,7 +67,7 @@ const calls = [ { idempotencyKey: "place-555" }, ], body: { - session: "support", + connection: "support", to: "+15550100", video: false, exclusive: true, @@ -76,7 +76,7 @@ const calls = [ status: 201, response: { success: true, - data: { callId, session: "support", video: false }, + data: { callId, connection: "support", video: false }, }, }, { @@ -156,8 +156,8 @@ const calls = [ { operationId: "checkCall", method: "check", - args: [{ session: "support/eu", to: "+14155550123" }], - body: { session: "support/eu", to: "+14155550123" }, + args: [{ connection: "support/eu", to: "+14155550123" }], + body: { connection: "support/eu", to: "+14155550123" }, status: 200, response: { success: true, @@ -304,7 +304,7 @@ describe("reconciled coverage evidence", () => { expect(new URL(url).pathname).toBe( mapping.path .replace("{id}", encodeURIComponent(callId)) - .replace("{session}", encodeURIComponent("support/eu")) + .replace("{connection}", encodeURIComponent("support/eu")) .replace("{to}", encodeURIComponent("+14155550123")), ); expect(init.method).toBe(mapping.method); @@ -325,7 +325,7 @@ describe("reconciled coverage evidence", () => { }, ); - it("retires session answer modes and calling tickets", () => { + it("retires connection answer modes and calling tickets", () => { for (const operationId of [ "voipSetMode", "voipToken", @@ -407,7 +407,7 @@ describe("reconciled coverage evidence", () => { paths: Record>; }; expect(platform.paths[operation.path]!.get!.security).toEqual([ - { ConsoleSession: [] }, + { ConsoleConnection: [] }, ]); }); @@ -431,7 +431,7 @@ describe("reconciled coverage evidence", () => { expect( platform.paths[operation.path]![operation.method.toLowerCase()]! .security, - ).toEqual([{ ConsoleSession: [] }]); + ).toEqual([{ ConsoleConnection: [] }]); } }); @@ -459,7 +459,7 @@ describe("reconciled coverage evidence", () => { platform.paths[operation.path]![operation.method.toLowerCase()]! .security, operationId, - ).toEqual([{ ConsoleSession: [] }]); + ).toEqual([{ ConsoleConnection: [] }]); } }); }); diff --git a/packages/typescript/test/coverage.test.ts b/packages/typescript/test/coverage.test.ts index 4db4cf91b..a3186033a 100644 --- a/packages/typescript/test/coverage.test.ts +++ b/packages/typescript/test/coverage.test.ts @@ -317,14 +317,14 @@ describe("coverage checker", () => { }); }); - it("maps batch session lifecycle to the team-key client", () => { + it("maps batch connection lifecycle to the team-key client", () => { const ledger = JSON.parse(readFileSync(repositoryLedger, "utf8")) as { operations: Array<{ operationId: string; typescript: { status: string; method?: string }; }>; }; - const operationIds = ["stopSessions", "deleteSessions"]; + const operationIds = ["stopConnections", "deleteConnections"]; const mappings = Object.fromEntries( ledger.operations .filter(({ operationId }) => operationIds.includes(operationId)) @@ -332,8 +332,8 @@ describe("coverage checker", () => { ); expect(mappings).toEqual({ - deleteSessions: "Client.sessions.deleteMany", - stopSessions: "Client.sessions.stopMany", + deleteConnections: "Client.connections.deleteMany", + stopConnections: "Client.connections.stopMany", }); }); @@ -366,7 +366,7 @@ describe("coverage checker", () => { }, }), BrowserMessagingClient: new BrowserMessagingClient({ - session: "coverage", + connection: "coverage", getClientToken: async () => "pmfa_ct_coverage", }), }; @@ -487,8 +487,8 @@ describe("coverage checker", () => { getBusinessProduct: "MessagingClient.business.getProduct", getProjectObservationPolicy: "MessagingClient.observationPolicies.retrieveForProject", - getSessionObservationPolicy: - "MessagingClient.observationPolicies.retrieveForSession", + getConnectionObservationPolicy: + "MessagingClient.observationPolicies.retrieveForConnection", getOwnBusinessProfile: "MessagingClient.business.getProfile", reorderBusinessCollections: "MessagingClient.business.reorderCollections", setBusinessCartEnabled: "MessagingClient.business.setCartEnabled", @@ -629,7 +629,7 @@ describe("coverage checker", () => { "checkCall", "getCallPermission", "getUserSecurityCode", - "listSessionCalls", + "listConnectionCalls", "rejectCall", "resolveIdentity", ]); @@ -654,8 +654,8 @@ describe("coverage checker", () => { "listApiKeys", "listMembers", "listAuditLogs", - "listSessionBans", - "listActiveSessionBans", + "listConnectionBans", + "listActiveConnectionBans", "listSecurityIncidents", "acknowledgeSecurityIncident", "getPlatformOperation", @@ -683,13 +683,13 @@ describe("coverage checker", () => { status: "covered", method: "Client.auditLogs.list", }, - listSessionBans: { + listConnectionBans: { status: "covered", - method: "Client.sessionBans.list", + method: "Client.connectionBans.list", }, - listActiveSessionBans: { + listActiveConnectionBans: { status: "covered", - method: "Client.sessionBans.listActive", + method: "Client.connectionBans.listActive", }, listSecurityIncidents: { status: "covered", diff --git a/packages/typescript/test/customers.test.ts b/packages/typescript/test/customers.test.ts index 1d8960420..9c9bea9f1 100644 --- a/packages/typescript/test/customers.test.ts +++ b/packages/typescript/test/customers.test.ts @@ -138,7 +138,7 @@ describe("Client customers", () => { ); await client.customers.transferNumber( "customer/a", - "session/a", + "connection/a", { projectId: "project/a", sourceCustomerId: "customer/source", @@ -155,7 +155,7 @@ describe("Client customers", () => { "POST /platform/customers/customer%2Fa/pairing-links", "GET /platform/customers/customer%2Fa/pairing-links?projectId=project%2Fa", "DELETE /platform/customers/customer%2Fa/pairing-links/link%2Fa?projectId=project%2Fa", - "POST /platform/customers/customer%2Fa/numbers/session%2Fa/transfer", + "POST /platform/customers/customer%2Fa/numbers/connection%2Fa/transfer", ]); expect(requests[0]?.headers["idempotency-key"]).toBe("archive-1"); expect(requests[1]?.headers["idempotency-key"]).toBe("restore-1"); diff --git a/packages/typescript/test/delivery-41-contract.test.ts b/packages/typescript/test/delivery-41-contract.test.ts index 51d582362..ad7ce1371 100644 --- a/packages/typescript/test/delivery-41-contract.test.ts +++ b/packages/typescript/test/delivery-41-contract.test.ts @@ -19,15 +19,15 @@ it("selects delivery intent versions without changing legacy reset or explicit v credential: { type: "teamApiKey", value: TEAM_API_KEY }, baseUrl: server.url, }).project(projectId); - await c.sessionConfiguration.update({ + await c.connectionConfiguration.update({ configuration: { set: { historySync: { delivery: "descriptor" } } }, revision: 0, } as never); - await c.sessionConfiguration.update({ + await c.connectionConfiguration.update({ configuration: { reset: ["historySync"] }, revision: 0, }); - await c.sessionConfiguration.update( + await c.connectionConfiguration.update( { configuration: { reset: ["historySync.delivery"] }, revision: 0, @@ -47,7 +47,7 @@ it("selects delivery intent versions without changing legacy reset or explicit v }); it("keeps QuickLink omission, explicit modes and descriptor consent distinct", async () => { const server = await startTestServer(() => ({ - body: '{"success":true,"data":{"purpose":"initial","connectionGoal":"single","id":"link","url":"https://example.test/link","session":"session","expiresAt":null}}', + body: '{"success":true,"data":{"purpose":"initial","connectionGoal":"single","id":"link","url":"https://example.test/link","connection":"connection","expiresAt":null}}', })); servers.push(server); const m = new MessagingClient({ @@ -100,7 +100,7 @@ it("rejects archive writes, nested custody aliases and supplementary custody bef }).project(projectId); const calls = [ () => - c.sessionConfiguration.update({ + c.connectionConfiguration.update({ configuration: { set: { historySync: { delivery: "archive" } } }, revision: 0, } as never), @@ -111,7 +111,7 @@ it("rejects archive writes, nested custody aliases and supplementary custody bef () => m.quickLinks.create({ purpose: "add_connection", - session: "x", + connection: "x", addConnection: "official_api", signalMode: "standard", } as never), @@ -170,7 +170,7 @@ it("refuses Client direct upload before reading input, keeps relay and custom tr const custom = { name: "customer", async upload( - _session: string, + _connection: string, body: import("../src/index.js").WhatsAppEncryptedUploadBody, ) { const reader = (await body.open()).getReader(); @@ -284,8 +284,8 @@ it("retains A/B configuration owners through interleaved reads, writes and calle credential: { type: "teamApiKey", value: TEAM_API_KEY }, baseUrl: server.url, }); - const a = c.project(projectId).sessionConfiguration, - b = c.project(otherId).sessionConfiguration; + const a = c.project(projectId).connectionConfiguration, + b = c.project(otherId).connectionConfiguration; await a.retrieve({ apiVersion: "2026-10-14" }); await b.update({ revision: 0, @@ -316,7 +316,7 @@ it("retains A/B configuration owners through interleaved reads, writes and calle expect(server.requests).toHaveLength(4); }); -it("retains old and new configuration reads, requested/effective divergence and optional session custody facts", async () => { +it("retains old and new configuration reads, requested/effective divergence and optional connection custody facts", async () => { const observation = { presenceMode: "off", typingMode: "off", @@ -345,10 +345,10 @@ it("retains old and new configuration reads, requested/effective divergence and "observation.labelMode": "platform", "observation.quickReplyMode": "platform", }, - revisions: { team: 0, project: 0, session: 0 }, + revisions: { team: 0, project: 0, connection: 0 }, }; - const session = { - sessionId: projectId, + const connection = { + connectionId: projectId, name: "Synthetic Number", tenantId: projectId, type: "linked_device", @@ -363,7 +363,7 @@ it("retains old and new configuration reads, requested/effective divergence and body: JSON.stringify( request.path.includes("session-configuration") ? { data: configuration } - : { success: true, data: session }, + : { success: true, data: connection }, ), }; }); @@ -372,12 +372,12 @@ it("retains old and new configuration reads, requested/effective divergence and credential: { type: "teamApiKey", value: TEAM_API_KEY }, baseUrl: server.url, }); - const legacy = (await c.project(projectId).sessionConfiguration.retrieve()) + const legacy = (await c.project(projectId).connectionConfiguration.retrieve()) .data; const current = ( await c .project(projectId) - .sessionConfiguration.retrieve({ apiVersion: "2026-10-14" }) + .connectionConfiguration.retrieve({ apiVersion: "2026-10-14" }) ).data; expect(legacy.requestedHistory).not.toHaveProperty("delivery"); expect(current.requestedHistory).toEqual({ @@ -392,13 +392,13 @@ it("retains old and new configuration reads, requested/effective divergence and }); expect(current.sources["historySync.delivery"]).toBe("platform"); expect( - (await c.sessions.retrieve(projectId)).data.data.signalMode, + (await c.connections.retrieve(projectId)).data.data.signalMode, ).toBeUndefined(); expect( - (await c.sessions.retrieve(projectId, { apiVersion: "2026-10-14" })).data + (await c.connections.retrieve(projectId, { apiVersion: "2026-10-14" })).data .data.signalMode, ).toBe("zero_knowledge"); - const updated = await c.sessions.update(projectId, { + const updated = await c.connections.update(projectId, { revision: 0, configuration: { set: { historySync: { delivery: "descriptor" } } }, }); @@ -414,7 +414,7 @@ it("retains old and new configuration reads, requested/effective divergence and { configuration: { set: { signalMode: "zero_knowledge" } } }, ]) expect(() => - c.sessions.update(projectId, { + c.connections.update(projectId, { revision: 0, configuration: {}, ...extra, diff --git a/packages/typescript/test/direct-media-upload.test.ts b/packages/typescript/test/direct-media-upload.test.ts index 962f054c3..0df64aee1 100644 --- a/packages/typescript/test/direct-media-upload.test.ts +++ b/packages/typescript/test/direct-media-upload.test.ts @@ -133,13 +133,13 @@ describe("customer-owned media upload over native HTTP", () => { value: { success: true, data: location }, })); const result = await client(api.url).whatsappMedia.upload( - "session/id", + "connection/id", plaintext, { mediaType }, ); const request = api.requests[0]!; expect(request.url.pathname).toBe( - "/messaging/session%2Fid/media/uploads", + "/messaging/connection%2Fid/media/uploads", ); expect(request.url.searchParams.get("type")).toBe(type); expect(request.url.searchParams.get("ptt")).toBe( @@ -335,7 +335,7 @@ describe("customer-owned media upload over native HTTP", () => { ); }); - it("sends a pre-uploaded descriptor through the standard-session message API", async () => { + it("sends a pre-uploaded descriptor through the standard-connection message API", async () => { const api = await server((request) => ({ value: request.url.pathname.endsWith("/media/uploads") ? { success: true, data: location } diff --git a/packages/typescript/test/error-body.test.ts b/packages/typescript/test/error-body.test.ts index 123051f87..d8e0a6a22 100644 --- a/packages/typescript/test/error-body.test.ts +++ b/packages/typescript/test/error-body.test.ts @@ -143,7 +143,7 @@ describe("error codes", () => { "new_chat_limit_reached", "whatsapp_account_restricted", "bansafe_throttled", - "session_not_ready", + "connection_not_ready", ]) { expect(isKnownPolymorfaErrorCode(code), code).toBe(true); } @@ -238,7 +238,7 @@ describe("error codes", () => { "campaign_approval_required", "campaign_approval_stale", "campaign_variables_missing", - "zero_knowledge_session", + "zero_knowledge_connection", ]; const supplement = await readFile( new URL( diff --git a/packages/typescript/test/event-stream.test.ts b/packages/typescript/test/event-stream.test.ts index 2f0685e4b..a99e87b54 100644 --- a/packages/typescript/test/event-stream.test.ts +++ b/packages/typescript/test/event-stream.test.ts @@ -13,7 +13,7 @@ const PROJECT = "018f0000-0000-7000-8000-000000000077"; function webhookBody(id: string, type = "message.received") { return { id, - session: "support", + connection: "support", timestamp: "2026-09-18T10:00:00.000Z", event: type, payload: { text: "hello" }, @@ -151,13 +151,13 @@ describe("events.stream", () => { ) as unknown as typeof fetch; const items = await collect( projectClient(fetcher).events.stream({ - types: ["message.*", "session.connected"], + types: ["message.*", "connection.connected"], }), 2, ); const url = new URL(requests[0]!.url); expect(url.pathname).toBe(`/platform/projects/${PROJECT}/events/stream`); - expect(url.searchParams.get("types")).toBe("message.*,session.connected"); + expect(url.searchParams.get("types")).toBe("message.*,connection.connected"); expect(requests[0]!.headers.get("accept")).toBe("text/event-stream"); expect(requests[0]!.headers.get("authorization")).toBe( `Bearer ${PROJECT_TOKEN}`, diff --git a/packages/typescript/test/exports.test.ts b/packages/typescript/test/exports.test.ts index 7149a5567..ae1c9dd78 100644 --- a/packages/typescript/test/exports.test.ts +++ b/packages/typescript/test/exports.test.ts @@ -42,7 +42,7 @@ import { PolymorfaRateLimitError, PolymorfaTimeoutError, SecurityIncidentsResource, - SessionBansResource, + ConnectionBansResource, TemplatesResource, UsersResource, VoipResource, @@ -102,20 +102,20 @@ import { type ResolveIdentityParams, type ResponseMetadata, type SecurityIncident, - type SessionBan, - type SessionBatchRequest, + type ConnectionBan, + type ConnectionBatchRequest, type SendMessageRequest, type TemplateDefinition, type TierPricing, type NumberTierChange, type NumberTierQuoteRequest, - type SessionTierOverrideRequest, + type ConnectionTierOverrideRequest, type WebhookEvent, type UserSecurityCode, type TeamQuickLinkSettings, type ProjectQuickLinkSettings, - type SessionCallSettings, - type UpdateSessionCallSettingsRequest, + type ConnectionCallSettings, + type UpdateConnectionCallSettingsRequest, type VoipAcceptCallRequest, type VoipAcceptCallResult, type VoipLeaveCallRequest, @@ -169,7 +169,7 @@ describe("public exports", () => { PolymorfaTimeoutError, PolymorfaCancelledError, SecurityIncidentsResource, - SessionBansResource, + ConnectionBansResource, TemplatesResource, UsersResource, VoipResource, @@ -193,7 +193,7 @@ describe("public exports", () => { expectTypeOf().toHaveProperty("dailyRateCents"); expectTypeOf().toHaveProperty("quote"); expectTypeOf().toHaveProperty("tierOverride"); - expectTypeOf().toHaveProperty("quoteId"); + expectTypeOf().toHaveProperty("quoteId"); expectTypeOf().toHaveProperty("requestId"); expectTypeOf().toHaveProperty("signal"); expectTypeOf().toMatchTypeOf< @@ -219,8 +219,8 @@ describe("public exports", () => { >(); expectTypeOf().toHaveProperty("revokedAt"); expectTypeOf().toHaveProperty("resolution"); - expectTypeOf().toHaveProperty("status"); - expectTypeOf().toHaveProperty("sessionIds"); + expectTypeOf().toHaveProperty("status"); + expectTypeOf().toHaveProperty("connectionIds"); expectTypeOf().toHaveProperty("projectId"); expectTypeOf().toHaveProperty("picture"); expectTypeOf().toHaveProperty("id"); @@ -263,8 +263,8 @@ describe("public exports", () => { expectTypeOf().toHaveProperty("answeredBy"); expectTypeOf().toHaveProperty("connectionId"); expectTypeOf().toHaveProperty("state"); - expectTypeOf().toHaveProperty("conferenceMode"); - expectTypeOf().toHaveProperty( + expectTypeOf().toHaveProperty("conferenceMode"); + expectTypeOf().toHaveProperty( "conferenceMode", ); }); diff --git a/packages/typescript/test/feature-evaluation-contract.test.ts b/packages/typescript/test/feature-evaluation-contract.test.ts index 2f799672b..7fe5dc43e 100644 --- a/packages/typescript/test/feature-evaluation-contract.test.ts +++ b/packages/typescript/test/feature-evaluation-contract.test.ts @@ -208,7 +208,7 @@ describe("feature evaluation contract supplement", () => { ).toEqual([{ BearerAuth: [] }]); for (const path of Object.keys(platform.paths)) expect(operation(platform, path).security, path).toEqual([ - { ConsoleSession: [] }, + { ConsoleConnection: [] }, ]); }); diff --git a/packages/typescript/test/flow-endpoints.test.ts b/packages/typescript/test/flow-endpoints.test.ts index bc65b807d..96f41f8a9 100644 --- a/packages/typescript/test/flow-endpoints.test.ts +++ b/packages/typescript/test/flow-endpoints.test.ts @@ -35,46 +35,46 @@ async function setup(status = 200) { describe("dynamic Flow endpoints", () => { it("binds project identity on endpoint, receipt and key paths", async () => { const { server, flows } = await setup(); - await flows.endpoint(flowId, { sessionId: "support" }); + await flows.endpoint(flowId, { connectionId: "support" }); await flows.setEndpoint(flowId, { - sessionId: "support", + connectionId: "support", mode: "forward", url: "https://example.com/flow", }); await flows.setEndpoint(flowId, { - sessionId: "support", + connectionId: "support", mode: "function", functionId: "fn", deploymentId: null, }); await flows.setEndpoint(flowId, { - sessionId: "support", + connectionId: "support", mode: "direct", url: "https://example.com/direct", expectedRevision: 2, }); - await flows.deleteEndpoint(flowId, { sessionId: "support" }); - await flows.endpointReceipts(flowId, { sessionId: "support", limit: 10 }); - await flows.encryptionKey({ sessionId: "support" }); - await flows.rotateEncryptionKey({ sessionId: "support" }); + await flows.deleteEndpoint(flowId, { connectionId: "support" }); + await flows.endpointReceipts(flowId, { connectionId: "support", limit: 10 }); + await flows.encryptionKey({ connectionId: "support" }); + await flows.rotateEncryptionKey({ connectionId: "support" }); expect(server.requests.map((r) => `${r.method} ${r.path}`)).toEqual([ - `GET /platform/flows/${flowId}/endpoint?sessionId=support&projectId=${projectId}`, + `GET /platform/flows/${flowId}/endpoint?connectionId=support&projectId=${projectId}`, `PUT /platform/flows/${flowId}/endpoint`, `PUT /platform/flows/${flowId}/endpoint`, `PUT /platform/flows/${flowId}/endpoint`, - `DELETE /platform/flows/${flowId}/endpoint?sessionId=support&projectId=${projectId}`, - `GET /platform/flows/${flowId}/endpoint/receipts?sessionId=support&limit=10&projectId=${projectId}`, - `GET /platform/flow-encryption-keys?sessionId=support&projectId=${projectId}`, + `DELETE /platform/flows/${flowId}/endpoint?connectionId=support&projectId=${projectId}`, + `GET /platform/flows/${flowId}/endpoint/receipts?connectionId=support&limit=10&projectId=${projectId}`, + `GET /platform/flow-encryption-keys?connectionId=support&projectId=${projectId}`, "POST /platform/flow-encryption-keys/rotate", ]); expect(JSON.parse(server.requests[1]!.body)).toEqual({ - sessionId: "support", + connectionId: "support", mode: "forward", url: "https://example.com/flow", projectId, }); expect(JSON.parse(server.requests[7]!.body)).toEqual({ - sessionId: "support", + connectionId: "support", projectId, }); }); @@ -83,13 +83,13 @@ describe("dynamic Flow endpoints", () => { const { server, flows } = await setup(503); await expect( flows.setEndpoint(flowId, { - sessionId: "support", + connectionId: "support", mode: "forward", url: "https://example.com/flow", }), ).rejects.toThrow(); await expect( - flows.rotateEncryptionKey({ sessionId: "support" }), + flows.rotateEncryptionKey({ connectionId: "support" }), ).rejects.toThrow(); expect(server.requests).toHaveLength(2); }); @@ -97,21 +97,21 @@ describe("dynamic Flow endpoints", () => { it("validates input before transport", async () => { const { server, flows } = await setup(); const bad: SetFlowEndpointRequest[] = [ - { sessionId: "", mode: "forward", url: "https://example.com" }, - { sessionId: "s", mode: "forward", url: "http://example.com" }, - { sessionId: "s", mode: "forward", url: "https://" }, - { sessionId: "s", mode: "direct", url: "https://user:pw@example.com" }, - { sessionId: "s", mode: "direct", url: "https://example.com/#x" }, - { sessionId: "s", mode: "function", functionId: "" }, + { connectionId: "", mode: "forward", url: "https://example.com" }, + { connectionId: "s", mode: "forward", url: "http://example.com" }, + { connectionId: "s", mode: "forward", url: "https://" }, + { connectionId: "s", mode: "direct", url: "https://user:pw@example.com" }, + { connectionId: "s", mode: "direct", url: "https://example.com/#x" }, + { connectionId: "s", mode: "function", functionId: "" }, { - sessionId: "s", + connectionId: "s", mode: "direct", url: "https://example.com", expectedRevision: 0, }, - { sessionId: "s", mode: "other" } as unknown as SetFlowEndpointRequest, + { connectionId: "s", mode: "other" } as unknown as SetFlowEndpointRequest, { - sessionId: "s", + connectionId: "s", mode: "forward", url: "https://example.com", projectId: "x", @@ -122,8 +122,8 @@ describe("dynamic Flow endpoints", () => { expect(() => flows.endpointReceipts(flowId, { limit: 101 })).toThrow( "limit", ); - expect(() => flows.rotateEncryptionKey({ sessionId: " " })).toThrow( - "sessionId", + expect(() => flows.rotateEncryptionKey({ connectionId: " " })).toThrow( + "connectionId", ); expect(server.requests).toHaveLength(0); const typed: FlowEndpointSetResult["signingSecret"] = undefined; diff --git a/packages/typescript/test/flows.test.ts b/packages/typescript/test/flows.test.ts index 364bb6100..a3b798c99 100644 --- a/packages/typescript/test/flows.test.ts +++ b/packages/typescript/test/flows.test.ts @@ -35,7 +35,7 @@ describe("project Flow lifecycle", () => { "Flow ID is required", ); expect(() => - flows.upload(null as unknown as string, { sessionId: "support" }), + flows.upload(null as unknown as string, { connectionId: "support" }), ).toThrow("Flow ID is required"); for (const expectedUpdatedAt of [undefined, NaN, Infinity, -Infinity]) { expect(() => @@ -68,7 +68,7 @@ describe("project Flow lifecycle", () => { "sync", ] as const) { await flows[method]("flow/eu", { - sessionId: "support", + connectionId: "support", categories: ["APPOINTMENT_BOOKING"], requestId: "22222222-2222-4222-8222-222222222222", }); @@ -114,7 +114,7 @@ describe("project Flow lifecycle", () => { expect(() => flows.upload("flow", { flowId: "another", - sessionId: "support", + connectionId: "support", } as FlowProviderRequest), ).toThrow("override"); expect(server.requests).toHaveLength(0); @@ -132,7 +132,7 @@ describe("project Flow lifecycle", () => { await expect( client(server).flows[action]( "flow", - { sessionId: "support" }, + { connectionId: "support" }, { idempotencyKey: "request", maxNetworkRetries: 4 }, ), ).rejects.toMatchObject({ status: 503 }); @@ -153,7 +153,7 @@ describe("project Flow lifecycle", () => { })); servers.push(server); const response = await client(server).flows.upload("flow", { - sessionId: "support", + connectionId: "support", }); expectTypeOf(response.data).toEqualTypeOf(); expect(response.data).toEqual(data); @@ -222,7 +222,7 @@ describe("project Flow reads", () => { it("keeps project tokens bound, rejects malformed IDs locally, and preserves API authorization errors", async () => { const fetch = vi.fn(async () => Response.json( - { error: { code: "forbidden", message: "Missing sessions:read" } }, + { error: { code: "forbidden", message: "Missing connections:read" } }, { status: 403 }, ), ); diff --git a/packages/typescript/test/group-capabilities.test.ts b/packages/typescript/test/group-capabilities.test.ts index c12fa087a..a4730bfae 100644 --- a/packages/typescript/test/group-capabilities.test.ts +++ b/packages/typescript/test/group-capabilities.test.ts @@ -2,7 +2,7 @@ import { afterEach, describe, it, expect, expectTypeOf } from "vitest"; import { MessagingClient, type GroupCapabilities, - type SessionCapabilitiesUpdatedPayload, + type ConnectionCapabilitiesUpdatedPayload, isEvent, type WebhookEvent, } from "../src/index.js"; @@ -52,9 +52,9 @@ describe("group capabilities", () => { }); it("narrows capability changes to the canonical number view", () => { const event = { - event: "session.capabilities_updated", + event: "connection.capabilities_updated", payload: { - session: "support", + connection: "support", projectId: "00000000-0000-4000-8000-000000000001", status: "unknown", syncedAt: null, @@ -64,10 +64,10 @@ describe("group capabilities", () => { changedKeys: ["polls.endTime"], }, } as WebhookEvent; - expect(isEvent(event, "session.capabilities_updated")).toBe(true); - if (isEvent(event, "session.capabilities_updated")) + expect(isEvent(event, "connection.capabilities_updated")).toBe(true); + if (isEvent(event, "connection.capabilities_updated")) expectTypeOf( event.payload, - ).toEqualTypeOf(); + ).toEqualTypeOf(); }); }); diff --git a/packages/typescript/test/groups.test.ts b/packages/typescript/test/groups.test.ts index bdaca0d41..08ea677ae 100644 --- a/packages/typescript/test/groups.test.ts +++ b/packages/typescript/test/groups.test.ts @@ -111,14 +111,14 @@ describe("MessagingClient groups", () => { it("maps every group read with encoded identifiers and response metadata", async () => { const { client, requests } = await groupsServer(); - const session = "support/eu"; + const connection = "support/eu"; const groupId = "120363/group@g.us"; - const listed = await client.groups.list(session, { apiVersion: "next" }); - await client.groups.retrieve(session, groupId); - await client.groups.getJoinInfo(session, "invite/code"); - await client.groups.getInviteCode(session, groupId); - await client.groups.listParticipants(session, groupId); + const listed = await client.groups.list(connection, { apiVersion: "next" }); + await client.groups.retrieve(connection, groupId); + await client.groups.getJoinInfo(connection, "invite/code"); + await client.groups.getInviteCode(connection, groupId); + await client.groups.listParticipants(connection, groupId); expectTypeOf(listed).toEqualTypeOf>(); expect(listed.metadata.requestId).toBe("req_groups"); @@ -134,18 +134,18 @@ describe("MessagingClient groups", () => { it("maps group lifecycle mutations and preserves idempotency options", async () => { const { client, requests } = await groupsServer(); - const session = "support/eu"; + const connection = "support/eu"; const groupId = "120363/group@g.us"; const options = { idempotencyKey: "group-lifecycle" } as const; await client.groups.create( - session, + connection, { name: "Support", participants: ["15551234567"] }, options, ); - await client.groups.join(session, { code: "invite/code" }, options); - await client.groups.delete(session, groupId, options); - await client.groups.leave(session, groupId, options); + await client.groups.join(connection, { code: "invite/code" }, options); + await client.groups.delete(connection, groupId, options); + await client.groups.leave(connection, groupId, options); expect(requests.map(({ method, path }) => `${method} ${path}`)).toEqual([ "POST /messaging/support%2Feu/groups", @@ -169,15 +169,15 @@ describe("MessagingClient groups", () => { it("maps participant administration with exact request bodies", async () => { const { client, requests } = await groupsServer(); - const session = "support"; + const connection = "support"; const groupId = "120363@g.us"; const body = { participants: ["15551234567", "15557654321"] } as const; const options = { idempotencyKey: "group-participants" } as const; - await client.groups.addParticipants(session, groupId, body, options); - await client.groups.removeParticipants(session, groupId, body, options); - await client.groups.promoteParticipants(session, groupId, body, options); - await client.groups.demoteParticipants(session, groupId, body, options); + await client.groups.addParticipants(connection, groupId, body, options); + await client.groups.removeParticipants(connection, groupId, body, options); + await client.groups.promoteParticipants(connection, groupId, body, options); + await client.groups.demoteParticipants(connection, groupId, body, options); expect(requests.map(({ method, path }) => `${method} ${path}`)).toEqual([ "POST /messaging/support/groups/120363%40g.us/participants/add", @@ -195,49 +195,49 @@ describe("MessagingClient groups", () => { it("maps group profile, invite, and permission mutations", async () => { const { client, requests } = await groupsServer(); - const session = "support"; + const connection = "support"; const groupId = "120363@g.us"; const options = { idempotencyKey: "group-settings" } as const; await client.groups.setSubject( - session, + connection, groupId, { value: "Support" }, options, ); await client.groups.setDescription( - session, + connection, groupId, { value: "Customer support" }, options, ); - await client.groups.revokeInviteCode(session, groupId, options); + await client.groups.revokeInviteCode(connection, groupId, options); await client.groups.setPicture( - session, + connection, groupId, { url: "https://cdn.example.test/group.jpg" }, options, ); await client.groups.setInfoEditing( - session, + connection, groupId, { adminsOnly: true }, options, ); await client.groups.setMessaging( - session, + connection, groupId, { adminsOnly: false }, options, ); await client.groups.setMemberAddMode( - session, + connection, groupId, { mode: "all_member_add" }, options, ); await client.groups.setJoinApproval( - session, + connection, groupId, { required: true }, options, diff --git a/packages/typescript/test/hybrid-link.test.ts b/packages/typescript/test/hybrid-link.test.ts index 0db487419..2bc601270 100644 --- a/packages/typescript/test/hybrid-link.test.ts +++ b/packages/typescript/test/hybrid-link.test.ts @@ -12,9 +12,9 @@ it("serializes scoped routing revisions and pause guards exactly", async () => { fetch, }); await client.hybridLink.getPolicy({ - scope: "session", + scope: "connection", projectId: "project/1", - session: "number/1", + connection: "number/1", }); await client.hybridLink.setPolicy( { scope: "team" }, @@ -30,7 +30,7 @@ it("serializes scoped routing revisions and pause guards exactly", async () => { paused: true, }); expect(fetch.mock.calls.map((call) => String(call[0]))).toEqual([ - "https://api.example.test/messaging/routing/hybrid?scope=session&projectId=project%2F1&session=number%2F1", + "https://api.example.test/messaging/routing/hybrid?scope=connection&projectId=project%2F1&connection=number%2F1", "https://api.example.test/messaging/routing/hybrid?scope=team", "https://api.example.test/messaging/number%2F1/hybrid-link", "https://api.example.test/messaging/number%2F1/hybrid-link", diff --git a/packages/typescript/test/hybrid-tier-transitions.test.ts b/packages/typescript/test/hybrid-tier-transitions.test.ts index 8c6682717..dc08c6150 100644 --- a/packages/typescript/test/hybrid-tier-transitions.test.ts +++ b/packages/typescript/test/hybrid-tier-transitions.test.ts @@ -101,11 +101,11 @@ describe("Hybrid Link tier transitions", () => { }), }), })); - await client(server).sessions.quoteTierChange(SURVIVOR, body); + await client(server).connections.quoteTierChange(SURVIVOR, body); expect(server.requests).toHaveLength(1); expect(server.requests[0]?.method).toBe("POST"); expect(server.requests[0]?.path).toBe( - `/platform/sessions/${SURVIVOR}/tier-quotes`, + `/platform/connections/${SURVIVOR}/tier-quotes`, ); expect(JSON.parse(server.requests[0]!.body)).toEqual(body); }); @@ -114,7 +114,7 @@ describe("Hybrid Link tier transitions", () => { const server = await startTestServer(() => ({ body: "{}" })); const sdk = client(server); expect(() => - sdk.sessions.quoteTierChange(SURVIVOR, { + sdk.connections.quoteTierChange(SURVIVOR, { tierOverride: "pro", hybridResolution: { action: "keep", transport: "linked_devices" }, hybridMerge: { absorbNumberId: ABSORBED }, @@ -163,7 +163,7 @@ describe("Hybrid Link tier transitions", () => { const sdk = client(server); const seen: NumberHybridTransition[] = []; for (let i = 0; i < 3; i += 1) { - const read = await sdk.sessions.retrieveTierChange( + const read = await sdk.connections.retrieveTierChange( SURVIVOR, "01994234-0000-7000-8000-000000000001", ); @@ -198,7 +198,7 @@ describe("Hybrid Link tier transitions", () => { }, }), })); - const read = await client(server).sessions.retrieveTierChange( + const read = await client(server).connections.retrieveTierChange( SURVIVOR, "01994234-0000-7000-8000-000000000001", ); @@ -235,7 +235,7 @@ describe("Hybrid Link tier transitions", () => { }), })); const sdk = client(server); - const failed = (await sdk.sessions.retrieveTierChange(SURVIVOR, "q")).data + const failed = (await sdk.connections.retrieveTierChange(SURVIVOR, "q")).data .data.quote.hybridTransition!; expect(failed).toMatchObject({ action: "keep", @@ -243,7 +243,7 @@ describe("Hybrid Link tier transitions", () => { failureReason: "hybrid_transition.runtime_unconfirmed", }); const merge = ( - await sdk.sessions.quoteTierChange(SURVIVOR, { + await sdk.connections.quoteTierChange(SURVIVOR, { tierOverride: "pro", hybridMerge: { absorbNumberId: ABSORBED }, }) @@ -285,7 +285,7 @@ describe("Hybrid Link tier transitions", () => { }), })); const error = await client(server) - .sessions.quoteTierChange(SURVIVOR, { tierOverride: "standard" }) + .connections.quoteTierChange(SURVIVOR, { tierOverride: "standard" }) .then( () => undefined, (caught: unknown) => caught, diff --git a/packages/typescript/test/labels.test.ts b/packages/typescript/test/labels.test.ts index d84b4c448..03df5f75a 100644 --- a/packages/typescript/test/labels.test.ts +++ b/packages/typescript/test/labels.test.ts @@ -99,7 +99,7 @@ describe("MessagingClient labels", () => { expectTypeOf().toEqualTypeOf(); }); - it("lists session and chat labels with observation envelopes and encoded identifiers", async () => { + it("lists connection and chat labels with observation envelopes and encoded identifiers", async () => { const { client, requests } = await labelsServer(); const listed = await client.labels.list( diff --git a/packages/typescript/test/media.test.ts b/packages/typescript/test/media.test.ts index 4c95ae653..c4e5cc9b8 100644 --- a/packages/typescript/test/media.test.ts +++ b/packages/typescript/test/media.test.ts @@ -47,7 +47,7 @@ describe("MessagingClient media", () => { it("exports the exact metadata shape and a distinct Messaging resource", () => { expectTypeOf().toEqualTypeOf<{ readonly id: string; - readonly session: string; + readonly connection: string; readonly messageId: string; readonly mimeType: string; readonly fileLength: number; @@ -107,7 +107,7 @@ describe("MessagingClient media", () => { success: true, data: { id: "media/id", - session: "support", + connection: "support", messageId: "message-1", mimeType: "image/jpeg", fileLength: 5, diff --git a/packages/typescript/test/messages.test.ts b/packages/typescript/test/messages.test.ts index 21acc0c37..31c92db4a 100644 --- a/packages/typescript/test/messages.test.ts +++ b/packages/typescript/test/messages.test.ts @@ -173,7 +173,7 @@ describe("MessagingClient message types", () => { describe("MessagingClient message routes", () => { it("sends typed text, media, location, contact, poll, buttons, list, and template bodies through the one source route", async () => { const { client, requests } = await messagesServer(); - const session = "support/eu"; + const connection = "support/eu"; const sends: readonly SendMessageRequest[] = [ { @@ -237,7 +237,7 @@ describe("MessagingClient message routes", () => { ]; for (const body of sends) { - await client.messages.send(session, body, { + await client.messages.send(connection, body, { idempotencyKey: `send-${Object.keys(body.content)[0]}`, apiVersion: "next", }); diff --git a/packages/typescript/test/messaging-idempotency.test.ts b/packages/typescript/test/messaging-idempotency.test.ts index cf04e3b2a..7c534d5ae 100644 --- a/packages/typescript/test/messaging-idempotency.test.ts +++ b/packages/typescript/test/messaging-idempotency.test.ts @@ -113,7 +113,7 @@ describe("Idempotency-Key on messaging writes", () => { campaignId: "018f0000-0000-7000-8000-000000000002", status: "sent", from: { - sessionId: "018f0000-0000-7000-8000-000000000003", + connectionId: "018f0000-0000-7000-8000-000000000003", phone: "+15550001111", }, to: "+15550001112", @@ -132,7 +132,7 @@ describe("Idempotency-Key on messaging writes", () => { const projectId = "018f0000-0000-7000-8000-000000000004"; const campaignId = "018f0000-0000-7000-8000-000000000002"; const body = { - sessionId: "018f0000-0000-7000-8000-000000000003", + connectionId: "018f0000-0000-7000-8000-000000000003", to: "+15550001112", variables: {}, }; @@ -274,7 +274,7 @@ describe("Idempotency-Key on messaging writes", () => { "content-type": "application/json", "retry-after": "0", }, - body: '{"error":{"code":"session_not_ready"}}', + body: '{"error":{"code":"connection_not_ready"}}', } : ok, 2, diff --git a/packages/typescript/test/messaging.test.ts b/packages/typescript/test/messaging.test.ts index 8a5eda747..4fa118792 100644 --- a/packages/typescript/test/messaging.test.ts +++ b/packages/typescript/test/messaging.test.ts @@ -46,10 +46,10 @@ async function messagingServer(): Promise<{ }; } -describe("MessagingClient sessions", () => { - it("lists sessions and creates new ones through QuickLink", async () => { +describe("MessagingClient connections", () => { + it("lists connections and creates new ones through QuickLink", async () => { const { client, requests } = await messagingServer(); - await client.sessions.list(); + await client.connections.list(); await client.quickLinks.create({ projectId: "project_1", configuration: { @@ -58,36 +58,36 @@ describe("MessagingClient sessions", () => { }, }); expect(requests.map(({ method, path }) => `${method} ${path}`)).toEqual([ - "GET /platform/sessions", + "GET /platform/connections", "POST /messaging/quicklinks", ]); - expect(client.sessions).not.toHaveProperty("create"); + expect(client.connections).not.toHaveProperty("create"); }); - it("encodes session identifiers for lifecycle and account operations", async () => { + it("encodes connection identifiers for lifecycle and account operations", async () => { const { client, requests } = await messagingServer(); const id = "support/eu"; - await client.sessions.retrieve(id); - await client.sessions.update(id, { + await client.connections.retrieve(id); + await client.connections.update(id, { revision: 0, configuration: { set: { historySync: { mode: "deliver" } } }, }); - await client.sessions.start(id); - await client.sessions.stop(id); - await client.sessions.restart(id); - await client.sessions.logout(id); - await client.sessions.delete(id); - await client.sessions.account(id); + await client.connections.start(id); + await client.connections.stop(id); + await client.connections.restart(id); + await client.connections.logout(id); + await client.connections.delete(id); + await client.connections.account(id); expect(requests.map(({ method, path }) => `${method} ${path}`)).toEqual([ - "GET /platform/sessions/support%2Feu", - "PUT /platform/sessions/support%2Feu", - "POST /platform/sessions/support%2Feu/start", - "POST /platform/sessions/support%2Feu/stop", - "POST /platform/sessions/support%2Feu/restart", - "POST /platform/sessions/support%2Feu/logout", - "DELETE /platform/sessions/support%2Feu", - "GET /platform/sessions/support%2Feu/me", + "GET /platform/connections/support%2Feu", + "PUT /platform/connections/support%2Feu", + "POST /platform/connections/support%2Feu/start", + "POST /platform/connections/support%2Feu/stop", + "POST /platform/connections/support%2Feu/restart", + "POST /platform/connections/support%2Feu/logout", + "DELETE /platform/connections/support%2Feu", + "GET /platform/connections/support%2Feu/me", ]); expect(requests[1]?.body).toBe( '{"revision":0,"configuration":{"set":{"historySync":{"mode":"deliver"}}}}', @@ -97,8 +97,8 @@ describe("MessagingClient sessions", () => { it("retrieves JSON pairing data and requests a phone pairing code", async () => { const { client, requests } = await messagingServer(); - const qr = await client.sessions.qr("support/eu", { timeoutMs: 5_000 }); - await client.sessions.requestPairingCode( + const qr = await client.connections.qr("support/eu", { timeoutMs: 5_000 }); + await client.connections.requestPairingCode( "support/eu", { phone: "+15551234567" }, { idempotencyKey: "pair-support-phone" }, @@ -182,7 +182,7 @@ describe("MessagingClient client tokens", () => { await client.clientTokens.mint( { - session: "support/eu", + connection: "support/eu", ephemeralId: "user-1-tab-2", ttlSeconds: 600, }, @@ -201,12 +201,12 @@ describe("MessagingClient client tokens", () => { expect(requests.map(({ method, path }) => `${method} ${path}`)).toEqual([ "POST /platform/client-tokens", - "GET /platform/sessions/support%2Feu/client-rules", - "PUT /platform/sessions/support%2Feu/client-rules", - "DELETE /platform/sessions/support%2Feu/client-rules", + "GET /platform/connections/support%2Feu/client-rules", + "PUT /platform/connections/support%2Feu/client-rules", + "DELETE /platform/connections/support%2Feu/client-rules", ]); expect(requests[0]?.body).toBe( - '{"session":"support/eu","ephemeralId":"user-1-tab-2","ttlSeconds":600}', + '{"connection":"support/eu","ephemeralId":"user-1-tab-2","ttlSeconds":600}', ); expect(requests[0]?.headers["idempotency-key"]).toBe( "browser-user-1-tab-2", @@ -294,21 +294,21 @@ describe("MessagingClient client rules contract", () => { }); describe("MessagingClient Customer-scoped client tokens", () => { - it("serializes a session ceiling including reserved regional beta actions", async () => { + it("serializes a connection ceiling including reserved regional beta actions", async () => { const { client, requests } = await messagingServer(); await client.clientTokens.mint({ - session: "support", + connection: "support", ephemeralId: "u", allow: ["chats_read", "chats_manage", "contact_write", "contact_delete"], }); expect(JSON.parse(requests[0]!.body!)).toEqual({ - session: "support", + connection: "support", ephemeralId: "u", allow: ["chats_read", "chats_manage", "contact_write", "contact_delete"], }); }); - it("sends customer and allow instead of session", async () => { + it("sends customer and allow instead of connection", async () => { const { client, requests } = await messagingServer(); await client.clientTokens.mint({ @@ -328,14 +328,14 @@ describe("MessagingClient Customer-scoped client tokens", () => { it.each([ [ - "both session and customer", + "both connection and customer", { - session: "support", + connection: "support", customer: "0190f0b6-7c1e-7a55-9d1a-2f0c6b1e4a10", ephemeralId: "u", }, ], - ["neither session nor customer", { ephemeralId: "u" }], + ["neither connection nor customer", { ephemeralId: "u" }], ])("rejects %s before transport", async (_label, body) => { const { client, requests } = await messagingServer(); expect(() => @@ -348,17 +348,17 @@ describe("MessagingClient Customer-scoped client tokens", () => { describe("MessagingClient contacts", () => { it("maps the complete contact directory and metadata read surface", async () => { const { client, requests } = await messagingServer(); - const session = "support/eu"; + const connection = "support/eu"; const contactId = "15551234567/1@lid"; - await client.contacts.list(session); - await client.contacts.check(session, ["+15551234567", "+15557654321"]); - await client.contacts.blocklist(session); - await client.contacts.retrieve(session, contactId); - await client.contacts.picture(session, contactId); - await client.contacts.info(session, contactId); - await client.contacts.devices(session, contactId); - await client.contacts.businessProfile(session, contactId); + await client.contacts.list(connection); + await client.contacts.check(connection, ["+15551234567", "+15557654321"]); + await client.contacts.blocklist(connection); + await client.contacts.retrieve(connection, contactId); + await client.contacts.picture(connection, contactId); + await client.contacts.info(connection, contactId); + await client.contacts.devices(connection, contactId); + await client.contacts.businessProfile(connection, contactId); expect(requests.map(({ method, path }) => `${method} ${path}`)).toEqual([ "GET /messaging/support%2Feu/contacts", @@ -405,18 +405,18 @@ describe("MessagingClient contacts", () => { describe("MessagingClient chats", () => { it("maps message editing and deletion with fully encoded identifiers", async () => { const { client, requests } = await messagingServer(); - const session = "support/eu"; + const connection = "support/eu"; const chatId = "15551234567@g.us/team"; const messageId = "message/1"; await client.chats.editMessage( - session, + connection, chatId, messageId, { text: "Corrected copy" }, { idempotencyKey: "edit-message-1" }, ); - await client.chats.deleteMessage(session, chatId, messageId, { + await client.chats.deleteMessage(connection, chatId, messageId, { idempotencyKey: "delete-message-1", }); @@ -431,17 +431,17 @@ describe("MessagingClient chats", () => { it("maps archive state and the exact disappearing-message durations", async () => { const { client, requests } = await messagingServer(); - const session = "support"; + const connection = "support"; const chatId = "15551234567@s.whatsapp.net"; - await client.chats.archive(session, chatId, { + await client.chats.archive(connection, chatId, { idempotencyKey: "archive-chat-1", }); - await client.chats.unarchive(session, chatId, { + await client.chats.unarchive(connection, chatId, { idempotencyKey: "unarchive-chat-1", }); await client.chats.setDisappearingTimer( - session, + connection, chatId, { durationSeconds: 604800 }, { idempotencyKey: "chat-timer-1" }, @@ -505,7 +505,7 @@ describe("MessagingClient templates", () => { surface: "sandbox", }); await client.templates.submit("support/eu", "template/1", { - session: "cloud/support", + connection: "cloud/support", }); expect(requests.map(({ method, path }) => `${method} ${path}`)).toEqual([ @@ -530,7 +530,7 @@ describe("MessagingClient templates", () => { expect(requests[5]?.body).toBe( '{"values":{"name":"Grace","order_id":"A-200"},"surface":"sandbox"}', ); - expect(requests[6]?.body).toBe('{"session":"cloud/support"}'); + expect(requests[6]?.body).toBe('{"connection":"cloud/support"}'); }); }); @@ -539,7 +539,7 @@ describe("MessagingClient webhooks", () => { const { client, requests } = await messagingServer(); await client.webhooks.list(); await client.webhooks.create({ - session: "support", + connection: "support", url: "https://example.test/hooks", events: ["message.received"], hmacKey: "fixture-secret", @@ -570,7 +570,7 @@ describe("MessagingClient webhooks", () => { credential: { type: "clientToken", value: "pmfa_ct_d2lkZ2V0" }, baseUrl: server.url, }); - expect(() => client.sessions.list()).toThrow(/server API key/); + expect(() => client.connections.list()).toThrow(/server API key/); expect(server.requests).toHaveLength(0); }); }); diff --git a/packages/typescript/test/nine-41-public.test.ts b/packages/typescript/test/nine-41-public.test.ts index 60049584d..ddbcb6797 100644 --- a/packages/typescript/test/nine-41-public.test.ts +++ b/packages/typescript/test/nine-41-public.test.ts @@ -22,13 +22,13 @@ afterEach(async () => { it("checks bare testing-phone results and actual202 through native HTTP", async () => { const fixtures = [ { - session: "s/a", + connection: "s/a", phone: "+15551234567", online: false, devices: [{ deviceId: 99 }], }, - { session: "s/a", to: "+15551234568", messageId: null }, - { session: "s/a", deviceId: 99, unlinked: true }, + { connection: "s/a", to: "+15551234568", messageId: null }, + { connection: "s/a", deviceId: 99, unlinked: true }, ]; const server = await startTestServer((_request, index) => ({ status: index === 1 ? 202 : 200, @@ -203,7 +203,7 @@ it("exports the projected descriptor union alongside archive/Cloud and verifies for (const payload of [inline, media, archive, cloud]) { const raw = JSON.stringify({ id: projectId, - session: "s", + connection: "s", timestamp: "2026-10-14T00:00:00Z", event: "history.sync", payload, diff --git a/packages/typescript/test/observation-policies.test.ts b/packages/typescript/test/observation-policies.test.ts index 4641bae3e..5b4002407 100644 --- a/packages/typescript/test/observation-policies.test.ts +++ b/packages/typescript/test/observation-policies.test.ts @@ -6,9 +6,9 @@ import { ObservationPoliciesResource, type ApiResponse, type ProjectObservationPolicy, - type SessionObservationPolicy, + type ConnectionObservationPolicy, type UpdateProjectObservationPolicyRequest, - type UpdateSessionObservationPolicyRequest, + type UpdateConnectionObservationPolicyRequest, } from "../src/index.js"; import { startTestServer, @@ -30,8 +30,8 @@ const projectPolicy: ProjectObservationPolicy = { quickReplyMode: "off", }; -const sessionPolicy: SessionObservationPolicy = { - sessionName: "support", +const connectionPolicy: ConnectionObservationPolicy = { + connectionName: "support", projectId: projectPolicy.projectId, project: { presenceMode: "events", @@ -62,7 +62,7 @@ async function policiesServer(): Promise<{ }, body: JSON.stringify({ success: true, - data: request.path.includes("/projects/") ? projectPolicy : sessionPolicy, + data: request.path.includes("/projects/") ? projectPolicy : connectionPolicy, }), })); servers.push(server); @@ -80,7 +80,7 @@ async function policiesServer(): Promise<{ } describe("MessagingClient observation policies", () => { - it("exports exact project, session, and update shapes", () => { + it("exports exact project, connection, and update shapes", () => { expectTypeOf().toEqualTypeOf<{ readonly projectId: string; readonly presenceMode: "off" | "events" | "cache"; @@ -88,7 +88,7 @@ describe("MessagingClient observation policies", () => { readonly labelMode: "off" | "events" | "cache" | "project"; readonly quickReplyMode?: "off" | "events" | "cache"; }>(); - expectTypeOf().toEqualTypeOf<{ + expectTypeOf().toEqualTypeOf<{ readonly presenceMode: "inherit" | "off" | "events" | "cache"; readonly typingMode: "inherit" | "off" | "events" | "cache"; readonly labelMode: "inherit" | "off" | "events" | "cache" | "project"; @@ -99,7 +99,7 @@ describe("MessagingClient observation policies", () => { readonly typingMode: "off" | "events" | "cache"; readonly labelMode?: "off" | "events" | "cache" | "project"; }>(); - expectTypeOf().toEqualTypeOf<{ + expectTypeOf().toEqualTypeOf<{ readonly presenceMode: "inherit" | "off" | "events" | "cache"; readonly typingMode: "inherit" | "off" | "events" | "cache"; readonly labelMode?: "inherit" | "off" | "events" | "cache" | "project"; @@ -109,15 +109,15 @@ describe("MessagingClient observation policies", () => { >().toEqualTypeOf(); }); - it("maps project and session reads with encoded identifiers and metadata", async () => { + it("maps project and connection reads with encoded identifiers and metadata", async () => { const { client, requests } = await policiesServer(); const project = await client.observationPolicies.retrieveForProject( "00000000-0000-4000-8000-000000000001", { apiVersion: "next" }, ); - const session = - await client.observationPolicies.retrieveForSession("support/eu"); + const connection = + await client.observationPolicies.retrieveForConnection("support/eu"); expectTypeOf(project).toEqualTypeOf< ApiResponse<{ @@ -126,7 +126,7 @@ describe("MessagingClient observation policies", () => { }> >(); expect(project.metadata.requestId).toBe("req_policy"); - expect(session.data.data.sessionName).toBe("support"); + expect(connection.data.data.connectionName).toBe("support"); expect(requests.map(({ method, path }) => `${method} ${path}`)).toEqual([ "GET /messaging/projects/00000000-0000-4000-8000-000000000001/observation-policy", "GET /messaging/support%2Feu/observation-policy", @@ -136,9 +136,9 @@ describe("MessagingClient observation policies", () => { it("replaces policy writes with unified configuration", async () => { const { client, requests } = await policiesServer(); - expect(client.observationPolicies).not.toHaveProperty("updateForSession"); + expect(client.observationPolicies).not.toHaveProperty("updateForConnection"); expect(client.observationPolicies).not.toHaveProperty("updateForProject"); - await client.sessions.update("support", { + await client.connections.update("support", { revision: 2, configuration: { set: { observation: { presenceMode: "events" } } }, }); diff --git a/packages/typescript/test/official-api-round2.test.ts b/packages/typescript/test/official-api-round2.test.ts index 0ee66363a..c8cbe655e 100644 --- a/packages/typescript/test/official-api-round2.test.ts +++ b/packages/typescript/test/official-api-round2.test.ts @@ -38,7 +38,7 @@ async function setup( } const event = { id: "evt-1", - session: "support", + connection: "support", timestamp: "2026-10-21T10:00:00Z", event: "message.received", payload: {}, diff --git a/packages/typescript/test/onboarding.test.ts b/packages/typescript/test/onboarding.test.ts index 80a7f2793..c56fc0b2e 100644 --- a/packages/typescript/test/onboarding.test.ts +++ b/packages/typescript/test/onboarding.test.ts @@ -2,7 +2,7 @@ import { afterEach, expect, it, vi } from "vitest"; import { MessagingClient } from "../src/index.js"; import { TEAM_API_KEY } from "./support/credentials.js"; afterEach(() => vi.unstubAllGlobals()); -it("uploads fixture content separately and advances an existing QuickLink without session credentials", async () => { +it("uploads fixture content separately and advances an existing QuickLink without connection credentials", async () => { const fetcher = vi.fn( async () => new Response(JSON.stringify({ fixtureId: "fixture" }), { diff --git a/packages/typescript/test/package.test.ts b/packages/typescript/test/package.test.ts index bd3335f7c..df0e86452 100644 --- a/packages/typescript/test/package.test.ts +++ b/packages/typescript/test/package.test.ts @@ -99,7 +99,7 @@ describe("npm package", () => { 'const bridge = new BridgeClient({ credential: { type: "projectToken", value: "pmfa_pt_AAECAwQFBgcICQoLDA0ODxAREhM73f-k" } });', "let listenerCredentialRejected = false;", 'try { new Client({ credential: { type: "teamApiKey", value: "pmfa_ls_fixture" } }); } catch { listenerCredentialRejected = true; }', - 'console.log(JSON.stringify({ version: SDK_VERSION, messaging: !!messaging.raw, business: typeof messaging.business.getCatalog, calls: typeof messaging.calls.reject, campaigns: typeof messaging.campaigns.launch, messagingMedia: typeof messaging.media.download, chats: typeof messaging.chats.editMessage, channels: typeof messaging.channels.listMessageUpdates, contacts: typeof messaging.contacts.list, groups: typeof messaging.groups.list, labels: typeof messaging.labels.list, lids: typeof messaging.identities.resolve, observationPolicies: typeof messaging.observationPolicies.retrieveForProject, profile: typeof messaging.profile.get, privacy: typeof messaging.privacy.set, privacyValues: PRIVACY_SETTING_VALUES.defense, presence: typeof messaging.presence.getForChat, presenceStates: PRESENCE_STATES, quickReplies: typeof messaging.quickReplies.list, pairing: typeof messaging.sessions.requestPairingCode, messagingOperations: typeof messaging.operations, templates: typeof messaging.templates.create, users: typeof messaging.users.getSecurityCode, systemStatus: typeof system.status, systemVersion: typeof system.version, systemHealth: typeof system.health, systemPing: typeof system.ping, bridgeRoutes: typeof bridge.routes.resolve, bridgeListen: typeof bridge.listen, platform: !!platform.raw, platformOwner: platform.owner, projectOwner: project.owner, projectId: project.projectId, apiKeys: typeof platform.apiKeys.deactivate, auditLogs: typeof platform.auditLogs.list, billing: typeof platform.billing.usage, members: typeof platform.members.list, events: typeof project.events.replay, webhooks: typeof project.webhooks.rotateSecret, webhookDeliveries: typeof project.webhookDeliveries.retrieveAttempt, operations: typeof project.operations.wait, projectTokens: typeof platform.projectTokens.list, securityIncidents: typeof platform.securityIncidents.acknowledge, sessionBans: typeof platform.sessionBans.listActive, sessionStart: typeof platform.sessions.start, batchStop: typeof platform.sessions.stopMany, quickLinkSettings: typeof project.quickLinkSettings.update, verifyWebhook: typeof webhooks.verify, createWebhookFixture: typeof webhooks.createFixture, listenerCredentialRejected, platformClientExported: "PlatformClient" in sdk, listenerApiExported: "eventStreams" in sdk, memberInvite: typeof platform.members.invite, teamUpdate: typeof platform.teams.update }));', + 'console.log(JSON.stringify({ version: SDK_VERSION, messaging: !!messaging.raw, business: typeof messaging.business.getCatalog, calls: typeof messaging.calls.reject, campaigns: typeof messaging.campaigns.launch, messagingMedia: typeof messaging.media.download, chats: typeof messaging.chats.editMessage, channels: typeof messaging.channels.listMessageUpdates, contacts: typeof messaging.contacts.list, groups: typeof messaging.groups.list, labels: typeof messaging.labels.list, lids: typeof messaging.identities.resolve, observationPolicies: typeof messaging.observationPolicies.retrieveForProject, profile: typeof messaging.profile.get, privacy: typeof messaging.privacy.set, privacyValues: PRIVACY_SETTING_VALUES.defense, presence: typeof messaging.presence.getForChat, presenceStates: PRESENCE_STATES, quickReplies: typeof messaging.quickReplies.list, pairing: typeof messaging.connections.requestPairingCode, messagingOperations: typeof messaging.operations, templates: typeof messaging.templates.create, users: typeof messaging.users.getSecurityCode, systemStatus: typeof system.status, systemVersion: typeof system.version, systemHealth: typeof system.health, systemPing: typeof system.ping, bridgeRoutes: typeof bridge.routes.resolve, bridgeListen: typeof bridge.listen, platform: !!platform.raw, platformOwner: platform.owner, projectOwner: project.owner, projectId: project.projectId, apiKeys: typeof platform.apiKeys.deactivate, auditLogs: typeof platform.auditLogs.list, billing: typeof platform.billing.usage, members: typeof platform.members.list, events: typeof project.events.replay, webhooks: typeof project.webhooks.rotateSecret, webhookDeliveries: typeof project.webhookDeliveries.retrieveAttempt, operations: typeof project.operations.wait, projectTokens: typeof platform.projectTokens.list, securityIncidents: typeof platform.securityIncidents.acknowledge, connectionBans: typeof platform.connectionBans.listActive, connectionStart: typeof platform.connections.start, batchStop: typeof platform.connections.stopMany, quickLinkSettings: typeof project.quickLinkSettings.update, verifyWebhook: typeof webhooks.verify, createWebhookFixture: typeof webhooks.createFixture, listenerCredentialRejected, platformClientExported: "PlatformClient" in sdk, listenerApiExported: "eventStreams" in sdk, memberInvite: typeof platform.members.invite, teamUpdate: typeof platform.teams.update }));', ].join("\n"), ); const imported = spawnSync(process.execPath, [consumer], { @@ -151,8 +151,8 @@ describe("npm package", () => { operations: "function", projectTokens: "function", securityIncidents: "function", - sessionBans: "function", - sessionStart: "function", + connectionBans: "function", + connectionStart: "function", batchStop: "function", quickLinkSettings: "function", verifyWebhook: "function", diff --git a/packages/typescript/test/passkeys.test.ts b/packages/typescript/test/passkeys.test.ts index 902018151..241b707ed 100644 --- a/packages/typescript/test/passkeys.test.ts +++ b/packages/typescript/test/passkeys.test.ts @@ -17,7 +17,7 @@ const operations = [ suffix: "/challenge", body: f.issue, reply: f.ticket, - call: (c: MessagingClient) => c.passkeys.issueChallenge(f.session, f.issue), + call: (c: MessagingClient) => c.passkeys.issueChallenge(f.connection, f.issue), }, { method: "GET", @@ -25,7 +25,7 @@ const operations = [ body: undefined, reply: f.ticket, call: (c: MessagingClient) => - c.passkeys.getChallenge(f.session, f.ticketId), + c.passkeys.getChallenge(f.connection, f.ticketId), }, { method: "POST", @@ -33,7 +33,7 @@ const operations = [ body: f.assertion, reply: f.assertionResult, call: (c: MessagingClient) => - c.passkeys.submitAssertion(f.session, f.assertion), + c.passkeys.submitAssertion(f.connection, f.assertion), }, { method: "GET", @@ -45,14 +45,14 @@ const operations = [ code: "ABCD-EF12", skipHandoffUX: false, }, - call: (c: MessagingClient) => c.passkeys.getConfirmation(f.session), + call: (c: MessagingClient) => c.passkeys.getConfirmation(f.connection), }, { method: "POST", suffix: "/confirmation", body: f.confirm, reply: { status: "waiting_for_pairing" }, - call: (c: MessagingClient) => c.passkeys.confirm(f.session, f.confirm), + call: (c: MessagingClient) => c.passkeys.confirm(f.connection, f.confirm), }, ]; describe("five direct passkey operations", () => { diff --git a/packages/typescript/test/platform-access.test.ts b/packages/typescript/test/platform-access.test.ts index fef76834a..bcb26c3ed 100644 --- a/packages/typescript/test/platform-access.test.ts +++ b/packages/typescript/test/platform-access.test.ts @@ -8,7 +8,7 @@ import { Client, ProjectTokensResource, SecurityIncidentsResource, - SessionBansResource, + ConnectionBansResource, type ApiResponse, type ApiKey, type AuditLog, @@ -17,7 +17,7 @@ import { type TeamMember, type ProjectToken, type SecurityIncident, - type SessionBan, + type ConnectionBan, } from "../src/index.js"; import { startTestServer, @@ -61,7 +61,7 @@ describe("Client team access and operations", () => { expectTypeOf().toEqualTypeOf(); expectTypeOf().toEqualTypeOf(); expectTypeOf().toEqualTypeOf(); - expectTypeOf().toEqualTypeOf(); + expectTypeOf().toEqualTypeOf(); expectTypeOf< Client["securityIncidents"] >().toEqualTypeOf(); @@ -73,7 +73,7 @@ describe("Client team access and operations", () => { expectTypeOf().toHaveProperty("lastUsed"); expectTypeOf().toHaveProperty("joinedAt"); expectTypeOf().toHaveProperty("metadata"); - expectTypeOf().toHaveProperty("banExpiresAt"); + expectTypeOf().toHaveProperty("banExpiresAt"); expectTypeOf().toHaveProperty("acknowledgedAt"); expectTypeOf().toHaveProperty("capabilities"); expectTypeOf().toHaveProperty("revokedAt"); @@ -119,7 +119,7 @@ describe("Client team access and operations", () => { it("maps live audit filters without claiming cursor pagination", async () => { const { client, requests } = await platformAccessServer(); const listed = await client.auditLogs.list( - { action: "session.stop", resource: "session/a", limit: 250 }, + { action: "connection.stop", resource: "connection/a", limit: 250 }, { apiVersion: "next" }, ); @@ -128,21 +128,21 @@ describe("Client team access and operations", () => { >(); expect(requests[0]).toMatchObject({ method: "GET", - path: "/platform/audit?action=session.stop&resource=session%2Fa&limit=250", + path: "/platform/audit?action=connection.stop&resource=connection%2Fa&limit=250", }); expect(requests[0]?.headers["polymorfa-version"]).toBe("next"); }); - it("lists all and active-only session bans", async () => { + it("lists all and active-only connection bans", async () => { const { client, requests } = await platformAccessServer(); - const all = await client.sessionBans.list(); - const active = await client.sessionBans.listActive(); + const all = await client.connectionBans.list(); + const active = await client.connectionBans.listActive(); expectTypeOf(all).toEqualTypeOf< - ApiResponse> + ApiResponse> >(); expectTypeOf(active).toEqualTypeOf< - ApiResponse> + ApiResponse> >(); expect(requests.map(({ method, path }) => `${method} ${path}`)).toEqual([ "GET /platform/bans", diff --git a/packages/typescript/test/platform-calls.test.ts b/packages/typescript/test/platform-calls.test.ts index 5ef68177c..24d5064a7 100644 --- a/packages/typescript/test/platform-calls.test.ts +++ b/packages/typescript/test/platform-calls.test.ts @@ -48,7 +48,7 @@ function record(callId: string): CallRecord { return { callId, projectId: PROJECT_ID, - sessionId: "support", + connectionId: "support", direction: "inbound", upstream: "linked_device", outcome: "answered", @@ -92,7 +92,7 @@ function projectClient(fetch: typeof globalThis.fetch) { function csv(rows: readonly string[], cursor?: string): Response { return new Response( - ["callId,projectId,sessionId", ...rows].map((row) => `${row}\r\n`).join(""), + ["callId,projectId,connectionId", ...rows].map((row) => `${row}\r\n`).join(""), { headers: { "content-type": "text/csv; charset=utf-8", @@ -125,7 +125,7 @@ describe("Platform call analytics", () => { ); const client = teamClient(fetch); const result = await client.calls.stats({ - sessionId: "support", + connectionId: "support", direction: "inbound", upstream: "cloud_api", outcome: "answered", @@ -141,7 +141,7 @@ describe("Platform call analytics", () => { expect(sent.url.pathname).toBe("/platform/calls/stats"); expect(sent.authorization).toBe(`Bearer ${TEAM_API_KEY}`); expect(Object.fromEntries(sent.url.searchParams)).toEqual({ - sessionId: "support", + connectionId: "support", direction: "inbound", upstream: "cloud_api", outcome: "answered", @@ -233,7 +233,7 @@ describe("Platform call analytics", () => { () => client.calls.stats({ until: "2026-09-01T24:00:00Z" }), () => client.calls.stats({ until: "Tue, 01 Sep 2026 00:00:00 GMT" }), () => client.calls.stats({ until: new Date(Number.NaN) }), - () => client.calls.stats({ sessionId: "" }), + () => client.calls.stats({ connectionId: "" }), () => client.calls.stats({ timezone: "x".repeat(65) }), () => client.calls.list({ limit: 0 }), () => client.calls.list({ limit: 101 }), @@ -293,7 +293,7 @@ describe("Platform call analytics", () => { }); expect(page.data).toEqual({ format: "csv", - body: "callId,projectId,sessionId\r\ncall-1,p,support\r\n", + body: "callId,projectId,connectionId\r\ncall-1,p,support\r\n", nextCursor: "next-page", }); const sent = call(fetch, 0); @@ -376,7 +376,7 @@ describe("Platform call analytics", () => { chunks.push(chunk); } expect(chunks.join("")).toBe( - 'callId,projectId,sessionId\r\ncall-1,p,support\r\ncall-2,p,"multi\r\nline"\r\n', + 'callId,projectId,connectionId\r\ncall-1,p,support\r\ncall-2,p,"multi\r\nline"\r\n', ); expect(fetch).toHaveBeenCalledTimes(3); expect(call(fetch, 1).url.searchParams.get("cursor")).toBe("page-2"); @@ -428,7 +428,7 @@ describe("Platform call analytics", () => { await expect(walk()).rejects.toBeInstanceOf(PolymorfaServerError); expect(fetch).toHaveBeenCalledTimes(2); expect(chunks).toEqual([ - "callId,projectId,sessionId\r\ncall-1,p,support\r\n", + "callId,projectId,connectionId\r\ncall-1,p,support\r\n", ]); }); diff --git a/packages/typescript/test/platform-session-start.test.ts b/packages/typescript/test/platform-connection-start.test.ts similarity index 71% rename from packages/typescript/test/platform-session-start.test.ts rename to packages/typescript/test/platform-connection-start.test.ts index c09d6a489..a266496c6 100644 --- a/packages/typescript/test/platform-session-start.test.ts +++ b/packages/typescript/test/platform-connection-start.test.ts @@ -5,13 +5,13 @@ import { Client, type ApiResponse, type DataEnvelope, - type SessionStartResult, + type ConnectionStartResult, } from "../src/index.js"; -describe("Client.sessions.start", () => { - it("starts a team-managed session", async () => { +describe("Client.connections.start", () => { + it("starts a team-managed connection", async () => { const fetch = vi.fn(async () => - Response.json({ data: { starting: true, sessionId: "session-uuid" } }), + Response.json({ data: { starting: true, connectionId: "session-uuid" } }), ); const client = new Client({ credential: { @@ -22,22 +22,22 @@ describe("Client.sessions.start", () => { fetch, }); - const response = await client.sessions.start( + const response = await client.connections.start( "support/us", { projectId: "project-a" }, { idempotencyKey: "start-support" }, ); expectTypeOf(response).toEqualTypeOf< - ApiResponse> + ApiResponse> >(); expect(response.data.data).toEqual({ starting: true, - sessionId: "session-uuid", + connectionId: "session-uuid", }); const [url, init] = fetch.mock.calls[0]!; expect(new URL(String(url)).pathname).toBe( - "/platform/sessions/support%2Fus/start", + "/platform/connections/support%2Fus/start", ); expect(init?.method).toBe("POST"); expect(JSON.parse(String(init?.body))).toEqual({ projectId: "project-a" }); diff --git a/packages/typescript/test/platform-widget-sessions.test.ts b/packages/typescript/test/platform-widget-connections.test.ts similarity index 61% rename from packages/typescript/test/platform-widget-sessions.test.ts rename to packages/typescript/test/platform-widget-connections.test.ts index 51b0e3d99..745ee1199 100644 --- a/packages/typescript/test/platform-widget-sessions.test.ts +++ b/packages/typescript/test/platform-widget-connections.test.ts @@ -5,8 +5,8 @@ import { Client, type ApiResponse, type DataEnvelope, - type SessionBatchRemoveResult, - type SessionBatchStopResult, + type ConnectionBatchRemoveResult, + type ConnectionBatchStopResult, } from "../src/index.js"; import { startTestServer, @@ -27,7 +27,7 @@ async function platformServer(): Promise<{ const server = await startTestServer(() => ({ headers: { "content-type": "application/json", - "x-request-id": "req_platform_widget_sessions", + "x-request-id": "req_platform_widget_connections", }, body: '{"data":{"id":"fixture"}}', })); @@ -45,46 +45,46 @@ async function platformServer(): Promise<{ }; } -describe("Client batch session lifecycle", () => { +describe("Client batch connection lifecycle", () => { it("requests bounded asynchronous stops without inventing per-item results", async () => { const { client, requests } = await platformServer(); - const stopped = await client.sessions.stopMany( + const stopped = await client.connections.stopMany( { projectId: "project/a", - sessionIds: ["support", "session/a"], + connectionIds: ["support", "connection/a"], }, - { idempotencyKey: "stop-sessions-1" }, + { idempotencyKey: "stop-connections-1" }, ); expectTypeOf(stopped).toEqualTypeOf< - ApiResponse> + ApiResponse> >(); expect(requests[0]).toMatchObject({ method: "POST", - path: "/platform/sessions/stop", - body: '{"projectId":"project/a","sessionIds":["support","session/a"]}', + path: "/platform/connections/stop", + body: '{"projectId":"project/a","connectionIds":["support","connection/a"]}', }); - expect(requests[0]?.headers["idempotency-key"]).toBe("stop-sessions-1"); + expect(requests[0]?.headers["idempotency-key"]).toBe("stop-connections-1"); }); - it("permanently removes a bounded session set", async () => { + it("permanently removes a bounded connection set", async () => { const { client, requests } = await platformServer(); - const removed = await client.sessions.deleteMany( - { sessionIds: ["support", "sales"] }, - { idempotencyKey: "delete-sessions-1" }, + const removed = await client.connections.deleteMany( + { connectionIds: ["support", "sales"] }, + { idempotencyKey: "delete-connections-1" }, ); expectTypeOf(removed).toEqualTypeOf< - ApiResponse> + ApiResponse> >(); expect(requests[0]).toMatchObject({ method: "POST", - path: "/platform/sessions/delete", - body: '{"sessionIds":["support","sales"]}', + path: "/platform/connections/delete", + body: '{"connectionIds":["support","sales"]}', }); - expect(requests[0]?.headers["idempotency-key"]).toBe("delete-sessions-1"); - expect(removed.metadata.requestId).toBe("req_platform_widget_sessions"); + expect(requests[0]?.headers["idempotency-key"]).toBe("delete-connections-1"); + expect(removed.metadata.requestId).toBe("req_platform_widget_connections"); }); }); diff --git a/packages/typescript/test/platform.test.ts b/packages/typescript/test/platform.test.ts index 7892f49bc..c2dcc45c4 100644 --- a/packages/typescript/test/platform.test.ts +++ b/packages/typescript/test/platform.test.ts @@ -129,30 +129,30 @@ describe("Client teams and projects", () => { }); }); -describe("Client sessions", () => { - it("lists sessions with optional project scope", async () => { +describe("Client connections", () => { + it("lists connections with optional project scope", async () => { const { client, requests } = await platformServer(); - await client.sessions.list(); - await client.sessions.list({ projectId: "project_1" }); + await client.connections.list(); + await client.connections.list({ projectId: "project_1" }); expect(requests.map(({ path }) => path)).toEqual([ - "/platform/sessions", - "/platform/sessions?projectId=project_1", + "/platform/connections", + "/platform/connections?projectId=project_1", ]); }); - it("maps stop, delete, tier override, and testing-session operations", async () => { + it("maps stop, delete, tier override, and testing-connection operations", async () => { const { client, requests } = await platformServer(); - await client.sessions.stop("session/a", { projectId: "project_1" }); - await client.sessions.delete("session/a"); - await client.sessions.setTierOverride("session/a", { + await client.connections.stop("connection/a", { projectId: "project_1" }); + await client.connections.delete("connection/a"); + await client.connections.setTierOverride("connection/a", { projectId: "project_1", quoteId: "quote_1", }); expect(requests.map(({ method, path }) => `${method} ${path}`)).toEqual([ - "POST /platform/sessions/session%2Fa/stop", - "DELETE /platform/sessions/session%2Fa", - "PATCH /platform/sessions/session%2Fa", + "POST /platform/connections/connection%2Fa/stop", + "DELETE /platform/connections/connection%2Fa", + "PATCH /platform/connections/connection%2Fa", ]); expect(requests[0]?.body).toBe('{"projectId":"project_1"}'); expect(requests[2]?.body).toBe( @@ -161,17 +161,17 @@ describe("Client sessions", () => { }); }); -it("reads and updates unified session configuration through Platform", async () => { +it("reads and updates unified connection configuration through Platform", async () => { const { client, requests } = await platformServer(); const patch = { revision: 4, configuration: { reset: ["historySync.mode" as const] }, }; - await client.sessions.retrieve("support/eu"); - await client.sessions.update("support/eu", patch); + await client.connections.retrieve("support/eu"); + await client.connections.update("support/eu", patch); expect(requests.map(({ method, path }) => `${method} ${path}`)).toEqual([ - "GET /platform/sessions/support%2Feu", - "PUT /platform/sessions/support%2Feu", + "GET /platform/connections/support%2Feu", + "PUT /platform/connections/support%2Feu", ]); expect(JSON.parse(requests[1]!.body)).toEqual(patch); }); diff --git a/packages/typescript/test/privacy.test.ts b/packages/typescript/test/privacy.test.ts index f8154f279..032adda29 100644 --- a/packages/typescript/test/privacy.test.ts +++ b/packages/typescript/test/privacy.test.ts @@ -121,7 +121,7 @@ describe("MessagingClient privacy", () => { expectTypeOf().toEqualTypeOf(); }); - it("gets every privacy setting with metadata and an encoded session", async () => { + it("gets every privacy setting with metadata and an encoded connection", async () => { const { client, requests } = await privacyServer(); const result = await client.privacy.get("support/eu", { diff --git a/packages/typescript/test/profile.test.ts b/packages/typescript/test/profile.test.ts index f8c709ea2..4aa7c93c1 100644 --- a/packages/typescript/test/profile.test.ts +++ b/packages/typescript/test/profile.test.ts @@ -79,7 +79,7 @@ describe("MessagingClient profile", () => { expectTypeOf().toEqualTypeOf(); }); - it("gets the session profile with metadata and an encoded session", async () => { + it("gets the connection profile with metadata and an encoded connection", async () => { const { client, requests } = await profileServer(); const result = await client.profile.get("support/eu", { diff --git a/packages/typescript/test/quick-replies.test.ts b/packages/typescript/test/quick-replies.test.ts index 735c7f951..b8ed04ff0 100644 --- a/packages/typescript/test/quick-replies.test.ts +++ b/packages/typescript/test/quick-replies.test.ts @@ -116,7 +116,7 @@ describe("MessagingClient quick replies", () => { >().toEqualTypeOf(); }); - it("lists the bounded observation projection with metadata and an encoded session", async () => { + it("lists the bounded observation projection with metadata and an encoded connection", async () => { const { client, requests } = await quickRepliesServer(); const listed = await client.quickReplies.list("support/eu", { diff --git a/packages/typescript/test/quicklinks.test.ts b/packages/typescript/test/quicklinks.test.ts index f9825e12e..055c52cbc 100644 --- a/packages/typescript/test/quicklinks.test.ts +++ b/packages/typescript/test/quicklinks.test.ts @@ -53,17 +53,17 @@ describe("MessagingClient.quickLinks", () => { expect(server.requests).toHaveLength(1); }); - it("requires an existing session for supplementary setup at compile time", () => { + it("requires an existing connection for supplementary setup at compile time", () => { const initial = {} satisfies CreateQuickLinkRequest; const supplement = { purpose: "add_connection", - session: "existing/number", + connection: "existing/number", addConnection: "official_api", } satisfies CreateQuickLinkRequest; - // @ts-expect-error supplementary setup requires an existing Number session + // @ts-expect-error supplementary setup requires an existing Number connection const invalid: CreateQuickLinkRequest = { purpose: "add_connection" }; expect(initial).toEqual({}); - expect(supplement.session).toBe("existing/number"); + expect(supplement.connection).toBe("existing/number"); expect(invalid.purpose).toBe("add_connection"); }); it("creates, retrieves, and cancels the exact hosted QuickLink resource", async () => { @@ -77,7 +77,7 @@ describe("MessagingClient.quickLinks", () => { data: { id: "ql_123", url: "https://connect.polymorfa.com/quicklink/token", - session: "quicklink-123", + connection: "quicklink-123", expiresAt: "2026-09-08T12:15:00.000Z", }, }), @@ -100,7 +100,7 @@ describe("MessagingClient.quickLinks", () => { data: { id: "ql_123", status: "pending", - session: "quicklink-123", + connection: "quicklink-123", expiresAt: "2026-09-08T12:15:00.000Z", openedAt: null, connectedAt: null, @@ -186,22 +186,22 @@ describe("MessagingClient.quickLinks", () => { projectId: "project-1", purpose: "add_connection", connectionGoal: "hybrid", - session: "existing/number", + connection: "existing/number", addConnection: "linked_devices", }); const availability = await client.quickLinks.availability({ projectId: "project-1", - session: "existing/number", + connection: "existing/number", }); expect(JSON.parse(server.requests[0]!.body)).toEqual({ projectId: "project-1", purpose: "add_connection", connectionGoal: "hybrid", - session: "existing/number", + connection: "existing/number", addConnection: "linked_devices", }); expect(server.requests[1]!.path).toBe( - "/messaging/quicklinks/availability?projectId=project-1&session=existing%2Fnumber", + "/messaging/quicklinks/availability?projectId=project-1&connection=existing%2Fnumber", ); expect(availability.data.data.allowed).toBe(false); }); @@ -213,7 +213,7 @@ describe("MessagingClient.quickLinks", () => { data: { id: "ql_project", status: "pending", - session: "quicklink-project", + connection: "quicklink-project", expiresAt: "2026-09-08T12:15:00.000Z", openedAt: null, connectedAt: null, @@ -270,7 +270,7 @@ describe("MessagingClient.quickLinks", () => { expect(() => client.quickLinks.availability({ projectId: "project-1", - session: "number", + connection: "number", }), ).toThrow(PolymorfaConfigurationError); expect(fetch).not.toHaveBeenCalled(); @@ -286,7 +286,7 @@ it("applies initial financial controls in the create request and rejects test-nu data: { id: "ql_budget", url: "https://example.test/budget", - session: "reserved", + connection: "reserved", expiresAt: null, }, }), diff --git a/packages/typescript/test/request-logs.test.ts b/packages/typescript/test/request-logs.test.ts index 4523f9c13..f26252acf 100644 --- a/packages/typescript/test/request-logs.test.ts +++ b/packages/typescript/test/request-logs.test.ts @@ -30,7 +30,7 @@ function entry(id: string, createdAt = "2026-10-10T12:00:00.000Z"): RequestLog { projectId: PROJECT, createdAt, method: "POST", - route: "/messaging/:session/messages", + route: "/messaging/:connection/messages", status: 422, durationMs: 41, result: "failure", @@ -103,7 +103,7 @@ describe("Client.requestLogs", () => { projectId: PROJECT, status: [404, "5xx"], method: ["POST", "DELETE"], - route: "/messaging/:session/messages", + route: "/messaging/:connection/messages", source: "mcp", traceId: "4bf92f3577b34da6a3ce929d0e0e4736", since: new Date("2026-10-10T00:00:00.000Z"), @@ -114,7 +114,7 @@ describe("Client.requestLogs", () => { expect(Object.fromEntries(url.searchParams)).toEqual({ status: "404,5xx", method: "POST,DELETE", - route: "/messaging/:session/messages", + route: "/messaging/:connection/messages", source: "mcp", traceId: "4bf92f3577b34da6a3ce929d0e0e4736", since: "2026-10-10T00:00:00.000Z", diff --git a/packages/typescript/test/s3-media-store.integration.test.ts b/packages/typescript/test/s3-media-store.integration.test.ts index 09d708d96..51c4794c5 100644 --- a/packages/typescript/test/s3-media-store.integration.test.ts +++ b/packages/typescript/test/s3-media-store.integration.test.ts @@ -163,7 +163,7 @@ describe.skipIf(endpoint === undefined || scratch === undefined)( ); let reads = 0; const upload = async ( - _session: string, + _connection: string, source: { open: () => Promise> }, options: { mimetype?: string }, ) => { @@ -180,7 +180,7 @@ describe.skipIf(endpoint === undefined || scratch === undefined)( // This fixture tests the real S3 source seam; encrypted provider upload has independent native TCP tests. const result = await store.uploadToWhatsApp({ messaging: { whatsappMedia: { upload } as never }, - session: "fixture", + connection: "fixture", key: "source", mediaType: "document", }); diff --git a/packages/typescript/test/shared-behavior.test.ts b/packages/typescript/test/shared-behavior.test.ts index 769885430..95ef28642 100644 --- a/packages/typescript/test/shared-behavior.test.ts +++ b/packages/typescript/test/shared-behavior.test.ts @@ -141,8 +141,8 @@ describe("shared native wire behavior", () => { } }); } - it("invokes the public Messaging sessions and messages methods", async () => { - for (const id of ["sessions-list", "message-send"]) { + it("invokes the public Messaging connections and messages methods", async () => { + for (const id of ["connections-list", "message-send"]) { await fetch(`${base}/__fixtures/${id}/reset`, { method: "POST" }); const client = new MessagingClient({ baseUrl: `${base}/__fixtures/${id}`, @@ -150,8 +150,8 @@ describe("shared native wire behavior", () => { }); const options = { headers: { "x-polymorfa-fixture": id } }; const result = - id === "sessions-list" - ? await client.sessions.list(options) + id === "connections-list" + ? await client.connections.list(options) : await client.messages.send( "support", { diff --git a/packages/typescript/test/sip-trunks.test.ts b/packages/typescript/test/sip-trunks.test.ts index d324ae92e..da3a84b6a 100644 --- a/packages/typescript/test/sip-trunks.test.ts +++ b/packages/typescript/test/sip-trunks.test.ts @@ -32,7 +32,7 @@ function trunk(projectId = "project-a"): SipTrunk { inbound: { username: "pmfa_abc", realm: "sip.example.test", - session: "support", + connection: "support", allowedAddresses: ["203.0.113.10/32"], allowedDestinations: [], }, @@ -210,7 +210,7 @@ describe("SIP trunks", () => { success: false, error: { code: "sip_trunk_in_use", - message: "A session routes calls to this trunk.", + message: "A connection routes calls to this trunk.", }, }, { status: 409 }, diff --git a/packages/typescript/test/team-webhook-test.test.ts b/packages/typescript/test/team-webhook-test.test.ts index 29bfe32db..d87f8be93 100644 --- a/packages/typescript/test/team-webhook-test.test.ts +++ b/packages/typescript/test/team-webhook-test.test.ts @@ -34,8 +34,8 @@ it("keeps project webhook test body authority separate", () => { client.webhooks.test("hook-1", { // @ts-expect-error team webhook tests reject supplied bodies body: { event: "x" }, - // @ts-expect-error team webhook tests reject session IDs - sessionId: "session-1", + // @ts-expect-error team webhook tests reject connection IDs + connectionId: "session-1", }); }; expect(invalidTeamBody).toBeTypeOf("function"); diff --git a/packages/typescript/test/testing-events.test.ts b/packages/typescript/test/testing-events.test.ts index 62042939a..dc7f97100 100644 --- a/packages/typescript/test/testing-events.test.ts +++ b/packages/typescript/test/testing-events.test.ts @@ -43,14 +43,14 @@ const apiContract = JSON.parse( it("triggers a typed test event with overrides", async () => { const accepted = { event: "message.received", - session: "test-a", + connection: "test-a", delivery: "generated", eventId: "0199f1c2-7a4e-7c55-9d1e-3f0b8a2c6d10", source: "test", }; const { client: messaging, fetcher } = client(json(accepted, 202)); const input: TriggerTestEventRequest = { - session: "test-a", + connection: "test-a", event: "message.received", overrides: { text: "hi", from: "+15550100001" }, }; @@ -113,16 +113,16 @@ it.each([true, false])( "sends the restriction fixture with restrictionActive=%s", async (restrictionActive) => { const accepted = { - event: "session.restriction_updated", - session: "test-a", + event: "connection.restriction_updated", + connection: "test-a", delivery: "generated", eventId: "0199f1c2-7a4e-7c55-9d1e-3f0b8a2c6d10", source: "test", }; const { client: messaging, fetcher } = client(json(accepted, 202)); const input: TriggerTestEventRequest = { - session: "test-a", - event: "session.restriction_updated", + connection: "test-a", + event: "connection.restriction_updated", overrides: { restrictionActive }, }; expect( @@ -137,7 +137,7 @@ it("sends a call restriction outcome supported by the API fixture", async () => json({ event: "call.ended" }, 202), ); const input: TriggerTestEventRequest = { - session: "test-a", + connection: "test-a", event: "call.ended", overrides: { callEndReason: "call_restricted" }, }; @@ -145,7 +145,7 @@ it("sends a call restriction outcome supported by the API fixture", async () => expect(JSON.parse(String(fetcher.mock.calls[0]![1]?.body))).toEqual(input); }); -it("surfaces a real-session refusal as an invalid request", async () => { +it("surfaces a real-connection refusal as an invalid request", async () => { const { client: messaging } = client( json( { @@ -153,7 +153,7 @@ it("surfaces a real-session refusal as an invalid request", async () => { type: "invalid_request_error", code: "invalid_parameter", message: - "Test events are available only for Test numbers. This session is not a Test number in the project, or it does not exist.", + "Test events are available only for Test numbers. This connection is not a Test number in the project, or it does not exist.", param: null, }, data: null, @@ -163,7 +163,7 @@ it("surfaces a real-session refusal as an invalid request", async () => { ); await expect( messaging.testing.triggerEvent("project-a", { - session: "real", + connection: "real", event: "call.received", }), ).rejects.toBeInstanceOf(PolymorfaValidationError); @@ -178,8 +178,8 @@ it("rejects client tokens before transport", () => { }); expect(() => messaging.testing.triggerEvent("project-a", { - session: "test-a", - event: "session.status", + connection: "test-a", + event: "connection.status", }), ).toThrow("requires a team key or project token"); expect(() => messaging.testing.listEventFixtures("project-a")).toThrow( @@ -204,7 +204,7 @@ it("surfaces the per-project rate limit", async () => { await expect( messaging.testing.triggerEvent( "project-a", - { session: "test-a", event: "call.missed" }, + { connection: "test-a", event: "call.missed" }, { maxNetworkRetries: 0 }, ), ).rejects.toBeInstanceOf(PolymorfaRateLimitError); @@ -213,7 +213,7 @@ it("surfaces the per-project rate limit", async () => { it("sends an optional Idempotency-Key and retries safely with it", async () => { const accepted = { event: "message.received", - session: "test-a", + connection: "test-a", delivery: "generated", eventId: "0199f1c2-7a4e-7c55-9d1e-3f0b8a2c6d10", source: "test", @@ -232,7 +232,7 @@ it("sends an optional Idempotency-Key and retries safely with it", async () => { }); const result = await messaging.testing.triggerEvent( "project-a", - { session: "test-a", event: "message.received" }, + { connection: "test-a", event: "message.received" }, { idempotencyKey: "trigger-1", maxNetworkRetries: 1 }, ); expect(result.data).toEqual(accepted); @@ -246,8 +246,8 @@ it("omits Idempotency-Key when none is given", async () => { const { client: messaging, fetcher } = client( json( { - event: "session.status", - session: "test-a", + event: "connection.status", + connection: "test-a", delivery: "generated", eventId: null, source: "test", @@ -256,8 +256,8 @@ it("omits Idempotency-Key when none is given", async () => { ), ); await messaging.testing.triggerEvent("project-a", { - session: "test-a", - event: "session.status", + connection: "test-a", + event: "connection.status", }); const init = fetcher.mock.calls[0]![1]; expect(new Headers(init?.headers).has("idempotency-key")).toBe(false); @@ -266,12 +266,12 @@ it("omits Idempotency-Key when none is given", async () => { it("serializes restriction fixtures and restricted call endings", async () => { for (const input of [ { - session: "test-a", - event: "session.restriction_updated", + connection: "test-a", + event: "connection.restriction_updated", overrides: { restrictionActive: true }, }, { - session: "test-a", + connection: "test-a", event: "call.ended", overrides: { callEndReason: "call_restricted" }, }, @@ -280,7 +280,7 @@ it("serializes restriction fixtures and restricted call endings", async () => { json( { event: input.event, - session: input.session, + connection: input.connection, delivery: "generated", eventId: null, source: "test", diff --git a/packages/typescript/test/testing-phone.test.ts b/packages/typescript/test/testing-phone.test.ts index 0e389d6fa..4250c93cd 100644 --- a/packages/typescript/test/testing-phone.test.ts +++ b/packages/typescript/test/testing-phone.test.ts @@ -33,7 +33,7 @@ function client(response: Response, type: "apiKey" | "clientToken" = "apiKey") { it("reads a Test number's phone", async () => { const phone: TestingPhone = { - session: "test a", + connection: "test a", phone: "+15550100001", online: true, devices: [{ deviceId: 33 }, { deviceId: 74 }], @@ -49,7 +49,7 @@ it("reads a Test number's phone", async () => { }); it("sends a message from the phone", async () => { - const sent = { session: "test-a", to: "+15550100002", messageId: "3EB0AA" }; + const sent = { connection: "test-a", to: "+15550100002", messageId: "3EB0AA" }; const { client: messaging, fetcher } = client(json(sent, 202)); const input = { to: "+15550100002", text: "hello" }; const result = await messaging.testing.sendPhoneMessage( @@ -67,7 +67,7 @@ it("sends a message from the phone", async () => { }); it("unlinks a companion", async () => { - const unlinked = { session: "test-a", deviceId: 74, unlinked: true }; + const unlinked = { connection: "test-a", deviceId: 74, unlinked: true }; const { client: messaging, fetcher } = client(json(unlinked)); const result = await messaging.testing.unlinkPhoneDevice( "project-a", @@ -134,30 +134,30 @@ it("matches the pinned Testing phone contract", () => { const route = (operationId: string) => contract.operations[operationId]!; expect(route("getTestingPhone")).toMatchObject({ method: "GET", - path: "/messaging/testing/{projectId}/numbers/{session}/phone", + path: "/messaging/testing/{projectId}/numbers/{connection}/phone", }); expect(route("sendTestingPhoneMessage")).toMatchObject({ method: "POST", - path: "/messaging/testing/{projectId}/numbers/{session}/phone/messages", + path: "/messaging/testing/{projectId}/numbers/{connection}/phone/messages", }); expect(route("unlinkTestingPhoneDevice")).toMatchObject({ method: "POST", - path: "/messaging/testing/{projectId}/numbers/{session}/phone/devices/{deviceId}/unlink", + path: "/messaging/testing/{projectId}/numbers/{connection}/phone/devices/{deviceId}/unlink", }); const fields = (name: string) => Object.keys(contract.schemas[name]!.properties).sort(); const phone: TestingPhone = { - session: "s", + connection: "s", phone: "+1", online: true, devices: [], }; expect(fields("TestingPhoneState")).toEqual(Object.keys(phone).sort()); expect(fields("TestingPhoneMessageRequest")).toEqual(["text", "to"]); - expect(fields("TestingPhoneMessage")).toEqual(["messageId", "session", "to"]); + expect(fields("TestingPhoneMessage")).toEqual(["messageId", "connection", "to"]); expect(fields("TestingPhoneUnlink")).toEqual([ "deviceId", - "session", + "connection", "unlinked", ]); }); diff --git a/packages/typescript/test/transport.test.ts b/packages/typescript/test/transport.test.ts index 5b2f9a818..056bd52ba 100644 --- a/packages/typescript/test/transport.test.ts +++ b/packages/typescript/test/transport.test.ts @@ -54,7 +54,7 @@ describe("HttpTransport", () => { ...(marker === undefined ? {} : { "Idempotent-Replayed": marker }), - "set-cookie": "session=private", + "set-cookie": "connection=private", "x-internal-debug": "private", }, }, @@ -136,7 +136,7 @@ describe("HttpTransport", () => { "polymorfa-version": "2026-08-19", "x-ratelimit-remaining": "41", "x-ratelimit-reset": "1700000060", - "set-cookie": "session=secret", + "set-cookie": "connection=secret", "x-internal-debug": "database-host", }, body: '{"ok":true}', diff --git a/packages/typescript/test/unledgered-retry.test.ts b/packages/typescript/test/unledgered-retry.test.ts index 0fd314bc7..f39f44b35 100644 --- a/packages/typescript/test/unledgered-retry.test.ts +++ b/packages/typescript/test/unledgered-retry.test.ts @@ -148,7 +148,7 @@ describe("unledgered API submissions", () => { }, { idempotencyKey: "send-key", maxNetworkRetries: 1 }, ); - await sdk.sessions.retrieve("s", { maxNetworkRetries: 1 }); + await sdk.connections.retrieve("s", { maxNetworkRetries: 1 }); expect([...counts.values()]).toEqual([2, 2]); } finally { server.closeAllConnections(); diff --git a/packages/typescript/test/usage.test.ts b/packages/typescript/test/usage.test.ts index 31afc109c..bd850d42e 100644 --- a/packages/typescript/test/usage.test.ts +++ b/packages/typescript/test/usage.test.ts @@ -39,11 +39,11 @@ const summary: UsageSummary = { start: "2026-09-01T00:00:00.000Z", end: "2026-10-01T00:00:00.000Z", projectId: null, - session: null, + connection: null, billingEnabled: false, meters: [meterTotal], numbers: [ - { session: "support", projectId: "project-1", meters: [meterTotal] }, + { connection: "support", projectId: "project-1", meters: [meterTotal] }, ], numbersTruncated: false, } as UsageSummary; @@ -65,7 +65,7 @@ const record: UsageRecord = { sourceKind: "call", sourceId: "CALL-1", projectId: "project-1", - session: "support", + connection: "support", occurredAt: "2026-09-19T10:00:00.000Z", recordedAt: "2026-09-19T10:00:01.000Z", revision: 1, @@ -74,7 +74,7 @@ const record: UsageRecord = { pricedCredits: null, }; const gates: UsageGateList = { - session: "support", + connection: "support", gates: [ { key: "calls.outbound_monthly", @@ -145,12 +145,12 @@ describe("Client.usage", () => { ); const response = await client.usage.summary({ period: "2026-09", - session: "support", + connection: "support", }); expectTypeOf(response).toEqualTypeOf>(); expect(response.data).toEqual(summary); expect(requests[0]!.path).toBe( - "/platform/usage?period=2026-09&session=support", + "/platform/usage?period=2026-09&connection=support", ); }); @@ -177,12 +177,12 @@ describe("Client.usage", () => { const seen: number[] = []; for await (const item of client.usage.iterateRecords({ - session: "support", + connection: "support", })) seen.push(item.revision); expect(seen).toEqual([1, 2]); expect(requests[2]!.path).toBe( - "/platform/usage/records?session=support&cursor=cursor-2", + "/platform/usage/records?connection=support&cursor=cursor-2", ); }); @@ -210,10 +210,10 @@ describe("Client.usage", () => { const { client, requests } = await usageServer(() => JSON.stringify({ data: gates }), ); - const response = await client.usage.listGates({ session: "support" }); + const response = await client.usage.listGates({ connection: "support" }); expectTypeOf(response).toEqualTypeOf>(); expect(response.data.gates[0]!.mode).toBe("record"); - expect(requests[0]!.path).toBe("/platform/gates?session=support"); + expect(requests[0]!.path).toBe("/platform/gates?connection=support"); }); it("binds a project client to its own project", async () => { diff --git a/packages/typescript/test/voice.test.ts b/packages/typescript/test/voice.test.ts index fa258a0f7..2f1f92c94 100644 --- a/packages/typescript/test/voice.test.ts +++ b/packages/typescript/test/voice.test.ts @@ -1003,7 +1003,7 @@ describe("voice webhooks", () => { const body = Buffer.from( JSON.stringify({ id: "evt_1", - session: "", + connection: "", timestamp: "2026-09-19T10:00:05.000Z", event: type, payload, @@ -1011,7 +1011,7 @@ describe("voice webhooks", () => { ); const event = await constructWebhookEvent(body, sign(body), secret); expect(event.event).toBe(type); - expect(event.session).toBe(""); + expect(event.connection).toBe(""); expect(event.payload).toEqual(payload); if (isEvent(event, "voice.asset_ready")) { expectTypeOf(event.payload.durationMs).toEqualTypeOf(); diff --git a/packages/typescript/test/voip-placement-whitespace.test.ts b/packages/typescript/test/voip-placement-whitespace.test.ts index 680ea6d6f..92eadd861 100644 --- a/packages/typescript/test/voip-placement-whitespace.test.ts +++ b/packages/typescript/test/voip-placement-whitespace.test.ts @@ -15,7 +15,7 @@ describe("placement recipient serialization", () => { credential: { type: "apiKey", value: TEAM_API_KEY }, fetch, }); - expect(() => client.voip.place({ session: "support", ...targets })).toThrow( + expect(() => client.voip.place({ connection: "support", ...targets })).toThrow( PolymorfaValidationError, ); expect(fetch).not.toHaveBeenCalled(); diff --git a/packages/typescript/test/voip.test.ts b/packages/typescript/test/voip.test.ts index 00e502159..02f55ac3f 100644 --- a/packages/typescript/test/voip.test.ts +++ b/packages/typescript/test/voip.test.ts @@ -11,7 +11,7 @@ import { VoipResource, type ApiResponse, type ClientRules, - type SessionCallSettingsResponse, + type ConnectionCallSettingsResponse, type SetClientRulesRequest, type SuccessResponse, type VoipAcceptCallResponse, @@ -76,13 +76,13 @@ describe("VoipResource", () => { it("creates and previews call links with tokens confined to the POST body", async () => { const token = "private_link_test_token"; const created = { - session: "support", + connection: "support", token, url: `https://call.whatsapp.com/voice/${token}`, video: false, }; const previewed = { - session: "support", + connection: "support", creator: { id: "9007199254740993" }, video: false, approvalRequired: true, @@ -94,10 +94,10 @@ describe("VoipResource", () => { ]); const sdk = client(server); expect( - (await sdk.voip.createCallLink({ session: "support" })).data.data, + (await sdk.voip.createCallLink({ connection: "support" })).data.data, ).toEqual(created); expect( - (await sdk.voip.previewCallLink({ session: "support", token })).data.data, + (await sdk.voip.previewCallLink({ connection: "support", token })).data.data, ).toEqual(previewed); expect( server.requests.map(({ method, path, body }) => ({ @@ -109,12 +109,12 @@ describe("VoipResource", () => { { method: "POST", path: "/messaging/voip/call-links", - body: { session: "support" }, + body: { connection: "support" }, }, { method: "POST", path: "/messaging/voip/call-links/preview", - body: { session: "support", token }, + body: { connection: "support", token }, }, ]); }); @@ -126,23 +126,23 @@ describe("VoipResource", () => { client(server, { type: "clientToken", value: "ct_test_token", - }).voip.createCallLink({ session: "support" }), + }).voip.createCallLink({ connection: "support" }), ).toThrow(PolymorfaConfigurationError); - expect(() => sdk.voip.createCallLink({ session: " " })).toThrow( + expect(() => sdk.voip.createCallLink({ connection: " " })).toThrow( PolymorfaValidationError, ); expect(() => - sdk.voip.previewCallLink({ session: "support", token: "bad/token" }), + sdk.voip.previewCallLink({ connection: "support", token: "bad/token" }), ).toThrow(PolymorfaValidationError); expect(() => sdk.voip.createCallLink( - { session: "support" }, + { connection: "support" }, { idempotencyKey: "once" }, ), ).toThrow(PolymorfaValidationError); expect(() => sdk.voip.previewCallLink( - { session: "support", token: "test" }, + { connection: "support", token: "test" }, { headers: { "Idempotency-Key": "once" } }, ), ).toThrow(PolymorfaValidationError); @@ -158,7 +158,7 @@ describe("VoipResource", () => { ]); await expect( client(server).voip.createCallLink( - { session: "support" }, + { connection: "support" }, { maxNetworkRetries: 3 }, ), ).rejects.toThrow(); @@ -170,7 +170,7 @@ describe("VoipResource", () => { json( { success: true, - data: { callId: "group/1", session: "support", video: false }, + data: { callId: "group/1", connection: "support", video: false }, }, 201, ), @@ -178,7 +178,7 @@ describe("VoipResource", () => { ]); const sdk = client(server); await sdk.voip.place({ - session: "support", + connection: "support", participants: ["+15550100", "+15550101"], }); await sdk.voip.ringParticipant("group/1", { to: "+15550100" }); @@ -192,7 +192,7 @@ describe("VoipResource", () => { { method: "POST", path: "/messaging/voip/calls", - body: { session: "support", participants: ["+15550100", "+15550101"] }, + body: { connection: "support", participants: ["+15550100", "+15550101"] }, }, { method: "POST", @@ -207,17 +207,17 @@ describe("VoipResource", () => { json( { success: true, - data: { callId: "stored-group", session: "support", video: false }, + data: { callId: "stored-group", connection: "support", video: false }, }, 201, ), ]); await client(server).voip.place({ - session: "support", + connection: "support", groupId: "9007199254740996", }); expect(JSON.parse(server.requests[0]!.body)).toEqual({ - session: "support", + connection: "support", groupId: "9007199254740996", }); }); @@ -233,7 +233,7 @@ describe("VoipResource", () => { { groupId: "9007199254740996", to: "+15550100" }, { groupId: "9007199254740996", participants: ["+15550100", "+15550101"] }, ]) - expect(() => sdk.voip.place({ session: "support", ...body })).toThrow( + expect(() => sdk.voip.place({ connection: "support", ...body })).toThrow( PolymorfaValidationError, ); }); @@ -244,7 +244,7 @@ describe("VoipResource", () => { ...json( { success: true, - data: { callId: "call/1", session: "support", video: true }, + data: { callId: "call/1", connection: "support", video: true }, }, 201, ), @@ -276,7 +276,7 @@ describe("VoipResource", () => { const placed = await sdk.voip.place( { - session: "support", + connection: "support", to: "+15550100", video: true, exclusive: true, @@ -331,7 +331,7 @@ describe("VoipResource", () => { method: "POST", path: "/messaging/voip/calls", body: { - session: "support", + connection: "support", to: "+15550100", video: true, exclusive: true, @@ -430,7 +430,7 @@ describe("VoipResource", () => { }); }); - it("validates participant, connection, and session input before sending", async () => { + it("validates participant, connection, and connection input before sending", async () => { const server = await serve([]); const sdk = client(server); expect(() => sdk.voip.place({ to: "+15550100" })).toThrow( @@ -551,7 +551,7 @@ describe("VoipResource", () => { it("lets a client token act only as itself", async () => { const server = await serve([ json( - { success: true, data: { callId: "c", session: "s", video: false } }, + { success: true, data: { callId: "c", connection: "s", video: false } }, 201, ), ]); @@ -572,7 +572,7 @@ describe("VoipResource", () => { }); }); - it("reads and replaces session call settings with a project token", async () => { + it("reads and replaces connection call settings with a project token", async () => { const settings = { callsEnabled: true, conferenceMode: true, @@ -589,7 +589,7 @@ describe("VoipResource", () => { const sdk = client(server, { type: "projectToken", value: PROJECT_TOKEN }); const current = await sdk.voip.retrieveCallSettings("support/eu"); expectTypeOf(current).toEqualTypeOf< - ApiResponse + ApiResponse >(); expect(current.data.data.conferenceMode).toBe(false); const updated = await sdk.voip.updateCallSettings("support/eu", { @@ -598,8 +598,8 @@ describe("VoipResource", () => { }); expect(updated.data.data).toEqual(settings); expect(server.requests.map(({ method, path }) => [method, path])).toEqual([ - ["GET", "/platform/sessions/support%2Feu/call-settings"], - ["PUT", "/platform/sessions/support%2Feu/call-settings"], + ["GET", "/platform/connections/support%2Feu/call-settings"], + ["PUT", "/platform/connections/support%2Feu/call-settings"], ]); expect(JSON.parse(server.requests[1]?.body ?? "null")).toEqual({ conferenceMode: true, @@ -811,7 +811,7 @@ describe("VoipResource", () => { callsEnabled: false, }); const refused = await sdk.voip - .place({ session: "support", to: "+15550100" }) + .place({ connection: "support", to: "+15550100" }) .catch((error: unknown) => error); expect(refused).toBeInstanceOf(PolymorfaAuthorizationError); expect((refused as PolymorfaAuthorizationError).code).toBe( @@ -833,7 +833,7 @@ describe("VoipResource", () => { ), ]); const refused = await client(server) - .voip.place({ session: "support", to: "+15550100" }) + .voip.place({ connection: "support", to: "+15550100" }) .catch((error: unknown) => error); expect(refused).toBeInstanceOf(PolymorfaPaymentRequiredError); expect((refused as PolymorfaPaymentRequiredError).code).toBe( @@ -841,7 +841,7 @@ describe("VoipResource", () => { ); }); - it("no longer exposes session modes or calling tickets", () => { + it("no longer exposes connection modes or calling tickets", () => { const resource = VoipResource.prototype as unknown as Record< string, unknown diff --git a/packages/typescript/test/webhook-contract.test.ts b/packages/typescript/test/webhook-contract.test.ts index 1618eae76..bd236cedf 100644 --- a/packages/typescript/test/webhook-contract.test.ts +++ b/packages/typescript/test/webhook-contract.test.ts @@ -10,7 +10,7 @@ import { type KnownWebhookEventType, type ProjectWebhookDeliveryAttempt, type TeamWebhookDeliveryAttempt, - type SessionLoggedOutPayload, + type ConnectionLoggedOutPayload, type RuntimeTemplateStatusPayload, type CloudTemplateStatusPayload, type CloudAccountStatusPayload, @@ -77,10 +77,10 @@ const messaging: OpenApiDocument = { "ContactMarketingPreferencePayload", ].map((name) => [name, round2Marketing.components.schemas[name]!]), ), - SessionCapabilitiesUpdatedPayload: - abpropsContract.components.schemas.SessionCapabilitiesUpdatedPayload!, - SessionCapabilitiesUpdatedEvent: - abpropsContract.components.schemas.SessionCapabilitiesUpdatedEvent!, + ConnectionCapabilitiesUpdatedPayload: + abpropsContract.components.schemas.ConnectionCapabilitiesUpdatedPayload!, + ConnectionCapabilitiesUpdatedEvent: + abpropsContract.components.schemas.ConnectionCapabilitiesUpdatedEvent!, // Campaign pause reasons and skip timestamps from their merged API revision. CampaignPausedPayload: pausedReasons.CampaignPausedPayload!, CampaignRecipientSkippedPayload: @@ -219,7 +219,7 @@ const IDS = { project: "0b0e5b1e-0000-4000-8000-000000000003", customer: "0b0e5b1e-0000-4000-8000-000000000004", pairingLink: "0b0e5b1e-0000-4000-8000-000000000005", - session: "0b0e5b1e-0000-4000-8000-000000000006", + connection: "0b0e5b1e-0000-4000-8000-000000000006", }; const AT = "2026-09-16T00:00:00.000Z"; const customer = { @@ -248,9 +248,9 @@ const PAYLOADS: { ? Shape : Shape; } = { - "session.capabilities_updated": shape()( + "connection.capabilities_updated": shape()( { - session: "support", + connection: "support", projectId: IDS.project, status: "synced", syncedAt: AT, @@ -268,7 +268,7 @@ const PAYLOADS: { changedKeys: ["polls.endTime"], }, [ - "session", + "connection", "projectId", "status", "syncedAt", @@ -283,26 +283,26 @@ const PAYLOADS: { phone: "+15551234567", source: "stop-keyword", keyword: "START", - session: "support", + connection: "support", projectId: IDS.project, }, - ["phone", "source", "keyword", "session"], + ["phone", "source", "keyword", "connection"], ), "contact.opted_out": shape()( { phone: "+15551234567", source: "stop-keyword", keyword: "STOP", - session: "support", + connection: "support", projectId: IDS.project, }, - ["phone", "source", "keyword", "session"], + ["phone", "source", "keyword", "connection"], ), - "session.logged_out": shape()( + "connection.logged_out": shape()( { reason: "banned", code: 401 }, ["reason", "code"], ), - "session.restriction_updated": shape()( + "connection.restriction_updated": shape()( { type: "reachout_timelock", active: true, @@ -350,10 +350,10 @@ const PAYLOADS: { ), "customer.pairing_link.connected": shape< P["customer.pairing_link.connected"] - >()({ ...customer, pairingLinkId: IDS.pairingLink, sessionId: IDS.session }, [ + >()({ ...customer, pairingLinkId: IDS.pairingLink, connectionId: IDS.connection }, [ ...customerRequired, "pairingLinkId", - "sessionId", + "connectionId", ]), "customer.pairing_link.failed": shape()( { ...customer, pairingLinkId: IDS.pairingLink, errorCode: "expired" }, @@ -368,20 +368,20 @@ const PAYLOADS: { [...customerRequired, "pairingLinkId"], ), "customer.number.attached": shape()( - { ...customer, sessionId: IDS.session, pairingLinkId: IDS.pairingLink }, - [...customerRequired, "sessionId"], + { ...customer, connectionId: IDS.connection, pairingLinkId: IDS.pairingLink }, + [...customerRequired, "connectionId"], ), "customer.number.transferred": shape()( - { ...customer, sessionId: IDS.session, sourceCustomerId: IDS.event }, - [...customerRequired, "sessionId", "sourceCustomerId"], + { ...customer, connectionId: IDS.connection, sourceCustomerId: IDS.event }, + [...customerRequired, "connectionId", "sourceCustomerId"], ), "customer.number.disconnected": shape()( - { ...customer, sessionId: IDS.session, reason: "logged_out" }, - [...customerRequired, "sessionId", "reason"], + { ...customer, connectionId: IDS.connection, reason: "logged_out" }, + [...customerRequired, "connectionId", "reason"], ), "bansafe.health_threshold": shape()( { - sessionId: IDS.session, + connectionId: IDS.connection, projectId: IDS.project, health: 41.5, threshold: 45, @@ -394,7 +394,7 @@ const PAYLOADS: { actionId: IDS.pairingLink, }, [ - "sessionId", + "connectionId", "projectId", "health", "threshold", @@ -558,7 +558,7 @@ const PAYLOADS: { sourceKind: "call", sourceId: "call_1", projectId: IDS.project, - session: "number-1", + connection: "number-1", occurredAt: AT, recordedAt: AT, revision: 1, @@ -576,7 +576,7 @@ const PAYLOADS: { "sourceKind", "sourceId", "projectId", - "session", + "connection", "occurredAt", "recordedAt", "revision", @@ -734,7 +734,7 @@ const PAYLOADS: { ...campaign, recipientId: "rcp_1", phone: "+15551234567", - sessionKey: "support", + connectionKey: "support", externalMessageId: "msg_1", variantKey: "a", attempt: 1, @@ -744,7 +744,7 @@ const PAYLOADS: { "campaignId", "recipientId", "phone", - "sessionKey", + "connectionKey", "externalMessageId", "variantKey", "attempt", @@ -777,17 +777,17 @@ const PAYLOADS: { "campaign.throttled": shape()( { ...campaign, - sessionKey: "support", + connectionKey: "support", reason: "safe_mode", deferredCount: 20, at: 6, }, - ["campaignId", "sessionKey", "reason", "deferredCount", "at"], + ["campaignId", "connectionKey", "reason", "deferredCount", "at"], ), "campaign.cap_reached": shape()( { ...campaign, - sessionKey: "support", + connectionKey: "support", phone: "+15551234567", capType: "daily", capLimit: 250, @@ -796,7 +796,7 @@ const PAYLOADS: { }, [ "campaignId", - "sessionKey", + "connectionKey", "phone", "capType", "capLimit", @@ -830,10 +830,10 @@ type LegacyEventType = Exclude< | `voice.${string}` | "usage.recorded" | "message.failed" - | "session.capabilities_updated" - | "session.restriction_updated" + | "connection.capabilities_updated" + | "connection.restriction_updated" | "template.status" - | "session.logged_out" + | "connection.logged_out" >; /** Union payloads whose PAYLOADS fixture covers one named alternative. */ @@ -940,7 +940,7 @@ describe("webhook catalog contract", () => { ); }); - it("types the Meta account notification variant of session.status", () => { + it("types the Meta account notification variant of connection.status", () => { expectShape( messaging, "CloudAccountStatusPayload", @@ -962,7 +962,7 @@ describe("webhook catalog contract", () => { const body = Buffer.from( JSON.stringify({ id: "evt_1", - session: "support", + connection: "support", externalId: "crm-42", timestamp: AT, event: type, @@ -981,7 +981,7 @@ describe("webhook catalog contract", () => { const body = Buffer.from( JSON.stringify({ id: "evt_2", - session: "support", + connection: "support", timestamp: AT, event: "message.failed", payload, @@ -992,7 +992,7 @@ describe("webhook catalog contract", () => { if (isEvent(event, "message.failed")) { expectTypeOf(event.payload.error).toEqualTypeOf< | "invalid_recipient" - | "session_not_connected" + | "connection_not_connected" | "ack_timeout" | "send_failed" | "blocked_by_safety" @@ -1028,7 +1028,7 @@ describe("webhook catalog contract", () => { const body = Buffer.from( JSON.stringify({ id: "evt_hand_raised", - session: "support", + connection: "support", timestamp: AT, event: "call.participant_state", payload: { callId: "call-1", participant }, @@ -1042,15 +1042,15 @@ describe("webhook catalog contract", () => { }); it("types logged-out reasons and the required integer code from the pinned contract", async () => { - const payload = shape()( + const payload = shape()( { reason: "device_removed", code: 401 }, ["reason", "code"], ); - expectShape(messaging, "SessionLoggedOutPayload", payload); - expectTypeOf().toEqualTypeOf< + expectShape(messaging, "ConnectionLoggedOutPayload", payload); + expectTypeOf().toEqualTypeOf< "banned" | "device_removed" | "unknown" >(); - const schema = messaging.components.schemas.SessionLoggedOutPayload!; + const schema = messaging.components.schemas.ConnectionLoggedOutPayload!; expect( violations(messaging, schema, { reason: "device_removed" }), ).toContain("$.code is required"); @@ -1063,16 +1063,16 @@ describe("webhook catalog contract", () => { const body = Buffer.from( JSON.stringify({ id: "evt_logout", - session: "support", + connection: "support", timestamp: AT, - event: "session.logged_out", + event: "connection.logged_out", payload: payload.value, }), ); const event = await constructWebhookEvent(body, sign(body), secret); - if (!isEvent(event, "session.logged_out")) + if (!isEvent(event, "connection.logged_out")) throw new Error("Expected logged-out event"); - expectTypeOf(event.payload).toEqualTypeOf(); + expectTypeOf(event.payload).toEqualTypeOf(); expect(event.payload).toEqual({ reason: "device_removed", code: 401 }); }); }); diff --git a/packages/typescript/test/webhook-event-types.test.ts b/packages/typescript/test/webhook-event-types.test.ts index 864458b5d..ac0be2424 100644 --- a/packages/typescript/test/webhook-event-types.test.ts +++ b/packages/typescript/test/webhook-event-types.test.ts @@ -47,9 +47,9 @@ import type { PollOption, PollVotePayload, PresenceUpdatePayload, - SessionLoggedOutPayload, - SessionPhoneOfflinePayload, - SessionRestrictionUpdatedPayload, + ConnectionLoggedOutPayload, + ConnectionPhoneOfflinePayload, + ConnectionRestrictionUpdatedPayload, KnownWebhookEvent, WebhookPayloadMap, } from "../src/index.js"; @@ -174,7 +174,7 @@ type ExpectedPayloads = { readonly callId: string; readonly answeredBy?: string; readonly exclusive?: boolean; - readonly sessionConnection?: "linked_device" | "cloud_api"; + readonly connectionConnection?: "linked_device" | "cloud_api"; readonly capabilities?: ExpectedCallCapabilities; }; readonly "call.ended": { @@ -184,7 +184,7 @@ type ExpectedPayloads = { readonly reason: string; readonly direction: "inbound" | "outbound"; readonly hadVideo: boolean; - readonly sessionConnection?: "linked_device" | "cloud_api"; + readonly connectionConnection?: "linked_device" | "cloud_api"; }; readonly "call.missed": { readonly from: ExpectedIdentityReference; @@ -230,7 +230,7 @@ type ExpectedPayloads = { readonly from: ExpectedIdentityReference; readonly callId: string; readonly hasVideo: boolean; - readonly sessionConnection?: "linked_device" | "cloud_api"; + readonly connectionConnection?: "linked_device" | "cloud_api"; readonly capabilities?: ExpectedCallCapabilities; }; readonly "call.rejected": { @@ -440,7 +440,7 @@ type ExpectedPayloads = { readonly unavailable?: boolean; readonly lastSeen?: number; }; - readonly "session.phone_offline": { + readonly "connection.phone_offline": { readonly daysSinceLastSeen: number; readonly daysRemaining: number; readonly lastSeen: string; @@ -483,7 +483,7 @@ type ExportedPayloads = { readonly "message.vote": PollVotePayload; readonly "newsletter.update": NewsletterUpdatePayload; readonly "presence.update": PresenceUpdatePayload; - readonly "session.phone_offline": SessionPhoneOfflinePayload; + readonly "connection.phone_offline": ConnectionPhoneOfflinePayload; }; describe("webhook event payload types", () => { @@ -542,19 +542,19 @@ describe("webhook event payload types", () => { it("types the logout reason and the restriction event", () => { expectTypeOf< - WebhookPayloadMap["session.logged_out"] - >().toEqualTypeOf(); - expectTypeOf().toEqualTypeOf< + WebhookPayloadMap["connection.logged_out"] + >().toEqualTypeOf(); + expectTypeOf().toEqualTypeOf< "banned" | "device_removed" | "unknown" >(); - expectTypeOf().toEqualTypeOf(); + expectTypeOf().toEqualTypeOf(); expectTypeOf< - WebhookPayloadMap["session.restriction_updated"] - >().toEqualTypeOf(); + WebhookPayloadMap["connection.restriction_updated"] + >().toEqualTypeOf(); expectTypeOf< - SessionRestrictionUpdatedPayload["type"] + ConnectionRestrictionUpdatedPayload["type"] >().toEqualTypeOf<"reachout_timelock">(); - expectTypeOf().toEqualTypeOf< + expectTypeOf().toEqualTypeOf< string | null >(); }); diff --git a/packages/typescript/test/webhooks.test.ts b/packages/typescript/test/webhooks.test.ts index d77401403..40eb11de6 100644 --- a/packages/typescript/test/webhooks.test.ts +++ b/packages/typescript/test/webhooks.test.ts @@ -16,7 +16,7 @@ import { } from "../src/webhooks/index.js"; const raw = Buffer.from( - '{"id":"evt_1","session":"support","timestamp":"2026-08-19T10:00:00Z","event":"message.received","payload":{"id":"m1","from":{"id":"chat"},"sender":{"id":"sender"},"fromMe":false,"timestamp":1787133600,"pushName":"Ada","isGroup":false,"type":"text","text":"Hello"}}', + '{"id":"evt_1","connection":"support","timestamp":"2026-08-19T10:00:00Z","event":"message.received","payload":{"id":"m1","from":{"id":"chat"},"sender":{"id":"sender"},"fromMe":false,"timestamp":1787133600,"pushName":"Ada","isGroup":false,"type":"text","text":"Hello"}}', ); const signature = "52c730509d65561d9394c024bfef1e3787821749b97d6b5664c39f467a16a5b2"; @@ -72,7 +72,7 @@ describe("verifyWebhookSignature", () => { describe("webhook utilities", () => { it("does not advertise the retired direct-QR event", () => { - expect(KNOWN_WEBHOOK_EVENT_TYPES).not.toContain("session.qr"); + expect(KNOWN_WEBHOOK_EVENT_TYPES).not.toContain("connection.qr"); }); it("creates canonical exact-byte fixtures and verifies them", async () => { @@ -191,7 +191,7 @@ describe("constructWebhookEvent", () => { const body = Buffer.from( JSON.stringify({ id: "historical-bansafe-event", - session: "support", + connection: "support", timestamp: "2026-09-07T00:00:00Z", event: name, payload: { legacy: true }, @@ -221,7 +221,7 @@ describe("constructWebhookEvent", () => { const body = Buffer.from( JSON.stringify({ id: "event-555", - session: "support", + connection: "support", timestamp: "2026-09-07T00:00:00Z", event: "call.ended", payload, @@ -262,7 +262,7 @@ describe("constructWebhookEvent", () => { const body = Buffer.from( JSON.stringify({ id: "telemetry-555", - session: "support", + connection: "support", timestamp: "2026-09-07T00:00:00Z", event: "call.telemetry", payload, @@ -291,7 +291,7 @@ describe("constructWebhookEvent", () => { const body = Buffer.from( JSON.stringify({ id: "evt_campaign_stopped", - session: "", + connection: "", timestamp: "2026-09-23T00:00:00Z", event: "campaign.stopped", payload, @@ -311,7 +311,7 @@ describe("constructWebhookEvent", () => { it("preserves unknown event names and payloads", async () => { const body = Buffer.from( - '{"id":"evt_future","session":"support","timestamp":"2026-08-19T10:00:00Z","event":"future.ready","payload":{"capability":42}}', + '{"id":"evt_future","connection":"support","timestamp":"2026-08-19T10:00:00Z","event":"future.ready","payload":{"capability":42}}', ); const event = await constructWebhookEvent( body, From d80b581c9df122411e9149a7e39a33700a51571c Mon Sep 17 00:00:00 2001 From: Rajeh Taher Date: Sun, 15 Nov 2026 21:30:34 +0200 Subject: [PATCH 02/41] wip(connections): port TypeScript and Go consumers and storage schema 3 --- contracts/openapi.messaging.json | 4110 ++++++----- contracts/openapi.platform.json | 2613 ++++--- contracts/source.json | 12 +- contracts/testing-events.json | 37 +- examples/calls-example/client-rules.test.mjs | 32 +- .../configure-client-rules-core.mjs | 10 +- .../calls-example/configure-client-rules.mjs | 8 +- .../calls-example/mint-client-token-core.mjs | 20 +- examples/calls-example/mint-client-token.mjs | 10 +- .../src/{numbers.ts => connections.ts} | 30 +- examples/calls-example/src/main.tsx | 142 +- .../app/api/polymorfa/[...route]/route.ts | 2 +- .../app/api/admin/bansafe/route.ts | 16 +- .../admin/{sessions => connections}/route.ts | 38 +- .../app/api/admin/customers/route.ts | 8 +- .../app/api/admin/projects/route.ts | 2 +- .../app/api/admin/security/route.ts | 10 +- .../app/api/admin/settings/route.ts | 10 +- .../app/api/desk/connections/route.ts | 4 +- .../full-platform/app/api/desk/media/route.ts | 2 +- .../app/api/desk/tickets/route.ts | 6 +- .../app/api/messaging/bansafe/route.ts | 16 +- .../app/api/messaging/business/route.ts | 54 +- .../app/api/messaging/calls/token/route.ts | 4 +- .../app/api/messaging/channels/route.ts | 32 +- .../app/api/messaging/chats/route.ts | 14 +- .../app/api/messaging/client-rules/route.ts | 14 +- .../{sessions => connections}/route.ts | 36 +- .../app/api/messaging/contacts/route.ts | 26 +- .../app/api/messaging/groups/route.ts | 48 +- .../app/api/messaging/identities/route.ts | 8 +- .../app/api/messaging/inbox/route.ts | 4 +- .../app/api/messaging/labels/route.ts | 20 +- .../app/api/messaging/messages/route.ts | 14 +- .../messaging/observation-policies/route.ts | 10 +- .../app/api/messaging/onboarding/route.ts | 4 +- .../app/api/messaging/presence/route.ts | 14 +- .../app/api/messaging/privacy/route.ts | 12 +- .../app/api/messaging/profile/route.ts | 16 +- .../app/api/messaging/quick-replies/route.ts | 14 +- .../app/api/messaging/quicklinks/route.ts | 4 +- .../app/api/messaging/templates/route.ts | 2 +- .../app/api/polymorfa/templates/route.ts | 2 +- .../app/api/polymorfa/token/route.ts | 4 +- examples/full-platform/lib/desk/data.ts | 2 +- .../full-platform/lib/desk/demo-fixtures.ts | 58 +- examples/full-platform/lib/desk/live.ts | 86 +- examples/full-platform/lib/desk/mock.ts | 2 +- examples/full-platform/lib/desk/types.ts | 2 +- examples/full-platform/lib/env.ts | 10 +- examples/full-platform/lib/polymorfa.ts | 2 +- examples/full-platform/lib/realtime.ts | 8 +- examples/full-platform/lib/route.ts | 30 +- examples/full-platform/lib/webhooks.ts | 34 +- examples/full-platform/ui/app.tsx | 8 +- examples/full-platform/ui/calls.ts | 10 +- examples/full-platform/ui/pages/admin.tsx | 28 +- .../full-platform/ui/pages/connections.tsx | 10 +- examples/full-platform/ui/pages/login.tsx | 2 +- examples/full-platform/ui/pages/settings.tsx | 24 +- examples/full-platform/ui/qr.ts | 2 +- examples/full-platform/ui/shell.tsx | 6 +- .../nextjs/app/api/polymorfa/token/route.ts | 6 +- examples/react/App.tsx | 2 +- packages/calls/src/api.ts | 6 +- packages/calls/src/call.ts | 6 +- packages/calls/src/client.ts | 22 +- packages/calls/src/errors.ts | 4 +- packages/calls/src/lifecycle.ts | 26 +- packages/calls/src/protocol.ts | 12 +- packages/calls/src/token.ts | 4 +- packages/calls/test/client.test.ts | 16 +- packages/calls/test/diagnostics.test.ts | 2 +- packages/calls/test/external-media.test.ts | 14 +- packages/calls/test/helpers.ts | 2 +- packages/calls/test/lifecycle.test.ts | 12 +- packages/calls/test/public-api.test.ts | 4 +- packages/calls/test/social.test.ts | 2 +- .../examples/aspnet-core/wwwroot/elements.ts | 2 +- packages/go/analytics.go | 20 +- packages/go/analytics_types.go | 40 +- packages/go/bansafe.go | 184 +- packages/go/bansafe_test.go | 30 +- packages/go/billing.go | 24 +- packages/go/billing_test.go | 12 +- packages/go/calls_analytics_test.go | 12 +- packages/go/calls_coverage_end_test.go | 6 +- packages/go/calls_model_test.go | 6 +- packages/go/calls_placement_test.go | 12 +- packages/go/calls_socket.go | 18 +- packages/go/calls_socket_test.go | 10 +- .../go/campaign_contract_regressions_test.go | 8 +- .../go/campaign_contract_transport_test.go | 10 +- packages/go/campaign_contract_types.go | 6 +- packages/go/campaign_contract_validation.go | 4 +- .../go/campaign_contract_validation_test.go | 6 +- packages/go/campaign_contract_wire_test.go | 6 +- packages/go/campaign_existing.go | 24 +- packages/go/campaign_followups_test.go | 2 +- packages/go/campaign_types.go | 2 +- packages/go/campaigns_test.go | 2 +- packages/go/client.go | 14 +- packages/go/cloud_audiences_test.go | 18 +- packages/go/cloud_credentials.go | 8 +- packages/go/cloud_templates.go | 2 +- packages/go/cloud_templates_test.go | 6 +- packages/go/collection_wire_test.go | 4 +- ...ion_delivery.go => connection_delivery.go} | 74 +- packages/go/customers.go | 54 +- packages/go/customers_test.go | 20 +- packages/go/descriptor_storage_test.go | 32 +- packages/go/error_codes.go | 6 +- packages/go/event_source_test.go | 2 +- packages/go/event_stream_test.go | 2 +- packages/go/flows.go | 20 +- packages/go/flows_test.go | 50 +- packages/go/flows_types.go | 46 +- ...ession_test.go => go41_connection_test.go} | 38 +- packages/go/go41_nine_test.go | 42 +- packages/go/go41_replay_media_test.go | 6 +- packages/go/history_resource.go | 16 +- packages/go/history_resource_test.go | 22 +- packages/go/interactive_test.go | 4 +- packages/go/media.go | 2 +- packages/go/media_direct.go | 16 +- packages/go/media_file.go | 4 +- packages/go/media_send_test.go | 6 +- packages/go/media_upload.go | 22 +- packages/go/media_upload_test.go | 12 +- packages/go/media_upload_transport.go | 10 +- packages/go/media_upload_transport_test.go | 14 +- packages/go/messaging.go | 112 +- packages/go/messaging_types.go | 82 +- packages/go/messaging_webhooks.go | 34 +- packages/go/messaging_webhooks_test.go | 4 +- packages/go/observations.go | 36 +- packages/go/observations_test.go | 8 +- packages/go/official_round2_test.go | 2 +- packages/go/operations_test.go | 74 +- packages/go/passkeys.go | 10 +- packages/go/passkeys_test.go | 4 +- packages/go/platform.go | 4 +- packages/go/platform_calls.go | 18 +- packages/go/platform_connections.go | 235 + packages/go/platform_connections_test.go | 48 + packages/go/platform_sessions.go | 235 - packages/go/platform_sessions_test.go | 48 - packages/go/platform_types.go | 38 +- packages/go/project_health.go | 20 +- packages/go/project_health_test.go | 18 +- packages/go/request_logs_test.go | 4 +- packages/go/review_regressions_test.go | 2 +- packages/go/s3_media.go | 6 +- packages/go/s3_media_test.go | 4 +- packages/go/security_optouts_test.go | 8 +- packages/go/security_records.go | 28 +- packages/go/settings.go | 22 +- packages/go/settings_test.go | 28 +- packages/go/signal_custody.go | 2 +- packages/go/signal_reserved_secret_test.go | 2 +- packages/go/signal_sidecar.go | 30 +- packages/go/signal_sidecar_events.go | 22 +- packages/go/signal_sidecar_test.go | 48 +- packages/go/signal_sidecar_types.go | 26 +- packages/go/simultaneous_calls_test.go | 2 +- packages/go/sip_trunks.go | 6 +- packages/go/sip_trunks_test.go | 6 +- packages/go/storage/cosmos_test.go | 2 +- packages/go/storage/d1.go | 2 +- packages/go/storage/d1_secret_test.go | 2 +- packages/go/storage/d1_test.go | 34 +- packages/go/storage/dynamodb.go | 4 +- packages/go/storage/engine.go | 66 +- packages/go/storage/engine_test.go | 76 +- packages/go/storage/gorm_test.go | 2 +- packages/go/storage/memory.go | 4 +- packages/go/storage/proto_number_test.go | 8 +- packages/go/storage/provider_test.go | 44 +- packages/go/storage/reducer_common.go | 6 +- packages/go/storage/reducer_events.go | 104 +- packages/go/storage/reducer_history.go | 58 +- packages/go/storage/reducer_test.go | 18 +- packages/go/storage/schema.go | 6 +- packages/go/storage/schema3.json | 353 + packages/go/storage/sql.go | 10 +- packages/go/storage/sql_test.go | 8 +- packages/go/storage/supabase.go | 4 +- packages/go/storage/supabase_test.go | 8 +- packages/go/storage/sync.go | 32 +- packages/go/storage/sync_test.go | 10 +- .../testdata/conformance-fixtures.v3.json | 2073 ++++++ .../testdata/d1-bridge-fixtures.v3.json | 19 + packages/go/storage_edit_guard_test.go | 10 +- packages/go/storage_numeric_test.go | 8 +- packages/go/strict_history_download_test.go | 4 +- packages/go/supplements_test.go | 6 +- packages/go/templates.go | 2 +- packages/go/templates_test.go | 4 +- .../history-edit-guard/fixture.v3.json | 6040 ++++++++++++++++ .../testdata/numeric-storage/fixture.v3.json | 6072 +++++++++++++++++ packages/go/testing.go | 54 +- packages/go/transport_test.go | 12 +- packages/go/usage.go | 46 +- packages/go/voip.go | 58 +- packages/go/voip_test.go | 22 +- packages/go/webhook_payloads.go | 126 +- packages/go/webhook_payloads_test.go | 32 +- packages/go/webhooks.go | 10 +- packages/nextjs/src/development-store.ts | 6 +- packages/nextjs/src/handler.ts | 44 +- packages/nextjs/src/messaging-token-mint.ts | 18 +- packages/nextjs/src/template-builder-route.ts | 12 +- packages/nextjs/test/handler.test.ts | 48 +- packages/nextjs/test/media-route.test.ts | 4 +- packages/nextjs/test/nextjs.test.ts | 30 +- packages/storage/conformance-fixtures.v3.json | 2073 ++++++ packages/storage/d1-bridge-fixtures.v3.json | 19 + .../history-edit-guard-fixtures.v3.json | 6040 ++++++++++++++++ packages/storage/package.json | 4 +- packages/storage/prisma/mysql.prisma | 50 +- packages/storage/prisma/postgresql.prisma | 50 +- packages/storage/prisma/sqlite.prisma | 50 +- .../storage/proto-number-fixtures.v3.json | 6072 +++++++++++++++++ packages/storage/src/adapters/indexeddb.ts | 106 +- packages/storage/src/adapters/sql/core.ts | 68 +- packages/storage/src/adapters/sql/dialect.ts | 6 +- packages/storage/src/adapters/supabase.ts | 6 +- packages/storage/src/conformance.ts | 220 +- packages/storage/src/d1-bridge.ts | 2 +- packages/storage/src/engine.ts | 63 +- packages/storage/src/history-types.ts | 2 +- packages/storage/src/index.ts | 2 + packages/storage/src/reducer/events.ts | 168 +- packages/storage/src/reducer/history.ts | 70 +- packages/storage/src/schema.ts | 60 +- packages/storage/src/schema3-upgrade.ts | 30 + packages/storage/src/sync.ts | 26 +- packages/storage/src/types.ts | 10 +- packages/storage/test/convex-tenants.test.ts | 2 +- packages/storage/test/d1-bridge.test.ts | 31 +- packages/storage/test/fixtures.test.ts | 4 +- .../storage/test/history-descriptor-proof.mjs | 4 +- .../storage/test/history-descriptor.test.ts | 6 +- .../storage/test/history-edit-guard.test.ts | 2 +- packages/storage/test/presets.test.ts | 14 +- packages/storage/test/proto-number.test.ts | 14 +- packages/storage/test/schema3-upgrade.test.ts | 140 + packages/storage/test/security.test.ts | 6 +- packages/storage/test/sync.test.ts | 6 +- .../src/connection-delivery-validation.ts | 8 +- packages/typescript/src/errors.ts | 2 +- packages/typescript/src/index.ts | 40 +- .../typescript/src/messaging/onboarding.ts | 2 +- .../typescript/src/messaging/quicklinks.ts | 24 +- packages/typescript/src/messaging/types.ts | 5 +- packages/typescript/src/platform/analytics.ts | 6 +- packages/typescript/src/platform/bansafe.ts | 4 +- .../src/platform/billing-controls.ts | 10 +- packages/typescript/src/platform/billing.ts | 2 +- .../src/platform/connection-configuration.ts | 4 +- .../typescript/src/platform/connections.ts | 12 +- packages/typescript/src/platform/customers.ts | 22 +- packages/typescript/src/platform/flows.ts | 24 +- packages/typescript/src/platform/projects.ts | 2 +- packages/typescript/src/platform/types.ts | 98 +- packages/typescript/src/platform/usage.ts | 4 +- packages/typescript/src/webhooks/events.ts | 24 +- packages/typescript/src/webhooks/index.ts | 6 +- .../typescript/test/billing-contract.test.ts | 2 +- .../typescript/test/billing-controls.test.ts | 24 +- .../test/campaign-follow-ups-contract.test.ts | 2 +- .../typescript/test/contract-shapes.test.ts | 14 +- packages/typescript/test/coverage.test.ts | 4 +- packages/typescript/test/customers.test.ts | 12 +- .../test/delivery-41-contract.test.ts | 4 +- packages/typescript/test/exports.test.ts | 10 +- .../test/hybrid-tier-transitions.test.ts | 102 +- packages/typescript/test/messages.test.ts | 2 +- .../typescript/test/nine-41-public.test.ts | 6 +- packages/typescript/test/quicklinks.test.ts | 22 +- .../typescript/test/testing-phone.test.ts | 12 +- packages/typescript/test/transport.test.ts | 16 +- packages/typescript/test/usage.test.ts | 4 +- .../typescript/test/webhook-contract.test.ts | 60 +- packages/typescript/test/webhooks.test.ts | 14 +- packages/ui-kit/src/appearance/emoji.ts | 2 +- packages/ui-kit/src/appearance/locale.ts | 4 +- packages/ui-kit/src/browser/calls/api.ts | 4 +- packages/ui-kit/src/browser/calls/client.ts | 10 +- .../ui-kit/src/browser/calls/controller.ts | 8 +- packages/ui-kit/src/browser/calls/socket.ts | 8 +- packages/ui-kit/src/browser/dropin/client.ts | 12 +- packages/ui-kit/src/browser/dropin/inbox.ts | 18 +- .../ui-kit/src/browser/dropin/permissions.ts | 4 +- .../ui-kit/src/browser/messaging/client.ts | 50 +- packages/ui-kit/src/react/call-button.tsx | 30 +- ...-picker.tsx => call-connection-picker.tsx} | 60 +- packages/ui-kit/src/react/calls.tsx | 2 +- packages/ui-kit/src/react/index.ts | 8 +- packages/ui-kit/src/store/backend.ts | 2 +- .../ui-kit/src/store/conversation-source.ts | 6 +- packages/ui-kit/src/store/inbox-source.ts | 6 +- packages/ui-kit/src/store/index.ts | 2 +- packages/ui-kit/src/store/reducers.ts | 56 +- packages/ui-kit/src/store/store.ts | 30 +- packages/ui-kit/src/store/types.ts | 18 +- packages/ui-kit/src/web-components/calls.ts | 2 +- .../test/browser/call-permission.test.ts | 4 +- .../ui-kit/test/browser/calls-backend.test.ts | 26 +- .../calls-candidate-integration.test.ts | 2 +- .../ui-kit/test/browser/calls-client.test.ts | 32 +- .../test/browser/calls-diagnostics.test.ts | 6 +- ...t.ts => calls-example-connections.test.ts} | 34 +- .../ui-kit/test/browser/calls-media.test.ts | 178 +- .../ui-kit/test/browser/calls-socket.test.ts | 14 +- .../test/browser/client-actions.test.ts | 12 +- packages/ui-kit/test/browser/dropin.test.ts | 4 +- .../ui-kit/test/browser/transport.test.ts | 12 +- packages/ui-kit/test/package.test.ts | 6 +- ...st.tsx => call-connection-picker.test.tsx} | 8 +- packages/ui-kit/test/react/calls.test.tsx | 40 +- packages/ui-kit/test/react/dropin.test.tsx | 10 +- packages/ui-kit/test/store/contract.test.ts | 6 +- .../test/store/conversation-source.test.ts | 4 +- packages/ui-kit/test/store/helpers.ts | 4 +- .../ui-kit/test/store/inbox-source.test.ts | 2 +- packages/ui-kit/test/store/sources.test.ts | 4 +- packages/ui-kit/test/store/store.test.ts | 22 +- .../ui-kit/test/web-components/dropin.test.ts | 2 +- .../test/web-components/elements.test.ts | 4 +- .../web-components/native-bridges.test.ts | 2 +- 331 files changed, 35730 insertions(+), 6958 deletions(-) rename examples/calls-example/src/{numbers.ts => connections.ts} (62%) rename examples/full-platform/app/api/admin/{sessions => connections}/route.ts (55%) rename examples/full-platform/app/api/messaging/{sessions => connections}/route.ts (53%) rename packages/go/{session_delivery.go => connection_delivery.go} (76%) rename packages/go/{go41_session_test.go => go41_connection_test.go} (83%) create mode 100644 packages/go/platform_connections.go create mode 100644 packages/go/platform_connections_test.go delete mode 100644 packages/go/platform_sessions.go delete mode 100644 packages/go/platform_sessions_test.go create mode 100644 packages/go/storage/schema3.json create mode 100644 packages/go/storage/testdata/conformance-fixtures.v3.json create mode 100644 packages/go/storage/testdata/d1-bridge-fixtures.v3.json create mode 100644 packages/go/testdata/history-edit-guard/fixture.v3.json create mode 100644 packages/go/testdata/numeric-storage/fixture.v3.json create mode 100644 packages/storage/conformance-fixtures.v3.json create mode 100644 packages/storage/d1-bridge-fixtures.v3.json create mode 100644 packages/storage/history-edit-guard-fixtures.v3.json create mode 100644 packages/storage/proto-number-fixtures.v3.json create mode 100644 packages/storage/src/schema3-upgrade.ts create mode 100644 packages/storage/test/schema3-upgrade.test.ts rename packages/ui-kit/src/react/{call-number-picker.tsx => call-connection-picker.tsx} (50%) rename packages/ui-kit/test/browser/{calls-example-numbers.test.ts => calls-example-connections.test.ts} (72%) rename packages/ui-kit/test/react/{call-number-picker.test.tsx => call-connection-picker.test.tsx} (94%) diff --git a/contracts/openapi.messaging.json b/contracts/openapi.messaging.json index 76416382a..b13806fb7 100644 --- a/contracts/openapi.messaging.json +++ b/contracts/openapi.messaging.json @@ -3,7 +3,7 @@ "info": { "title": "Polymorfa WhatsApp API", "version": "1.0.0", - "description": "Public Polymorfa REST API for sessions, messaging, media, webhooks, campaigns, templates, client tokens, QuickLinks, and bridge routing.", + "description": "Public Polymorfa REST API for connections, messaging, media, webhooks, campaigns, templates, client tokens, QuickLinks, and bridge routing.", "contact": { "name": "Polymorfa API", "url": "https://docs.polymorfa.com" @@ -746,14 +746,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -773,7 +773,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -902,14 +902,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -929,7 +929,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -1026,14 +1026,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -1053,7 +1053,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -1067,14 +1067,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -1094,7 +1094,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -1108,14 +1108,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -1135,7 +1135,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -1149,14 +1149,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -1176,7 +1176,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -1190,14 +1190,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -1217,7 +1217,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -1272,14 +1272,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -1299,7 +1299,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -1346,14 +1346,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -1373,18 +1373,18 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" ] }, - "RuntimeSessionStatusPayload": { + "RuntimeConnectionStatusPayload": { "type": "object", "properties": { "status": { "type": "string", - "description": "Session status: CONNECTING, CONNECTED, DISCONNECTED", + "description": "Connection status: CONNECTING, CONNECTED, DISCONNECTED", "example": "DISCONNECTED" }, "statusReason": { @@ -1426,7 +1426,7 @@ "enum": [ "meta" ], - "description": "Always `meta`: a WhatsApp Business Account notification, not a connection-state change" + "description": "Always `meta`: a WhatsApp Business Account notification, not a method-state change" }, "kind": { "type": "string", @@ -1454,17 +1454,17 @@ "value" ] }, - "SessionStatusPayload": { + "ConnectionStatusPayload": { "anyOf": [ { - "$ref": "#/components/schemas/RuntimeSessionStatusPayload" + "$ref": "#/components/schemas/RuntimeConnectionStatusPayload" }, { "$ref": "#/components/schemas/CloudAccountStatusPayload" } ] }, - "SessionStatusEvent": { + "ConnectionStatusEvent": { "type": "object", "properties": { "id": { @@ -1472,14 +1472,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -1489,23 +1489,23 @@ "event": { "type": "string", "enum": [ - "session.status" + "connection.status" ], "description": "Event type" }, "payload": { - "$ref": "#/components/schemas/SessionStatusPayload" + "$ref": "#/components/schemas/ConnectionStatusPayload" } }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" ] }, - "SessionConnectedPayload": { + "ConnectionConnectedPayload": { "type": "object", "properties": { "phoneNumber": { @@ -1530,7 +1530,7 @@ "x-enumDescriptions": { "android": "WhatsApp or WhatsApp Business on an Android phone.", "ios": "WhatsApp or WhatsApp Business on an iPhone.", - "meta_cloud": "Meta hosts the number through Cloud API.", + "meta_cloud": "Meta hosts the connection through Cloud API.", "unknown": "The phone has not reported a recognized platform." } }, @@ -1561,7 +1561,7 @@ "accountType" ] }, - "SessionConnectedEvent": { + "ConnectionConnectedEvent": { "type": "object", "properties": { "id": { @@ -1569,14 +1569,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -1586,23 +1586,23 @@ "event": { "type": "string", "enum": [ - "session.connected" + "connection.connected" ], "description": "Event type" }, "payload": { - "$ref": "#/components/schemas/SessionConnectedPayload" + "$ref": "#/components/schemas/ConnectionConnectedPayload" } }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" ] }, - "SessionLoggedOutPayload": { + "ConnectionLoggedOutPayload": { "type": "object", "properties": { "reason": { @@ -1612,7 +1612,7 @@ "device_removed", "unknown" ], - "description": "Why the session was logged out: `banned` when WhatsApp banned the account, `device_removed` when the linked device was removed from the phone or from another device, `unknown` otherwise (including a locked account).", + "description": "Why the connection was logged out: `banned` when WhatsApp banned the account, `device_removed` when the linked device was removed from the phone or from another device, `unknown` otherwise (including a locked account).", "example": "device_removed" }, "code": { @@ -1626,7 +1626,7 @@ "code" ] }, - "SessionLoggedOutEvent": { + "ConnectionLoggedOutEvent": { "type": "object", "properties": { "id": { @@ -1634,14 +1634,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -1651,23 +1651,23 @@ "event": { "type": "string", "enum": [ - "session.logged_out" + "connection.logged_out" ], "description": "Event type" }, "payload": { - "$ref": "#/components/schemas/SessionLoggedOutPayload" + "$ref": "#/components/schemas/ConnectionLoggedOutPayload" } }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" ] }, - "SessionPhoneOfflinePayload": { + "ConnectionPhoneOfflinePayload": { "type": "object", "properties": { "daysSinceLastSeen": { @@ -1677,7 +1677,7 @@ }, "daysRemaining": { "type": "number", - "description": "Days remaining before WhatsApp disconnects the session (clamped to 0). WhatsApp typically severs the companion link after ~14 days of phone inactivity.", + "description": "Days remaining before WhatsApp disconnects the connection (clamped to 0). WhatsApp typically severs the companion link after ~14 days of phone inactivity.", "example": 3 }, "lastSeen": { @@ -1688,7 +1688,7 @@ "action": { "type": "string", "description": "Human-readable action string to surface to the end user (e.g. ask them to open WhatsApp on their phone).", - "example": "Open WhatsApp on your phone to keep the session alive" + "example": "Open WhatsApp on your phone to keep the connection alive" } }, "required": [ @@ -1699,7 +1699,7 @@ ], "description": "Sent once a day while the phone is offline, starting on the webhook's phoneOfflineStartDay (7-13, default 10). WhatsApp signs the linked device out after 14 days without its phone. Warnings stop once the phone is seen again." }, - "SessionPhoneOfflineEvent": { + "ConnectionPhoneOfflineEvent": { "type": "object", "properties": { "id": { @@ -1707,14 +1707,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -1724,26 +1724,26 @@ "event": { "type": "string", "enum": [ - "session.phone_offline" + "connection.phone_offline" ], "description": "Event type" }, "payload": { - "$ref": "#/components/schemas/SessionPhoneOfflinePayload" + "$ref": "#/components/schemas/ConnectionPhoneOfflinePayload" } }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" ] }, - "SessionCapabilitiesUpdatedPayload": { + "ConnectionCapabilitiesUpdatedPayload": { "type": "object", "properties": { - "session": { + "connection": { "type": "string", "maxLength": 256 }, @@ -1849,7 +1849,7 @@ } }, "required": [ - "session", + "connection", "projectId", "status", "syncedAt", @@ -1860,7 +1860,7 @@ ], "additionalProperties": false }, - "SessionCapabilitiesUpdatedEvent": { + "ConnectionCapabilitiesUpdatedEvent": { "type": "object", "properties": { "id": { @@ -1868,14 +1868,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -1885,23 +1885,23 @@ "event": { "type": "string", "enum": [ - "session.capabilities_updated" + "connection.capabilities_updated" ], "description": "Event type" }, "payload": { - "$ref": "#/components/schemas/SessionCapabilitiesUpdatedPayload" + "$ref": "#/components/schemas/ConnectionCapabilitiesUpdatedPayload" } }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" ] }, - "SessionRestrictionUpdatedPayload": { + "ConnectionRestrictionUpdatedPayload": { "type": "object", "properties": { "type": { @@ -1909,7 +1909,7 @@ "enum": [ "reachout_timelock" ], - "description": "The restriction. `reachout_timelock`: the number can only message or call people it has already chatted with.", + "description": "The restriction. `reachout_timelock`: the connection can only message or call people it has already chatted with.", "example": "reachout_timelock" }, "active": { @@ -1943,7 +1943,7 @@ "observedAt" ] }, - "SessionRestrictionUpdatedEvent": { + "ConnectionRestrictionUpdatedEvent": { "type": "object", "properties": { "id": { @@ -1951,14 +1951,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -1968,17 +1968,17 @@ "event": { "type": "string", "enum": [ - "session.restriction_updated" + "connection.restriction_updated" ], "description": "Event type" }, "payload": { - "$ref": "#/components/schemas/SessionRestrictionUpdatedPayload" + "$ref": "#/components/schemas/ConnectionRestrictionUpdatedPayload" } }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -2013,7 +2013,7 @@ }, "action": { "type": "string", - "description": "What changed, for example `joined` when the Number joins a group with an invite link." + "description": "What changed, for example `joined` when the Connection joins a group with an invite link." }, "requestId": { "type": "string", @@ -2063,14 +2063,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -2090,7 +2090,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -2205,14 +2205,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -2232,7 +2232,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -2275,14 +2275,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -2302,7 +2302,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -2414,14 +2414,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -2441,7 +2441,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -2467,21 +2467,21 @@ "description": "The configured keyword the reply matched, in upper case. The message itself is never included.", "example": "STOP" }, - "session": { + "connection": { "type": "string", - "description": "Session name of the number that received the reply", + "description": "Connection name of the connection that received the reply", "example": "sales-1" }, "projectId": { "type": "string", - "description": "Project that owns the receiving number, when known" + "description": "Project that owns the receiving connection, when known" } }, "required": [ "phone", "source", "keyword", - "session" + "connection" ] }, "ContactOptedOutEvent": { @@ -2492,14 +2492,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -2519,7 +2519,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -2533,14 +2533,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -2560,7 +2560,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -2591,14 +2591,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -2618,7 +2618,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -2650,14 +2650,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -2677,7 +2677,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -2706,14 +2706,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -2733,7 +2733,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -2758,14 +2758,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -2785,7 +2785,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -2810,14 +2810,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -2837,7 +2837,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -2857,13 +2857,13 @@ "description": "Whether the offered call advertised video.", "example": false }, - "sessionConnection": { + "connectionMethod": { "type": "string", "enum": [ "linked_device", "cloud_api" ], - "description": "Connection of the session that carries the call: a linked device or the WhatsApp Business Cloud API.", + "description": "Connection of the connection that carries the call: a linked device or the WhatsApp Business Cloud API.", "example": "linked_device" }, "capabilities": { @@ -2899,14 +2899,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -2926,7 +2926,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -2959,14 +2959,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -2986,7 +2986,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -3010,13 +3010,13 @@ "type": "boolean", "description": "Present and `true` when the answering participant claimed the call." }, - "sessionConnection": { + "connectionMethod": { "type": "string", "enum": [ "linked_device", "cloud_api" ], - "description": "Connection of the session that carries the call: a linked device or the WhatsApp Business Cloud API.", + "description": "Connection of the connection that carries the call: a linked device or the WhatsApp Business Cloud API.", "example": "linked_device" }, "capabilities": { @@ -3051,14 +3051,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -3078,7 +3078,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -3107,14 +3107,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -3134,7 +3134,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -3182,7 +3182,7 @@ }, "reason": { "type": "string", - "description": "Termination reason: user_hangup | timeout | lost_connection | rejected | capacity | pod_lost | connection_failed | upstream_failed | call_restricted (WhatsApp refused the call because the number is restricted to calling people it has already chatted with).", + "description": "Termination reason: user_hangup | timeout | lost_connection | rejected | capacity | pod_lost | connection_failed | upstream_failed | call_restricted (WhatsApp refused the call because the connection is restricted to calling people it has already chatted with).", "example": "user_hangup" }, "direction": { @@ -3199,13 +3199,13 @@ "description": "Whether the call carried video.", "example": false }, - "sessionConnection": { + "connectionMethod": { "type": "string", "enum": [ "linked_device", "cloud_api" ], - "description": "Connection of the session that carries the call: a linked device or the WhatsApp Business Cloud API.", + "description": "Connection of the connection that carries the call: a linked device or the WhatsApp Business Cloud API.", "example": "linked_device" } }, @@ -3226,14 +3226,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -3253,7 +3253,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -3338,14 +3338,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -3365,7 +3365,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -3374,6 +3374,14 @@ "CallParticipant": { "type": "object", "properties": { + "guest": { + "type": "boolean", + "description": "Whether the provider identifies this call participant as a guest." + }, + "name": { + "type": "string", + "description": "Participant display name supplied by the provider. This name is not verified identity." + }, "id": { "type": "string", "pattern": "^[1-9][0-9]{0,18}$", @@ -3447,14 +3455,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -3474,7 +3482,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -3488,14 +3496,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -3515,7 +3523,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -3547,14 +3555,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -3574,7 +3582,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -3586,7 +3594,7 @@ "id": { "type": "string", "pattern": "^[A-Za-z0-9_-]{8,64}$", - "description": "Client-chosen connection identifier.", + "description": "Client-chosen method identifier.", "example": "conn_0123456789" }, "participant": { @@ -3602,7 +3610,7 @@ "socket", "sip" ], - "description": "`webrtc` for a browser connection, `socket` for a server or app connection, `sip` for a SIP trunk." + "description": "`webrtc` for a browser method, `socket` for a server or app method, `sip` for a SIP trunk." } }, "required": [ @@ -3634,14 +3642,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -3661,7 +3669,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -3759,14 +3767,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -3786,7 +3794,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -3801,7 +3809,7 @@ "connectionId": { "type": "string", "pattern": "^[A-Za-z0-9_-]{8,64}$", - "description": "Client-chosen connection identifier.", + "description": "Client-chosen method identifier.", "example": "conn_0123456789" }, "participant": { @@ -3823,7 +3831,7 @@ "sip_unavailable", "sip_auth_failed" ], - "description": "`left`: the connection left. `replaced`: a reconnect reused the connection id. `claimed`: another participant claimed the call. `sip_busy`, `sip_declined`, `sip_no_answer`, `sip_unavailable` and `sip_auth_failed`: a SIP trunk did not join the call. `call_ended`: the call ended while a SIP trunk was still ringing. A SIP trunk that never joined the call (one of the `sip_*` reasons, or `call_ended` while it was still ringing) reports only `call.connection_left`, with no `call.connection_joined` before it. Connections still open when the call ends are closed by `call.ended` without a separate event.", + "description": "`left`: the method left. `replaced`: a reconnect reused the method id. `claimed`: another participant claimed the call. `sip_busy`, `sip_declined`, `sip_no_answer`, `sip_unavailable` and `sip_auth_failed`: a SIP trunk did not join the call. `call_ended`: the call ended while a SIP trunk was still ringing. A SIP trunk that never joined the call (one of the `sip_*` reasons, or `call_ended` while it was still ringing) reports only `call.connection_left`, with no `call.connection_joined` before it. Connections still open when the call ends are closed by `call.ended` without a separate event.", "example": "left" } }, @@ -3842,14 +3850,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -3869,7 +3877,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -3936,7 +3944,7 @@ } ] }, - "description": "Closed, per-meter attributes. Call meters carry `direction`, `upstream` (`linked_device` or `cloud_api`), `origin`, `participants`, `connections`, `sipLegs` and `video`.", + "description": "Closed, per-meter attributes. Call meters carry `direction`, `upstream` (`linked_device` or `cloud_api`), `origin`, `participants`, `methods`, `sipLegs` and `video`.", "example": { "direction": "outbound", "upstream": "linked_device", @@ -3976,10 +3984,10 @@ "nullable": true, "format": "uuid" }, - "session": { + "connection": { "type": "string", "nullable": true, - "description": "The number (session name) the usage belongs to." + "description": "The connection (connection name) the usage belongs to." }, "occurredAt": { "type": "string", @@ -4037,7 +4045,7 @@ "sourceKind", "sourceId", "projectId", - "session", + "connection", "occurredAt", "recordedAt", "revision", @@ -4054,14 +4062,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -4081,7 +4089,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -4241,14 +4249,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -4268,7 +4276,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -4327,14 +4335,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -4354,7 +4362,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -4436,14 +4444,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -4463,7 +4471,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -4527,14 +4535,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -4554,7 +4562,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -4587,14 +4595,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -4614,7 +4622,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -4647,14 +4655,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -4674,7 +4682,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -4855,14 +4863,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -4882,7 +4890,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -5091,7 +5099,7 @@ "type": "string", "format": "date-time" }, - "peerDataRequestSessionId": { + "peerDataRequestConnectionId": { "type": "string" }, "media": { @@ -5192,7 +5200,7 @@ "type": "string", "format": "date-time" }, - "peerDataRequestSessionId": { + "peerDataRequestConnectionId": { "type": "string" }, "inline": { @@ -5238,14 +5246,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -5265,7 +5273,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -5305,14 +5313,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -5332,7 +5340,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -5371,7 +5379,7 @@ "system" ] }, - "migratedNumberCount": { + "migratedConnectionCount": { "type": "integer", "minimum": 0 } @@ -5383,7 +5391,7 @@ "projectId", "customerId", "actorKind", - "migratedNumberCount" + "migratedConnectionCount" ], "additionalProperties": false }, @@ -5395,14 +5403,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -5422,7 +5430,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -5481,14 +5489,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -5508,7 +5516,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -5581,14 +5589,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -5608,7 +5616,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -5648,7 +5656,7 @@ "system" ] }, - "blockingNumberCount": { + "blockingConnectionCount": { "type": "integer", "minimum": 0 }, @@ -5664,7 +5672,7 @@ "projectId", "customerId", "actorKind", - "blockingNumberCount", + "blockingConnectionCount", "revokedPairingLinkCount" ], "additionalProperties": false @@ -5677,14 +5685,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -5704,7 +5712,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -5763,14 +5771,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -5790,7 +5798,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -5849,14 +5857,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -5876,7 +5884,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -5940,14 +5948,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -5967,7 +5975,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -6031,14 +6039,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -6058,7 +6066,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -6102,7 +6110,7 @@ "type": "string", "format": "uuid" }, - "sessionId": { + "connectionId": { "type": "string", "format": "uuid" } @@ -6115,7 +6123,7 @@ "customerId", "actorKind", "pairingLinkId", - "sessionId" + "connectionId" ], "additionalProperties": false }, @@ -6127,14 +6135,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -6154,7 +6162,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -6223,14 +6231,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -6250,7 +6258,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -6314,14 +6322,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -6341,7 +6349,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -6414,14 +6422,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -6441,14 +6449,14 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" ], "additionalProperties": false }, - "CustomerNumberAttachedPayload": { + "CustomerConnectionAttachedPayload": { "type": "object", "properties": { "eventId": { @@ -6481,7 +6489,7 @@ "system" ] }, - "sessionId": { + "connectionId": { "type": "string", "format": "uuid" }, @@ -6497,11 +6505,11 @@ "projectId", "customerId", "actorKind", - "sessionId" + "connectionId" ], "additionalProperties": false }, - "CustomerNumberAttachedEvent": { + "CustomerConnectionAttachedEvent": { "type": "object", "properties": { "id": { @@ -6509,14 +6517,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -6526,24 +6534,24 @@ "event": { "type": "string", "enum": [ - "customer.number.attached" + "customer.connection.attached" ], "description": "Event type" }, "payload": { - "$ref": "#/components/schemas/CustomerNumberAttachedPayload" + "$ref": "#/components/schemas/CustomerConnectionAttachedPayload" } }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" ], "additionalProperties": false }, - "CustomerNumberTransferredPayload": { + "CustomerConnectionTransferredPayload": { "type": "object", "properties": { "eventId": { @@ -6576,7 +6584,7 @@ "system" ] }, - "sessionId": { + "connectionId": { "type": "string", "format": "uuid" }, @@ -6592,12 +6600,12 @@ "projectId", "customerId", "actorKind", - "sessionId", + "connectionId", "sourceCustomerId" ], "additionalProperties": false }, - "CustomerNumberTransferredEvent": { + "CustomerConnectionTransferredEvent": { "type": "object", "properties": { "id": { @@ -6605,14 +6613,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -6622,24 +6630,24 @@ "event": { "type": "string", "enum": [ - "customer.number.transferred" + "customer.connection.transferred" ], "description": "Event type" }, "payload": { - "$ref": "#/components/schemas/CustomerNumberTransferredPayload" + "$ref": "#/components/schemas/CustomerConnectionTransferredPayload" } }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" ], "additionalProperties": false }, - "CustomerNumberDisconnectedPayload": { + "CustomerConnectionDisconnectedPayload": { "type": "object", "properties": { "eventId": { @@ -6672,7 +6680,7 @@ "system" ] }, - "sessionId": { + "connectionId": { "type": "string", "format": "uuid" }, @@ -6688,12 +6696,12 @@ "projectId", "customerId", "actorKind", - "sessionId", + "connectionId", "reason" ], "additionalProperties": false }, - "CustomerNumberDisconnectedEvent": { + "CustomerConnectionDisconnectedEvent": { "type": "object", "properties": { "id": { @@ -6701,14 +6709,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -6718,17 +6726,17 @@ "event": { "type": "string", "enum": [ - "customer.number.disconnected" + "customer.connection.disconnected" ], "description": "Event type" }, "payload": { - "$ref": "#/components/schemas/CustomerNumberDisconnectedPayload" + "$ref": "#/components/schemas/CustomerConnectionDisconnectedPayload" } }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -6812,14 +6820,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -6839,7 +6847,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -6915,14 +6923,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -6942,7 +6950,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -6987,7 +6995,7 @@ "phoneNumber": { "type": "string", "pattern": "^\\+[1-9]\\d{1,14}$", - "description": "The customer's own number in E.164 format.", + "description": "The customer's own phone number in E.164 format.", "example": "+15551234567" }, "action": { @@ -6998,15 +7006,15 @@ "lifted", "daily_allowance_reached" ], - "description": "Whether the restriction was newly applied, moved, or removed. `daily_allowance_reached` reports that the number spent its warm-up allowance for the day; nothing on the ladder moved and sending resumes at the next reset." + "description": "Whether the restriction was newly applied, moved, or removed. `daily_allowance_reached` reports that the connection spent its warm-up allowance for the day; nothing on the ladder moved and sending resumes at the next reset." }, "scope": { "type": "string", "enum": [ - "number", + "connection", "team" ], - "description": "Whether this covers one number or every number in the workspace." + "description": "Whether this covers one connection or every connection in the workspace." }, "rung": { "type": "string", @@ -7143,14 +7151,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -7170,7 +7178,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -7180,10 +7188,10 @@ "BanSafeHealthThresholdPayload": { "type": "object", "properties": { - "sessionId": { + "connectionId": { "type": "string", "format": "uuid", - "description": "Session whose present Health crossed the project threshold." + "description": "Connection whose present Health crossed the project threshold." }, "projectId": { "type": "string", @@ -7246,7 +7254,7 @@ } }, "required": [ - "sessionId", + "connectionId", "projectId", "health", "threshold", @@ -7268,14 +7276,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -7295,7 +7303,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -7313,7 +7321,7 @@ "phoneNumber": { "type": "string", "pattern": "^\\+[1-9]\\d{1,14}$", - "description": "The customer's own number in E.164 format.", + "description": "The customer's own phone number in E.164 format.", "example": "+15551234567" }, "kind": { @@ -7354,7 +7362,7 @@ "type": "number", "minimum": 0, "maximum": 1, - "description": "How confident Polymorfa is that this restriction was real, from 0 to 1. A restriction WhatsApp announced is 1. A ban you report starts at 0.9 and moves once the number's own sending shows whether it was restricted.", + "description": "How confident Polymorfa is that this restriction was real, from 0 to 1. A restriction WhatsApp announced is 1. A ban you report starts at 0.9 and moves once the connection's own sending shows whether it was restricted.", "example": 1 }, "resolution": { @@ -7366,7 +7374,7 @@ "phone_switch", "final" ], - "description": "How the incident settled. open: still being decided. corroborated: a report and an observed restriction agree. contradicted: the number kept sending, so there was no restriction. phone_switch: the number moved to another phone. final: settled with the confidence shown." + "description": "How the incident settled. open: still being decided. corroborated: a report and an observed restriction agree. contradicted: the connection kept sending, so there was no restriction. phone_switch: the connection moved to another phone. final: settled with the confidence shown." }, "claimId": { "type": "string", @@ -7404,14 +7412,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -7431,7 +7439,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -7454,7 +7462,7 @@ "phoneNumber": { "type": "string", "pattern": "^\\+[1-9]\\d{1,14}$", - "description": "The customer's own number in E.164 format.", + "description": "The customer's own phone number in E.164 format.", "example": "+15551234567" }, "status": { @@ -7480,7 +7488,7 @@ "simultaneous_calls", "linked_device_interactive" ], - "description": "What the ban was attributed to. other_device: another device on the account was sending. customer_conduct: Polymorfa was already restricting this number, or named the same serious problem for a week. shared_network: the number shared its connection with numbers that were being restricted. ours: nothing points at how the number was used. inconclusive: Polymorfa could not see enough of the window to say. simultaneous_calls: simultaneous calls were on for the number inside the window, which voids Ban Credit; the claim is denied when filed. linked_device_interactive: the number sent an interactive message (buttons, lists, product messages, Flows and similar) from a linked device inside the window, which voids Ban Credit; the claim is denied when filed." + "description": "What the ban was attributed to. other_device: another device on the account was sending. customer_conduct: Polymorfa was already restricting this connection, or named the same serious problem for a week. shared_network: the connection shared its method with connections that were being restricted. ours: nothing points at how the connection was used. inconclusive: Polymorfa could not see enough of the window to say. simultaneous_calls: simultaneous calls were on for the connection inside the window, which voids Ban Credit; the claim is denied when filed. linked_device_interactive: the connection sent an interactive message (buttons, lists, product messages, Flows and similar) from a linked device inside the window, which voids Ban Credit; the claim is denied when filed." }, "windowStart": { "type": "string", @@ -7496,7 +7504,7 @@ }, "measuredCents": { "type": "number", - "description": "Credit quantity this number consumed inside the window, with up to six decimal places.", + "description": "Credit quantity this connection consumed inside the window, with up to six decimal places.", "minimum": 0, "multipleOf": 0.000001, "example": 1080 @@ -7564,14 +7572,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -7591,7 +7599,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -7620,7 +7628,7 @@ "type": "string", "enum": [ "invalid_recipient", - "session_not_connected", + "connection_not_connected", "ack_timeout", "send_failed", "blocked_by_safety" @@ -7662,14 +7670,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -7689,7 +7697,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -7812,14 +7820,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -7839,7 +7847,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -7977,14 +7985,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -8004,7 +8012,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -8052,14 +8060,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -8079,7 +8087,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -8110,7 +8118,7 @@ }, "phoneNumberId": { "type": "string", - "description": "WhatsApp phone number ID of your Number" + "description": "WhatsApp phone number ID of your Connection" } }, "required": [ @@ -8127,14 +8135,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -8154,7 +8162,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -8187,11 +8195,11 @@ "reason": { "type": "string", "description": "Why Polymorfa paused the campaign. Present only on an automatic pause.", - "example": "WhatsApp lowered the messaging limit of a number this campaign sends from." + "example": "WhatsApp lowered the messaging limit of a connection this campaign sends from." }, "code": { "type": "string", - "description": "Stable code for an automatic pause: campaigns_not_entitled, bansafe_team_suspended, bansafe_suspended, campaign_throughput_capped, invalid_parameter, hybrid_campaign_unsupported, blocked_by_safety, number_quality_dropped, or messaging_limit_dropped. Present only on an automatic pause.", + "description": "Stable code for an automatic pause: campaigns_not_entitled, bansafe_team_suspended, bansafe_suspended, campaign_throughput_capped, invalid_parameter, hybrid_campaign_unsupported, blocked_by_safety, connection_quality_dropped, or messaging_limit_dropped. Present only on an automatic pause.", "example": "messaging_limit_dropped" } }, @@ -8210,14 +8218,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -8237,7 +8245,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -8283,14 +8291,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -8310,7 +8318,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -8353,14 +8361,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -8380,7 +8388,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -8423,14 +8431,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -8450,7 +8458,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -8496,14 +8504,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -8523,7 +8531,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -8593,14 +8601,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -8620,7 +8628,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -8660,14 +8668,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -8687,7 +8695,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -8711,9 +8719,9 @@ "description": "Recipient phone number in E.164", "example": "+14155550123" }, - "sessionKey": { + "connectionKey": { "type": "string", - "description": "Sending number's session key", + "description": "Sending connection's connection key", "example": "sales-1" }, "externalMessageId": { @@ -8744,7 +8752,7 @@ "campaignId", "recipientId", "phone", - "sessionKey", + "connectionKey", "externalMessageId", "variantKey", "attempt" @@ -8758,14 +8766,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -8785,7 +8793,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -8809,9 +8817,9 @@ "description": "Recipient phone number in E.164", "example": "+14155550123" }, - "sessionKey": { + "connectionKey": { "type": "string", - "description": "Sending number's session key", + "description": "Sending connection's connection key", "example": "sales-1" }, "externalMessageId": { @@ -8830,7 +8838,7 @@ "campaignId", "recipientId", "phone", - "sessionKey", + "connectionKey", "externalMessageId", "deliveredAt" ] @@ -8843,14 +8851,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -8870,7 +8878,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -8894,9 +8902,9 @@ "description": "Recipient phone number in E.164", "example": "+14155550123" }, - "sessionKey": { + "connectionKey": { "type": "string", - "description": "Sending number's session key", + "description": "Sending connection's connection key", "example": "sales-1" }, "externalMessageId": { @@ -8915,7 +8923,7 @@ "campaignId", "recipientId", "phone", - "sessionKey", + "connectionKey", "externalMessageId", "readAt" ] @@ -8928,14 +8936,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -8955,7 +8963,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -8979,9 +8987,9 @@ "description": "Recipient phone number in E.164", "example": "+14155550123" }, - "sessionKey": { + "connectionKey": { "type": "string", - "description": "Sending number's session key", + "description": "Sending connection's connection key", "example": "sales-1" }, "externalMessageId": { @@ -9006,7 +9014,7 @@ "campaignId", "recipientId", "phone", - "sessionKey", + "connectionKey", "externalMessageId", "repliedAt", "responseMs" @@ -9020,14 +9028,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -9047,7 +9055,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -9094,14 +9102,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -9121,7 +9129,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -9185,14 +9193,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -9212,7 +9220,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -9276,14 +9284,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -9303,7 +9311,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -9317,14 +9325,14 @@ "description": "Campaign id", "example": "01936b2e-5f2a-7c1d-9a3e-8b4c2d1e0f11" }, - "sessionKey": { + "connectionKey": { "type": "string", - "description": "Sending number's session key", + "description": "Sending connection's connection key", "example": "sales-1" }, "reason": { "type": "string", - "description": "Why sending was paced: `paced`, `bansafe_throttled`, `daily_allowance_reached`, or `new_chat_limit_reached` (WhatsApp capped this number's new chats for the current cycle)", + "description": "Why sending was paced: `paced`, `bansafe_throttled`, `daily_allowance_reached`, or `new_chat_limit_reached` (WhatsApp capped this connection's new chats for the current cycle)", "example": "bansafe_throttled" }, "deferredCount": { @@ -9341,7 +9349,7 @@ }, "required": [ "campaignId", - "sessionKey", + "connectionKey", "reason", "deferredCount", "at" @@ -9355,14 +9363,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -9382,7 +9390,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -9396,9 +9404,9 @@ "description": "Campaign id", "example": "01936b2e-5f2a-7c1d-9a3e-8b4c2d1e0f11" }, - "sessionKey": { + "connectionKey": { "type": "string", - "description": "Sending number's session key", + "description": "Sending connection's connection key", "example": "sales-1" }, "phone": { @@ -9408,7 +9416,7 @@ }, "capType": { "type": "string", - "description": "Which cap was reached: `hourly` or `daily` (the campaign's own caps), or `new_chat` (WhatsApp's per-number new-chat cap)", + "description": "Which cap was reached: `hourly` or `daily` (the campaign's own caps), or `new_chat` (WhatsApp's per-connection new-chat cap)", "example": "daily" }, "capLimit": { @@ -9431,7 +9439,7 @@ }, "required": [ "campaignId", - "sessionKey", + "connectionKey", "phone", "capType", "capLimit", @@ -9447,14 +9455,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -9474,7 +9482,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -9532,14 +9540,14 @@ "description": "Unique event identifier", "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event", + "description": "Connection that produced this event", "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", @@ -9559,7 +9567,7 @@ }, "required": [ "id", - "session", + "connection", "timestamp", "event", "payload" @@ -9683,7 +9691,7 @@ "code": { "type": "string", "enum": [ - "zero_knowledge_session", + "zero_knowledge_connection", "invalid_parameter", "invalid_credential", "entitlement_required", @@ -9734,7 +9742,7 @@ "order_status_transition_invalid", "order_cancellation_failed", "call_opt_out_limit", - "number_restricted", + "connection_restricted", "sip_trunk_in_use", "sip_trunk_revision_conflict", "sip_trunk_limit", @@ -9752,7 +9760,7 @@ "upstream_failure", "service_unavailable", "credential_verification_unavailable", - "session_not_ready", + "connection_not_ready", "command_dispatch_failed", "result_unknown", "parent_bsuid_not_supported", @@ -9887,7 +9895,7 @@ "ticket": { "type": "string" }, - "session": { + "connection": { "type": "string" }, "rpId": { @@ -9914,7 +9922,7 @@ "required": [ "version", "ticket", - "session", + "connection", "rpId", "challengeB64Url", "userVerification", @@ -10000,14 +10008,14 @@ "ticket": { "type": "string" }, - "session": { + "connection": { "type": "string" } }, "required": [ "ok", "ticket", - "session" + "connection" ] }, "SubmitPasskeyAssertionResponse": { @@ -10244,7 +10252,7 @@ "enum": [ "team", "project", - "session" + "connection" ] }, "revision": { @@ -10450,7 +10458,7 @@ "template", "target_reference", "only_eligible_transport", - "session_rule", + "connection_rule", "project_rule", "team_rule", "default_linked_devices" @@ -10683,7 +10691,7 @@ "type": "string", "minLength": 4, "maxLength": 21848, - "description": "Base64-encoded JPEG preview shown before the media downloads, at most 16 KiB. Linked Devices numbers only." + "description": "Base64-encoded JPEG preview shown before the media downloads, at most 16 KiB. Linked Devices connections only." }, "width": { "type": "integer", @@ -10763,7 +10771,7 @@ "type": "string", "minLength": 4, "maxLength": 21848, - "description": "Base64-encoded JPEG preview shown before the media downloads, at most 16 KiB. Linked Devices numbers only." + "description": "Base64-encoded JPEG preview shown before the media downloads, at most 16 KiB. Linked Devices connections only." }, "width": { "type": "integer", @@ -10849,7 +10857,7 @@ "type": "string", "minLength": 4, "maxLength": 21848, - "description": "Base64-encoded JPEG preview shown before the media downloads, at most 16 KiB. Linked Devices numbers only." + "description": "Base64-encoded JPEG preview shown before the media downloads, at most 16 KiB. Linked Devices connections only." } }, "required": [ @@ -11549,7 +11557,7 @@ "type": "string", "minLength": 4, "maxLength": 21848, - "description": "Base64-encoded JPEG preview shown before the media downloads, at most 16 KiB. Linked Devices numbers only." + "description": "Base64-encoded JPEG preview shown before the media downloads, at most 16 KiB. Linked Devices connections only." }, "descriptor": { "$ref": "#/components/schemas/VideoMediaDescriptor" @@ -11594,7 +11602,7 @@ "type": "string", "minLength": 4, "maxLength": 21848, - "description": "Base64-encoded JPEG preview shown before the media downloads, at most 16 KiB. Linked Devices numbers only." + "description": "Base64-encoded JPEG preview shown before the media downloads, at most 16 KiB. Linked Devices connections only." }, "descriptor": { "$ref": "#/components/schemas/FileMediaDescriptor" @@ -12541,7 +12549,7 @@ "buttonText", "sections" ], - "description": "On an official WhatsApp Business number, `title` is the header (at most 60 characters) and `description` the body (at most 1,024 characters); without `description`, `title` is the body. There, each section title allows at most 24 characters and is required when the list has more than one section, lists allow at most 10 rows in total, row titles at most 24 characters, row IDs at most 200, row descriptions at most 72, `buttonText` at most 20 and `footer` at most 60. Every number also limits `buttonText` to 64 UTF-8 bytes, row `id` to 256 bytes and `title` and `description` to 256 and 4,096 bytes, so multibyte text reaches those byte limits before the character limits. Content outside any limit returns `400`." + "description": "On an Official API connection, `title` is the header (at most 60 characters) and `description` the body (at most 1,024 characters); without `description`, `title` is the body. There, each section title allows at most 24 characters and is required when the list has more than one section, lists allow at most 10 rows in total, row titles at most 24 characters, row IDs at most 200, row descriptions at most 72, `buttonText` at most 20 and `footer` at most 60. Every connection also limits `buttonText` to 64 UTF-8 bytes, row `id` to 256 bytes and `title` and `description` to 256 and 4,096 bytes, so multibyte text reaches those byte limits before the character limits. Content outside any limit returns `400`." } }, "required": [ @@ -12898,7 +12906,7 @@ "type": "string", "minLength": 4, "maxLength": 21848, - "description": "Base64-encoded JPEG preview shown before the media downloads, at most 16 KiB. Linked Devices numbers only." + "description": "Base64-encoded JPEG preview shown before the media downloads, at most 16 KiB. Linked Devices connections only." } }, "additionalProperties": false @@ -12969,7 +12977,7 @@ "type": "string", "minLength": 4, "maxLength": 21848, - "description": "Base64-encoded JPEG preview shown before the media downloads, at most 16 KiB. Linked Devices numbers only." + "description": "Base64-encoded JPEG preview shown before the media downloads, at most 16 KiB. Linked Devices connections only." } }, "required": [ @@ -13128,7 +13136,7 @@ "body", "buttons" ], - "description": "Linked Devices support up to 10 total buttons and at most 3 CTAs. Replies may be mixed with URL and call buttons using a hydrated template; copy/catalog buttons cannot be mixed with replies. An optional image, video or document header requires exactly one URL or base64 source and cannot be combined with a title. On an official WhatsApp Business number, media headers require an approved template, and at most 3 `reply` buttons are sent; other button types return `501`. There, `body` allows at most 1,024 characters, `title` and `footer` at most 60, and each button needs a unique `id` and a unique `text` of at most 20 characters. Every number also limits each button `id` to 256 UTF-8 bytes. Content outside any limit returns `400`." + "description": "Linked Devices support up to 10 total buttons and at most 3 CTAs. Replies may be mixed with URL and call buttons using a hydrated template; copy/catalog buttons cannot be mixed with replies. An optional image, video or document header requires exactly one URL or base64 source and cannot be combined with a title. On an Official API connection, media headers require an approved template, and at most 3 `reply` buttons are sent; other button types return `501`. There, `body` allows at most 1,024 characters, `title` and `footer` at most 60, and each button needs a unique `id` and a unique `text` of at most 20 characters. Every connection also limits each button `id` to 256 UTF-8 bytes. Content outside any limit returns `400`." } }, "required": [ @@ -13279,7 +13287,7 @@ "body" ], "additionalProperties": false, - "description": "Ask the person for permission to call them. Cloud API numbers only; WhatsApp limits how often you can ask." + "description": "Ask the person for permission to call them. Cloud API connections only; WhatsApp limits how often you can ask." } }, "required": [ @@ -13355,7 +13363,7 @@ "linked_devices", "official_api" ], - "description": "Choose a transport or use the Number's routing rules. An explicit choice does not fall back." + "description": "Choose a transport or use the Connection's routing rules. An explicit choice does not fall back." }, "conversation": { "$ref": "#/components/schemas/ConversationReference" @@ -13478,7 +13486,7 @@ "template", "target_reference", "only_eligible_transport", - "session_rule", + "connection_rule", "project_rule", "team_rule", "default_linked_devices" @@ -13744,7 +13752,7 @@ }, "description": "The other party, as the call reported it." }, - "SessionCallRecord": { + "ConnectionCallRecord": { "type": "object", "properties": { "callId": { @@ -13753,9 +13761,9 @@ "projectId": { "type": "string" }, - "sessionId": { + "connectionId": { "type": "string", - "description": "The Number's session name." + "description": "The Connection's connection name." }, "direction": { "type": "string", @@ -13820,7 +13828,7 @@ "required": [ "callId", "projectId", - "sessionId", + "connectionId", "direction", "upstream", "outcome", @@ -13834,7 +13842,7 @@ "endReason" ] }, - "ListSessionCallsResponse": { + "ListConnectionCallsResponse": { "type": "object", "properties": { "success": { @@ -13846,7 +13854,7 @@ "data": { "type": "array", "items": { - "$ref": "#/components/schemas/SessionCallRecord" + "$ref": "#/components/schemas/ConnectionCallRecord" } }, "nextCursor": { @@ -14171,7 +14179,7 @@ }, "fromMe": { "type": "boolean", - "description": "True when the Number sent the message, including from another linked device." + "description": "True when the Connection sent the message, including from another linked device." }, "type": { "type": "string", @@ -14371,7 +14379,7 @@ "closed", "unknown" ], - "description": "`open`: the person messaged, reacted or called this Number through the Official API in the last 24 hours, so free-form messages can be sent. `closed`: no such activity in the last 24 hours; only approved templates can be sent, and Polymorfa refuses free-form sends with `conversation_window_closed`. `unknown`: Polymorfa cannot prove the window is closed; sends are passed to WhatsApp, which decides." + "description": "`open`: the person messaged, reacted or called this Connection through the Official API in the last 24 hours, so free-form messages can be sent. `closed`: no such activity in the last 24 hours; only approved templates can be sent, and Polymorfa refuses free-form sends with `conversation_window_closed`. `unknown`: Polymorfa cannot prove the window is closed; sends are passed to WhatsApp, which decides." }, "reason": { "type": "string", @@ -14383,7 +14391,7 @@ "identity_unlinked", null ], - "description": "Why the state is `unknown`, otherwise null. `not_tracked`: no WhatsApp notification has been processed for this connection yet. `tracking_started`: tracking began less than 24 hours ago. `notifications_interrupted`: a WhatsApp notification could not be processed in the last 24 hours. `identity_unlinked`: someone without a phone number (or username ID) wrote in during the last 24 hours and could be this person." + "description": "Why the state is `unknown`, otherwise null. `not_tracked`: no WhatsApp notification has been processed for this method yet. `tracking_started`: tracking began less than 24 hours ago. `notifications_interrupted`: a WhatsApp notification could not be processed in the last 24 hours. `identity_unlinked`: someone without a phone number (or username ID) wrote in during the last 24 hours and could be this person." }, "openedAt": { "type": "string", @@ -14572,7 +14580,7 @@ "limits" ], "additionalProperties": false, - "description": "Whether this number can send the person a call permission request now, with WhatsApp's limits." + "description": "Whether this connection can send the person a call permission request now, with WhatsApp's limits." }, "CallPermission": { "type": "object", @@ -14637,7 +14645,7 @@ "$ref": "#/components/schemas/CallPermissionAction" }, { - "description": "Whether this number can call the person now, with WhatsApp's limits." + "description": "Whether this connection can call the person now, with WhatsApp's limits." } ] } @@ -14761,7 +14769,7 @@ "$ref": "#/components/schemas/CallPermissionAction" }, { - "description": "Whether this number can call the person now, with WhatsApp's limits." + "description": "Whether this connection can call the person now, with WhatsApp's limits." } ] } @@ -14784,7 +14792,7 @@ "actions" ], "additionalProperties": false, - "description": "The person's call permission on a Cloud API number; null on linked-device numbers." + "description": "The person's call permission on a Cloud API connection; null on linked-device connections." } }, "required": [ @@ -14815,11 +14823,11 @@ "CallCheckRequest": { "type": "object", "properties": { - "session": { + "connection": { "type": "string", "minLength": 1, "maxLength": 128, - "description": "The session (number) that would place the call." + "description": "The Connection that would place the call." }, "to": { "type": "string", @@ -14829,7 +14837,7 @@ } }, "required": [ - "session", + "connection", "to" ], "additionalProperties": false @@ -14837,7 +14845,7 @@ "VoipCreatedCallLink": { "type": "object", "properties": { - "session": { + "connection": { "type": "string" }, "token": { @@ -14852,7 +14860,7 @@ } }, "required": [ - "session", + "connection", "token", "url", "video" @@ -14879,7 +14887,7 @@ "VoipCreateCallLinkRequest": { "type": "object", "properties": { - "session": { + "connection": { "type": "string", "minLength": 1, "maxLength": 128 @@ -14890,14 +14898,14 @@ } }, "required": [ - "session" + "connection" ], "additionalProperties": false }, "VoipPreviewedCallLink": { "type": "object", "properties": { - "session": { + "connection": { "type": "string" }, "video": { @@ -14911,11 +14919,11 @@ }, "isAdmin": { "type": "boolean", - "description": "Whether WhatsApp reports this Number as a link administrator. This field does not grant API permissions." + "description": "Whether WhatsApp reports this Connection as a link administrator. This field does not grant API permissions." } }, "required": [ - "session", + "connection", "video", "creator", "approvalRequired", @@ -14943,7 +14951,7 @@ "VoipPreviewCallLinkRequest": { "type": "object", "properties": { - "session": { + "connection": { "type": "string", "minLength": 1, "maxLength": 128 @@ -14959,7 +14967,7 @@ } }, "required": [ - "session", + "connection", "token" ], "additionalProperties": false @@ -15037,7 +15045,7 @@ "connectionId": { "type": "string", "pattern": "^[A-Za-z0-9_-]{8,64}$", - "description": "Client-chosen identifier of one media connection. Reusing it replaces that connection.", + "description": "Client-chosen identifier of one media connection. Reusing it replaces that media connection.", "example": "conn_0123456789" }, "participant": { @@ -15080,7 +15088,7 @@ "connectionId": { "type": "string", "pattern": "^[A-Za-z0-9_-]{8,64}$", - "description": "Client-chosen identifier of one media connection. Reusing it replaces that connection.", + "description": "Client-chosen identifier of one media connection. Reusing it replaces that media connection.", "example": "conn_0123456789" }, "participant": { @@ -15101,7 +15109,7 @@ "callId": { "type": "string" }, - "session": { + "connection": { "type": "string" }, "video": { @@ -15110,7 +15118,7 @@ }, "required": [ "callId", - "session", + "connection", "video" ] }, @@ -15135,7 +15143,7 @@ "VoipPlaceCallRequest": { "type": "object", "properties": { - "session": { + "connection": { "type": "string", "minLength": 1, "example": "support" @@ -15173,7 +15181,7 @@ "example": "agent-7" } }, - "description": "Provide exactly one of to, participants or groupId. Group calls require a Linked Device number and 2 to 31 remote recipients.", + "description": "Provide exactly one of to, participants or groupId. Group calls require a Linked Devices connection and 2 to 31 remote recipients.", "oneOf": [ { "required": [ @@ -15280,7 +15288,7 @@ }, "exclusive": { "type": "boolean", - "description": "Claim the call. Other participants then receive `409 call_claimed` for accept and media, and their open connections close." + "description": "Claim the call. Other participants then receive `409 call_claimed` for accept and media, and their open methods close." }, "participant": { "type": "string", @@ -15307,7 +15315,7 @@ "connectionId": { "type": "string", "pattern": "^[A-Za-z0-9_-]{8,64}$", - "description": "Client-chosen identifier of one media connection. Reusing it replaces that connection.", + "description": "Client-chosen identifier of one media connection. Reusing it replaces that media connection.", "example": "conn_0123456789" }, "participant": { @@ -15327,13 +15335,13 @@ "connectionId": { "type": "string", "pattern": "^[A-Za-z0-9_-]{8,64}$", - "description": "Client-chosen identifier of one media connection. Reusing it replaces that connection.", + "description": "Client-chosen identifier of one media connection. Reusing it replaces that media connection.", "example": "conn_0123456789" }, "participant": { "type": "string", "pattern": "^[A-Za-z0-9._:@-]{1,128}$", - "description": "Server credentials only: the participant acting in the call, which must own the connection. Defaults to `default`. Client tokens act as their own participant and must omit this field.", + "description": "Server credentials only: the participant acting in the call, which must own the media connection. Defaults to `default`. Client tokens act as their own participant and must omit this field.", "example": "agent-7" }, "emoji": { @@ -15362,13 +15370,13 @@ "connectionId": { "type": "string", "pattern": "^[A-Za-z0-9_-]{8,64}$", - "description": "Client-chosen identifier of one media connection. Reusing it replaces that connection.", + "description": "Client-chosen identifier of one media connection. Reusing it replaces that media connection.", "example": "conn_0123456789" }, "participant": { "type": "string", "pattern": "^[A-Za-z0-9._:@-]{1,128}$", - "description": "Server credentials only: the participant acting in the call, which must own the connection. Defaults to `default`. Client tokens act as their own participant and must omit this field.", + "description": "Server credentials only: the participant acting in the call, which must own the media connection. Defaults to `default`. Client tokens act as their own participant and must omit this field.", "example": "agent-7" }, "raised": { @@ -15381,6 +15389,190 @@ ], "additionalProperties": false }, + "VoipWaitingRoomControlResult": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "waiting_room_result" + ] + }, + "requestId": { + "type": "string", + "pattern": "^[A-Za-z0-9_-]{8,64}$", + "description": "Client-chosen identifier of one media connection. Reusing it replaces that media connection.", + "example": "conn_0123456789" + }, + "ok": { + "type": "boolean" + }, + "code": { + "type": "string", + "enum": [ + "invalid_waiting_room_control", + "connection_unavailable", + "unsupported_operation", + "waiting_room_admin_required", + "waiting_room_target_unavailable", + "waiting_room_unavailable", + "waiting_room_control_failed", + "waiting_room_control_unknown" + ] + } + }, + "required": [ + "type", + "requestId", + "ok" + ], + "additionalProperties": false + }, + "VoipWaitingRoomControlResponse": { + "type": "object", + "properties": { + "success": { + "type": "boolean", + "enum": [ + true + ] + }, + "data": { + "$ref": "#/components/schemas/VoipWaitingRoomControlResult" + } + }, + "required": [ + "success", + "data" + ] + }, + "VoipWaitingRoomControlRequest": { + "type": "object", + "properties": { + "connectionId": { + "type": "string", + "pattern": "^[A-Za-z0-9_-]{8,64}$", + "description": "Client-chosen identifier of one media connection. Reusing it replaces that media connection.", + "example": "conn_0123456789" + }, + "participant": { + "type": "string", + "pattern": "^[A-Za-z0-9._:@-]{1,128}$", + "description": "Server credentials only: the participant acting in the call, which must own the media connection. Defaults to `default`. Client tokens act as their own participant and must omit this field.", + "example": "agent-7" + }, + "control": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "waiting_room_control" + ] + }, + "requestId": { + "type": "string", + "pattern": "^[A-Za-z0-9_-]{8,64}$", + "description": "Client-chosen identifier of one media connection. Reusing it replaces that media connection.", + "example": "conn_0123456789" + }, + "operation": { + "type": "string", + "enum": [ + "toggle" + ] + }, + "enabled": { + "type": "boolean" + } + }, + "required": [ + "type", + "requestId", + "operation", + "enabled" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "waiting_room_control" + ] + }, + "requestId": { + "type": "string", + "pattern": "^[A-Za-z0-9_-]{8,64}$", + "description": "Client-chosen identifier of one media connection. Reusing it replaces that media connection.", + "example": "conn_0123456789" + }, + "operation": { + "type": "string", + "enum": [ + "admit" + ] + }, + "participantId": { + "type": "string", + "pattern": "^[1-9][0-9]{0,18}$" + } + }, + "required": [ + "type", + "requestId", + "operation", + "participantId" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "waiting_room_control" + ] + }, + "requestId": { + "type": "string", + "pattern": "^[A-Za-z0-9_-]{8,64}$", + "description": "Client-chosen identifier of one media connection. Reusing it replaces that media connection.", + "example": "conn_0123456789" + }, + "operation": { + "type": "string", + "enum": [ + "deny" + ] + }, + "participantId": { + "type": "string", + "pattern": "^[1-9][0-9]{0,18}$" + } + }, + "required": [ + "type", + "requestId", + "operation", + "participantId" + ], + "additionalProperties": false + } + ] + } + }, + "required": [ + "connectionId", + "control" + ], + "additionalProperties": false + }, "VoipAddParticipantRequest": { "type": "object", "properties": { @@ -15478,7 +15670,7 @@ "connectionId": { "type": "string", "pattern": "^[A-Za-z0-9_-]{8,64}$", - "description": "Client-chosen identifier of one media connection. Reusing it replaces that connection.", + "description": "Client-chosen identifier of one media connection. Reusing it replaces that media connection.", "example": "conn_0123456789" }, "participant": { @@ -15595,14 +15787,14 @@ "type": "integer", "minimum": 0, "maximum": 2147483647, - "description": "Packets lost since the connection started.", + "description": "Packets lost since the method started.", "example": 12 }, "packetsReceived": { "type": "integer", "minimum": 0, "maximum": 2147483647, - "description": "Packets received since the connection started.", + "description": "Packets received since the method started.", "example": 4810 }, "audioCodec": { @@ -15631,7 +15823,7 @@ "type": "integer", "minimum": 0, "maximum": 1000, - "description": "Times this connection reconnected so far.", + "description": "Times this method reconnected so far.", "example": 0 } }, @@ -15651,7 +15843,7 @@ "connectionId": { "type": "string", "pattern": "^[A-Za-z0-9_-]{8,64}$", - "description": "Client-chosen identifier of one media connection. Reusing it replaces that connection.", + "description": "Client-chosen identifier of one media connection. Reusing it replaces that media connection.", "example": "conn_0123456789" }, "participant": { @@ -15686,7 +15878,7 @@ "connectionId": { "type": "string", "pattern": "^[A-Za-z0-9_-]{8,64}$", - "description": "Client-chosen identifier of one media connection. Reusing it replaces that connection.", + "description": "Client-chosen identifier of one media connection. Reusing it replaces that media connection.", "example": "conn_0123456789" }, "participant": { @@ -16823,7 +17015,7 @@ "properties": { "wabaId": { "type": "string", - "description": "WhatsApp Business Account of the Number's Official API connection." + "description": "WhatsApp Business Account of the Connection's Official API connection." }, "onboarding": { "type": "object", @@ -20202,10 +20394,10 @@ "data" ] }, - "SessionSafeMode": { + "ConnectionSafeMode": { "type": "object", "properties": { - "session": { + "connection": { "type": "string" }, "projectId": { @@ -20413,7 +20605,7 @@ } }, "required": [ - "session", + "connection", "projectId", "project", "override", @@ -20424,7 +20616,7 @@ "entitlementReason" ] }, - "GetSessionSafeModeResponse": { + "GetConnectionSafeModeResponse": { "type": "object", "properties": { "success": { @@ -20434,7 +20626,7 @@ ] }, "data": { - "$ref": "#/components/schemas/SessionSafeMode" + "$ref": "#/components/schemas/ConnectionSafeMode" } }, "required": [ @@ -20442,7 +20634,7 @@ "data" ] }, - "UpdateSessionSafeModeResponse": { + "UpdateConnectionSafeModeResponse": { "type": "object", "properties": { "success": { @@ -20452,7 +20644,7 @@ ] }, "data": { - "$ref": "#/components/schemas/SessionSafeMode" + "$ref": "#/components/schemas/ConnectionSafeMode" } }, "required": [ @@ -20587,7 +20779,7 @@ "minimum": 0, "maximum": 100 }, - "sessionAction": { + "connectionAction": { "type": "string", "enum": [ "none", @@ -20629,7 +20821,7 @@ "version", "enabled", "threshold", - "sessionAction", + "connectionAction", "slowDownMps", "emailNotification", "webhookNotification", @@ -20687,7 +20879,7 @@ "minimum": 0, "maximum": 100 }, - "sessionAction": { + "connectionAction": { "type": "string", "enum": [ "none", @@ -20713,7 +20905,7 @@ "version", "enabled", "threshold", - "sessionAction", + "connectionAction", "slowDownMps", "emailNotification", "webhookNotification" @@ -20843,10 +21035,10 @@ "data" ] }, - "SessionObservationPolicy": { + "ConnectionObservationPolicy": { "type": "object", "properties": { - "sessionName": { + "connectionName": { "type": "string" }, "projectId": { @@ -20991,14 +21183,14 @@ } }, "required": [ - "sessionName", + "connectionName", "projectId", "project", "override", "effective" ] }, - "GetSessionObservationPolicyResponse": { + "GetConnectionObservationPolicyResponse": { "type": "object", "properties": { "success": { @@ -21008,7 +21200,7 @@ ] }, "data": { - "$ref": "#/components/schemas/SessionObservationPolicy" + "$ref": "#/components/schemas/ConnectionObservationPolicy" } }, "required": [ @@ -21040,7 +21232,7 @@ "x-enumDescriptions": { "android": "WhatsApp or WhatsApp Business on an Android phone.", "ios": "WhatsApp or WhatsApp Business on an iPhone.", - "meta_cloud": "Meta hosts the number through Cloud API.", + "meta_cloud": "Meta hosts the connection through Cloud API.", "unknown": "The phone has not reported a recognized platform." } }, @@ -21502,7 +21694,7 @@ "tenantId": { "type": "string" }, - "session": { + "connection": { "type": "string" }, "url": { @@ -21595,7 +21787,7 @@ "CreateWebhookRequest": { "type": "object", "properties": { - "session": { + "connection": { "type": "string" }, "url": { @@ -21634,7 +21826,7 @@ "type": "integer", "minimum": 7, "maximum": 13, - "description": "First day without the phone on which this webhook receives session.phone_offline. New webhooks default to 10; on update, omission keeps the stored value. WhatsApp signs the linked device out on day 14. To stop the warning, remove session.phone_offline from events." + "description": "First day without the phone on which this webhook receives connection.phone_offline. New webhooks default to 10; on update, omission keeps the stored value. WhatsApp signs the linked device out on day 14. To stop the warning, remove connection.phone_offline from events." } }, "required": [ @@ -21718,7 +21910,7 @@ "type": "integer", "minimum": 7, "maximum": 13, - "description": "First day without the phone on which this webhook receives session.phone_offline. New webhooks default to 10; on update, omission keeps the stored value. WhatsApp signs the linked device out on day 14. To stop the warning, remove session.phone_offline from events." + "description": "First day without the phone on which this webhook receives connection.phone_offline. New webhooks default to 10; on update, omission keeps the stored value. WhatsApp signs the linked device out on day 14. To stop the warning, remove connection.phone_offline from events." } } }, @@ -21978,7 +22170,7 @@ "id": { "type": "string" }, - "session": { + "connection": { "type": "string" }, "messageId": { @@ -22000,7 +22192,7 @@ }, "required": [ "id", - "session", + "connection", "messageId", "mimeType", "fileLength", @@ -22034,7 +22226,7 @@ "tenantId": { "type": "string" }, - "session": { + "connection": { "type": "string" }, "wabaId": { @@ -22092,7 +22284,7 @@ "required": [ "id", "tenantId", - "session", + "connection", "wabaId", "name", "language", @@ -22667,9 +22859,9 @@ "TemplateSubmission": { "type": "object", "properties": { - "session": { + "connection": { "type": "string", - "description": "Number the template was submitted for." + "description": "Connection the template was submitted for." }, "status": { "type": "string", @@ -22677,11 +22869,11 @@ "PENDING", "APPROVED" ], - "description": "PENDING: sent to Meta for review. APPROVED: the number sends this template without Meta review." + "description": "PENDING: sent to Meta for review. APPROVED: the connection sends this template without Meta review." }, "autoApproved": { "type": "boolean", - "description": "True when the number does not need Meta approval (any number that is not a Cloud API number). Nothing was sent to Meta." + "description": "True when the connection does not need Meta approval (any connection that is not a Cloud API connection). Nothing was sent to Meta." }, "metaTemplateId": { "type": "string", @@ -22690,7 +22882,7 @@ } }, "required": [ - "session", + "connection", "status", "autoApproved", "metaTemplateId" @@ -22732,13 +22924,13 @@ "SubmitMessageTemplateRequest": { "type": "object", "properties": { - "session": { + "connection": { "type": "string", "minLength": 1 } }, "required": [ - "session" + "connection" ] }, "CampaignMessageVariationBlueprint": { @@ -23041,7 +23233,7 @@ }, "exitOnReply": { "type": "boolean", - "description": "When true, a contact who replies to the sending number gets no further steps." + "description": "When true, a contact who replies to the sending connection gets no further steps." }, "exitOnLinkClick": { "type": "boolean", @@ -23250,7 +23442,7 @@ "message" ], "additionalProperties": false, - "description": "One optional follow-up, sent from the Number that sent the first message. Null when the campaign has none. Content and timing freeze at launch." + "description": "One optional follow-up, sent from the Connection that sent the first message. Null when the campaign has none. Content and timing freeze at launch." }, "sendWindow": { "$ref": "#/components/schemas/CampaignSendWindow" @@ -24002,7 +24194,7 @@ "exitOnReply": { "type": "boolean", "default": true, - "description": "When true, a contact who replies to the sending number gets no further steps." + "description": "When true, a contact who replies to the sending connection gets no further steps." }, "exitOnLinkClick": { "type": "boolean", @@ -24054,7 +24246,7 @@ "templateId": { "type": "string", "format": "uuid", - "description": "Template in this project to send instead of composed messages. On Cloud API numbers it must be approved by WhatsApp on every number the campaign can send from before launch." + "description": "Template in this project to send instead of composed messages. On Cloud API connections it must be approved by WhatsApp on every connection the campaign can send from before launch." }, "variableMapping": { "$ref": "#/components/schemas/CampaignVariableMapping" @@ -24080,7 +24272,7 @@ }, "minItems": 2, "maxItems": 5, - "description": "Two to five message alternatives for linked-device numbers. Each recipient receives one, chosen by weight, and keeps it across retries. Cannot be combined with composed messages, a template or an A/B test. A beta; a team that is not enrolled gets `403 feature_unavailable`." + "description": "Two to five message alternatives for linked-device connections. Each recipient receives one, chosen by weight, and keeps it across retries. Cannot be combined with composed messages, a template or an A/B test. A beta; a team that is not enrolled gets `403 feature_unavailable`." }, "recipientListId": { "type": "string" @@ -24110,7 +24302,7 @@ "$ref": "#/components/schemas/CampaignTrackedLink" }, "maxItems": 5, - "description": "Beta. Links to track, at most 5. Each message reference `{{link:}}` is replaced with a short link per recipient that redirects to `url`. Only campaigns sent from linked-device numbers track links. Setting links requires the campaign link tracking beta (`403 feature_unavailable` otherwise); `null` or `[]` removes them." + "description": "Beta. Links to track, at most 5. Each message reference `{{link:}}` is replaced with a short link per recipient that redirects to `url`. Only campaigns sent from linked-device connections track links. Setting links requires the campaign link tracking beta (`403 feature_unavailable` otherwise); `null` or `[]` removes them." }, "frequencyCap": { "allOf": [ @@ -24235,7 +24427,7 @@ }, "exitOnReply": { "type": "boolean", - "description": "When true, a contact who replies to the sending number gets no further steps." + "description": "When true, a contact who replies to the sending connection gets no further steps." }, "exitOnLinkClick": { "type": "boolean", @@ -24371,7 +24563,7 @@ "$ref": "#/components/schemas/CampaignTrackedLink" }, "maxItems": 5, - "description": "Beta. Links to track, at most 5. Each message reference `{{link:}}` is replaced with a short link per recipient that redirects to `url`. Only campaigns sent from linked-device numbers track links. Setting links requires the campaign link tracking beta (`403 feature_unavailable` otherwise); `null` or `[]` removes them. Only a draft, including one waiting for its scheduled start, can change them; a launched campaign must still define every link its messages reference." + "description": "Beta. Links to track, at most 5. Each message reference `{{link:}}` is replaced with a short link per recipient that redirects to `url`. Only campaigns sent from linked-device connections track links. Setting links requires the campaign link tracking beta (`403 feature_unavailable` otherwise); `null` or `[]` removes them. Only a draft, including one waiting for its scheduled start, can change them; a launched campaign must still define every link its messages reference." }, "templateId": { "type": "string", @@ -24575,7 +24767,7 @@ "from": { "type": "object", "properties": { - "sessionId": { + "connectionId": { "type": "string", "format": "uuid" }, @@ -24584,10 +24776,10 @@ } }, "required": [ - "sessionId", + "connectionId", "phone" ], - "description": "The number the test was sent from." + "description": "The connection the test was sent from." }, "to": { "type": "string", @@ -24642,16 +24834,16 @@ "CampaignTestSendRequest": { "type": "object", "properties": { - "sessionId": { + "connectionId": { "type": "string", "format": "uuid", - "description": "The number to send the test from. It must be connected, on a plan that includes Campaigns, and, when the campaign selects numbers, one of them." + "description": "The connection to send the test from. It must be connected, on a plan that includes Campaigns, and, when the campaign selects connections, one of them." }, "to": { "type": "string", "minLength": 1, "maxLength": 32, - "description": "The seed recipient in international format. It must be the phone of a number connected to your team.", + "description": "The seed recipient in international format. It must be the phone of a connection connected to your team.", "example": "+5511999990000" }, "sampleRecipientId": { @@ -24680,7 +24872,7 @@ } }, "required": [ - "sessionId", + "connectionId", "to" ] }, @@ -24921,7 +25113,7 @@ "screen" ], "additionalProperties": false, - "description": "A published WhatsApp Flow form. Official numbers only." + "description": "A published WhatsApp Flow form. Official connections only." } ] }, @@ -25247,7 +25439,7 @@ "cold_held", "campaign_cancelled", "invalid_recipient", - "session_not_connected", + "connection_not_connected", "ack_timeout", "blocked_by_safety", "send_failed", @@ -25256,7 +25448,7 @@ "other", null ], - "description": "Why the recipient was not sent, or why its last attempt did not succeed. Null when nothing went wrong. `opted_out`: the number is on the team's opt-out list. `cold_held`: the number never wrote to the sending number and the campaign holds cold sends. `campaign_cancelled`: the campaign was stopped before this recipient was sent. `invalid_recipient`: the number is not a valid WhatsApp address. `session_not_connected`: the sending number was not connected. `ack_timeout`: WhatsApp did not acknowledge the send in time. `blocked_by_safety`: a safety check refused the send before it was attempted; the recipient waits for the campaign to resume. `send_failed`: WhatsApp refused the send, or its outcome could not be confirmed. `missing_variable`: the campaign was launched with `skipMissingVariables` and the recipient had no value and no fallback for a variable. `frequency_cap`: the recipient reached the team's or campaign's rolling contact frequency cap. `other`: any other reason. New codes may be added." + "description": "Why the recipient was not sent, or why its last attempt did not succeed. Null when nothing went wrong. `opted_out`: the phone number is on the team's opt-out list. `cold_held`: the recipient never wrote to the sending connection and the campaign holds cold sends. `campaign_cancelled`: the campaign was stopped before this recipient was sent. `invalid_recipient`: the recipient is not a valid WhatsApp address. `connection_not_connected`: the sending connection was not connected. `ack_timeout`: WhatsApp did not acknowledge the send in time. `blocked_by_safety`: a safety check refused the send before it was attempted; the recipient waits for the campaign to resume. `send_failed`: WhatsApp refused the send, or its outcome could not be confirmed. `missing_variable`: the campaign was launched with `skipMissingVariables` and the recipient had no value and no fallback for a variable. `frequency_cap`: the recipient reached the team's or campaign's rolling contact frequency cap. `other`: any other reason. New codes may be added." }, "externalMessageId": { "type": "string", @@ -25308,7 +25500,7 @@ "type": "string", "format": "uuid" }, - "numberId": { + "connectionId": { "type": "string", "format": "uuid" }, @@ -25377,7 +25569,7 @@ }, "required": [ "id", - "numberId", + "connectionId", "status", "anchorKind", "firstDeliveredAt", @@ -25560,7 +25752,7 @@ "type": "string", "enum": [ "initial", - "add_connection", + "add_method", "reauthorization" ] }, @@ -25571,7 +25763,7 @@ "hybrid" ] }, - "addConnection": { + "addMethod": { "type": "string", "enum": [ "linked_devices", @@ -25584,11 +25776,11 @@ }, "url": { "type": "string", - "description": "Hosted connection URL. Share it only with the person holding the phone." + "description": "Hosted method URL. Share it only with the person holding the phone." }, - "session": { + "connection": { "type": "string", - "description": "Session name that receives the connected number." + "description": "Connection name that receives the connected connection." }, "expiresAt": { "type": "string", @@ -25601,7 +25793,7 @@ "connectionGoal", "id", "url", - "session", + "connection", "expiresAt" ] }, @@ -25672,7 +25864,7 @@ "android", "ios" ], - "description": "Primary phone platform the Test number emulates. Defaults to `android`. Not accepted when `accountType` is `meta_cloud`.", + "description": "Primary phone platform the Test connection emulates. Defaults to `android`. Not accepted when `accountType` is `meta_cloud`.", "x-enumDescriptions": { "android": "An Android phone.", "ios": "An iPhone." @@ -25748,7 +25940,7 @@ }, "minItems": 1, "maxItems": 2, - "description": "Linked Devices methods offered for this connection." + "description": "Linked Devices methods offered for this method." }, "defaultMethod": { "type": "string", @@ -25909,15 +26101,15 @@ "standard", "zero_knowledge" ], - "description": "Signal key custody for a new Number. Inherits Customer then Project default; cannot change an existing Number. Customer-owned custody requires beta admission and real Linked Devices." + "description": "Signal key custody for a new Connection. Inherits Customer then Project default; cannot change an existing Connection. Customer-owned custody requires beta admission and real Linked Devices." }, "purpose": { "type": "string", "enum": [ "initial", - "add_connection" + "add_method" ], - "description": "Initial setup, or add a transport to an existing session without replacing the Number." + "description": "Initial setup, or add a method to an existing Connection without replacing the Connection." }, "connectionGoal": { "type": "string", @@ -25926,13 +26118,13 @@ "hybrid" ] }, - "session": { + "connection": { "type": "string", "minLength": 1, "maxLength": 128, - "description": "Existing session name. Required only for add_connection." + "description": "Existing connection name. Required only for add_method." }, - "addConnection": { + "addMethod": { "type": "string", "enum": [ "linked_devices", @@ -25942,12 +26134,12 @@ "projectId": { "type": "string", "format": "uuid", - "description": "Project that receives the connected number. Required for team keys with more than one project." + "description": "Project that receives the connected connection. Required for team keys with more than one project." }, "customerId": { "type": "string", "format": "uuid", - "description": "Customer that owns the connected number when Customers is enabled for the project." + "description": "Customer that owns the connected connection when Customers is enabled for the project." }, "billingControls": { "type": "object", @@ -25969,14 +26161,14 @@ "priority" ], "additionalProperties": false, - "description": "Initial monthly spending limit and funding priority for a real Number. Requires a team key with billing:manage or a live team owner/admin on Pay-As-You-Go. Applied atomically before pairing admission." + "description": "Initial monthly spending limit and funding priority for a real Connection. Requires a team key with billing:manage or a live team owner/admin on Pay-As-You-Go. Applied atomically before pairing admission." }, "externalId": { "type": "string", "minLength": 1, "maxLength": 256, "pattern": "^[^\\x00-\\x1f\\x7f]+$", - "description": "Integrator correlation copied to the resulting session. May repeat across invitations; does not grant access." + "description": "Integrator correlation copied to the resulting connection. May repeat across invitations; does not grant access." }, "configuration": { "$ref": "#/components/schemas/QuickLinkConfiguration" @@ -26003,7 +26195,7 @@ "allowed": { "type": "boolean" }, - "addConnection": { + "addMethod": { "type": "string", "nullable": true, "enum": [ @@ -26012,7 +26204,7 @@ null ] }, - "connections": { + "methods": { "type": "array", "items": { "type": "object", @@ -26042,8 +26234,8 @@ "required": [ "resumeQuickLinkId", "allowed", - "addConnection", - "connections" + "addMethod", + "methods" ] } }, @@ -26133,7 +26325,7 @@ "type": "string", "enum": [ "initial", - "add_connection", + "add_method", "reauthorization" ] }, @@ -26144,7 +26336,7 @@ "hybrid" ] }, - "addConnection": { + "addMethod": { "type": "string", "enum": [ "linked_devices", @@ -26161,9 +26353,9 @@ "failed", "cancelled" ], - "description": "`linked`: for Linked Devices, the device is linked and the recipient has not confirmed; for Meta Cloud API, the number is connected to Meta and is still being made ready to send. For Meta Cloud API, `connected` requires every readiness check to pass, a successful runtime connection, and the recipient's confirmation. `failed` carries the reason in `errorCode`." + "description": "`linked`: for Linked Devices, the device is linked and the recipient has not confirmed; for Meta Cloud API, the connection is connected to Meta and is still being made ready to send. For Meta Cloud API, `connected` requires every readiness check to pass, a successful runtime method, and the recipient's confirmation. `failed` carries the reason in `errorCode`." }, - "session": { + "connection": { "type": "string" }, "expiresAt": { @@ -26205,7 +26397,7 @@ "stage": { "type": "string" }, - "connection": { + "method": { "type": "string", "nullable": true }, @@ -26234,7 +26426,7 @@ }, "required": [ "stage", - "connection", + "method", "coexistence", "contactsSync", "historySync", @@ -26242,7 +26434,7 @@ "errorCode", "sync" ], - "description": "Durable connection and sync progress; omitted when the onboarding service is unavailable, null when no record exists. Sync request and delivery evidence are independent of the connection stage." + "description": "Durable method and sync progress; omitted when the onboarding service is unavailable, null when no record exists. Sync request and delivery evidence are independent of the method stage." } }, "required": [ @@ -26250,7 +26442,7 @@ "purpose", "connectionGoal", "status", - "session", + "connection", "expiresAt", "openedAt", "connectedAt", @@ -26288,7 +26480,7 @@ "action_required", "unknown" ], - "description": "`healthy`: every check passed. `action_required`: a check failed and the Number needs reauthorization or a change in Meta. `unknown`: Meta could not be reached or returned an incomplete answer; the check is retried. `pending`: not checked since the credentials were saved." + "description": "`healthy`: every check passed. `action_required`: a check failed and the Connection needs reauthorization or a change in Meta. `unknown`: Meta could not be reached or returned an incomplete answer; the check is retried. `pending`: not checked since the credentials were saved." }, "checkedAt": { "type": "string", @@ -26412,16 +26604,16 @@ }, "url": { "type": "string", - "description": "Hosted link. Share it only with the person who manages the Number's Meta assets." + "description": "Hosted link. Share it only with the person who manages the Connection's Meta assets." }, - "session": { + "connection": { "type": "string" } }, "required": [ "quicklinkId", "url", - "session" + "connection" ] }, "CloudReauthorizationResponse": { @@ -26599,7 +26791,7 @@ "android", "ios" ], - "description": "Primary phone platform the Test number emulates. Defaults to `android`. Not accepted when `accountType` is `meta_cloud`.", + "description": "Primary phone platform the Test connection emulates. Defaults to `android`. Not accepted when `accountType` is `meta_cloud`.", "x-enumDescriptions": { "android": "An Android phone.", "ios": "An iPhone." @@ -26709,7 +26901,7 @@ "type": "string", "enum": [ "initial", - "add_connection", + "add_method", "reauthorization" ] }, @@ -26720,7 +26912,7 @@ "hybrid" ] }, - "addConnection": { + "addMethod": { "type": "string", "nullable": true, "enum": [ @@ -26750,7 +26942,7 @@ "format": "uri", "description": "Snapshotted failure callback for a failed link. Omitted for non-failed states." }, - "connections": { + "connectionChoices": { "type": "array", "items": { "type": "string", @@ -26807,7 +26999,7 @@ "stage": { "type": "string" }, - "connection": { + "method": { "type": "string", "nullable": true }, @@ -26836,7 +27028,7 @@ }, "required": [ "stage", - "connection", + "method", "coexistence", "contactsSync", "historySync", @@ -26941,18 +27133,18 @@ "allowChange": { "type": "boolean" }, - "noNumber": { + "noConnection": { "type": "boolean" }, - "allowNoNumber": { + "allowNoConnection": { "type": "boolean" } }, "required": [ "confirmed", "allowChange", - "noNumber", - "allowNoNumber" + "noConnection", + "allowNoConnection" ] }, "prefillPhone": { @@ -27007,9 +27199,9 @@ }, "customer": { "type": "boolean", - "description": "True when the link assigns the number to a Customer." + "description": "True when the link assigns the connection to a Customer." }, - "session": { + "connection": { "type": "object", "properties": { "status": { @@ -27028,7 +27220,7 @@ "qrSvg": { "type": "string", "nullable": true, - "description": "Inline SVG of the current WhatsApp QR code, when the QR method is offered and the number is not linked yet." + "description": "Inline SVG of the current WhatsApp QR code, when the QR method is offered and the connection is not linked yet." }, "passkeyAvailable": { "type": "boolean", @@ -27123,10 +27315,10 @@ "status", "purpose", "connectionGoal", - "addConnection", + "addMethod", "hybridPhase", "expiresAt", - "connections", + "connectionChoices", "selectedConnection", "connectionPreference", "connectionEnforcement", @@ -27152,7 +27344,7 @@ "prefillPhone", "phoneIdentity", "customer", - "session", + "connection", "qrSvg", "errorCode" ] @@ -27283,8 +27475,8 @@ "call.received", "call.missed", "call.ended", - "session.status", - "session.restriction_updated", + "connection.status", + "connection.restriction_updated", "template.status" ] }, @@ -27322,12 +27514,12 @@ "call.received", "call.missed", "call.ended", - "session.status", - "session.restriction_updated", + "connection.status", + "connection.restriction_updated", "template.status" ] }, - "session": { + "connection": { "type": "string" }, "delivery": { @@ -27352,7 +27544,7 @@ }, "required": [ "event", - "session", + "connection", "delivery", "eventId", "source" @@ -27407,7 +27599,7 @@ "type": "string", "enum": [ "invalid_recipient", - "session_not_connected", + "connection_not_connected", "ack_timeout", "send_failed", "blocked_by_safety" @@ -27486,8 +27678,8 @@ "call.received", "call.missed", "call.ended", - "session.status", - "session.restriction_updated", + "connection.status", + "connection.restriction_updated", "template.status" ], "description": "Fixture name. Each name is the event type it produces." @@ -27495,11 +27687,11 @@ "overrides": { "$ref": "#/components/schemas/TestEventOverrides" }, - "fromNumber": { + "fromConnection": { "type": "string", "minLength": 1, "maxLength": 128, - "description": "message.received only. Send a simulated text message from this other connected Test number in the same project instead of generating an event." + "description": "message.received only. Send a simulated text message from this other connected Test connection in the same project instead of generating an event." } }, "required": [ @@ -27510,7 +27702,7 @@ "TestingPhoneState": { "type": "object", "properties": { - "session": { + "connection": { "type": "string" }, "phone": { @@ -27534,11 +27726,11 @@ "deviceId" ] }, - "description": "Companions linked to the phone, such as Polymorfa's own session and Inspector." + "description": "Companions linked to the phone, such as Polymorfa's own connection and Inspector." } }, "required": [ - "session", + "connection", "phone", "online", "devices" @@ -27547,7 +27739,7 @@ "TestingPhoneMessage": { "type": "object", "properties": { - "session": { + "connection": { "type": "string" }, "to": { @@ -27559,7 +27751,7 @@ } }, "required": [ - "session", + "connection", "to", "messageId" ] @@ -27570,7 +27762,7 @@ "to": { "type": "string", "pattern": "^\\+[1-9]\\d{7,14}$", - "description": "Another Test number in the same project, in E.164 format." + "description": "The phone number of another Test connection in the same project, in E.164 format." }, "text": { "type": "string", @@ -27587,7 +27779,7 @@ "TestingPhoneUnlink": { "type": "object", "properties": { - "session": { + "connection": { "type": "string" }, "deviceId": { @@ -27601,7 +27793,7 @@ } }, "required": [ - "session", + "connection", "deviceId", "unlinked" ] @@ -27609,7 +27801,7 @@ "TestingAccountMode": { "type": "object", "properties": { - "session": { + "connection": { "type": "string" }, "accountType": { @@ -27644,18 +27836,18 @@ }, "changed": { "type": "boolean", - "description": "False when the Test number already used this mode. Nothing was unlinked." + "description": "False when the Test connection already used this mode. Nothing was unlinked." }, "unlinkedDevices": { "type": "array", "items": { "type": "integer" }, - "description": "Companions the phone unlinked. Each must pair again, including Polymorfa's own session." + "description": "Companions the phone unlinked. Each must pair again, including Polymorfa's own connection." } }, "required": [ - "session", + "connection", "accountType", "primaryPlatform", "changed", @@ -27687,7 +27879,7 @@ "android", "ios" ], - "description": "Primary phone platform the Test number emulates. Defaults to `android`. Not accepted when `accountType` is `meta_cloud`.", + "description": "Primary phone platform the Test connection emulates. Defaults to `android`. Not accepted when `accountType` is `meta_cloud`.", "x-enumDescriptions": { "android": "An Android phone.", "ios": "An iPhone." @@ -27727,7 +27919,7 @@ "BearerAuth": { "type": "http", "scheme": "bearer", - "description": "Polymorfa team key (pmfa_ prefix), project token (pmfa_pt_ prefix) where supported, or short-lived client token (pmfa_ct_ prefix). Team keys and project tokens may be personal or service-account owned and enforce selected action scopes. Team keys cover the team and its projects; project tokens stay inside one project. Client tokens stay inside their live project and session and enforce their client rules and immutable mint-time action ceiling. Treat all credentials as opaque strings. Never parse them or assume a fixed length; store at least 512 characters. Server keys use issuance-record lookup; short-lived client tokens carry a signed permission ceiling." + "description": "Polymorfa team key (pmfa_ prefix), project token (pmfa_pt_ prefix) where supported, or short-lived client token (pmfa_ct_ prefix). Team keys and project tokens may be personal or service-account owned and enforce selected action scopes. Team keys cover the team and its projects; project tokens stay inside one project. Client tokens stay inside their live project and connection and enforce their client rules and immutable mint-time action ceiling. Treat all credentials as opaque strings. Never parse them or assume a fixed length; store at least 512 characters. Server keys use issuance-record lookup; short-lived client tokens carry a signed permission ceiling." } } }, @@ -27994,9 +28186,6 @@ } } }, - "x-mint": { - "content": "bridge:connect" - }, "description": "**Required scope:** `bridge:connect`" } }, @@ -28085,7 +28274,7 @@ "ticket": { "type": "string" }, - "session": { + "connection": { "type": "string" }, "teamId": { @@ -28138,7 +28327,7 @@ "phoneMasked": { "type": "string", "nullable": true, - "description": "The number being linked with only the country code and last four digits visible, for example `+55 •• ••••• 4321`. Null when the pairing link has not collected a number." + "description": "The phone number being linked with only the country code and last four digits visible, for example `+55 •• ••••• 4321`. Null when the pairing link has not collected a phone number." } }, "required": [ @@ -28152,7 +28341,7 @@ "allowCredentials", "version", "ticket", - "session", + "connection", "teamId", "projectId", "attemptId", @@ -28755,20 +28944,20 @@ } } }, - "/messaging/{session}/passkey/challenge": { + "/messaging/{connection}/passkey/challenge": { "post": { "operationId": "issuePasskeyChallenge", "tags": [ "Passkey" ], - "summary": "Issue a single-use WebAuthn challenge ticket for a session", - "description": "**Protocols:** Linked Device API\n\n**Required scope:** `sessions:manage`\n\nYour team must have direct-pairing access for the target Number. Use [QuickLink](/numbers/quicklink) for standard connections. Binds a WhatsApp-originated passkey challenge to one session with a short TTL. The extension runs the ceremony and the assertion comes back to the redeem endpoint.", + "summary": "Issue a single-use WebAuthn challenge ticket for a connection", + "description": "**Protocols:** Linked Device API\n\n**Required scope:** `connections:manage`\n\nYour team must have direct-pairing access for the target Connection. Use [QuickLink](/connections/quicklink) for standard methods. Binds a WhatsApp-originated passkey challenge to one connection with a short TTL. The extension runs the ceremony and the assertion comes back to the redeem endpoint.", "security": [ { "BearerAuth": [] } ], - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "parameters": [ { "schema": { @@ -28776,7 +28965,7 @@ "minLength": 1 }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -28940,7 +29129,7 @@ } }, "409": { - "description": "No passkey challenge pending for this session", + "description": "No passkey challenge pending for this connection", "content": { "application/json": { "schema": { @@ -29164,28 +29353,25 @@ } } }, - "x-mint": { - "content": "Linked Device API sessions:manage" - }, "x-protocols": [ "Linked Device API" ] } }, - "/messaging/{session}/passkey/challenge/{ticketId}": { + "/messaging/{connection}/passkey/challenge/{ticketId}": { "get": { "operationId": "getPasskeyChallenge", "tags": [ "Passkey" ], "summary": "Read a live passkey challenge ticket", - "description": "**Protocols:** Linked Device API\n\n**Required scope:** `sessions:manage`\n\nYour team must have direct-pairing access for the target Number. Returns the ceremony options for a ticket that has not expired and has not been redeemed.", + "description": "**Protocols:** Linked Device API\n\n**Required scope:** `connections:manage`\n\nYour team must have direct-pairing access for the target Connection. Returns the ceremony options for a ticket that has not expired and has not been redeemed.", "security": [ { "BearerAuth": [] } ], - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "parameters": [ { "schema": { @@ -29193,7 +29379,7 @@ "minLength": 1 }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -29357,7 +29543,7 @@ } }, "409": { - "description": "No passkey challenge pending for this session", + "description": "No passkey challenge pending for this connection", "content": { "application/json": { "schema": { @@ -29549,28 +29735,25 @@ } } }, - "x-mint": { - "content": "Linked Device API sessions:manage" - }, "x-protocols": [ "Linked Device API" ] } }, - "/messaging/{session}/passkey/assertion": { + "/messaging/{connection}/passkey/assertion": { "post": { "operationId": "submitPasskeyAssertion", "tags": [ "Passkey" ], "summary": "Redeem a passkey ticket with the ceremony assertion", - "description": "**Protocols:** Linked Device API\n\n**Required scope:** `sessions:manage`\n\nThe complete HTTP body is limited to 1048576 UTF-8 bytes before JSON parsing. Credential IDs allow at most 1023 decoded bytes; user handles allow 64. Opaque assertion fields share the body budget without independent small caps. Your team must have direct-pairing access for the target Number. Single-use: verifies the assertion is bound to the ticket challenge, forwards it to the session runner, and consumes the ticket once acknowledged.", + "description": "**Protocols:** Linked Device API\n\n**Required scope:** `connections:manage`\n\nThe complete HTTP body is limited to 1048576 UTF-8 bytes before JSON parsing. Credential IDs allow at most 1023 decoded bytes; user handles allow 64. Opaque assertion fields share the body budget without independent small caps. Your team must have direct-pairing access for the target Connection. Single-use: verifies the assertion is bound to the ticket challenge, forwards it to the connection runner, and consumes the ticket once acknowledged.", "security": [ { "BearerAuth": [] } ], - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "parameters": [ { "schema": { @@ -29578,7 +29761,7 @@ "minLength": 1 }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -29742,7 +29925,7 @@ } }, "409": { - "description": "No passkey challenge pending for this session", + "description": "No passkey challenge pending for this connection", "content": { "application/json": { "schema": { @@ -29966,15 +30149,12 @@ } } }, - "x-mint": { - "content": "Linked Device API sessions:manage" - }, "x-protocols": [ "Linked Device API" ] } }, - "/messaging/{session}/passkey/confirmation": { + "/messaging/{connection}/passkey/confirmation": { "post": { "operationId": "confirmPasskey", "tags": [ @@ -29986,8 +30166,8 @@ "BearerAuth": [] } ], - "description": "**Protocols:** Linked Device API\n\n**Required scope:** `sessions:manage`\n\nConfirm only after comparing the displayed code with the phone. Omit code only when the current runner reports skipHandoffUX. An accepted confirmation still waits for pairing completion.", - "x-required-scope": "sessions:manage", + "description": "**Protocols:** Linked Device API\n\n**Required scope:** `connections:manage`\n\nConfirm only after comparing the displayed code with the phone. Omit code only when the current runner reports skipHandoffUX. An accepted confirmation still waits for pairing completion.", + "x-required-scope": "connections:manage", "parameters": [ { "schema": { @@ -29995,7 +30175,7 @@ "minLength": 1 }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -30174,7 +30354,7 @@ } }, "409": { - "description": "No passkey challenge pending for this session", + "description": "No passkey challenge pending for this connection", "content": { "application/json": { "schema": { @@ -30398,9 +30578,6 @@ } } }, - "x-mint": { - "content": "Linked Device API sessions:manage" - }, "x-protocols": [ "Linked Device API" ] @@ -30410,14 +30587,14 @@ "tags": [ "Passkey" ], - "summary": "Read the passkey round-trip state for a session", - "description": "**Protocols:** Linked Device API\n\n**Required scope:** `sessions:manage`\n\nYour team must have direct-pairing access for the target Number. Reports where the ceremony stands: no round-trip, challenge pending, assertion submitted, code available for comparison, confirmation sending, waiting for pairing, completed, or failed.", + "summary": "Read the passkey round-trip state for a connection", + "description": "**Protocols:** Linked Device API\n\n**Required scope:** `connections:manage`\n\nYour team must have direct-pairing access for the target Connection. Reports where the ceremony stands: no round-trip, challenge pending, assertion submitted, code available for comparison, confirmation sending, waiting for pairing, completed, or failed.", "security": [ { "BearerAuth": [] } ], - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "parameters": [ { "schema": { @@ -30425,7 +30602,7 @@ "minLength": 1 }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -30580,7 +30757,7 @@ } }, "409": { - "description": "No passkey challenge pending for this session", + "description": "No passkey challenge pending for this connection", "content": { "application/json": { "schema": { @@ -30772,35 +30949,32 @@ } } }, - "x-mint": { - "content": "Linked Device API sessions:manage" - }, "x-protocols": [ "Linked Device API" ] } }, - "/messaging/{session}/pair/qr": { + "/messaging/{connection}/pair/qr": { "get": { "operationId": "getQRCode", "tags": [ "Pairing" ], "summary": "Get QR code for device pairing", - "description": "**Protocols:** Linked Device API\n\n**Required scope:** `sessions:manage`\n\nDirect-pairing access must be enabled for the team that owns this Number. Use [QuickLink](/numbers/quicklink) when direct pairing is unavailable. Requests without access return 403.", + "description": "**Protocols:** Linked Device API\n\n**Required scope:** `connections:manage`\n\nDirect-pairing access must be enabled for the team that owns this Connection. Use [QuickLink](/connections/quicklink) when direct pairing is unavailable. Requests without access return 403.", "security": [ { "BearerAuth": [] } ], - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "parameters": [ { "schema": { "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -30910,7 +31084,7 @@ } }, "403": { - "description": "Direct-pairing access is required for this Number. Use QuickLink when it is unavailable.", + "description": "Direct-pairing access is required for this Connection. Use QuickLink when it is unavailable.", "content": { "application/json": { "schema": { @@ -31006,35 +31180,32 @@ } } }, - "x-mint": { - "content": "Linked Device API sessions:manage" - }, "x-protocols": [ "Linked Device API" ] } }, - "/messaging/{session}/pair/code": { + "/messaging/{connection}/pair/code": { "post": { "operationId": "requestPairCode", "tags": [ "Pairing" ], "summary": "Request a pairing code for a phone number", - "description": "**Protocols:** Linked Device API\n\n**Required scope:** `sessions:manage`\n\nDirect-pairing access must be enabled for the team that owns this Number. Use [QuickLink](/numbers/quicklink) when direct pairing is unavailable. Requests without access return 403.", + "description": "**Protocols:** Linked Device API\n\n**Required scope:** `connections:manage`\n\nDirect-pairing access must be enabled for the team that owns this Connection. Use [QuickLink](/connections/quicklink) when direct pairing is unavailable. Requests without access return 403.", "security": [ { "BearerAuth": [] } ], - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "parameters": [ { "schema": { "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -31134,7 +31305,7 @@ } }, "403": { - "description": "Direct-pairing access is required for this Number. Use QuickLink when it is unavailable.", + "description": "Direct-pairing access is required for this Connection. Use QuickLink when it is unavailable.", "content": { "application/json": { "schema": { @@ -31230,9 +31401,6 @@ } } }, - "x-mint": { - "content": "Linked Device API sessions:manage" - }, "x-protocols": [ "Linked Device API" ] @@ -31244,13 +31412,13 @@ "tags": [ "Messages" ], - "summary": "Read a team, project or Number routing policy", + "summary": "Read a team, project or Connection routing policy", "security": [ { "BearerAuth": [] } ], - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "parameters": [ { "schema": { @@ -31258,7 +31426,7 @@ "enum": [ "team", "project", - "session" + "connection" ] }, "required": true, @@ -31281,7 +31449,7 @@ "maxLength": 256 }, "required": false, - "name": "session", + "name": "connection", "in": "query" } ], @@ -31455,10 +31623,7 @@ } } }, - "x-mint": { - "content": "sessions:read" - }, - "description": "**Required scope:** `sessions:read`" + "description": "**Required scope:** `connections:read`" }, "put": { "operationId": "setHybridRoutingPolicy", @@ -31471,7 +31636,7 @@ "BearerAuth": [] } ], - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "parameters": [ { "schema": { @@ -31479,7 +31644,7 @@ "enum": [ "team", "project", - "session" + "connection" ] }, "required": true, @@ -31502,7 +31667,7 @@ "maxLength": 256 }, "required": false, - "name": "session", + "name": "connection", "in": "query" } ], @@ -31685,25 +31850,22 @@ } } }, - "x-mint": { - "content": "sessions:manage" - }, - "description": "**Required scope:** `sessions:manage`" + "description": "**Required scope:** `connections:manage`" } }, - "/messaging/{session}/hybrid-link": { + "/messaging/{connection}/hybrid-link": { "get": { "operationId": "getHybridLinkState", "tags": [ - "Sessions" + "Connections" ], - "summary": "Read the Number's Hybrid connection state", + "summary": "Read the Connection's Hybrid connection state", "security": [ { "BearerAuth": [] } ], - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "parameters": [ { "schema": { @@ -31711,7 +31873,7 @@ "minLength": 1 }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -31885,18 +32047,15 @@ } } }, - "x-mint": { - "content": "Linked Device API sessions:read" - }, "x-protocols": [ "Linked Device API" ], - "description": "**Protocols:** Linked Device API\n\n**Required scope:** `sessions:read`" + "description": "**Protocols:** Linked Device API\n\n**Required scope:** `connections:read`" }, "put": { "operationId": "setHybridLinkPaused", "tags": [ - "Sessions" + "Connections" ], "summary": "Pause or resume Hybrid sending", "security": [ @@ -31904,7 +32063,7 @@ "BearerAuth": [] } ], - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "parameters": [ { "schema": { @@ -31912,7 +32071,7 @@ "minLength": 1 }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -32109,23 +32268,20 @@ } } }, - "x-mint": { - "content": "Linked Device API sessions:manage" - }, "x-protocols": [ "Linked Device API" ], - "description": "**Protocols:** Linked Device API\n\n**Required scope:** `sessions:manage`" + "description": "**Protocols:** Linked Device API\n\n**Required scope:** `connections:manage`" } }, - "/messaging/{session}/messages/send": { + "/messaging/{connection}/messages/send": { "post": { "operationId": "sendMessage", "tags": [ "Messages" ], "summary": "Send a message", - "description": "**Protocols:** Linked Device API · Meta Cloud API · Polymorfa Hybrid Link\n\n**Required scope:** `messages:write`\n\nSend a message to a conversation. Put exactly one message kind inside content. The complete JSON request body is limited to 72 MiB before parsing; decoded media remains limited to 50 MiB. Testing sessions send only to active testing numbers in the same project; supply the recipient phoneNumber.", + "description": "**Protocols:** Linked Device API · Meta Cloud API · Polymorfa Hybrid Link\n\n**Required scope:** `messages:write`\n\nSend a message to a conversation. Put exactly one message kind inside content. The complete JSON request body is limited to 72 MiB before parsing; decoded media remains limited to 50 MiB. Testing connections send only to active testing connections in the same project; supply the recipient phoneNumber.", "security": [ { "BearerAuth": [] @@ -32138,7 +32294,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -32320,7 +32476,7 @@ } }, "402": { - "description": "`billing_credit_required`: credit is unavailable for this number. Add credit or review team billing.", + "description": "`billing_credit_required`: credit is unavailable for this connection. Add credit or review team billing.", "content": { "application/json": { "schema": { @@ -32330,7 +32486,7 @@ "error": { "type": "billing_error", "code": "billing_credit_required", - "message": "Credit is unavailable for this number. Add credit or review team billing.", + "message": "Credit is unavailable for this connection. Add credit or review team billing.", "param": null, "request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30" }, @@ -32394,7 +32550,7 @@ } }, "409": { - "description": "`unsupported_for_connection`: call permission requests need a Cloud API number; `call_permission_granted`: the person already granted permanent permission. The Idempotency-Key belongs to a request that is still running (`idempotency_in_progress`, with Retry-After) or whose outcome was not recorded (`idempotency_outcome_unknown`)", + "description": "`unsupported_for_connection`: call permission requests need a Cloud API connection; `call_permission_granted`: the person already granted permanent permission. The Idempotency-Key belongs to a request that is still running (`idempotency_in_progress`, with Retry-After) or whose outcome was not recorded (`idempotency_outcome_unknown`)", "content": { "application/json": { "schema": { @@ -32404,7 +32560,7 @@ "error": { "type": "conflict_error", "code": "unsupported_for_connection", - "message": "The session's connection does not support this call operation.", + "message": "The connection's connection does not support this call operation.", "param": null, "request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30" }, @@ -32547,7 +32703,7 @@ "error": { "type": "rate_limit_error", "code": "call_permission_request_limited", - "message": "WhatsApp limits how often this number can ask this person for call permission. Follow Retry-After when supplied.", + "message": "WhatsApp limits how often this connection can ask this person for call permission. Follow Retry-After when supplied.", "param": null, "request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30" }, @@ -32602,7 +32758,7 @@ } }, "501": { - "description": "`operation_not_supported`: the number's connection cannot send this content, such as a poll, or a URL, call or copy-code button on an official WhatsApp Business number", + "description": "`operation_not_supported`: the selected method cannot send this content, such as a poll, or a URL, call or copy-code button on an Official API connection", "content": { "application/json": { "schema": { @@ -32678,7 +32834,7 @@ } }, "503": { - "description": "Session or service unavailable. For `idempotency_replay_unavailable` only: the exact response for this Idempotency-Key is unavailable (with Retry-After). Opaque responses are not retained by default. The write did not run again. Keep the first response and reconcile events or the resource; waiting does not guarantee that replay data becomes available. Do not switch keys to resend", + "description": "Connection or service unavailable. For `idempotency_replay_unavailable` only: the exact response for this Idempotency-Key is unavailable (with Retry-After). Opaque responses are not retained by default. The write did not run again. Keep the first response and reconcile events or the resource; waiting does not guarantee that replay data becomes available. Do not switch keys to resend", "content": { "application/json": { "schema": { @@ -32773,9 +32929,6 @@ } } }, - "x-mint": { - "content": "Linked Device API Meta Cloud API Polymorfa Hybrid Link messages:write" - }, "x-protocols": [ "Linked Device API", "Meta Cloud API", @@ -32783,7 +32936,7 @@ ] } }, - "/messaging/{session}/messages/seen": { + "/messaging/{connection}/messages/seen": { "post": { "operationId": "sendSeen", "tags": [ @@ -32802,7 +32955,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -32901,7 +33054,7 @@ } }, "402": { - "description": "`billing_credit_required`: credit is unavailable for this number. Add credit or review team billing.", + "description": "`billing_credit_required`: credit is unavailable for this connection. Add credit or review team billing.", "content": { "application/json": { "schema": { @@ -32911,7 +33064,7 @@ "error": { "type": "billing_error", "code": "billing_credit_required", - "message": "Credit is unavailable for this number. Add credit or review team billing.", + "message": "Credit is unavailable for this connection. Add credit or review team billing.", "param": null, "request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30" }, @@ -33038,7 +33191,7 @@ } }, "503": { - "description": "Session or service unavailable", + "description": "Connection or service unavailable", "content": { "application/json": { "schema": { @@ -33080,9 +33233,6 @@ } } }, - "x-mint": { - "content": "Linked Device API Meta Cloud API Polymorfa Hybrid Link messages:write" - }, "x-protocols": [ "Linked Device API", "Meta Cloud API", @@ -33091,14 +33241,14 @@ "description": "**Protocols:** Linked Device API · Meta Cloud API · Polymorfa Hybrid Link\n\n**Required scope:** `messages:write`" } }, - "/messaging/{session}/messages/typing": { + "/messaging/{connection}/messages/typing": { "post": { "operationId": "setTyping", "tags": [ "Messages" ], "summary": "Set typing indicator for a chat", - "description": "**Protocols:** Linked Device API · Meta Cloud API\n\n**Required scope:** `messages:write`\n\nOn a Linked Devices number, `state` sets typing, recording or paused. On an official WhatsApp Business number, send `state: \"typing\"` with the `id` of a message you received; this marks that message read and shows a typing indicator until you reply or 25 seconds pass. On a Number with both connections, this method uses the Linked Devices connection; use the Graph API status request for official typing. Other states return `501`, and a missing `id` returns `400`.", + "description": "**Protocols:** Linked Device API · Meta Cloud API\n\n**Required scope:** `messages:write`\n\nOn a Linked Devices connection, `state` sets typing, recording or paused. On an Official API connection, send `state: \"typing\"` with the `id` of a message you received; this marks that message read and shows a typing indicator until you reply or 25 seconds pass. On a Connection with both methods, this operation uses Linked Devices; use the Graph API status request for official typing. Other states return `501`, and a missing `id` returns `400`.", "security": [ { "BearerAuth": [] @@ -33111,7 +33261,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -33210,7 +33360,7 @@ } }, "402": { - "description": "`billing_credit_required`: credit is unavailable for this number. Add credit or review team billing.", + "description": "`billing_credit_required`: credit is unavailable for this connection. Add credit or review team billing.", "content": { "application/json": { "schema": { @@ -33220,7 +33370,7 @@ "error": { "type": "billing_error", "code": "billing_credit_required", - "message": "Credit is unavailable for this number. Add credit or review team billing.", + "message": "Credit is unavailable for this connection. Add credit or review team billing.", "param": null, "request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30" }, @@ -33326,7 +33476,7 @@ } }, "501": { - "description": "`operation_not_supported`: official WhatsApp Business numbers support only the `typing` state", + "description": "`operation_not_supported`: Official API connections support only the `typing` state", "content": { "application/json": { "schema": { @@ -33379,7 +33529,7 @@ } }, "503": { - "description": "Session or service unavailable", + "description": "Connection or service unavailable", "content": { "application/json": { "schema": { @@ -33421,16 +33571,13 @@ } } }, - "x-mint": { - "content": "Linked Device API Meta Cloud API messages:write" - }, "x-protocols": [ "Linked Device API", "Meta Cloud API" ] } }, - "/messaging/{session}/messages/react": { + "/messaging/{connection}/messages/react": { "post": { "operationId": "sendReaction", "tags": [ @@ -33449,7 +33596,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -33623,7 +33770,7 @@ } }, "402": { - "description": "`billing_credit_required`: credit is unavailable for this number. Add credit or review team billing.", + "description": "`billing_credit_required`: credit is unavailable for this connection. Add credit or review team billing.", "content": { "application/json": { "schema": { @@ -33633,7 +33780,7 @@ "error": { "type": "billing_error", "code": "billing_credit_required", - "message": "Credit is unavailable for this number. Add credit or review team billing.", + "message": "Credit is unavailable for this connection. Add credit or review team billing.", "param": null, "request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30" }, @@ -33879,7 +34026,7 @@ } }, "503": { - "description": "Session or service unavailable. For `idempotency_replay_unavailable` only: the exact response for this Idempotency-Key is unavailable (with Retry-After). Opaque responses are not retained by default. The write did not run again. Keep the first response and reconcile events or the resource; waiting does not guarantee that replay data becomes available. Do not switch keys to resend", + "description": "Connection or service unavailable. For `idempotency_replay_unavailable` only: the exact response for this Idempotency-Key is unavailable (with Retry-After). Opaque responses are not retained by default. The write did not run again. Keep the first response and reconcile events or the resource; waiting does not guarantee that replay data becomes available. Do not switch keys to resend", "content": { "application/json": { "schema": { @@ -33974,9 +34121,6 @@ } } }, - "x-mint": { - "content": "Linked Device API Meta Cloud API Polymorfa Hybrid Link messages:write" - }, "x-protocols": [ "Linked Device API", "Meta Cloud API", @@ -33985,7 +34129,7 @@ "description": "**Protocols:** Linked Device API · Meta Cloud API · Polymorfa Hybrid Link\n\n**Required scope:** `messages:write`" } }, - "/messaging/{session}/messages/star": { + "/messaging/{connection}/messages/star": { "post": { "operationId": "starMessage", "tags": [ @@ -34004,7 +34148,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -34103,7 +34247,7 @@ } }, "402": { - "description": "`billing_credit_required`: credit is unavailable for this number. Add credit or review team billing.", + "description": "`billing_credit_required`: credit is unavailable for this connection. Add credit or review team billing.", "content": { "application/json": { "schema": { @@ -34113,7 +34257,7 @@ "error": { "type": "billing_error", "code": "billing_credit_required", - "message": "Credit is unavailable for this number. Add credit or review team billing.", + "message": "Credit is unavailable for this connection. Add credit or review team billing.", "param": null, "request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30" }, @@ -34240,7 +34384,7 @@ } }, "503": { - "description": "Session or service unavailable", + "description": "Connection or service unavailable", "content": { "application/json": { "schema": { @@ -34282,16 +34426,13 @@ } } }, - "x-mint": { - "content": "Linked Device API messages:write" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `messages:write`" } }, - "/messaging/{session}/operations/{operationId}": { + "/messaging/{connection}/operations/{operationId}": { "get": { "operationId": "getMessageOperation", "tags": [ @@ -34311,7 +34452,7 @@ "minLength": 1 }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -34473,16 +34614,13 @@ } } }, - "x-mint": { - "content": "Linked Device API operations:read" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `operations:read`" } }, - "/messaging/{session}/chats/{conversation}/messages/{messageId}": { + "/messaging/{connection}/chats/{conversation}/messages/{messageId}": { "put": { "operationId": "editMessage", "tags": [ @@ -34501,7 +34639,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -34945,9 +35083,6 @@ } } }, - "x-mint": { - "content": "Linked Device API chats:manage" - }, "x-protocols": [ "Linked Device API" ], @@ -34971,7 +35106,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -35419,9 +35554,6 @@ } } }, - "x-mint": { - "content": "Linked Device API chats:manage" - }, "x-protocols": [ "Linked Device API" ], @@ -35445,10 +35577,10 @@ "schema": { "type": "string", "minLength": 1, - "description": "Number ID." + "description": "Connection ID." }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -35564,7 +35696,7 @@ } }, "404": { - "description": "The Number or conversation is unavailable, or hosted message storage is not enabled (`hms_not_enabled`).", + "description": "The Connection or conversation is unavailable, or hosted message storage is not enabled (`hms_not_enabled`).", "content": { "application/json": { "schema": { @@ -35585,7 +35717,7 @@ } }, "503": { - "description": "The history service for the Number's data region is unavailable.", + "description": "The history service for the Connection's data region is unavailable.", "content": { "application/json": { "schema": { @@ -35606,15 +35738,12 @@ } } }, - "x-mint": { - "content": "Linked Device API messages:read" - }, "x-protocols": [ "Linked Device API" ] } }, - "/messaging/{session}/chats/{conversation}/archive": { + "/messaging/{connection}/chats/{conversation}/archive": { "post": { "operationId": "archiveChat", "tags": [ @@ -35633,7 +35762,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -35828,16 +35957,13 @@ } } }, - "x-mint": { - "content": "Linked Device API chats:manage" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `chats:manage`" } }, - "/messaging/{session}/chats/{conversation}/unarchive": { + "/messaging/{connection}/chats/{conversation}/unarchive": { "post": { "operationId": "unarchiveChat", "tags": [ @@ -35856,7 +35982,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -36051,16 +36177,13 @@ } } }, - "x-mint": { - "content": "Linked Device API chats:manage" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `chats:manage`" } }, - "/messaging/{session}/chats/{conversation}/disappearing": { + "/messaging/{connection}/chats/{conversation}/disappearing": { "put": { "operationId": "setChatDisappearingTimer", "tags": [ @@ -36079,7 +36202,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -36283,36 +36406,33 @@ } } }, - "x-mint": { - "content": "Linked Device API chats:manage" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `chats:manage`" } }, - "/messaging/{session}/calls": { + "/messaging/{connection}/calls": { "get": { - "operationId": "listSessionCalls", + "operationId": "listConnectionCalls", "tags": [ "Calls" ], - "summary": "List a number's calls", - "description": "**Protocols:** Linked Device API\n\n**Required scope:** `sessions:read`\n\nCalls on this number, newest first, with the other party's identity. Records are stored and served in the number's data region. Client tokens need the `read_calls` action.", + "summary": "List a connection's calls", + "description": "**Protocols:** Linked Device API\n\n**Required scope:** `connections:read`\n\nCalls on this connection, newest first, with the other party's identity. Records are stored and served in the connection's data region. Client tokens need the `read_calls` action.", "security": [ { "BearerAuth": [] } ], - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "parameters": [ { "schema": { "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -36382,7 +36502,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ListSessionCallsResponse" + "$ref": "#/components/schemas/ListConnectionCallsResponse" } } }, @@ -36559,15 +36679,12 @@ } } }, - "x-mint": { - "content": "Linked Device API sessions:read" - }, "x-protocols": [ "Linked Device API" ] } }, - "/messaging/{session}/stickers": { + "/messaging/{connection}/stickers": { "get": { "operationId": "listStoredStickers", "tags": [ @@ -36590,10 +36707,10 @@ "schema": { "type": "string", "minLength": 1, - "description": "Number ID." + "description": "Connection ID." }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -36724,7 +36841,7 @@ } }, "404": { - "description": "The Number or conversation is unavailable, or hosted message storage is not enabled (`hms_not_enabled`).", + "description": "The Connection or conversation is unavailable, or hosted message storage is not enabled (`hms_not_enabled`).", "content": { "application/json": { "schema": { @@ -36745,7 +36862,7 @@ } }, "503": { - "description": "The history service for the Number's data region is unavailable.", + "description": "The history service for the Connection's data region is unavailable.", "content": { "application/json": { "schema": { @@ -36766,22 +36883,19 @@ } } }, - "x-mint": { - "content": "Linked Device API messages:read media:read" - }, "x-protocols": [ "Linked Device API" ] } }, - "/messaging/{session}/chats": { + "/messaging/{connection}/chats": { "get": { "operationId": "listChats", "tags": [ "Chats" ], "summary": "List stored conversations", - "description": "**Protocols:** Linked Device API\n\n**Required scope:** `chats:read`\n\nLists conversations with stored messages for a Number with hosted message storage, most recent activity first. Beta: requires team enrollment.", + "description": "**Protocols:** Linked Device API\n\n**Required scope:** `chats:read`\n\nLists conversations with stored messages for a Connection with hosted message storage, most recent activity first. Beta: requires team enrollment.", "security": [ { "BearerAuth": [] @@ -36793,10 +36907,10 @@ "schema": { "type": "string", "minLength": 1, - "description": "Number ID." + "description": "Connection ID." }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -36952,7 +37066,7 @@ } }, "404": { - "description": "The Number or conversation is unavailable, or hosted message storage is not enabled (`hms_not_enabled`).", + "description": "The Connection or conversation is unavailable, or hosted message storage is not enabled (`hms_not_enabled`).", "content": { "application/json": { "schema": { @@ -36973,7 +37087,7 @@ } }, "503": { - "description": "The history service for the Number's data region is unavailable.", + "description": "The history service for the Connection's data region is unavailable.", "content": { "application/json": { "schema": { @@ -36994,15 +37108,12 @@ } } }, - "x-mint": { - "content": "Linked Device API chats:read" - }, "x-protocols": [ "Linked Device API" ] } }, - "/messaging/{session}/chats/{conversation}": { + "/messaging/{connection}/chats/{conversation}": { "get": { "operationId": "getChat", "tags": [ @@ -37021,10 +37132,10 @@ "schema": { "type": "string", "minLength": 1, - "description": "Number ID." + "description": "Connection ID." }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -37129,7 +37240,7 @@ } }, "404": { - "description": "The Number or conversation is unavailable, or hosted message storage is not enabled (`hms_not_enabled`).", + "description": "The Connection or conversation is unavailable, or hosted message storage is not enabled (`hms_not_enabled`).", "content": { "application/json": { "schema": { @@ -37150,7 +37261,7 @@ } }, "503": { - "description": "The history service for the Number's data region is unavailable.", + "description": "The history service for the Connection's data region is unavailable.", "content": { "application/json": { "schema": { @@ -37171,15 +37282,12 @@ } } }, - "x-mint": { - "content": "Linked Device API chats:read" - }, "x-protocols": [ "Linked Device API" ] } }, - "/messaging/{session}/chats/{conversation}/messages": { + "/messaging/{connection}/chats/{conversation}/messages": { "get": { "operationId": "listChatMessages", "tags": [ @@ -37198,10 +37306,10 @@ "schema": { "type": "string", "minLength": 1, - "description": "Number ID." + "description": "Connection ID." }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -37279,7 +37387,7 @@ "inbound", "outbound" ], - "description": "`inbound` returns messages from contacts; `outbound` returns messages sent by the Number." + "description": "`inbound` returns messages from contacts; `outbound` returns messages sent by the Connection." }, "required": false, "name": "direction", @@ -37389,7 +37497,7 @@ } }, "404": { - "description": "The Number or conversation is unavailable, or hosted message storage is not enabled (`hms_not_enabled`).", + "description": "The Connection or conversation is unavailable, or hosted message storage is not enabled (`hms_not_enabled`).", "content": { "application/json": { "schema": { @@ -37410,7 +37518,7 @@ } }, "503": { - "description": "The history service for the Number's data region is unavailable.", + "description": "The history service for the Connection's data region is unavailable.", "content": { "application/json": { "schema": { @@ -37431,15 +37539,12 @@ } } }, - "x-mint": { - "content": "Linked Device API messages:read" - }, "x-protocols": [ "Linked Device API" ] } }, - "/messaging/{session}/chats/{conversation}/messages/{messageId}/media": { + "/messaging/{connection}/chats/{conversation}/messages/{messageId}/media": { "get": { "operationId": "getChatMessageMedia", "tags": [ @@ -37462,10 +37567,10 @@ "schema": { "type": "string", "minLength": 1, - "description": "Number ID." + "description": "Connection ID." }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -37582,7 +37687,7 @@ } }, "404": { - "description": "The Number, conversation or message is unavailable, no stored copy exists, or hosted message storage is not enabled (`hms_not_enabled`).", + "description": "The Connection, conversation or message is unavailable, no stored copy exists, or hosted message storage is not enabled (`hms_not_enabled`).", "content": { "application/json": { "schema": { @@ -37603,7 +37708,7 @@ } }, "503": { - "description": "The history service for the Number's data region is unavailable.", + "description": "The history service for the Connection's data region is unavailable.", "content": { "application/json": { "schema": { @@ -37624,22 +37729,19 @@ } } }, - "x-mint": { - "content": "Meta Cloud API messages:read media:read" - }, "x-protocols": [ "Meta Cloud API" ] } }, - "/messaging/{session}/chats/{conversation}/service-window": { + "/messaging/{connection}/chats/{conversation}/service-window": { "get": { "operationId": "getCustomerServiceWindow", "tags": [ "Chats" ], "summary": "Get the customer service window", - "description": "**Protocols:** Meta Cloud API\n\n**Required scope:** `chats:read`\n\nReturns whether free-form messages can be sent to a person from a Number's active Official API connection. WhatsApp's customer service window opens for 24 hours when the person messages or calls the Number. Outside it, only approved templates can be sent. Beta: requires team enrollment.", + "description": "**Protocols:** Meta Cloud API\n\n**Required scope:** `chats:read`\n\nReturns whether free-form messages can be sent to a person from a Connection's active Official API method. WhatsApp's customer service window opens for 24 hours when the person messages or calls the Connection. Outside it, only approved templates can be sent. Beta: requires team enrollment.", "security": [ { "BearerAuth": [] @@ -37651,10 +37753,10 @@ "schema": { "type": "string", "minLength": 1, - "description": "Number ID." + "description": "Connection ID." }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -37753,7 +37855,7 @@ } }, "404": { - "description": "The Number or conversation is unavailable.", + "description": "The Connection or conversation is unavailable.", "content": { "application/json": { "schema": { @@ -37774,7 +37876,7 @@ } }, "409": { - "description": "The Number has no Official API connection (`unsupported_for_connection`).", + "description": "The Connection has no Official API method (`unsupported_for_connection`).", "content": { "application/json": { "schema": { @@ -37795,7 +37897,7 @@ } }, "503": { - "description": "The Number's regional evidence service is temporarily unavailable.", + "description": "The Connection's regional evidence service is temporarily unavailable.", "content": { "application/json": { "schema": { @@ -37816,37 +37918,34 @@ } } }, - "x-mint": { - "content": "Meta Cloud API chats:read" - }, "x-protocols": [ "Meta Cloud API" ] } }, - "/messaging/{session}/meta-pricing": { + "/messaging/{connection}/meta-pricing": { "get": { "operationId": "getMetaPricingSummary", "tags": [ - "Sessions" + "Connections" ], "summary": "Summarize Meta-reported pricing", - "description": "**Protocols:** Meta Cloud API\n\n**Required scope:** `sessions:read`\n\nCounts the messages sent from the Number's active Official API connection generation by the pricing classification WhatsApp reported for each one. Meta bills your WhatsApp Business Account directly. These counts are not a Polymorfa charge and contain no prices. Each message is counted in the period of its first pricing report. Beta: requires team enrollment.", + "description": "**Protocols:** Meta Cloud API\n\n**Required scope:** `connections:read`\n\nCounts the messages sent from the Connection's active Official API method generation by the pricing classification WhatsApp reported for each one. Meta bills your WhatsApp Business Account directly. These counts are not a Polymorfa charge and contain no prices. Each message is counted in the period of its first pricing report. Beta: requires team enrollment.", "security": [ { "BearerAuth": [] } ], - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "parameters": [ { "schema": { "type": "string", "minLength": 1, - "description": "Number ID." + "description": "Connection ID." }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -37956,7 +38055,7 @@ } }, "404": { - "description": "The Number is unavailable.", + "description": "The Connection is unavailable.", "content": { "application/json": { "schema": { @@ -37977,7 +38076,7 @@ } }, "409": { - "description": "The Number has no Official API connection (`unsupported_for_connection`).", + "description": "The Connection has no Official API method (`unsupported_for_connection`).", "content": { "application/json": { "schema": { @@ -37998,7 +38097,7 @@ } }, "503": { - "description": "The Number's regional evidence service is temporarily unavailable.", + "description": "The Connection's regional evidence service is temporarily unavailable.", "content": { "application/json": { "schema": { @@ -38019,35 +38118,32 @@ } } }, - "x-mint": { - "content": "Meta Cloud API sessions:read" - }, "x-protocols": [ "Meta Cloud API" ] } }, - "/messaging/{session}/call-permissions/{to}": { + "/messaging/{connection}/call-permissions/{to}": { "get": { "operationId": "getCallPermission", "tags": [ "Calls" ], "summary": "Get a person's call permission", - "description": "**Protocols:** Meta Cloud API\n\n**Required scope:** `sessions:read`\n\nReturns whether the person has allowed this number to call them. On Cloud API numbers WhatsApp is asked on every request and the answer includes its limits on permission requests and calls. Linked-device numbers return `409 unsupported_for_connection`.", + "description": "**Protocols:** Meta Cloud API\n\n**Required scope:** `connections:read`\n\nReturns whether the person has allowed this connection to call them. On Cloud API connections WhatsApp is asked on every request and the answer includes its limits on permission requests and calls. Linked-device connections return `409 unsupported_for_connection`.", "security": [ { "BearerAuth": [] } ], - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "parameters": [ { "schema": { "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -38211,7 +38307,7 @@ } }, "409": { - "description": "`unsupported_for_connection`: the number is not a Cloud API number.", + "description": "`unsupported_for_connection`: the connection is not a Cloud API connection.", "content": { "application/json": { "schema": { @@ -38221,7 +38317,7 @@ "error": { "type": "conflict_error", "code": "unsupported_for_connection", - "message": "The session's connection does not support this call operation.", + "message": "The connection's connection does not support this call operation.", "param": null, "request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30" }, @@ -38275,9 +38371,6 @@ } } }, - "x-mint": { - "content": "Meta Cloud API sessions:read" - }, "x-protocols": [ "Meta Cloud API" ] @@ -38290,13 +38383,13 @@ "Calls" ], "summary": "Check whether a call can be placed", - "description": "**Required scope:** `sessions:read`\n\nRuns the checks a call placement runs, without calling: the number's calling switch, the team's do-not-call list and blocked country codes, and on Cloud API numbers the person's call permission and WhatsApp's call limits. If WhatsApp's permission status is unavailable and no other refusal is known, returns 503 service_unavailable. Server credentials only.", + "description": "**Required scope:** `connections:read`\n\nRuns the checks a call placement runs, without calling: the connection's calling switch, the team's do-not-call list and blocked country codes, and on Cloud API connections the person's call permission and WhatsApp's call limits. If WhatsApp's permission status is unavailable and no other refusal is known, returns 503 service_unavailable. Server credentials only.", "security": [ { "BearerAuth": [] } ], - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "requestBody": { "required": true, "content": { @@ -38521,9 +38614,6 @@ } } } - }, - "x-mint": { - "content": "sessions:read" } } }, @@ -38534,13 +38624,13 @@ "VoIP" ], "summary": "Create a WhatsApp call link", - "description": "**Required scope:** `sessions:manage`\n\nRequires a server credential with sessions:manage and a Linked Device Number with calling enabled. Client tokens and Cloud API-only Numbers are refused. This operation does not place or join a call. Idempotency-Key is not supported; do not automatically retry an unknown outcome. Keep call-link tokens and URLs private.", + "description": "**Required scope:** `connections:manage`\n\nRequires a server credential with connections:manage and a Linked Device Connection with calling enabled. Client tokens and Cloud API-only Connections are refused. This operation does not place or join a call. Idempotency-Key is not supported; do not automatically retry an unknown outcome. Keep call-link tokens and URLs private.", "security": [ { "BearerAuth": [] } ], - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "requestBody": { "required": true, "content": { @@ -38798,7 +38888,7 @@ } }, "503": { - "description": "Calling settings, Number authority or the connection are unavailable", + "description": "Calling settings, Connection authority or the connection are unavailable", "content": { "application/json": { "schema": { @@ -38829,9 +38919,6 @@ } } } - }, - "x-mint": { - "content": "sessions:manage" } } }, @@ -38842,13 +38929,13 @@ "VoIP" ], "summary": "Preview a WhatsApp call link", - "description": "**Required scope:** `sessions:manage`\n\nRequires a server credential with sessions:manage and a Linked Device Number with calling enabled. Client tokens and Cloud API-only Numbers are refused. This operation does not place or join a call. Idempotency-Key is not supported; do not automatically retry an unknown outcome. Keep call-link tokens and URLs private.", + "description": "**Required scope:** `connections:manage`\n\nRequires a server credential with connections:manage and a Linked Device Connection with calling enabled. Client tokens and Cloud API-only Connections are refused. This operation does not place or join a call. Idempotency-Key is not supported; do not automatically retry an unknown outcome. Keep call-link tokens and URLs private.", "security": [ { "BearerAuth": [] } ], - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "requestBody": { "required": true, "content": { @@ -39106,7 +39193,7 @@ } }, "503": { - "description": "Calling settings, Number authority or the connection are unavailable", + "description": "Calling settings, Connection authority or the connection are unavailable", "content": { "application/json": { "schema": { @@ -39137,9 +39224,6 @@ } } } - }, - "x-mint": { - "content": "sessions:manage" } } }, @@ -39150,14 +39234,14 @@ "tags": [ "VoIP" ], - "summary": "Attach a WebRTC connection and receive the pod's answer + ICE servers", - "description": "**Required scope:** `sessions:manage`\n\nSubmits the SDP offer for one connection. The offer carries one audio transceiver, a data channel negotiated out of band with label `pmfa.calls` and id 0, and one or more video transceivers. Reusing a `connectionId` replaces that connection.", + "summary": "Attach a WebRTC method and receive the pod's answer + ICE servers", + "description": "**Required scope:** `connections:manage`\n\nSubmits the SDP offer for one method. The offer carries one audio transceiver, a data channel negotiated out of band with label `pmfa.calls` and id 0, and one or more video transceivers. Reusing a `connectionId` replaces that method.", "security": [ { "BearerAuth": [] } ], - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "parameters": [ { "schema": { @@ -39331,7 +39415,7 @@ } }, "409": { - "description": "`call_claimed` when another participant claimed the call, `connection_limit` when the call has no free connection, or `state_conflict` when the call is not ready", + "description": "`call_claimed` when another participant claimed the call, `connection_limit` when the call has no free method, or `state_conflict` when the call is not ready", "content": { "application/json": { "schema": { @@ -39490,9 +39574,6 @@ } } } - }, - "x-mint": { - "content": "sessions:manage" } } }, @@ -39503,14 +39584,14 @@ "tags": [ "VoIP" ], - "summary": "Re-offer on an established connection and receive the pod's answer", - "description": "**Required scope:** `sessions:manage`\n\nRenegotiates one connection, for example to add video, add receive transceivers after `video_slots_exhausted`, or restart ICE.", + "summary": "Re-offer on an established method and receive the pod's answer", + "description": "**Required scope:** `connections:manage`\n\nRenegotiates one method, for example to add video, add receive transceivers after `video_slots_exhausted`, or restart ICE.", "security": [ { "BearerAuth": [] } ], - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "parameters": [ { "schema": { @@ -39535,7 +39616,7 @@ }, "responses": { "200": { - "description": "SDP answer for the re-offer, on the same peer connection", + "description": "SDP answer for the re-offer, on the same peer method", "content": { "application/json": { "schema": { @@ -39684,7 +39765,7 @@ } }, "409": { - "description": "`call_claimed` when another participant claimed the call, `connection_limit` when the call has no free connection, or `state_conflict` when the call is not ready", + "description": "`call_claimed` when another participant claimed the call, `connection_limit` when the call has no free method, or `state_conflict` when the call is not ready", "content": { "application/json": { "schema": { @@ -39811,9 +39892,6 @@ } } } - }, - "x-mint": { - "content": "sessions:manage" } } }, @@ -39823,14 +39901,14 @@ "tags": [ "VoIP" ], - "summary": "Place an outbound call from a session", - "description": "**Required scope:** `sessions:manage`\n\nOriginates a WhatsApp call to `to`, an ad-hoc group call to `participants` (2 to 31 distinct E.164 phone numbers or public user IDs), or every remote member of `groupId` (a public group ID). Group rosters must contain 2 to 31 remote members; a membership change during placement refuses the call. Provide exactly one destination form. Group calls require a Linked Device number and check every recipient against the team policy and number restrictions before dialing. The call is owned by the placing participant and rings on the callee's device: `call.accepted` follows when they pick up and `call.ended` when either side hangs up. Carry its audio and video with a Polymorfa Calls SDK. `exclusive: true` claims the call for the placing participant. Client tokens place from their bound session; server credentials must name one. Outbound starts share a rate limit per team and source session across server credentials and client tokens; client-token rules also apply.", + "summary": "Place an outbound call from a connection", + "description": "**Required scope:** `connections:manage`\n\nOriginates a WhatsApp call to `to`, an ad-hoc group call to `participants` (2 to 31 distinct E.164 phone numbers or public user IDs), or every remote member of `groupId` (a public group ID). Group rosters must contain 2 to 31 remote members; a membership change during placement refuses the call. Provide exactly one destination form. Group calls require a Linked Devices connection and check every recipient against the team policy and number restrictions before dialing. The call is owned by the placing participant and rings on the callee's device: `call.accepted` follows when they pick up and `call.ended` when either side hangs up. Carry its audio and video with a Polymorfa Calls SDK. `exclusive: true` claims the call for the placing participant. Client tokens place from their bound connection; server credentials must name one. Outbound starts share a rate limit per team and source connection across server credentials and client tokens; client-token rules also apply.", "security": [ { "BearerAuth": [] } ], - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "requestBody": { "required": true, "content": { @@ -39960,7 +40038,7 @@ } }, "403": { - "description": "`call_permission_required` when the recipient has not granted this business permission to call them, `number_restricted` when WhatsApp restricts the number to calling people it has already chatted with and the callee is not one of them (`Retry-After` gives the seconds until the restriction ends, when known), or the credential is not permitted", + "description": "`call_permission_required` when the recipient has not granted this business permission to call them, `connection_restricted` when WhatsApp restricts the connection to calling people it has already chatted with and the callee is not one of them (`Retry-After` gives the seconds until the restriction ends, when known), or the credential is not permitted", "content": { "application/json": { "schema": { @@ -40024,7 +40102,7 @@ } }, "409": { - "description": "`unsupported_for_connection` when the session's connection cannot place this call (Cloud API calls are audio only), or `state_conflict` when the named session cannot place an outbound call yet", + "description": "`unsupported_for_connection` when the connection's method cannot place this call (Cloud API calls are audio only), or `state_conflict` when the named connection cannot place an outbound call yet", "content": { "application/json": { "schema": { @@ -40034,7 +40112,7 @@ "error": { "type": "conflict_error", "code": "unsupported_for_connection", - "message": "The session's connection does not support this call operation.", + "message": "The connection's connection does not support this call operation.", "param": null, "request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30" }, @@ -40088,7 +40166,7 @@ } }, "429": { - "description": "Outbound call rate exceeded for this team and source session, which every credential shares, or a client token's own request rate (`rateLimit`) was exceeded.", + "description": "Outbound call rate exceeded for this team and source connection, which every credential shares, or a client token's own request rate (`rateLimit`) was exceeded.", "content": { "application/json": { "schema": { @@ -40247,9 +40325,6 @@ } } } - }, - "x-mint": { - "content": "sessions:manage" } } }, @@ -40260,13 +40335,329 @@ "VoIP" ], "summary": "Answer or join a call", - "description": "**Required scope:** `sessions:manage`\n\nThe first accept answers a ringing call. `exclusive: true` claims it: other participants then receive `409 call_claimed` for accept and media, and their open connections close. Without a claim, later accepts join the answered call. Retrying with the same participant returns the same result. An exclusive request from another participant on a shared call is refused with `409 call_claimed`.", + "description": "**Required scope:** `connections:manage`\n\nThe first accept answers a ringing call. `exclusive: true` claims it: other participants then receive `409 call_claimed` for accept and media, and their open methods close. Without a claim, later accepts join the answered call. Retrying with the same participant returns the same result. An exclusive request from another participant on a shared call is refused with `409 call_claimed`.", + "security": [ + { + "BearerAuth": [] + } + ], + "x-required-scope": "connections:manage", + "parameters": [ + { + "schema": { + "type": "string", + "minLength": 1, + "example": "call-123" + }, + "required": true, + "name": "id", + "in": "path" + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VoipAcceptCallRequest" + } + } + } + }, + "responses": { + "200": { + "description": "Call answered or joined", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VoipAcceptCallResponse" + } + } + }, + "headers": { + "X-RateLimit-Limit": { + "$ref": "#/components/headers/X-RateLimit-Limit" + }, + "X-RateLimit-Remaining": { + "$ref": "#/components/headers/X-RateLimit-Remaining" + }, + "X-RateLimit-Reset": { + "$ref": "#/components/headers/X-RateLimit-Reset" + } + } + }, + "400": { + "description": "Bad request — request body or params failed validation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PublicError" + }, + "example": { + "error": { + "type": "invalid_request_error", + "code": "invalid_parameter", + "message": "Correct the invalid request field.", + "param": null, + "request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30" + }, + "data": null, + "docs": "https://docs.polymorfa.com/api/errors#invalid-parameter" + } + } + }, + "headers": { + "X-RateLimit-Limit": { + "$ref": "#/components/headers/X-RateLimit-Limit" + }, + "X-RateLimit-Remaining": { + "$ref": "#/components/headers/X-RateLimit-Remaining" + }, + "X-RateLimit-Reset": { + "$ref": "#/components/headers/X-RateLimit-Reset" + } + } + }, + "401": { + "description": "Missing or invalid authentication token", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PublicError" + }, + "example": { + "error": { + "type": "authentication_error", + "code": "invalid_credential", + "message": "Supply a valid credential.", + "param": null, + "request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30" + }, + "data": null, + "docs": "https://docs.polymorfa.com/api/errors#invalid-credential" + } + } + }, + "headers": { + "X-RateLimit-Limit": { + "$ref": "#/components/headers/X-RateLimit-Limit" + }, + "X-RateLimit-Remaining": { + "$ref": "#/components/headers/X-RateLimit-Remaining" + }, + "X-RateLimit-Reset": { + "$ref": "#/components/headers/X-RateLimit-Reset" + } + } + }, + "403": { + "description": "Authenticated but not permitted (missing scope or rule violation)", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PublicError" + }, + "example": { + "error": { + "type": "permission_error", + "code": "permission_denied", + "message": "The credential does not have access to this resource.", + "param": null, + "request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30" + }, + "data": null, + "docs": "https://docs.polymorfa.com/api/errors#permission-denied" + } + } + }, + "headers": { + "X-RateLimit-Limit": { + "$ref": "#/components/headers/X-RateLimit-Limit" + }, + "X-RateLimit-Remaining": { + "$ref": "#/components/headers/X-RateLimit-Remaining" + }, + "X-RateLimit-Reset": { + "$ref": "#/components/headers/X-RateLimit-Reset" + } + } + }, + "404": { + "description": "Resource not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PublicError" + }, + "example": { + "error": { + "type": "invalid_request_error", + "code": "resource_not_found", + "message": "The resource is unavailable to this caller.", + "param": null, + "request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30" + }, + "data": null, + "docs": "https://docs.polymorfa.com/api/errors#resource-not-found" + } + } + }, + "headers": { + "X-RateLimit-Limit": { + "$ref": "#/components/headers/X-RateLimit-Limit" + }, + "X-RateLimit-Remaining": { + "$ref": "#/components/headers/X-RateLimit-Remaining" + }, + "X-RateLimit-Reset": { + "$ref": "#/components/headers/X-RateLimit-Reset" + } + } + }, + "409": { + "description": "`call_claimed` when another participant claimed the call, or `state_conflict` when the call is not ready", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PublicError" + }, + "example": { + "error": { + "type": "conflict_error", + "code": "call_claimed", + "message": "Another participant claimed this call.", + "param": null, + "request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30" + }, + "data": null, + "docs": "https://docs.polymorfa.com/api/errors#call-claimed" + } + } + }, + "headers": { + "X-RateLimit-Limit": { + "$ref": "#/components/headers/X-RateLimit-Limit" + }, + "X-RateLimit-Remaining": { + "$ref": "#/components/headers/X-RateLimit-Remaining" + }, + "X-RateLimit-Reset": { + "$ref": "#/components/headers/X-RateLimit-Reset" + } + } + }, + "410": { + "description": "Call ended — the pod that owned its media is gone (pod_lost)", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PublicError" + }, + "example": { + "error": { + "type": "invalid_request_error", + "code": "resource_gone", + "message": "The requested retained resource has expired or was removed.", + "param": null, + "request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30" + }, + "data": null, + "docs": "https://docs.polymorfa.com/api/errors#resource-gone" + } + } + }, + "headers": { + "X-RateLimit-Limit": { + "$ref": "#/components/headers/X-RateLimit-Limit" + }, + "X-RateLimit-Remaining": { + "$ref": "#/components/headers/X-RateLimit-Remaining" + }, + "X-RateLimit-Reset": { + "$ref": "#/components/headers/X-RateLimit-Reset" + } + } + }, + "500": { + "description": "Internal server error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PublicError" + }, + "example": { + "error": { + "type": "api_error", + "code": "internal_error", + "message": "An unexpected service failure occurred. Keep the request ID for support.", + "param": null, + "request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30" + }, + "data": null, + "docs": "https://docs.polymorfa.com/api/errors#internal-error" + } + } + }, + "headers": { + "X-RateLimit-Limit": { + "$ref": "#/components/headers/X-RateLimit-Limit" + }, + "X-RateLimit-Remaining": { + "$ref": "#/components/headers/X-RateLimit-Remaining" + }, + "X-RateLimit-Reset": { + "$ref": "#/components/headers/X-RateLimit-Reset" + } + } + }, + "503": { + "description": "Call unavailable — the owning pod is at capacity or draining, or call authority cannot be verified", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PublicError" + }, + "example": { + "error": { + "type": "api_error", + "code": "service_unavailable", + "message": "A required service is unavailable. Check completion before repeating a write.", + "param": null, + "request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30" + }, + "data": null, + "docs": "https://docs.polymorfa.com/api/errors#service-unavailable" + } + } + }, + "headers": { + "X-RateLimit-Limit": { + "$ref": "#/components/headers/X-RateLimit-Limit" + }, + "X-RateLimit-Remaining": { + "$ref": "#/components/headers/X-RateLimit-Remaining" + }, + "X-RateLimit-Reset": { + "$ref": "#/components/headers/X-RateLimit-Reset" + } + } + } + } + } + }, + "/messaging/voip/calls/{id}/reject": { + "post": { + "operationId": "voipRejectCall", + "tags": [ + "VoIP" + ], + "summary": "Decline a ringing call", + "description": "**Required scope:** `connections:manage`\n\nDeclines a ringing call and releases it. Returns `409 call_not_ringing` when the call is not ringing.", "security": [ { "BearerAuth": [] } ], - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "parameters": [ { "schema": { @@ -40283,18 +40674,18 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/VoipAcceptCallRequest" + "$ref": "#/components/schemas/VoipRejectCallRequest" } } } }, "responses": { - "200": { - "description": "Call answered or joined", + "202": { + "description": "Call declined", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/VoipAcceptCallResponse" + "$ref": "#/components/schemas/SuccessResponse" } } }, @@ -40439,7 +40830,7 @@ } }, "409": { - "description": "`call_claimed` when another participant claimed the call, or `state_conflict` when the call is not ready", + "description": "`call_not_ringing` when the call was already answered, declined, or ended", "content": { "application/json": { "schema": { @@ -40448,13 +40839,13 @@ "example": { "error": { "type": "conflict_error", - "code": "call_claimed", - "message": "Another participant claimed this call.", + "code": "call_not_ringing", + "message": "The call is no longer ringing.", "param": null, "request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30" }, "data": null, - "docs": "https://docs.polymorfa.com/api/errors#call-claimed" + "docs": "https://docs.polymorfa.com/api/errors#call-not-ringing" } } }, @@ -40566,26 +40957,23 @@ } } } - }, - "x-mint": { - "content": "sessions:manage" } } }, - "/messaging/voip/calls/{id}/reject": { + "/messaging/voip/calls/{id}/leave": { "post": { - "operationId": "voipRejectCall", + "operationId": "voipLeaveCall", "tags": [ "VoIP" ], - "summary": "Decline a ringing call", - "description": "**Required scope:** `sessions:manage`\n\nDeclines a ringing call and releases it. Returns `409 call_not_ringing` when the call is not ringing.", + "summary": "Close one method without ending the call", + "description": "**Required scope:** `connections:manage`\n\nDisconnects the named method. The call and the participant's other methods continue. Use `DELETE /voip/calls/{id}` to end the call for everyone.", "security": [ { "BearerAuth": [] } ], - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "parameters": [ { "schema": { @@ -40599,17 +40987,18 @@ } ], "requestBody": { + "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/VoipRejectCallRequest" + "$ref": "#/components/schemas/VoipLeaveRequest" } } } }, "responses": { "202": { - "description": "Call declined", + "description": "Connection closed", "content": { "application/json": { "schema": { @@ -40758,7 +41147,7 @@ } }, "409": { - "description": "`call_not_ringing` when the call was already answered, declined, or ended", + "description": "Call not ready — no media connection on the owning pod yet", "content": { "application/json": { "schema": { @@ -40767,13 +41156,13 @@ "example": { "error": { "type": "conflict_error", - "code": "call_not_ringing", - "message": "The call is no longer ringing.", + "code": "state_conflict", + "message": "The request conflicts with the resource state.", "param": null, "request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30" }, "data": null, - "docs": "https://docs.polymorfa.com/api/errors#call-not-ringing" + "docs": "https://docs.polymorfa.com/api/errors#state-conflict" } } }, @@ -40885,26 +41274,23 @@ } } } - }, - "x-mint": { - "content": "sessions:manage" } } }, - "/messaging/voip/calls/{id}/leave": { + "/messaging/voip/calls/{id}/reaction": { "post": { - "operationId": "voipLeaveCall", + "operationId": "sendCallReaction", "tags": [ "VoIP" ], - "summary": "Close one connection without ending the call", - "description": "**Required scope:** `sessions:manage`\n\nDisconnects the named connection. The call and the participant's other connections continue. Use `DELETE /voip/calls/{id}` to end the call for everyone.", + "summary": "Send or clear a call reaction", + "description": "**Required scope:** `connections:manage`\n\nRequires an attached method owned by the acting participant, connections:manage, and voip_signal for client tokens. Linked-device calls only; unsupported backends return 409 unsupported_for_connection. Reactions are transient and are not replayed. Hand state is shared by the Connection and restored on media reconnection. Do not automatically retry an uncertain result.", "security": [ { "BearerAuth": [] } ], - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "parameters": [ { "schema": { @@ -40922,14 +41308,14 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/VoipLeaveRequest" + "$ref": "#/components/schemas/VoipReactionRequest" } } } }, "responses": { "202": { - "description": "Connection closed", + "description": "Reaction accepted", "content": { "application/json": { "schema": { @@ -41078,7 +41464,7 @@ } }, "409": { - "description": "Call not ready — no media session on the owning pod yet", + "description": "The call is not ready (`state_conflict`), or the calling backend does not support this action (`unsupported_for_connection`).", "content": { "application/json": { "schema": { @@ -41205,26 +41591,23 @@ } } } - }, - "x-mint": { - "content": "sessions:manage" } } }, - "/messaging/voip/calls/{id}/reaction": { + "/messaging/voip/calls/{id}/hand": { "post": { - "operationId": "sendCallReaction", + "operationId": "setCallHandRaised", "tags": [ "VoIP" ], - "summary": "Send or clear a call reaction", - "description": "**Required scope:** `sessions:manage`\n\nRequires an attached connection owned by the acting participant, sessions:manage, and voip_signal for client tokens. Linked-device calls only; unsupported backends return 409 unsupported_for_connection. Reactions are transient and are not replayed. Hand state is shared by the Number and restored on media reconnection. Do not automatically retry an uncertain result.", + "summary": "Raise or lower the Connection's hand in a call", + "description": "**Required scope:** `connections:manage`\n\nRequires an attached method owned by the acting participant, connections:manage, and voip_signal for client tokens. Linked-device calls only; unsupported backends return 409 unsupported_for_connection. Reactions are transient and are not replayed. Hand state is shared by the Connection and restored on media reconnection. Do not automatically retry an uncertain result.", "security": [ { "BearerAuth": [] } ], - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "parameters": [ { "schema": { @@ -41242,14 +41625,14 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/VoipReactionRequest" + "$ref": "#/components/schemas/VoipHandRequest" } } } }, "responses": { "202": { - "description": "Reaction accepted", + "description": "Hand state accepted", "content": { "application/json": { "schema": { @@ -41525,26 +41908,23 @@ } } } - }, - "x-mint": { - "content": "sessions:manage" } } }, - "/messaging/voip/calls/{id}/hand": { + "/messaging/voip/calls/{id}/waiting-room": { "post": { - "operationId": "setCallHandRaised", + "operationId": "controlCallWaitingRoom", "tags": [ "VoIP" ], - "summary": "Raise or lower the Number's hand in a call", - "description": "**Required scope:** `sessions:manage`\n\nRequires an attached connection owned by the acting participant, sessions:manage, and voip_signal for client tokens. Linked-device calls only; unsupported backends return 409 unsupported_for_connection. Reactions are transient and are not replayed. Hand state is shared by the Number and restored on media reconnection. Do not automatically retry an uncertain result.", + "summary": "Moderate a call waiting room", + "description": "**Required scope:** `connections:manage`\n\nReauthorizes the credential and current Connection/project on each request. Requires the answering participant's attached method and current provider administrator authority. A result with ok=false reports a refusal or unknown outcome. Never replay uncertain moderation.", "security": [ { "BearerAuth": [] } ], - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "parameters": [ { "schema": { @@ -41562,18 +41942,18 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/VoipHandRequest" + "$ref": "#/components/schemas/VoipWaitingRoomControlRequest" } } } }, "responses": { - "202": { - "description": "Hand state accepted", + "200": { + "description": "Correlated provider outcome; inspect data.ok and data.code", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SuccessResponse" + "$ref": "#/components/schemas/VoipWaitingRoomControlResponse" } } }, @@ -41845,9 +42225,6 @@ } } } - }, - "x-mint": { - "content": "sessions:manage" } } }, @@ -41858,13 +42235,13 @@ "VoIP" ], "summary": "Ring an existing call participant again", - "description": "**Required scope:** `sessions:manage`\n\nRings one non-connected participant already in the upstream call roster. Does not add a participant or change the roster optimistically. Requires the same destination permission as an invitation. Cloud API calls do not support this operation.", + "description": "**Required scope:** `connections:manage`\n\nRings one non-connected participant already in the upstream call roster. Does not add a participant or change the roster optimistically. Requires the same destination permission as an invitation. Cloud API calls do not support this operation.", "security": [ { "BearerAuth": [] } ], - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "parameters": [ { "schema": { @@ -42197,9 +42574,6 @@ } } } - }, - "x-mint": { - "content": "sessions:manage" } } }, @@ -42210,13 +42584,13 @@ "VoIP" ], "summary": "Invite another party into a live call", - "description": "**Required scope:** `sessions:manage`\n\nRings `to` (an E.164 phone number or a user ID) into the call, turning a 1:1 call into a group call. The invitee enters the roster as `invited`; roster changes reach media sockets as `participant_joined` / `participant_state` / `participant_left` frames. 409 until the call has a live leg.", + "description": "**Required scope:** `connections:manage`\n\nRings `to` (an E.164 phone number or a user ID) into the call, turning a 1:1 call into a group call. The invitee enters the roster as `invited`; roster changes reach media sockets as `participant_joined` / `participant_state` / `participant_left` frames. 409 until the call has a live leg.", "security": [ { "BearerAuth": [] } ], - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "parameters": [ { "schema": { @@ -42325,7 +42699,7 @@ } }, "403": { - "description": "`number_restricted` when WhatsApp restricts the number to calling people it has already chatted with and the invitee is not one of them (`Retry-After` gives the seconds until the restriction ends, when known), or the credential is not permitted", + "description": "`connection_restricted` when WhatsApp restricts the connection to calling people it has already chatted with and the invitee is not one of them (`Retry-After` gives the seconds until the restriction ends, when known), or the credential is not permitted", "content": { "application/json": { "schema": { @@ -42334,13 +42708,13 @@ "example": { "error": { "type": "permission_error", - "code": "number_restricted", - "message": "WhatsApp restricts this number to calling people it has already chatted with. The restriction lifts on its own; follow Retry-After when supplied.", + "code": "connection_restricted", + "message": "WhatsApp restricts this connection to calling people it has already chatted with. The restriction lifts on its own; follow Retry-After when supplied.", "param": null, "request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30" }, "data": null, - "docs": "https://docs.polymorfa.com/api/errors#number-restricted" + "docs": "https://docs.polymorfa.com/api/errors#connection-restricted" } } }, @@ -42389,7 +42763,7 @@ } }, "409": { - "description": "`unsupported_for_connection` when the session connects through the Cloud API, which has no group calls, or `state_conflict` when the call has no live leg yet", + "description": "`unsupported_for_connection` when the connection connects through the Cloud API, which has no group calls, or `state_conflict` when the call has no live leg yet", "content": { "application/json": { "schema": { @@ -42399,7 +42773,7 @@ "error": { "type": "conflict_error", "code": "unsupported_for_connection", - "message": "The session's connection does not support this call operation.", + "message": "The connection's connection does not support this call operation.", "param": null, "request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30" }, @@ -42548,9 +42922,6 @@ } } } - }, - "x-mint": { - "content": "sessions:manage" } } }, @@ -42561,13 +42932,13 @@ "tags": [ "VoIP" ], - "summary": "Trickle a local ICE candidate to one connection", + "summary": "Trickle a local ICE candidate to one method", "security": [ { "BearerAuth": [] } ], - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "parameters": [ { "schema": { @@ -42741,7 +43112,7 @@ } }, "409": { - "description": "Call not ready — no media session on the owning pod yet", + "description": "Call not ready — no media connection on the owning pod yet", "content": { "application/json": { "schema": { @@ -42869,10 +43240,7 @@ } } }, - "x-mint": { - "content": "sessions:manage" - }, - "description": "**Required scope:** `sessions:manage`" + "description": "**Required scope:** `connections:manage`" } }, "/messaging/voip/calls/{id}/candidates": { @@ -42888,7 +43256,7 @@ "BearerAuth": [] } ], - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "parameters": [ { "schema": { @@ -43052,7 +43420,7 @@ } }, "409": { - "description": "Call not ready — no media session on the owning pod yet", + "description": "Call not ready — no media connection on the owning pod yet", "content": { "application/json": { "schema": { @@ -43180,10 +43548,7 @@ } } }, - "x-mint": { - "content": "sessions:manage" - }, - "description": "**Required scope:** `sessions:manage`" + "description": "**Required scope:** `connections:manage`" } }, "/messaging/voip/calls/{id}/reports": { @@ -43193,13 +43558,13 @@ "VoIP" ], "summary": "Report call diagnostics from your app", - "description": "**Required scope:** `sessions:manage`\n\nRecords quality figures or an error that your app measured for one of its connections. The Console shows the latest quality report and the reported errors of each connection on the call. Reports are optional and are accepted while the call is live and for 10 minutes after it ends. Each connection can send one quality report every 5 seconds and 20 error reports per minute. At most 200 reports are kept per call: at that limit a quality report replaces the same connection's oldest quality report. A quality report from a connection with no stored quality report, and every error report, is accepted but not stored.", + "description": "**Required scope:** `connections:manage`\n\nRecords quality figures or an error that your app measured for one of its methods. The Console shows the latest quality report and the reported errors of each method on the call. Reports are optional and are accepted while the call is live and for 10 minutes after it ends. Each method can send one quality report every 5 seconds and 20 error reports per minute. At most 200 reports are kept per call: at that limit a quality report replaces the same method's oldest quality report. A quality report from a method with no stored quality report, and every error report, is accepted but not stored.", "security": [ { "BearerAuth": [] } ], - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "parameters": [ { "schema": { @@ -43437,7 +43802,7 @@ } }, "429": { - "description": "The connection exceeded its report limit: one quality report every 5 seconds or 20 error reports per minute", + "description": "The method exceeded its report limit: one quality report every 5 seconds or 20 error reports per minute", "content": { "application/json": { "schema": { @@ -43532,9 +43897,6 @@ } } } - }, - "x-mint": { - "content": "sessions:manage" } } }, @@ -43545,13 +43907,13 @@ "VoIP" ], "summary": "End a call for everyone", - "description": "**Required scope:** `sessions:manage`\n\nEnds the call and closes every connection. Repeating the request succeeds.", + "description": "**Required scope:** `connections:manage`\n\nEnds the call and closes every method. Repeating the request succeeds.", "security": [ { "BearerAuth": [] } ], - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "parameters": [ { "schema": { @@ -43715,7 +44077,7 @@ } }, "409": { - "description": "Call not ready — no media session on the owning pod yet", + "description": "Call not ready — no media connection on the owning pod yet", "content": { "application/json": { "schema": { @@ -43842,13 +44204,10 @@ } } } - }, - "x-mint": { - "content": "sessions:manage" } } }, - "/messaging/{session}/calls/{callId}/reject": { + "/messaging/{connection}/calls/{callId}/reject": { "post": { "operationId": "rejectCall", "tags": [ @@ -43867,7 +44226,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -44073,22 +44432,19 @@ } } }, - "x-mint": { - "content": "Linked Device API chats:manage" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `chats:manage`" } }, - "/messaging/{session}/groups": { + "/messaging/{connection}/groups": { "get": { "operationId": "listGroups", "tags": [ "Groups" ], - "summary": "List groups the session is a member of", + "summary": "List groups the connection is a member of", "security": [ { "BearerAuth": [] @@ -44101,7 +44457,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -44288,9 +44644,6 @@ } } }, - "x-mint": { - "content": "Linked Device API groups:read" - }, "x-protocols": [ "Linked Device API" ], @@ -44314,7 +44667,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -44510,16 +44863,13 @@ } } }, - "x-mint": { - "content": "Linked Device API groups:manage" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `groups:manage`" } }, - "/messaging/{session}/groups/join-info": { + "/messaging/{connection}/groups/join-info": { "get": { "operationId": "getGroupJoinInfo", "tags": [ @@ -44538,7 +44888,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -44734,16 +45084,13 @@ } } }, - "x-mint": { - "content": "Linked Device API groups:read" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `groups:read`" } }, - "/messaging/{session}/groups/join": { + "/messaging/{connection}/groups/join": { "post": { "operationId": "joinGroup", "tags": [ @@ -44762,7 +45109,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -44958,16 +45305,13 @@ } } }, - "x-mint": { - "content": "Linked Device API groups:manage" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `groups:manage`" } }, - "/messaging/{session}/groups/{id}/capabilities": { + "/messaging/{connection}/groups/{id}/capabilities": { "get": { "operationId": "getGroupCapabilities", "tags": [ @@ -44986,7 +45330,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -45001,7 +45345,7 @@ ], "responses": { "200": { - "description": "Account-bound stored group capabilities. Unknown until successful number and group syncs for the linked account. Requires current group membership and the enrolled number-capabilities beta.", + "description": "Account-bound stored group capabilities. Unknown until successful connection and group syncs for the linked account. Requires current group membership and the enrolled connection-capabilities beta.", "content": { "application/json": { "schema": { @@ -45214,16 +45558,13 @@ } } }, - "x-mint": { - "content": "Linked Device API groups:read" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `groups:read`" } }, - "/messaging/{session}/groups/{id}": { + "/messaging/{connection}/groups/{id}": { "get": { "operationId": "getGroup", "tags": [ @@ -45242,7 +45583,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -45438,9 +45779,6 @@ } } }, - "x-mint": { - "content": "Linked Device API groups:read" - }, "x-protocols": [ "Linked Device API" ], @@ -45464,7 +45802,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -45660,16 +45998,13 @@ } } }, - "x-mint": { - "content": "Linked Device API groups:manage" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `groups:manage`" } }, - "/messaging/{session}/groups/{id}/leave": { + "/messaging/{connection}/groups/{id}/leave": { "post": { "operationId": "leaveGroup", "tags": [ @@ -45688,7 +46023,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -45884,16 +46219,13 @@ } } }, - "x-mint": { - "content": "Linked Device API groups:manage" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `groups:manage`" } }, - "/messaging/{session}/groups/{id}/subject": { + "/messaging/{connection}/groups/{id}/subject": { "put": { "operationId": "setGroupSubject", "tags": [ @@ -45912,7 +46244,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -46117,16 +46449,13 @@ } } }, - "x-mint": { - "content": "Linked Device API groups:manage" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `groups:manage`" } }, - "/messaging/{session}/groups/{id}/description": { + "/messaging/{connection}/groups/{id}/description": { "put": { "operationId": "setGroupDescription", "tags": [ @@ -46145,7 +46474,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -46350,16 +46679,13 @@ } } }, - "x-mint": { - "content": "Linked Device API groups:manage" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `groups:manage`" } }, - "/messaging/{session}/groups/{id}/invite-code": { + "/messaging/{connection}/groups/{id}/invite-code": { "get": { "operationId": "getGroupInviteCode", "tags": [ @@ -46378,7 +46704,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -46574,16 +46900,13 @@ } } }, - "x-mint": { - "content": "Linked Device API groups:read" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `groups:read`" } }, - "/messaging/{session}/groups/{id}/invite-code/revoke": { + "/messaging/{connection}/groups/{id}/invite-code/revoke": { "post": { "operationId": "revokeGroupInviteCode", "tags": [ @@ -46602,7 +46925,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -46798,16 +47121,13 @@ } } }, - "x-mint": { - "content": "Linked Device API groups:manage" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `groups:manage`" } }, - "/messaging/{session}/groups/{id}/participants": { + "/messaging/{connection}/groups/{id}/participants": { "get": { "operationId": "getGroupParticipants", "tags": [ @@ -46826,7 +47146,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -47022,16 +47342,13 @@ } } }, - "x-mint": { - "content": "Linked Device API groups:read" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `groups:read`" } }, - "/messaging/{session}/groups/{id}/participants/add": { + "/messaging/{connection}/groups/{id}/participants/add": { "post": { "operationId": "addGroupParticipants", "tags": [ @@ -47050,7 +47367,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -47255,16 +47572,13 @@ } } }, - "x-mint": { - "content": "Linked Device API groups:manage" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `groups:manage`" } }, - "/messaging/{session}/groups/{id}/participants/remove": { + "/messaging/{connection}/groups/{id}/participants/remove": { "post": { "operationId": "removeGroupParticipants", "tags": [ @@ -47283,7 +47597,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -47488,16 +47802,13 @@ } } }, - "x-mint": { - "content": "Linked Device API groups:manage" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `groups:manage`" } }, - "/messaging/{session}/groups/{id}/admin/promote": { + "/messaging/{connection}/groups/{id}/admin/promote": { "post": { "operationId": "promoteGroupAdmin", "tags": [ @@ -47516,7 +47827,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -47721,16 +48032,13 @@ } } }, - "x-mint": { - "content": "Linked Device API groups:manage" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `groups:manage`" } }, - "/messaging/{session}/groups/{id}/admin/demote": { + "/messaging/{connection}/groups/{id}/admin/demote": { "post": { "operationId": "demoteGroupAdmin", "tags": [ @@ -47749,7 +48057,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -47954,16 +48262,13 @@ } } }, - "x-mint": { - "content": "Linked Device API groups:manage" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `groups:manage`" } }, - "/messaging/{session}/groups/{id}/picture": { + "/messaging/{connection}/groups/{id}/picture": { "put": { "operationId": "setGroupPicture", "tags": [ @@ -47982,7 +48287,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -48187,16 +48492,13 @@ } } }, - "x-mint": { - "content": "Linked Device API groups:manage" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `groups:manage`" } }, - "/messaging/{session}/groups/{id}/settings/info-edit": { + "/messaging/{connection}/groups/{id}/settings/info-edit": { "put": { "operationId": "setGroupInfoEditing", "tags": [ @@ -48215,7 +48517,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -48420,16 +48722,13 @@ } } }, - "x-mint": { - "content": "Linked Device API groups:manage" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `groups:manage`" } }, - "/messaging/{session}/groups/{id}/settings/messages": { + "/messaging/{connection}/groups/{id}/settings/messages": { "put": { "operationId": "setGroupMessaging", "tags": [ @@ -48448,7 +48747,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -48653,16 +48952,13 @@ } } }, - "x-mint": { - "content": "Linked Device API groups:manage" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `groups:manage`" } }, - "/messaging/{session}/groups/{id}/settings/member-add": { + "/messaging/{connection}/groups/{id}/settings/member-add": { "put": { "operationId": "setGroupMemberAddMode", "tags": [ @@ -48681,7 +48977,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -48886,16 +49182,13 @@ } } }, - "x-mint": { - "content": "Linked Device API groups:manage" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `groups:manage`" } }, - "/messaging/{session}/groups/{id}/settings/join-approval": { + "/messaging/{connection}/groups/{id}/settings/join-approval": { "put": { "operationId": "setGroupJoinApproval", "tags": [ @@ -48914,7 +49207,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -49119,23 +49412,20 @@ } } }, - "x-mint": { - "content": "Linked Device API groups:manage" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `groups:manage`" } }, - "/messaging/{session}/official-groups": { + "/messaging/{connection}/official-groups": { "get": { "operationId": "listOfficialGroups", "tags": [ "Official groups" ], "summary": "List Official groups", - "description": "**Protocols:** Linked Device API\n\n**Required scope:** `groups:read`\n\nLists the active groups this Number created through the Official API, newest first as WhatsApp returns them. Beta: requires team enrollment and a Number with an Official API connection whose WhatsApp Business Account is an Official Business Account.", + "description": "**Protocols:** Linked Device API\n\n**Required scope:** `groups:read`\n\nLists the active groups this Connection created through the Official API, newest first as WhatsApp returns them. Beta: requires team enrollment and a Connection with an Official API connection whose WhatsApp Business Account is an Official Business Account.", "security": [ { "BearerAuth": [] @@ -49147,10 +49437,10 @@ "schema": { "type": "string", "minLength": 1, - "description": "Number ID." + "description": "Connection ID." }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -49271,7 +49561,7 @@ } }, "403": { - "description": "The credential lacks the scope, the team is not enrolled in the beta (`feature_unavailable`), the number is not eligible for groups (`whatsapp_groups_ineligible`), group creation is paused (`whatsapp_group_creation_paused`), or the group is suspended (`whatsapp_group_suspended`).", + "description": "The credential lacks the scope, the team is not enrolled in the beta (`feature_unavailable`), the connection is not eligible for groups (`whatsapp_groups_ineligible`), group creation is paused (`whatsapp_group_creation_paused`), or the group is suspended (`whatsapp_group_suspended`).", "content": { "application/json": { "schema": { @@ -49292,7 +49582,7 @@ } }, "404": { - "description": "The Number or group is unavailable.", + "description": "The Connection or group is unavailable.", "content": { "application/json": { "schema": { @@ -49313,7 +49603,7 @@ } }, "409": { - "description": "The Number has no Official API connection (`unsupported_for_connection`), or a WhatsApp group limit was reached (`whatsapp_group_limit_reached`, `whatsapp_group_full`).", + "description": "The Connection has no Official API connection (`unsupported_for_connection`), or a WhatsApp group limit was reached (`whatsapp_group_limit_reached`, `whatsapp_group_full`).", "content": { "application/json": { "schema": { @@ -49334,7 +49624,7 @@ } }, "429": { - "description": "WhatsApp is limiting group requests from this number (`whatsapp_rate_limited`).", + "description": "WhatsApp is limiting group requests from this connection (`whatsapp_rate_limited`).", "content": { "application/json": { "schema": { @@ -49397,9 +49687,6 @@ } } }, - "x-mint": { - "content": "Linked Device API groups:read" - }, "x-protocols": [ "Linked Device API" ] @@ -49410,7 +49697,7 @@ "Official groups" ], "summary": "Create an Official group", - "description": "**Protocols:** Linked Device API\n\n**Required scope:** `groups:manage`\n\nAsks WhatsApp to create a group. WhatsApp creates it asynchronously and sends a `group.update` event with the group's conversation ID and invite link. A Number can create at most 10,000 groups, and each group holds at most 8 participants besides your business. Beta: requires team enrollment and a Number with an Official API connection whose WhatsApp Business Account is an Official Business Account.", + "description": "**Protocols:** Linked Device API\n\n**Required scope:** `groups:manage`\n\nAsks WhatsApp to create a group. WhatsApp creates it asynchronously and sends a `group.update` event with the group's conversation ID and invite link. A Connection can create at most 10,000 groups, and each group holds at most 8 participants besides your business. Beta: requires team enrollment and a Connection with an Official API connection whose WhatsApp Business Account is an Official Business Account.", "security": [ { "BearerAuth": [] @@ -49422,10 +49709,10 @@ "schema": { "type": "string", "minLength": 1, - "description": "Number ID." + "description": "Connection ID." }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -49545,7 +49832,7 @@ } }, "403": { - "description": "The credential lacks the scope, the team is not enrolled in the beta (`feature_unavailable`), the number is not eligible for groups (`whatsapp_groups_ineligible`), group creation is paused (`whatsapp_group_creation_paused`), or the group is suspended (`whatsapp_group_suspended`).", + "description": "The credential lacks the scope, the team is not enrolled in the beta (`feature_unavailable`), the connection is not eligible for groups (`whatsapp_groups_ineligible`), group creation is paused (`whatsapp_group_creation_paused`), or the group is suspended (`whatsapp_group_suspended`).", "content": { "application/json": { "schema": { @@ -49566,7 +49853,7 @@ } }, "404": { - "description": "The Number or group is unavailable.", + "description": "The Connection or group is unavailable.", "content": { "application/json": { "schema": { @@ -49587,7 +49874,7 @@ } }, "409": { - "description": "The Number has no Official API connection (`unsupported_for_connection`), or a WhatsApp group limit was reached (`whatsapp_group_limit_reached`, `whatsapp_group_full`). The Idempotency-Key belongs to a request that is still running (`idempotency_in_progress`, with Retry-After) or whose outcome was not recorded (`idempotency_outcome_unknown`)", + "description": "The Connection has no Official API connection (`unsupported_for_connection`), or a WhatsApp group limit was reached (`whatsapp_group_limit_reached`, `whatsapp_group_full`). The Idempotency-Key belongs to a request that is still running (`idempotency_in_progress`, with Retry-After) or whose outcome was not recorded (`idempotency_outcome_unknown`)", "content": { "application/json": { "schema": { @@ -49658,7 +49945,7 @@ } }, "429": { - "description": "WhatsApp is limiting group requests from this number (`whatsapp_rate_limited`).", + "description": "WhatsApp is limiting group requests from this connection (`whatsapp_rate_limited`).", "content": { "application/json": { "schema": { @@ -49728,22 +50015,19 @@ } } }, - "x-mint": { - "content": "Linked Device API groups:manage" - }, "x-protocols": [ "Linked Device API" ] } }, - "/messaging/{session}/official-groups/{group}": { + "/messaging/{connection}/official-groups/{group}": { "get": { "operationId": "getOfficialGroup", "tags": [ "Official groups" ], "summary": "Get an Official group", - "description": "**Protocols:** Linked Device API\n\n**Required scope:** `groups:read`\n\nReturns the group's subject, description, participants, suspension and join approval setting. Beta: requires team enrollment and a Number with an Official API connection whose WhatsApp Business Account is an Official Business Account.", + "description": "**Protocols:** Linked Device API\n\n**Required scope:** `groups:read`\n\nReturns the group's subject, description, participants, suspension and join approval setting. Beta: requires team enrollment and a Connection with an Official API connection whose WhatsApp Business Account is an Official Business Account.", "security": [ { "BearerAuth": [] @@ -49755,10 +50039,10 @@ "schema": { "type": "string", "minLength": 1, - "description": "Number ID." + "description": "Connection ID." }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -49859,7 +50143,7 @@ } }, "403": { - "description": "The credential lacks the scope, the team is not enrolled in the beta (`feature_unavailable`), the number is not eligible for groups (`whatsapp_groups_ineligible`), group creation is paused (`whatsapp_group_creation_paused`), or the group is suspended (`whatsapp_group_suspended`).", + "description": "The credential lacks the scope, the team is not enrolled in the beta (`feature_unavailable`), the connection is not eligible for groups (`whatsapp_groups_ineligible`), group creation is paused (`whatsapp_group_creation_paused`), or the group is suspended (`whatsapp_group_suspended`).", "content": { "application/json": { "schema": { @@ -49880,7 +50164,7 @@ } }, "404": { - "description": "The Number or group is unavailable.", + "description": "The Connection or group is unavailable.", "content": { "application/json": { "schema": { @@ -49901,7 +50185,7 @@ } }, "409": { - "description": "The Number has no Official API connection (`unsupported_for_connection`), or a WhatsApp group limit was reached (`whatsapp_group_limit_reached`, `whatsapp_group_full`).", + "description": "The Connection has no Official API connection (`unsupported_for_connection`), or a WhatsApp group limit was reached (`whatsapp_group_limit_reached`, `whatsapp_group_full`).", "content": { "application/json": { "schema": { @@ -49922,7 +50206,7 @@ } }, "429": { - "description": "WhatsApp is limiting group requests from this number (`whatsapp_rate_limited`).", + "description": "WhatsApp is limiting group requests from this connection (`whatsapp_rate_limited`).", "content": { "application/json": { "schema": { @@ -49985,9 +50269,6 @@ } } }, - "x-mint": { - "content": "Linked Device API groups:read" - }, "x-protocols": [ "Linked Device API" ] @@ -49998,7 +50279,7 @@ "Official groups" ], "summary": "Update an Official group", - "description": "**Protocols:** Linked Device API\n\n**Required scope:** `groups:manage`\n\nChanges the group's subject or description. A `group.update` event with action `settings_updated` reports which changes WhatsApp applied. Beta: requires team enrollment and a Number with an Official API connection whose WhatsApp Business Account is an Official Business Account.", + "description": "**Protocols:** Linked Device API\n\n**Required scope:** `groups:manage`\n\nChanges the group's subject or description. A `group.update` event with action `settings_updated` reports which changes WhatsApp applied. Beta: requires team enrollment and a Connection with an Official API connection whose WhatsApp Business Account is an Official Business Account.", "security": [ { "BearerAuth": [] @@ -50010,10 +50291,10 @@ "schema": { "type": "string", "minLength": 1, - "description": "Number ID." + "description": "Connection ID." }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -50144,7 +50425,7 @@ } }, "403": { - "description": "The credential lacks the scope, the team is not enrolled in the beta (`feature_unavailable`), the number is not eligible for groups (`whatsapp_groups_ineligible`), group creation is paused (`whatsapp_group_creation_paused`), or the group is suspended (`whatsapp_group_suspended`).", + "description": "The credential lacks the scope, the team is not enrolled in the beta (`feature_unavailable`), the connection is not eligible for groups (`whatsapp_groups_ineligible`), group creation is paused (`whatsapp_group_creation_paused`), or the group is suspended (`whatsapp_group_suspended`).", "content": { "application/json": { "schema": { @@ -50165,7 +50446,7 @@ } }, "404": { - "description": "The Number or group is unavailable.", + "description": "The Connection or group is unavailable.", "content": { "application/json": { "schema": { @@ -50186,7 +50467,7 @@ } }, "409": { - "description": "The Number has no Official API connection (`unsupported_for_connection`), or a WhatsApp group limit was reached (`whatsapp_group_limit_reached`, `whatsapp_group_full`). The Idempotency-Key belongs to a request that is still running (`idempotency_in_progress`, with Retry-After) or whose outcome was not recorded (`idempotency_outcome_unknown`)", + "description": "The Connection has no Official API connection (`unsupported_for_connection`), or a WhatsApp group limit was reached (`whatsapp_group_limit_reached`, `whatsapp_group_full`). The Idempotency-Key belongs to a request that is still running (`idempotency_in_progress`, with Retry-After) or whose outcome was not recorded (`idempotency_outcome_unknown`)", "content": { "application/json": { "schema": { @@ -50257,7 +50538,7 @@ } }, "429": { - "description": "WhatsApp is limiting group requests from this number (`whatsapp_rate_limited`).", + "description": "WhatsApp is limiting group requests from this connection (`whatsapp_rate_limited`).", "content": { "application/json": { "schema": { @@ -50327,9 +50608,6 @@ } } }, - "x-mint": { - "content": "Linked Device API groups:manage" - }, "x-protocols": [ "Linked Device API" ] @@ -50340,7 +50618,7 @@ "Official groups" ], "summary": "Delete an Official group", - "description": "**Protocols:** Linked Device API\n\n**Required scope:** `groups:manage`\n\nDeletes the group and removes every participant, including your business. Nobody can message the group afterwards. A `group.update` event with action `deleted` confirms it. Beta: requires team enrollment and a Number with an Official API connection whose WhatsApp Business Account is an Official Business Account.", + "description": "**Protocols:** Linked Device API\n\n**Required scope:** `groups:manage`\n\nDeletes the group and removes every participant, including your business. Nobody can message the group afterwards. A `group.update` event with action `deleted` confirms it. Beta: requires team enrollment and a Connection with an Official API connection whose WhatsApp Business Account is an Official Business Account.", "security": [ { "BearerAuth": [] @@ -50352,10 +50630,10 @@ "schema": { "type": "string", "minLength": 1, - "description": "Number ID." + "description": "Connection ID." }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -50476,7 +50754,7 @@ } }, "403": { - "description": "The credential lacks the scope, the team is not enrolled in the beta (`feature_unavailable`), the number is not eligible for groups (`whatsapp_groups_ineligible`), group creation is paused (`whatsapp_group_creation_paused`), or the group is suspended (`whatsapp_group_suspended`).", + "description": "The credential lacks the scope, the team is not enrolled in the beta (`feature_unavailable`), the connection is not eligible for groups (`whatsapp_groups_ineligible`), group creation is paused (`whatsapp_group_creation_paused`), or the group is suspended (`whatsapp_group_suspended`).", "content": { "application/json": { "schema": { @@ -50497,7 +50775,7 @@ } }, "404": { - "description": "The Number or group is unavailable.", + "description": "The Connection or group is unavailable.", "content": { "application/json": { "schema": { @@ -50518,7 +50796,7 @@ } }, "409": { - "description": "The Number has no Official API connection (`unsupported_for_connection`), or a WhatsApp group limit was reached (`whatsapp_group_limit_reached`, `whatsapp_group_full`). The Idempotency-Key belongs to a request that is still running (`idempotency_in_progress`, with Retry-After) or whose outcome was not recorded (`idempotency_outcome_unknown`)", + "description": "The Connection has no Official API connection (`unsupported_for_connection`), or a WhatsApp group limit was reached (`whatsapp_group_limit_reached`, `whatsapp_group_full`). The Idempotency-Key belongs to a request that is still running (`idempotency_in_progress`, with Retry-After) or whose outcome was not recorded (`idempotency_outcome_unknown`)", "content": { "application/json": { "schema": { @@ -50589,7 +50867,7 @@ } }, "429": { - "description": "WhatsApp is limiting group requests from this number (`whatsapp_rate_limited`).", + "description": "WhatsApp is limiting group requests from this connection (`whatsapp_rate_limited`).", "content": { "application/json": { "schema": { @@ -50659,22 +50937,19 @@ } } }, - "x-mint": { - "content": "Linked Device API groups:manage" - }, "x-protocols": [ "Linked Device API" ] } }, - "/messaging/{session}/official-groups/{group}/invite-link": { + "/messaging/{connection}/official-groups/{group}/invite-link": { "get": { "operationId": "getOfficialGroupInviteLink", "tags": [ "Official groups" ], "summary": "Get an Official group invite link", - "description": "**Protocols:** Linked Device API\n\n**Required scope:** `groups:read`\n\nReturns the link people open to join the group. Participants can only join with the link. Beta: requires team enrollment and a Number with an Official API connection whose WhatsApp Business Account is an Official Business Account.", + "description": "**Protocols:** Linked Device API\n\n**Required scope:** `groups:read`\n\nReturns the link people open to join the group. Participants can only join with the link. Beta: requires team enrollment and a Connection with an Official API connection whose WhatsApp Business Account is an Official Business Account.", "security": [ { "BearerAuth": [] @@ -50686,10 +50961,10 @@ "schema": { "type": "string", "minLength": 1, - "description": "Number ID." + "description": "Connection ID." }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -50790,7 +51065,7 @@ } }, "403": { - "description": "The credential lacks the scope, the team is not enrolled in the beta (`feature_unavailable`), the number is not eligible for groups (`whatsapp_groups_ineligible`), group creation is paused (`whatsapp_group_creation_paused`), or the group is suspended (`whatsapp_group_suspended`).", + "description": "The credential lacks the scope, the team is not enrolled in the beta (`feature_unavailable`), the connection is not eligible for groups (`whatsapp_groups_ineligible`), group creation is paused (`whatsapp_group_creation_paused`), or the group is suspended (`whatsapp_group_suspended`).", "content": { "application/json": { "schema": { @@ -50811,7 +51086,7 @@ } }, "404": { - "description": "The Number or group is unavailable.", + "description": "The Connection or group is unavailable.", "content": { "application/json": { "schema": { @@ -50832,7 +51107,7 @@ } }, "409": { - "description": "The Number has no Official API connection (`unsupported_for_connection`), or a WhatsApp group limit was reached (`whatsapp_group_limit_reached`, `whatsapp_group_full`).", + "description": "The Connection has no Official API connection (`unsupported_for_connection`), or a WhatsApp group limit was reached (`whatsapp_group_limit_reached`, `whatsapp_group_full`).", "content": { "application/json": { "schema": { @@ -50853,7 +51128,7 @@ } }, "429": { - "description": "WhatsApp is limiting group requests from this number (`whatsapp_rate_limited`).", + "description": "WhatsApp is limiting group requests from this connection (`whatsapp_rate_limited`).", "content": { "application/json": { "schema": { @@ -50916,22 +51191,19 @@ } } }, - "x-mint": { - "content": "Linked Device API groups:read" - }, "x-protocols": [ "Linked Device API" ] } }, - "/messaging/{session}/official-groups/{group}/invite-link/reset": { + "/messaging/{connection}/official-groups/{group}/invite-link/reset": { "post": { "operationId": "resetOfficialGroupInviteLink", "tags": [ "Official groups" ], "summary": "Reset an Official group invite link", - "description": "**Protocols:** Linked Device API\n\n**Required scope:** `groups:manage`\n\nCreates a new invite link. Every earlier link stops working. Beta: requires team enrollment and a Number with an Official API connection whose WhatsApp Business Account is an Official Business Account.", + "description": "**Protocols:** Linked Device API\n\n**Required scope:** `groups:manage`\n\nCreates a new invite link. Every earlier link stops working. Beta: requires team enrollment and a Connection with an Official API connection whose WhatsApp Business Account is an Official Business Account.", "security": [ { "BearerAuth": [] @@ -50943,10 +51215,10 @@ "schema": { "type": "string", "minLength": 1, - "description": "Number ID." + "description": "Connection ID." }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -51067,7 +51339,7 @@ } }, "403": { - "description": "The credential lacks the scope, the team is not enrolled in the beta (`feature_unavailable`), the number is not eligible for groups (`whatsapp_groups_ineligible`), group creation is paused (`whatsapp_group_creation_paused`), or the group is suspended (`whatsapp_group_suspended`).", + "description": "The credential lacks the scope, the team is not enrolled in the beta (`feature_unavailable`), the connection is not eligible for groups (`whatsapp_groups_ineligible`), group creation is paused (`whatsapp_group_creation_paused`), or the group is suspended (`whatsapp_group_suspended`).", "content": { "application/json": { "schema": { @@ -51088,7 +51360,7 @@ } }, "404": { - "description": "The Number or group is unavailable.", + "description": "The Connection or group is unavailable.", "content": { "application/json": { "schema": { @@ -51109,7 +51381,7 @@ } }, "409": { - "description": "The Number has no Official API connection (`unsupported_for_connection`), or a WhatsApp group limit was reached (`whatsapp_group_limit_reached`, `whatsapp_group_full`). The Idempotency-Key belongs to a request that is still running (`idempotency_in_progress`, with Retry-After) or whose outcome was not recorded (`idempotency_outcome_unknown`)", + "description": "The Connection has no Official API connection (`unsupported_for_connection`), or a WhatsApp group limit was reached (`whatsapp_group_limit_reached`, `whatsapp_group_full`). The Idempotency-Key belongs to a request that is still running (`idempotency_in_progress`, with Retry-After) or whose outcome was not recorded (`idempotency_outcome_unknown`)", "content": { "application/json": { "schema": { @@ -51180,7 +51452,7 @@ } }, "429": { - "description": "WhatsApp is limiting group requests from this number (`whatsapp_rate_limited`).", + "description": "WhatsApp is limiting group requests from this connection (`whatsapp_rate_limited`).", "content": { "application/json": { "schema": { @@ -51250,22 +51522,19 @@ } } }, - "x-mint": { - "content": "Linked Device API groups:manage" - }, "x-protocols": [ "Linked Device API" ] } }, - "/messaging/{session}/official-groups/{group}/participants/remove": { + "/messaging/{connection}/official-groups/{group}/participants/remove": { "post": { "operationId": "removeOfficialGroupParticipants", "tags": [ "Official groups" ], "summary": "Remove Official group participants", - "description": "**Protocols:** Linked Device API\n\n**Required scope:** `groups:manage`\n\nRemoves up to eight participants. A removed participant cannot rejoin with the invite link. A `group.participant` event reports each removal. Beta: requires team enrollment and a Number with an Official API connection whose WhatsApp Business Account is an Official Business Account.", + "description": "**Protocols:** Linked Device API\n\n**Required scope:** `groups:manage`\n\nRemoves up to eight participants. A removed participant cannot rejoin with the invite link. A `group.participant` event reports each removal. Beta: requires team enrollment and a Connection with an Official API connection whose WhatsApp Business Account is an Official Business Account.", "security": [ { "BearerAuth": [] @@ -51277,10 +51546,10 @@ "schema": { "type": "string", "minLength": 1, - "description": "Number ID." + "description": "Connection ID." }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -51411,7 +51680,7 @@ } }, "403": { - "description": "The credential lacks the scope, the team is not enrolled in the beta (`feature_unavailable`), the number is not eligible for groups (`whatsapp_groups_ineligible`), group creation is paused (`whatsapp_group_creation_paused`), or the group is suspended (`whatsapp_group_suspended`).", + "description": "The credential lacks the scope, the team is not enrolled in the beta (`feature_unavailable`), the connection is not eligible for groups (`whatsapp_groups_ineligible`), group creation is paused (`whatsapp_group_creation_paused`), or the group is suspended (`whatsapp_group_suspended`).", "content": { "application/json": { "schema": { @@ -51432,7 +51701,7 @@ } }, "404": { - "description": "The Number or group is unavailable.", + "description": "The Connection or group is unavailable.", "content": { "application/json": { "schema": { @@ -51453,7 +51722,7 @@ } }, "409": { - "description": "The Number has no Official API connection (`unsupported_for_connection`), or a WhatsApp group limit was reached (`whatsapp_group_limit_reached`, `whatsapp_group_full`). The Idempotency-Key belongs to a request that is still running (`idempotency_in_progress`, with Retry-After) or whose outcome was not recorded (`idempotency_outcome_unknown`)", + "description": "The Connection has no Official API connection (`unsupported_for_connection`), or a WhatsApp group limit was reached (`whatsapp_group_limit_reached`, `whatsapp_group_full`). The Idempotency-Key belongs to a request that is still running (`idempotency_in_progress`, with Retry-After) or whose outcome was not recorded (`idempotency_outcome_unknown`)", "content": { "application/json": { "schema": { @@ -51524,7 +51793,7 @@ } }, "429": { - "description": "WhatsApp is limiting group requests from this number (`whatsapp_rate_limited`).", + "description": "WhatsApp is limiting group requests from this connection (`whatsapp_rate_limited`).", "content": { "application/json": { "schema": { @@ -51594,22 +51863,19 @@ } } }, - "x-mint": { - "content": "Linked Device API groups:manage" - }, "x-protocols": [ "Linked Device API" ] } }, - "/messaging/{session}/official-groups/{group}/join-requests": { + "/messaging/{connection}/official-groups/{group}/join-requests": { "get": { "operationId": "listOfficialGroupJoinRequests", "tags": [ "Official groups" ], "summary": "List Official group join requests", - "description": "**Protocols:** Linked Device API\n\n**Required scope:** `groups:read`\n\nLists open requests to join a group that requires join approval. Beta: requires team enrollment and a Number with an Official API connection whose WhatsApp Business Account is an Official Business Account.", + "description": "**Protocols:** Linked Device API\n\n**Required scope:** `groups:read`\n\nLists open requests to join a group that requires join approval. Beta: requires team enrollment and a Connection with an Official API connection whose WhatsApp Business Account is an Official Business Account.", "security": [ { "BearerAuth": [] @@ -51621,10 +51887,10 @@ "schema": { "type": "string", "minLength": 1, - "description": "Number ID." + "description": "Connection ID." }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -51745,7 +52011,7 @@ } }, "403": { - "description": "The credential lacks the scope, the team is not enrolled in the beta (`feature_unavailable`), the number is not eligible for groups (`whatsapp_groups_ineligible`), group creation is paused (`whatsapp_group_creation_paused`), or the group is suspended (`whatsapp_group_suspended`).", + "description": "The credential lacks the scope, the team is not enrolled in the beta (`feature_unavailable`), the connection is not eligible for groups (`whatsapp_groups_ineligible`), group creation is paused (`whatsapp_group_creation_paused`), or the group is suspended (`whatsapp_group_suspended`).", "content": { "application/json": { "schema": { @@ -51766,7 +52032,7 @@ } }, "404": { - "description": "The Number or group is unavailable.", + "description": "The Connection or group is unavailable.", "content": { "application/json": { "schema": { @@ -51787,7 +52053,7 @@ } }, "409": { - "description": "The Number has no Official API connection (`unsupported_for_connection`), or a WhatsApp group limit was reached (`whatsapp_group_limit_reached`, `whatsapp_group_full`).", + "description": "The Connection has no Official API connection (`unsupported_for_connection`), or a WhatsApp group limit was reached (`whatsapp_group_limit_reached`, `whatsapp_group_full`).", "content": { "application/json": { "schema": { @@ -51808,7 +52074,7 @@ } }, "429": { - "description": "WhatsApp is limiting group requests from this number (`whatsapp_rate_limited`).", + "description": "WhatsApp is limiting group requests from this connection (`whatsapp_rate_limited`).", "content": { "application/json": { "schema": { @@ -51871,22 +52137,19 @@ } } }, - "x-mint": { - "content": "Linked Device API groups:read" - }, "x-protocols": [ "Linked Device API" ] } }, - "/messaging/{session}/official-groups/{group}/join-requests/approve": { + "/messaging/{connection}/official-groups/{group}/join-requests/approve": { "post": { "operationId": "approveOfficialGroupJoinRequests", "tags": [ "Official groups" ], "summary": "Approve Official group join requests", - "description": "**Protocols:** Linked Device API\n\n**Required scope:** `groups:manage`\n\nApproves open join requests. Approved people can join with the invite link. Requests WhatsApp could not approve are listed in `failed`. Beta: requires team enrollment and a Number with an Official API connection whose WhatsApp Business Account is an Official Business Account.", + "description": "**Protocols:** Linked Device API\n\n**Required scope:** `groups:manage`\n\nApproves open join requests. Approved people can join with the invite link. Requests WhatsApp could not approve are listed in `failed`. Beta: requires team enrollment and a Connection with an Official API connection whose WhatsApp Business Account is an Official Business Account.", "security": [ { "BearerAuth": [] @@ -51898,10 +52161,10 @@ "schema": { "type": "string", "minLength": 1, - "description": "Number ID." + "description": "Connection ID." }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -52032,7 +52295,7 @@ } }, "403": { - "description": "The credential lacks the scope, the team is not enrolled in the beta (`feature_unavailable`), the number is not eligible for groups (`whatsapp_groups_ineligible`), group creation is paused (`whatsapp_group_creation_paused`), or the group is suspended (`whatsapp_group_suspended`).", + "description": "The credential lacks the scope, the team is not enrolled in the beta (`feature_unavailable`), the connection is not eligible for groups (`whatsapp_groups_ineligible`), group creation is paused (`whatsapp_group_creation_paused`), or the group is suspended (`whatsapp_group_suspended`).", "content": { "application/json": { "schema": { @@ -52053,7 +52316,7 @@ } }, "404": { - "description": "The Number or group is unavailable.", + "description": "The Connection or group is unavailable.", "content": { "application/json": { "schema": { @@ -52074,7 +52337,7 @@ } }, "409": { - "description": "The Number has no Official API connection (`unsupported_for_connection`), or a WhatsApp group limit was reached (`whatsapp_group_limit_reached`, `whatsapp_group_full`). The Idempotency-Key belongs to a request that is still running (`idempotency_in_progress`, with Retry-After) or whose outcome was not recorded (`idempotency_outcome_unknown`)", + "description": "The Connection has no Official API connection (`unsupported_for_connection`), or a WhatsApp group limit was reached (`whatsapp_group_limit_reached`, `whatsapp_group_full`). The Idempotency-Key belongs to a request that is still running (`idempotency_in_progress`, with Retry-After) or whose outcome was not recorded (`idempotency_outcome_unknown`)", "content": { "application/json": { "schema": { @@ -52145,7 +52408,7 @@ } }, "429": { - "description": "WhatsApp is limiting group requests from this number (`whatsapp_rate_limited`).", + "description": "WhatsApp is limiting group requests from this connection (`whatsapp_rate_limited`).", "content": { "application/json": { "schema": { @@ -52215,22 +52478,19 @@ } } }, - "x-mint": { - "content": "Linked Device API groups:manage" - }, "x-protocols": [ "Linked Device API" ] } }, - "/messaging/{session}/official-groups/{group}/join-requests/reject": { + "/messaging/{connection}/official-groups/{group}/join-requests/reject": { "post": { "operationId": "rejectOfficialGroupJoinRequests", "tags": [ "Official groups" ], "summary": "Reject Official group join requests", - "description": "**Protocols:** Linked Device API\n\n**Required scope:** `groups:manage`\n\nRejects open join requests. The person can request to join again. Requests WhatsApp could not reject are listed in `failed`. Beta: requires team enrollment and a Number with an Official API connection whose WhatsApp Business Account is an Official Business Account.", + "description": "**Protocols:** Linked Device API\n\n**Required scope:** `groups:manage`\n\nRejects open join requests. The person can request to join again. Requests WhatsApp could not reject are listed in `failed`. Beta: requires team enrollment and a Connection with an Official API connection whose WhatsApp Business Account is an Official Business Account.", "security": [ { "BearerAuth": [] @@ -52242,10 +52502,10 @@ "schema": { "type": "string", "minLength": 1, - "description": "Number ID." + "description": "Connection ID." }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -52376,7 +52636,7 @@ } }, "403": { - "description": "The credential lacks the scope, the team is not enrolled in the beta (`feature_unavailable`), the number is not eligible for groups (`whatsapp_groups_ineligible`), group creation is paused (`whatsapp_group_creation_paused`), or the group is suspended (`whatsapp_group_suspended`).", + "description": "The credential lacks the scope, the team is not enrolled in the beta (`feature_unavailable`), the connection is not eligible for groups (`whatsapp_groups_ineligible`), group creation is paused (`whatsapp_group_creation_paused`), or the group is suspended (`whatsapp_group_suspended`).", "content": { "application/json": { "schema": { @@ -52397,7 +52657,7 @@ } }, "404": { - "description": "The Number or group is unavailable.", + "description": "The Connection or group is unavailable.", "content": { "application/json": { "schema": { @@ -52418,7 +52678,7 @@ } }, "409": { - "description": "The Number has no Official API connection (`unsupported_for_connection`), or a WhatsApp group limit was reached (`whatsapp_group_limit_reached`, `whatsapp_group_full`). The Idempotency-Key belongs to a request that is still running (`idempotency_in_progress`, with Retry-After) or whose outcome was not recorded (`idempotency_outcome_unknown`)", + "description": "The Connection has no Official API connection (`unsupported_for_connection`), or a WhatsApp group limit was reached (`whatsapp_group_limit_reached`, `whatsapp_group_full`). The Idempotency-Key belongs to a request that is still running (`idempotency_in_progress`, with Retry-After) or whose outcome was not recorded (`idempotency_outcome_unknown`)", "content": { "application/json": { "schema": { @@ -52489,7 +52749,7 @@ } }, "429": { - "description": "WhatsApp is limiting group requests from this number (`whatsapp_rate_limited`).", + "description": "WhatsApp is limiting group requests from this connection (`whatsapp_rate_limited`).", "content": { "application/json": { "schema": { @@ -52559,22 +52819,19 @@ } } }, - "x-mint": { - "content": "Linked Device API groups:manage" - }, "x-protocols": [ "Linked Device API" ] } }, - "/messaging/{session}/official-groups/{group}/picture": { + "/messaging/{connection}/official-groups/{group}/picture": { "put": { "operationId": "setOfficialGroupPicture", "tags": [ "Official groups" ], "summary": "Set an Official group picture", - "description": "**Protocols:** Meta Cloud API\n\n**Required scope:** `groups:manage`\n\nReplaces the group's profile picture. Send `multipart/form-data` with one `file` part: a square JPEG of at least 192 x 192 pixels and at most 5 MB. A `group.update` event with action `settings_updated` reports whether WhatsApp applied it. Repeating the same upload is safe. Beta: requires team enrollment and a Number with an Official API connection whose WhatsApp Business Account is an Official Business Account.", + "description": "**Protocols:** Meta Cloud API\n\n**Required scope:** `groups:manage`\n\nReplaces the group's profile picture. Send `multipart/form-data` with one `file` part: a square JPEG of at least 192 x 192 pixels and at most 5 MB. A `group.update` event with action `settings_updated` reports whether WhatsApp applied it. Repeating the same upload is safe. Beta: requires team enrollment and a Connection with an Official API connection whose WhatsApp Business Account is an Official Business Account.", "security": [ { "BearerAuth": [] @@ -52586,10 +52843,10 @@ "schema": { "type": "string", "minLength": 1, - "description": "Number ID." + "description": "Connection ID." }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -52700,7 +52957,7 @@ } }, "403": { - "description": "The credential lacks the scope, the team is not enrolled in the beta (`feature_unavailable`), the number is not eligible for groups (`whatsapp_groups_ineligible`), group creation is paused (`whatsapp_group_creation_paused`), or the group is suspended (`whatsapp_group_suspended`).", + "description": "The credential lacks the scope, the team is not enrolled in the beta (`feature_unavailable`), the connection is not eligible for groups (`whatsapp_groups_ineligible`), group creation is paused (`whatsapp_group_creation_paused`), or the group is suspended (`whatsapp_group_suspended`).", "content": { "application/json": { "schema": { @@ -52721,7 +52978,7 @@ } }, "404": { - "description": "The Number or group is unavailable.", + "description": "The Connection or group is unavailable.", "content": { "application/json": { "schema": { @@ -52742,7 +52999,7 @@ } }, "409": { - "description": "The Number has no Official API connection (`unsupported_for_connection`), or a WhatsApp group limit was reached (`whatsapp_group_limit_reached`, `whatsapp_group_full`).", + "description": "The Connection has no Official API connection (`unsupported_for_connection`), or a WhatsApp group limit was reached (`whatsapp_group_limit_reached`, `whatsapp_group_full`).", "content": { "application/json": { "schema": { @@ -52784,7 +53041,7 @@ } }, "429": { - "description": "WhatsApp is limiting group requests from this number (`whatsapp_rate_limited`).", + "description": "WhatsApp is limiting group requests from this connection (`whatsapp_rate_limited`).", "content": { "application/json": { "schema": { @@ -52868,22 +53125,19 @@ } } }, - "x-mint": { - "content": "Meta Cloud API groups:manage" - }, "x-protocols": [ "Meta Cloud API" ] } }, - "/messaging/{session}/official-groups/{group}/pins": { + "/messaging/{connection}/official-groups/{group}/pins": { "post": { "operationId": "pinOfficialGroupMessage", "tags": [ "Official groups" ], "summary": "Pin or unpin an Official group message", - "description": "**Protocols:** Linked Device API\n\n**Required scope:** `groups:manage`\n\nPins a message for 1 to 30 days, or unpins it. At most three messages stay pinned; a new pin unpins the oldest. Beta: requires team enrollment and a Number with an Official API connection whose WhatsApp Business Account is an Official Business Account.", + "description": "**Protocols:** Linked Device API\n\n**Required scope:** `groups:manage`\n\nPins a message for 1 to 30 days, or unpins it. At most three messages stay pinned; a new pin unpins the oldest. Beta: requires team enrollment and a Connection with an Official API connection whose WhatsApp Business Account is an Official Business Account.", "security": [ { "BearerAuth": [] @@ -52895,10 +53149,10 @@ "schema": { "type": "string", "minLength": 1, - "description": "Number ID." + "description": "Connection ID." }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -53029,7 +53283,7 @@ } }, "403": { - "description": "The credential lacks the scope, the team is not enrolled in the beta (`feature_unavailable`), the number is not eligible for groups (`whatsapp_groups_ineligible`), group creation is paused (`whatsapp_group_creation_paused`), or the group is suspended (`whatsapp_group_suspended`).", + "description": "The credential lacks the scope, the team is not enrolled in the beta (`feature_unavailable`), the connection is not eligible for groups (`whatsapp_groups_ineligible`), group creation is paused (`whatsapp_group_creation_paused`), or the group is suspended (`whatsapp_group_suspended`).", "content": { "application/json": { "schema": { @@ -53050,7 +53304,7 @@ } }, "404": { - "description": "The Number or group is unavailable.", + "description": "The Connection or group is unavailable.", "content": { "application/json": { "schema": { @@ -53071,7 +53325,7 @@ } }, "409": { - "description": "The Number has no Official API connection (`unsupported_for_connection`), or a WhatsApp group limit was reached (`whatsapp_group_limit_reached`, `whatsapp_group_full`). The Idempotency-Key belongs to a request that is still running (`idempotency_in_progress`, with Retry-After) or whose outcome was not recorded (`idempotency_outcome_unknown`)", + "description": "The Connection has no Official API connection (`unsupported_for_connection`), or a WhatsApp group limit was reached (`whatsapp_group_limit_reached`, `whatsapp_group_full`). The Idempotency-Key belongs to a request that is still running (`idempotency_in_progress`, with Retry-After) or whose outcome was not recorded (`idempotency_outcome_unknown`)", "content": { "application/json": { "schema": { @@ -53142,7 +53396,7 @@ } }, "429": { - "description": "WhatsApp is limiting group requests from this number (`whatsapp_rate_limited`).", + "description": "WhatsApp is limiting group requests from this connection (`whatsapp_rate_limited`).", "content": { "application/json": { "schema": { @@ -53212,38 +53466,35 @@ } } }, - "x-mint": { - "content": "Linked Device API groups:manage" - }, "x-protocols": [ "Linked Device API" ] } }, - "/messaging/{session}/marketing-messages/status": { + "/messaging/{connection}/marketing-messages/status": { "get": { "operationId": "getMarketingMessagesStatus", "tags": [ "Marketing Messages" ], "summary": "Get Marketing Messages onboarding status", - "description": "**Protocols:** Meta Cloud API\n\n**Required scope:** `sessions:read`\n\nReads WhatsApp's Marketing Messages onboarding status, terms of service state and Cloud API marketing setting for the Number's WhatsApp Business Account. The status can change between this read and a send; WhatsApp decides each send. Beta: requires team enrollment and a Number with an Official API connection.", + "description": "**Protocols:** Meta Cloud API\n\n**Required scope:** `connections:read`\n\nReads WhatsApp's Marketing Messages onboarding status, terms of service state and Cloud API marketing setting for the Connection's WhatsApp Business Account. The status can change between this read and a send; WhatsApp decides each send. Beta: requires team enrollment and a Connection with an Official API connection.", "security": [ { "BearerAuth": [] } ], - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "parameters": [ { "schema": { "type": "string", "minLength": 1, "maxLength": 128, - "description": "Number ID." + "description": "Connection ID." }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -53270,7 +53521,7 @@ } }, "400": { - "description": "The Number ID fails validation (`invalid_parameter`); it must contain 1 to 128 characters.", + "description": "The Connection ID fails validation (`invalid_parameter`); it must contain 1 to 128 characters.", "content": { "application/json": { "schema": { @@ -53312,7 +53563,7 @@ } }, "403": { - "description": "The credential lacks `sessions:read`, or the team is not enrolled in the beta (`feature_unavailable`).", + "description": "The credential lacks `connections:read`, or the team is not enrolled in the beta (`feature_unavailable`).", "content": { "application/json": { "schema": { @@ -53333,7 +53584,7 @@ } }, "404": { - "description": "The Number is unavailable.", + "description": "The Connection is unavailable.", "content": { "application/json": { "schema": { @@ -53354,7 +53605,7 @@ } }, "409": { - "description": "The Number has no connected Official API account, for example a Linked Devices or test Number (`unsupported_for_connection`).", + "description": "The Connection has no connected Official API account, for example a Linked Devices or test Connection (`unsupported_for_connection`).", "content": { "application/json": { "schema": { @@ -53417,21 +53668,18 @@ } } }, - "x-mint": { - "content": "Meta Cloud API sessions:read" - }, "x-protocols": [ "Meta Cloud API" ] } }, - "/messaging/{session}/contacts": { + "/messaging/{connection}/contacts": { "get": { "operationId": "listContacts", "tags": [ "Contacts" ], - "summary": "List all contacts known to the session", + "summary": "List all contacts known to the connection", "security": [ { "BearerAuth": [] @@ -53444,7 +53692,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -53631,16 +53879,13 @@ } } }, - "x-mint": { - "content": "Linked Device API contacts:read" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `contacts:read`" } }, - "/messaging/{session}/contacts/check": { + "/messaging/{connection}/contacts/check": { "get": { "operationId": "checkContacts", "tags": [ @@ -53659,7 +53904,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -53867,16 +54112,13 @@ } } }, - "x-mint": { - "content": "Linked Device API contacts:read" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `contacts:read`" } }, - "/messaging/{session}/contacts/blocked": { + "/messaging/{connection}/contacts/blocked": { "get": { "operationId": "getBlocklist", "tags": [ @@ -53895,7 +54137,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -54082,16 +54324,13 @@ } } }, - "x-mint": { - "content": "Linked Device API contacts:read" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `contacts:read`" } }, - "/messaging/{session}/contacts/{contactId}": { + "/messaging/{connection}/contacts/{contactId}": { "get": { "operationId": "getContact", "tags": [ @@ -54110,7 +54349,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -54306,16 +54545,13 @@ } } }, - "x-mint": { - "content": "Linked Device API contacts:read" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `contacts:read`" } }, - "/messaging/{session}/contacts/{contactId}/picture": { + "/messaging/{connection}/contacts/{contactId}/picture": { "get": { "operationId": "getContactPicture", "tags": [ @@ -54334,7 +54570,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -54530,16 +54766,13 @@ } } }, - "x-mint": { - "content": "Linked Device API contacts:read" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `contacts:read`" } }, - "/messaging/{session}/contacts/{contactId}/info": { + "/messaging/{connection}/contacts/{contactId}/info": { "get": { "operationId": "getUserInfo", "tags": [ @@ -54558,7 +54791,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -54754,16 +54987,13 @@ } } }, - "x-mint": { - "content": "Linked Device API contacts:read" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `contacts:read`" } }, - "/messaging/{session}/contacts/{contactId}/devices": { + "/messaging/{connection}/contacts/{contactId}/devices": { "get": { "operationId": "getUserDevices", "tags": [ @@ -54782,7 +55012,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -54978,16 +55208,13 @@ } } }, - "x-mint": { - "content": "Linked Device API contacts:read" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `contacts:read`" } }, - "/messaging/{session}/contacts/{contactId}/business-profile": { + "/messaging/{connection}/contacts/{contactId}/business-profile": { "get": { "operationId": "getBusinessProfile", "tags": [ @@ -55006,7 +55233,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -55202,16 +55429,13 @@ } } }, - "x-mint": { - "content": "Linked Device API contacts:read" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `contacts:read`" } }, - "/messaging/{session}/contacts/{contactId}/block": { + "/messaging/{connection}/contacts/{contactId}/block": { "post": { "operationId": "blockContact", "tags": [ @@ -55230,7 +55454,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -55426,16 +55650,13 @@ } } }, - "x-mint": { - "content": "Linked Device API contacts:manage" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `contacts:manage`" } }, - "/messaging/{session}/contacts/{contactId}/unblock": { + "/messaging/{connection}/contacts/{contactId}/unblock": { "post": { "operationId": "unblockContact", "tags": [ @@ -55454,7 +55675,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -55650,16 +55871,13 @@ } } }, - "x-mint": { - "content": "Linked Device API contacts:manage" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `contacts:manage`" } }, - "/messaging/{session}/stickers/favorite": { + "/messaging/{connection}/stickers/favorite": { "put": { "security": [ { @@ -55679,7 +55897,7 @@ "minLength": 1 }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -55908,16 +56126,13 @@ } } }, - "x-mint": { - "content": "Linked Device API profile:write" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `profile:write`" } }, - "/messaging/{session}/stickers/recents/remove": { + "/messaging/{connection}/stickers/recents/remove": { "post": { "security": [ { @@ -55937,7 +56152,7 @@ "minLength": 1 }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -56166,16 +56381,13 @@ } } }, - "x-mint": { - "content": "Linked Device API profile:write" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `profile:write`" } }, - "/messaging/{session}/stickers/reuploads": { + "/messaging/{connection}/stickers/reuploads": { "post": { "security": [ { @@ -56196,7 +56408,7 @@ "minLength": 1 }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -56425,15 +56637,12 @@ } } }, - "x-mint": { - "content": "Linked Device API media:read" - }, "x-protocols": [ "Linked Device API" ] } }, - "/messaging/{session}/stickers/recents/bootstrap": { + "/messaging/{connection}/stickers/recents/bootstrap": { "post": { "security": [ { @@ -56454,7 +56663,7 @@ "minLength": 1 }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -56673,15 +56882,12 @@ } } }, - "x-mint": { - "content": "Linked Device API messages:read" - }, "x-protocols": [ "Linked Device API" ] } }, - "/messaging/{session}/business/linked-accounts": { + "/messaging/{connection}/business/linked-accounts": { "get": { "operationId": "getBusinessLinkedAccounts", "tags": [ @@ -56700,7 +56906,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -56887,16 +57093,13 @@ } } }, - "x-mint": { - "content": "Linked Device API business:read" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `business:read`" } }, - "/messaging/{session}/business/eligibility": { + "/messaging/{connection}/business/eligibility": { "get": { "operationId": "getBusinessEligibility", "tags": [ @@ -56915,7 +57118,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -57102,16 +57305,13 @@ } } }, - "x-mint": { - "content": "Linked Device API business:read" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `business:read`" } }, - "/messaging/{session}/business/profile": { + "/messaging/{connection}/business/profile": { "get": { "operationId": "getOwnBusinessProfile", "tags": [ @@ -57130,7 +57330,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -57317,9 +57517,6 @@ } } }, - "x-mint": { - "content": "Linked Device API profile:read" - }, "x-protocols": [ "Linked Device API" ], @@ -57343,7 +57540,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -57540,16 +57737,13 @@ } } }, - "x-mint": { - "content": "Linked Device API profile:write" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `profile:write`" } }, - "/messaging/{session}/business/profile/cover-photo": { + "/messaging/{connection}/business/profile/cover-photo": { "put": { "operationId": "setBusinessCoverPhoto", "tags": [ @@ -57568,7 +57762,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -57765,16 +57959,13 @@ } } }, - "x-mint": { - "content": "Linked Device API profile:write" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `profile:write`" } }, - "/messaging/{session}/business/profile/cover-photo/{coverPhotoId}": { + "/messaging/{connection}/business/profile/cover-photo/{coverPhotoId}": { "delete": { "operationId": "deleteBusinessCoverPhoto", "tags": [ @@ -57793,7 +57984,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -57990,16 +58181,13 @@ } } }, - "x-mint": { - "content": "Linked Device API profile:write" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `profile:write`" } }, - "/messaging/{session}/business/compliance": { + "/messaging/{connection}/business/compliance": { "get": { "operationId": "getBusinessMerchantCompliance", "tags": [ @@ -58018,7 +58206,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -58205,9 +58393,6 @@ } } }, - "x-mint": { - "content": "Linked Device API profile:read" - }, "x-protocols": [ "Linked Device API" ], @@ -58231,7 +58416,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -58428,16 +58613,13 @@ } } }, - "x-mint": { - "content": "Linked Device API profile:write" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `profile:write`" } }, - "/messaging/{session}/business/quick-replies": { + "/messaging/{connection}/business/quick-replies": { "post": { "operationId": "createBusinessQuickReply", "tags": [ @@ -58456,7 +58638,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -58653,9 +58835,6 @@ } } }, - "x-mint": { - "content": "Linked Device API profile:write" - }, "x-protocols": [ "Linked Device API" ], @@ -58679,7 +58858,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -58866,16 +59045,13 @@ } } }, - "x-mint": { - "content": "Linked Device API profile:read" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `profile:read`" } }, - "/messaging/{session}/business/quick-replies/{quickReplyId}": { + "/messaging/{connection}/business/quick-replies/{quickReplyId}": { "put": { "operationId": "setBusinessQuickReply", "tags": [ @@ -58894,7 +59070,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -59102,9 +59278,6 @@ } } }, - "x-mint": { - "content": "Linked Device API profile:write" - }, "x-protocols": [ "Linked Device API" ], @@ -59128,7 +59301,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -59326,16 +59499,13 @@ } } }, - "x-mint": { - "content": "Linked Device API profile:write" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `profile:write`" } }, - "/messaging/{session}/business/catalog": { + "/messaging/{connection}/business/catalog": { "get": { "operationId": "getBusinessCatalog", "tags": [ @@ -59354,7 +59524,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -59622,9 +59792,6 @@ } } }, - "x-mint": { - "content": "Linked Device API business:read" - }, "x-protocols": [ "Linked Device API" ], @@ -59648,7 +59815,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -59835,16 +60002,13 @@ } } }, - "x-mint": { - "content": "Linked Device API profile:write" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `profile:write`" } }, - "/messaging/{session}/business/catalog/cart": { + "/messaging/{connection}/business/catalog/cart": { "patch": { "operationId": "setBusinessCartEnabled", "tags": [ @@ -59863,7 +60027,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -60060,16 +60224,13 @@ } } }, - "x-mint": { - "content": "Linked Device API profile:write" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `profile:write`" } }, - "/messaging/{session}/business/products/{productId}": { + "/messaging/{connection}/business/products/{productId}": { "get": { "operationId": "getBusinessProduct", "tags": [ @@ -60088,7 +60249,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -60326,9 +60487,6 @@ } } }, - "x-mint": { - "content": "Linked Device API business:read" - }, "x-protocols": [ "Linked Device API" ], @@ -60352,7 +60510,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -60558,9 +60716,6 @@ } } }, - "x-mint": { - "content": "Linked Device API profile:write" - }, "x-protocols": [ "Linked Device API" ], @@ -60584,7 +60739,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -60780,16 +60935,13 @@ } } }, - "x-mint": { - "content": "Linked Device API profile:write" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `profile:write`" } }, - "/messaging/{session}/business/products": { + "/messaging/{connection}/business/products": { "post": { "operationId": "createBusinessProduct", "tags": [ @@ -60808,7 +60960,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -61005,16 +61157,13 @@ } } }, - "x-mint": { - "content": "Linked Device API profile:write" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `profile:write`" } }, - "/messaging/{session}/business/products/{productId}/visibility": { + "/messaging/{connection}/business/products/{productId}/visibility": { "patch": { "operationId": "setBusinessProductVisibility", "tags": [ @@ -61033,7 +61182,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -61239,16 +61388,13 @@ } } }, - "x-mint": { - "content": "Linked Device API profile:write" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `profile:write`" } }, - "/messaging/{session}/business/products/{productId}/appeal": { + "/messaging/{connection}/business/products/{productId}/appeal": { "post": { "operationId": "appealBusinessProduct", "tags": [ @@ -61267,7 +61413,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -61473,16 +61619,13 @@ } } }, - "x-mint": { - "content": "Linked Device API profile:write" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `profile:write`" } }, - "/messaging/{session}/business/collections": { + "/messaging/{connection}/business/collections": { "get": { "operationId": "getBusinessCollections", "tags": [ @@ -61501,7 +61644,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -61779,9 +61922,6 @@ } } }, - "x-mint": { - "content": "Linked Device API business:read" - }, "x-protocols": [ "Linked Device API" ], @@ -61805,7 +61945,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -62002,16 +62142,13 @@ } } }, - "x-mint": { - "content": "Linked Device API profile:write" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `profile:write`" } }, - "/messaging/{session}/business/collections/{collectionId}": { + "/messaging/{connection}/business/collections/{collectionId}": { "get": { "operationId": "getBusinessCollection", "tags": [ @@ -62030,7 +62167,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -62307,9 +62444,6 @@ } } }, - "x-mint": { - "content": "Linked Device API business:read" - }, "x-protocols": [ "Linked Device API" ], @@ -62333,7 +62467,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -62539,9 +62673,6 @@ } } }, - "x-mint": { - "content": "Linked Device API profile:write" - }, "x-protocols": [ "Linked Device API" ], @@ -62565,7 +62696,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -62761,16 +62892,13 @@ } } }, - "x-mint": { - "content": "Linked Device API profile:write" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `profile:write`" } }, - "/messaging/{session}/business/collections/reorder": { + "/messaging/{connection}/business/collections/reorder": { "post": { "operationId": "reorderBusinessCollections", "tags": [ @@ -62789,7 +62917,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -62986,16 +63114,13 @@ } } }, - "x-mint": { - "content": "Linked Device API profile:write" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `profile:write`" } }, - "/messaging/{session}/business/collections/{collectionId}/appeal": { + "/messaging/{connection}/business/collections/{collectionId}/appeal": { "post": { "operationId": "appealBusinessCollection", "tags": [ @@ -63014,7 +63139,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -63220,16 +63345,13 @@ } } }, - "x-mint": { - "content": "Linked Device API profile:write" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `profile:write`" } }, - "/messaging/{session}/business/orders/{orderId}/lookup": { + "/messaging/{connection}/business/orders/{orderId}/lookup": { "post": { "operationId": "getBusinessOrder", "tags": [ @@ -63248,7 +63370,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -63486,16 +63608,13 @@ } } }, - "x-mint": { - "content": "Linked Device API business:read" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `business:read`" } }, - "/messaging/{session}/identities/resolve": { + "/messaging/{connection}/identities/resolve": { "get": { "operationId": "resolveIdentity", "tags": [ @@ -63514,7 +63633,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -63737,16 +63856,13 @@ } } }, - "x-mint": { - "content": "Linked Device API contacts:read" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `contacts:read`" } }, - "/messaging/{session}/users/{id}/security-code": { + "/messaging/{connection}/users/{id}/security-code": { "get": { "operationId": "getUserSecurityCode", "tags": [ @@ -63765,7 +63881,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -63961,22 +64077,19 @@ } } }, - "x-mint": { - "content": "Linked Device API contacts:read" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `contacts:read`" } }, - "/messaging/{session}/channels": { + "/messaging/{connection}/channels": { "get": { "operationId": "listChannels", "tags": [ "Channels" ], - "summary": "List channels the session follows", + "summary": "List channels the connection follows", "security": [ { "BearerAuth": [] @@ -63989,7 +64102,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -64176,9 +64289,6 @@ } } }, - "x-mint": { - "content": "Linked Device API channels:read" - }, "x-protocols": [ "Linked Device API" ], @@ -64202,7 +64312,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -64398,16 +64508,13 @@ } } }, - "x-mint": { - "content": "Linked Device API channels:manage" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `channels:manage`" } }, - "/messaging/{session}/channels/{id}": { + "/messaging/{connection}/channels/{id}": { "get": { "operationId": "getChannel", "tags": [ @@ -64426,7 +64533,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -64622,9 +64729,6 @@ } } }, - "x-mint": { - "content": "Linked Device API channels:read" - }, "x-protocols": [ "Linked Device API" ], @@ -64648,7 +64752,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -64876,16 +64980,13 @@ } } }, - "x-mint": { - "content": "Linked Device API channels:manage" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `channels:manage`" } }, - "/messaging/{session}/channels/{id}/messages": { + "/messaging/{connection}/channels/{id}/messages": { "get": { "operationId": "listChannelMessages", "tags": [ @@ -64904,7 +65005,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -65121,16 +65222,13 @@ } } }, - "x-mint": { - "content": "Linked Device API channels:read" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `channels:read`" } }, - "/messaging/{session}/channels/{id}/message-updates": { + "/messaging/{connection}/channels/{id}/message-updates": { "get": { "operationId": "listChannelMessageUpdates", "tags": [ @@ -65149,7 +65247,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -65376,16 +65474,13 @@ } } }, - "x-mint": { - "content": "Linked Device API channels:read" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `channels:read`" } }, - "/messaging/{session}/channels/{id}/messages/{messageId}/viewed": { + "/messaging/{connection}/channels/{id}/messages/{messageId}/viewed": { "post": { "operationId": "markChannelMessageViewed", "tags": [ @@ -65404,7 +65499,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -65609,16 +65704,13 @@ } } }, - "x-mint": { - "content": "Linked Device API channels:manage" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `channels:manage`" } }, - "/messaging/{session}/channels/{id}/messages/{messageId}/reaction": { + "/messaging/{connection}/channels/{id}/messages/{messageId}/reaction": { "post": { "operationId": "reactToChannelMessage", "tags": [ @@ -65637,7 +65729,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -65990,16 +66082,13 @@ } } }, - "x-mint": { - "content": "Linked Device API channels:manage" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `channels:manage`" } }, - "/messaging/{session}/channels/{id}/live-updates": { + "/messaging/{connection}/channels/{id}/live-updates": { "post": { "operationId": "subscribeChannelLiveUpdates", "tags": [ @@ -66018,7 +66107,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -66214,16 +66303,13 @@ } } }, - "x-mint": { - "content": "Linked Device API channels:read" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `channels:read`" } }, - "/messaging/{session}/channels/{id}/follow": { + "/messaging/{connection}/channels/{id}/follow": { "post": { "operationId": "followChannel", "tags": [ @@ -66242,7 +66328,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -66438,16 +66524,13 @@ } } }, - "x-mint": { - "content": "Linked Device API channels:manage" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `channels:manage`" } }, - "/messaging/{session}/channels/{id}/unfollow": { + "/messaging/{connection}/channels/{id}/unfollow": { "post": { "operationId": "unfollowChannel", "tags": [ @@ -66466,7 +66549,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -66662,16 +66745,13 @@ } } }, - "x-mint": { - "content": "Linked Device API channels:manage" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `channels:manage`" } }, - "/messaging/{session}/channels/{id}/mute": { + "/messaging/{connection}/channels/{id}/mute": { "post": { "operationId": "muteChannel", "tags": [ @@ -66690,7 +66770,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -66886,16 +66966,13 @@ } } }, - "x-mint": { - "content": "Linked Device API channels:manage" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `channels:manage`" } }, - "/messaging/{session}/channels/{id}/unmute": { + "/messaging/{connection}/channels/{id}/unmute": { "post": { "operationId": "unmuteChannel", "tags": [ @@ -66914,7 +66991,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -67110,22 +67187,19 @@ } } }, - "x-mint": { - "content": "Linked Device API channels:manage" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `channels:manage`" } }, - "/messaging/{session}/presence": { + "/messaging/{connection}/presence": { "post": { "operationId": "setPresence", "tags": [ "Presence" ], - "summary": "Set the session's own presence (available / unavailable)", + "summary": "Set the connection's own presence (available / unavailable)", "security": [ { "BearerAuth": [] @@ -67138,7 +67212,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -67355,9 +67429,6 @@ } } }, - "x-mint": { - "content": "Linked Device API presence:write" - }, "x-protocols": [ "Linked Device API" ], @@ -67368,7 +67439,7 @@ "tags": [ "Presence" ], - "summary": "Get the session's own presence", + "summary": "Get the connection's own presence", "security": [ { "BearerAuth": [] @@ -67381,7 +67452,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -67568,16 +67639,13 @@ } } }, - "x-mint": { - "content": "Linked Device API presence:read" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `presence:read`" } }, - "/messaging/{session}/presence/{conversation}": { + "/messaging/{connection}/presence/{conversation}": { "get": { "operationId": "getChatPresence", "tags": [ @@ -67596,7 +67664,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -67791,16 +67859,13 @@ } } }, - "x-mint": { - "content": "Linked Device API presence:read" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `presence:read`" } }, - "/messaging/{session}/presence/{conversation}/subscribe": { + "/messaging/{connection}/presence/{conversation}/subscribe": { "post": { "operationId": "subscribePresence", "tags": [ @@ -67819,7 +67884,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -68003,7 +68068,7 @@ } }, "429": { - "description": "Observation limit exceeded, or the session is inside the suspension window that follows", + "description": "Observation limit exceeded, or the connection is inside the suspension window that follows", "content": { "application/json": { "schema": { @@ -68067,9 +68132,6 @@ } } }, - "x-mint": { - "content": "Linked Device API presence:observe" - }, "x-protocols": [ "Linked Device API" ], @@ -68088,7 +68150,7 @@ "BearerAuth": [] } ], - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "parameters": [ { "schema": { @@ -68283,10 +68345,7 @@ } } }, - "x-mint": { - "content": "sessions:read" - }, - "description": "**Required scope:** `sessions:read`" + "description": "**Required scope:** `connections:read`" }, "put": { "operationId": "updateProjectSafeMode", @@ -68294,13 +68353,13 @@ "Safe Mode" ], "summary": "Set a project's Safe Mode ceiling", - "description": "**Required scope:** `sessions:manage`\n\nSets the most visible behaviour any number in this project may use. Presence and read receipts are visible to the people this number messages: turning them on makes the number appear online, exposes last-seen subject to the account's privacy settings, and puts blue ticks on incoming messages. Every axis is off by default and only this request changes it.", + "description": "**Required scope:** `connections:manage`\n\nSets the most visible behaviour any connection in this project may use. Presence and read receipts are visible to the people this connection messages: turning them on makes the connection appear online, exposes last-seen subject to the account's privacy settings, and puts blue ticks on incoming messages. Every axis is off by default and only this request changes it.", "security": [ { "BearerAuth": [] } ], - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "parameters": [ { "schema": { @@ -68453,7 +68512,7 @@ } }, "402": { - "description": "`safe_mode_not_entitled`: Safe Mode is part of BanSafe Lite, which is not included on this number's plan", + "description": "`safe_mode_not_entitled`: Safe Mode is part of BanSafe Lite, which is not included on this connection's plan", "content": { "application/json": { "schema": { @@ -68463,7 +68522,7 @@ "error": { "type": "billing_error", "code": "safe_mode_not_entitled", - "message": "Safe Mode is not included on this number’s plan.", + "message": "Safe Mode is not included on this connection’s plan.", "param": null, "request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30" }, @@ -68581,7 +68640,7 @@ } }, "503": { - "description": "Stored, but a connected number did not confirm the policy; retry the request", + "description": "Stored, but a connected connection did not confirm the policy; retry the request", "content": { "application/json": { "schema": { @@ -68612,25 +68671,22 @@ } } } - }, - "x-mint": { - "content": "sessions:manage" } } }, - "/messaging/{session}/safe-mode": { + "/messaging/{connection}/safe-mode": { "get": { - "operationId": "getSessionSafeMode", + "operationId": "getConnectionSafeMode", "tags": [ "Safe Mode" ], - "summary": "Get a number's effective Safe Mode", + "summary": "Get a connection's effective Safe Mode", "security": [ { "BearerAuth": [] } ], - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "parameters": [ { "schema": { @@ -68638,17 +68694,17 @@ "minLength": 1 }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], "responses": { "200": { - "description": "Project ceiling, number override, the effective policy, and whether the plan includes BanSafe Lite", + "description": "Project ceiling, connection override, the effective policy, and whether the plan includes BanSafe Lite", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GetSessionSafeModeResponse" + "$ref": "#/components/schemas/GetConnectionSafeModeResponse" } } }, @@ -68825,27 +68881,24 @@ } } }, - "x-mint": { - "content": "Linked Device API sessions:read" - }, "x-protocols": [ "Linked Device API" ], - "description": "**Protocols:** Linked Device API\n\n**Required scope:** `sessions:read`" + "description": "**Protocols:** Linked Device API\n\n**Required scope:** `connections:read`" }, "put": { - "operationId": "updateSessionSafeMode", + "operationId": "updateConnectionSafeMode", "tags": [ "Safe Mode" ], - "summary": "Set a number's Safe Mode override", - "description": "**Protocols:** Linked Device API\n\n**Required scope:** `sessions:manage`\n\nSets one number's Safe Mode. Each axis accepts `inherit` to follow the project ceiling. An override may only be equally or more conservative than the ceiling; a more visible value is refused with `safe_mode_exceeds_project_ceiling`.", + "summary": "Set a connection's Safe Mode override", + "description": "**Protocols:** Linked Device API\n\n**Required scope:** `connections:manage`\n\nSets one connection's Safe Mode. Each axis accepts `inherit` to follow the project ceiling. An override may only be equally or more conservative than the ceiling; a more visible value is refused with `safe_mode_exceeds_project_ceiling`.", "security": [ { "BearerAuth": [] } ], - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "parameters": [ { "schema": { @@ -68853,7 +68906,7 @@ "minLength": 1 }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -68907,11 +68960,11 @@ }, "responses": { "200": { - "description": "Number Safe Mode override updated", + "description": "Connection Safe Mode override updated", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/UpdateSessionSafeModeResponse" + "$ref": "#/components/schemas/UpdateConnectionSafeModeResponse" } } }, @@ -68992,7 +69045,7 @@ } }, "402": { - "description": "`safe_mode_not_entitled`: Safe Mode is part of BanSafe Lite, which is not included on this number's plan", + "description": "`safe_mode_not_entitled`: Safe Mode is part of BanSafe Lite, which is not included on this connection's plan", "content": { "application/json": { "schema": { @@ -69002,7 +69055,7 @@ "error": { "type": "billing_error", "code": "safe_mode_not_entitled", - "message": "Safe Mode is not included on this number’s plan.", + "message": "Safe Mode is not included on this connection’s plan.", "param": null, "request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30" }, @@ -69120,7 +69173,7 @@ } }, "503": { - "description": "Stored, but a connected number did not confirm the policy; retry the request", + "description": "Stored, but a connected connection did not confirm the policy; retry the request", "content": { "application/json": { "schema": { @@ -69152,9 +69205,6 @@ } } }, - "x-mint": { - "content": "Linked Device API sessions:manage" - }, "x-protocols": [ "Linked Device API" ] @@ -69172,7 +69222,7 @@ "BearerAuth": [] } ], - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "parameters": [ { "schema": { @@ -69367,10 +69417,7 @@ } } }, - "x-mint": { - "content": "sessions:read" - }, - "description": "**Required scope:** `sessions:read`" + "description": "**Required scope:** `connections:read`" }, "put": { "operationId": "updateProjectWarmupPlan", @@ -69378,13 +69425,13 @@ "Warm-up plan" ], "summary": "Set a project's warm-up plan", - "description": "**Required scope:** `sessions:manage`\n\nTurns the warm-up plan on or off for a project and sets how long the ramp takes and how many messages a number may send on its first day. While the plan is on, a send past a number's allowance is refused with `bansafe_daily_allowance_reached` and campaign recipients are deferred to the next reset.", + "description": "**Required scope:** `connections:manage`\n\nTurns the warm-up plan on or off for a project and sets how long the ramp takes and how many messages a connection may send on its first day. While the plan is on, a send past a connection's allowance is refused with `bansafe_daily_allowance_reached` and campaign recipients are deferred to the next reset.", "security": [ { "BearerAuth": [] } ], - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "parameters": [ { "schema": { @@ -69636,7 +69683,7 @@ } }, "503": { - "description": "Stored, but a connected number did not confirm the plan; retry the request", + "description": "Stored, but a connected connection did not confirm the plan; retry the request", "content": { "application/json": { "schema": { @@ -69667,9 +69714,6 @@ } } } - }, - "x-mint": { - "content": "sessions:manage" } } }, @@ -69685,7 +69729,7 @@ "BearerAuth": [] } ], - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "parameters": [ { "schema": { @@ -69880,10 +69924,7 @@ } } }, - "x-mint": { - "content": "sessions:read" - }, - "description": "**Required scope:** `sessions:read`" + "description": "**Required scope:** `connections:read`" }, "put": { "operationId": "updateProjectHealthPolicy", @@ -69891,13 +69932,13 @@ "BanSafe" ], "summary": "Set a project's health policy", - "description": "**Required scope:** `sessions:manage`\n\nReplaces the project policy when version matches the stored version. The rule triggers only when an available health estimate is below threshold. Stopping disconnects a session while retaining its linked credentials; logging out requires relinking.", + "description": "**Required scope:** `connections:manage`\n\nReplaces the project policy when version matches the stored version. The rule triggers only when an available health estimate is below threshold. Stopping disconnects a connection while retaining its linked credentials; logging out requires relinking.", "security": [ { "BearerAuth": [] } ], - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "parameters": [ { "schema": { @@ -70133,9 +70174,6 @@ } } } - }, - "x-mint": { - "content": "sessions:manage" } } }, @@ -70146,13 +70184,13 @@ "Ban insurance" ], "summary": "Get Ban Credit evidence setting", - "description": "**Required scope:** `sessions:read`\n\nBan Credit evidence lets Polymorfa measure what the other devices linked to a number do with it: how many messages they send, to how many people, how fast, and in which hours. Only counts are kept, never messages, contacts, or device names. With it off, a claim can still be filed, but Polymorfa cannot say whether another device caused the ban and a person decides the claim.", + "description": "**Required scope:** `connections:read`\n\nBan Credit evidence lets Polymorfa measure what the other devices linked to a connection do with it: how many messages they send, to how many people, how fast, and in which hours. Only counts are kept, never messages, contacts, or device names. With it off, a claim can still be filed, but Polymorfa cannot say whether another device caused the ban and a person decides the claim.", "security": [ { "BearerAuth": [] } ], - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "parameters": [ { "schema": { @@ -70346,9 +70384,6 @@ } } } - }, - "x-mint": { - "content": "sessions:read" } }, "put": { @@ -70357,13 +70392,13 @@ "Ban insurance" ], "summary": "Set Ban Credit evidence setting", - "description": "**Required scope:** `sessions:manage`\n\nBan Credit evidence lets Polymorfa measure what the other devices linked to a number do with it: how many messages they send, to how many people, how fast, and in which hours. Only counts are kept, never messages, contacts, or device names. With it off, a claim can still be filed, but Polymorfa cannot say whether another device caused the ban and a person decides the claim.", + "description": "**Required scope:** `connections:manage`\n\nBan Credit evidence lets Polymorfa measure what the other devices linked to a connection do with it: how many messages they send, to how many people, how fast, and in which hours. Only counts are kept, never messages, contacts, or device names. With it off, a claim can still be filed, but Polymorfa cannot say whether another device caused the ban and a person decides the claim.", "security": [ { "BearerAuth": [] } ], - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "parameters": [ { "schema": { @@ -70576,7 +70611,7 @@ } }, "503": { - "description": "Stored, but a connected number did not confirm the change; retry the request", + "description": "Stored, but a connected connection did not confirm the change; retry the request", "content": { "application/json": { "schema": { @@ -70607,9 +70642,6 @@ } } } - }, - "x-mint": { - "content": "sessions:manage" } } }, @@ -70821,15 +70853,12 @@ } } }, - "x-mint": { - "content": "presence:read" - }, "description": "**Required scope:** `presence:read`" } }, - "/messaging/{session}/observation-policy": { + "/messaging/{connection}/observation-policy": { "get": { - "operationId": "getSessionObservationPolicy", + "operationId": "getConnectionObservationPolicy", "tags": [ "Presence", "Labels", @@ -70848,17 +70877,17 @@ "minLength": 1 }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], "responses": { "200": { - "description": "Effective session observation policy", + "description": "Effective connection observation policy", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GetSessionObservationPolicyResponse" + "$ref": "#/components/schemas/GetConnectionObservationPolicyResponse" } } }, @@ -71035,22 +71064,19 @@ } } }, - "x-mint": { - "content": "Linked Device API presence:read" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `presence:read`" } }, - "/messaging/{session}/profile": { + "/messaging/{connection}/profile": { "get": { "operationId": "getProfile", "tags": [ "Profile" ], - "summary": "Get the session's own profile", + "summary": "Get the connection's own profile", "security": [ { "BearerAuth": [] @@ -71063,7 +71089,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -71250,16 +71276,13 @@ } } }, - "x-mint": { - "content": "Linked Device API profile:read" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `profile:read`" } }, - "/messaging/{session}/profile/name": { + "/messaging/{connection}/profile/name": { "put": { "operationId": "setProfileName", "tags": [ @@ -71278,7 +71301,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -71474,16 +71497,13 @@ } } }, - "x-mint": { - "content": "Linked Device API profile:write" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `profile:write`" } }, - "/messaging/{session}/profile/status": { + "/messaging/{connection}/profile/status": { "put": { "operationId": "setProfileStatus", "tags": [ @@ -71502,7 +71522,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -71698,16 +71718,13 @@ } } }, - "x-mint": { - "content": "Linked Device API profile:write" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `profile:write`" } }, - "/messaging/{session}/profile/picture": { + "/messaging/{connection}/profile/picture": { "put": { "operationId": "setProfilePicture", "tags": [ @@ -71726,7 +71743,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -71922,9 +71939,6 @@ } } }, - "x-mint": { - "content": "Linked Device API profile:write" - }, "x-protocols": [ "Linked Device API" ], @@ -71948,7 +71962,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -72135,16 +72149,13 @@ } } }, - "x-mint": { - "content": "Linked Device API profile:write" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `profile:write`" } }, - "/messaging/{session}/privacy": { + "/messaging/{connection}/privacy": { "get": { "operationId": "getPrivacySettings", "tags": [ @@ -72163,7 +72174,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -72350,16 +72361,13 @@ } } }, - "x-mint": { - "content": "Linked Device API profile:read" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `profile:read`" } }, - "/messaging/{session}/privacy/disappearing/default": { + "/messaging/{connection}/privacy/disappearing/default": { "put": { "operationId": "setDefaultDisappearingTimer", "tags": [ @@ -72378,7 +72386,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -72574,16 +72582,13 @@ } } }, - "x-mint": { - "content": "Linked Device API profile:write" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `profile:write`" } }, - "/messaging/{session}/privacy/{setting}": { + "/messaging/{connection}/privacy/{setting}": { "put": { "operationId": "setPrivacySetting", "tags": [ @@ -72602,7 +72607,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -72818,22 +72823,19 @@ } } }, - "x-mint": { - "content": "Linked Device API profile:write" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `profile:write`" } }, - "/messaging/{session}/labels": { + "/messaging/{connection}/labels": { "get": { "operationId": "listLabels", "tags": [ "Labels" ], - "summary": "List labels defined for the session", + "summary": "List labels defined for the connection", "security": [ { "BearerAuth": [] @@ -72846,7 +72848,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -73045,9 +73047,6 @@ } } }, - "x-mint": { - "content": "Linked Device API labels:read" - }, "x-protocols": [ "Linked Device API" ], @@ -73071,7 +73070,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -73267,16 +73266,13 @@ } } }, - "x-mint": { - "content": "Linked Device API labels:manage" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `labels:manage`" } }, - "/messaging/{session}/labels/{labelId}": { + "/messaging/{connection}/labels/{labelId}": { "put": { "operationId": "updateLabel", "tags": [ @@ -73295,7 +73291,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -73467,7 +73463,7 @@ } }, "409": { - "description": "The session has no authoritative view of its labels yet. Retry once a cached or project-retained snapshot is complete.", + "description": "The connection has no authoritative view of its labels yet. Retry once a cached or project-retained snapshot is complete.", "content": { "application/json": { "schema": { @@ -73531,9 +73527,6 @@ } } }, - "x-mint": { - "content": "Linked Device API labels:manage" - }, "x-protocols": [ "Linked Device API" ], @@ -73557,7 +73550,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -73752,16 +73745,13 @@ } } }, - "x-mint": { - "content": "Linked Device API labels:manage" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `labels:manage`" } }, - "/messaging/{session}/labels/chats/{conversation}": { + "/messaging/{connection}/labels/chats/{conversation}": { "get": { "operationId": "getChatLabels", "tags": [ @@ -73780,7 +73770,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -73987,9 +73977,6 @@ } } }, - "x-mint": { - "content": "Linked Device API labels:read" - }, "x-protocols": [ "Linked Device API" ], @@ -74013,7 +74000,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -74185,7 +74172,7 @@ } }, "409": { - "description": "The session has no authoritative view of its labels yet. Retry once a cached or project-retained snapshot is complete.", + "description": "The connection has no authoritative view of its labels yet. Retry once a cached or project-retained snapshot is complete.", "content": { "application/json": { "schema": { @@ -74249,9 +74236,6 @@ } } }, - "x-mint": { - "content": "Linked Device API labels:manage" - }, "x-protocols": [ "Linked Device API" ], @@ -74454,9 +74438,6 @@ } } }, - "x-mint": { - "content": "webhooks:manage" - }, "description": "**Required scope:** `webhooks:manage`" }, "post": { @@ -74663,9 +74644,6 @@ } } }, - "x-mint": { - "content": "webhooks:manage" - }, "description": "**Required scope:** `webhooks:manage`" } }, @@ -74875,9 +74853,6 @@ } } }, - "x-mint": { - "content": "webhooks:manage" - }, "description": "**Required scope:** `webhooks:manage`" }, "put": { @@ -75094,9 +75069,6 @@ } } }, - "x-mint": { - "content": "webhooks:manage" - }, "description": "**Required scope:** `webhooks:manage`" }, "delete": { @@ -75304,33 +75276,30 @@ } } }, - "x-mint": { - "content": "webhooks:manage" - }, "description": "**Required scope:** `webhooks:manage`" } }, - "/messaging/{session}/history/chunks/retry": { + "/messaging/{connection}/history/chunks/retry": { "post": { "operationId": "retryHistoryChunk", "tags": [ "History" ], "summary": "Request a history chunk again", - "description": "**Protocols:** Linked Device API\n\n**Required scope:** `sessions:manage`\n\nRequires Polymorfa-Version 2026-10-14 or later, a server credential and accepted history consent. Requests the account's primary device to resend a chunk; it does not download or retain history. Linked Devices numbers only. The device decides whether the chunk is available.", + "description": "**Protocols:** Linked Device API\n\n**Required scope:** `connections:manage`\n\nRequires Polymorfa-Version 2026-10-14 or later, a server credential and accepted history consent. Requests the account's primary device to resend a chunk; it does not download or retain history. Linked Devices connections only. The device decides whether the chunk is available.", "security": [ { "BearerAuth": [] } ], - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "parameters": [ { "schema": { "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -75598,35 +75567,32 @@ } } }, - "x-mint": { - "content": "Linked Device API sessions:manage" - }, "x-protocols": [ "Linked Device API" ] } }, - "/messaging/{session}/history/media/delete": { + "/messaging/{connection}/history/media/delete": { "post": { "operationId": "deleteHistoryMedia", "tags": [ "History" ], "summary": "Delete a downloaded history chunk from WhatsApp", - "description": "**Protocols:** Linked Device API\n\n**Required scope:** `sessions:manage`\n\nRequires Polymorfa-Version 2026-10-14 or later and a server credential. After you have downloaded and verified a chunk, ask the Linked Devices connection to delete that history blob. This operation never addresses ordinary message attachments or deletes your local copy.", + "description": "**Protocols:** Linked Device API\n\n**Required scope:** `connections:manage`\n\nRequires Polymorfa-Version 2026-10-14 or later and a server credential. After you have downloaded and verified a chunk, ask the Linked Devices connection to delete that history blob. This operation never addresses ordinary message attachments or deletes your local copy.", "security": [ { "BearerAuth": [] } ], - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "parameters": [ { "schema": { "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -75894,22 +75860,19 @@ } } }, - "x-mint": { - "content": "Linked Device API sessions:manage" - }, "x-protocols": [ "Linked Device API" ] } }, - "/messaging/{session}/media/uploads": { + "/messaging/{connection}/media/uploads": { "post": { "operationId": "uploadEncryptedMedia", "tags": [ "Media" ], - "summary": "Upload encrypted media through the session", - "description": "**Protocols:** Linked Device API\n\n**Required scope:** `messages:write`\n\nUpload media you encrypted with WhatsApp media encryption. Send the ciphertext followed by its 10-byte MAC as the request body. Polymorfa uploads it to WhatsApp from the session's own network and never receives the media key. Use the returned `url` and `directPath`, with your media key and hashes, as `descriptor` when you send the message. The body must state Content-Length and be at most 52428800 bytes; for larger files, create an upload grant. Linked Devices numbers only.", + "summary": "Upload encrypted media through the connection", + "description": "**Protocols:** Linked Device API\n\n**Required scope:** `messages:write`\n\nUpload media you encrypted with WhatsApp media encryption. Send the ciphertext followed by its 10-byte MAC as the request body. Polymorfa uploads it to WhatsApp from the connection's own network and never receives the media key. Use the returned `url` and `directPath`, with your media key and hashes, as `descriptor` when you send the message. The body must state Content-Length and be at most 52428800 bytes; for larger files, create an upload grant. Linked Devices connections only.", "security": [ { "BearerAuth": [] @@ -75922,7 +75885,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -76087,7 +76050,7 @@ } }, "404": { - "description": "Session not found", + "description": "Connection not found", "content": { "application/json": { "schema": { @@ -76108,7 +76071,7 @@ } }, "409": { - "description": "`unsupported_for_connection`: the Number has no Linked Devices connection", + "description": "`unsupported_for_connection`: the Connection has no Linked Devices connection", "content": { "application/json": { "schema": { @@ -76118,7 +76081,7 @@ "error": { "type": "conflict_error", "code": "unsupported_for_connection", - "message": "The session's connection does not support this call operation.", + "message": "The connection's connection does not support this call operation.", "param": null, "request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30" }, @@ -76193,7 +76156,7 @@ } }, "429": { - "description": "WhatsApp or Polymorfa is limiting uploads for this session. Follow Retry-After when supplied.", + "description": "WhatsApp or Polymorfa is limiting uploads for this connection. Follow Retry-After when supplied.", "content": { "application/json": { "schema": { @@ -76235,7 +76198,7 @@ } }, "503": { - "description": "Session or service unavailable", + "description": "Connection or service unavailable", "content": { "application/json": { "schema": { @@ -76277,22 +76240,19 @@ } } }, - "x-mint": { - "content": "Linked Device API messages:write" - }, "x-protocols": [ "Linked Device API" ] } }, - "/messaging/{session}/media/upload-grants": { + "/messaging/{connection}/media/upload-grants": { "post": { "operationId": "createMediaUploadGrant", "tags": [ "Media" ], "summary": "Create a media upload grant", - "description": "**Protocols:** Linked Device API\n\n**Required scope:** `messages:write`\n\nGet a short-lived WhatsApp upload URL for one encrypted file so you can upload it from your own network. The URL carries the session's WhatsApp upload authorization; treat it as a secret. Uploading from a network other than the session's may be treated differently by WhatsApp; the relay upload avoids that. Server credentials only; client tokens are refused. Linked Devices numbers only.", + "description": "**Protocols:** Linked Device API\n\n**Required scope:** `messages:write`\n\nGet a short-lived WhatsApp upload URL for one encrypted file so you can upload it from your own network. The URL carries the connection's WhatsApp upload authorization; treat it as a secret. Uploading from a network other than the connection's may be treated differently by WhatsApp; the relay upload avoids that. Server credentials only; client tokens are refused. Linked Devices connections only.", "security": [ { "BearerAuth": [] @@ -76305,7 +76265,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -76426,7 +76386,7 @@ } }, "404": { - "description": "Session not found", + "description": "Connection not found", "content": { "application/json": { "schema": { @@ -76447,7 +76407,7 @@ } }, "409": { - "description": "`unsupported_for_connection`: the Number has no Linked Devices connection", + "description": "`unsupported_for_connection`: the Connection has no Linked Devices connection", "content": { "application/json": { "schema": { @@ -76457,7 +76417,7 @@ "error": { "type": "conflict_error", "code": "unsupported_for_connection", - "message": "The session's connection does not support this call operation.", + "message": "The connection's connection does not support this call operation.", "param": null, "request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30" }, @@ -76479,7 +76439,7 @@ } }, "429": { - "description": "WhatsApp or Polymorfa is limiting uploads for this session. Follow Retry-After when supplied.", + "description": "WhatsApp or Polymorfa is limiting uploads for this connection. Follow Retry-After when supplied.", "content": { "application/json": { "schema": { @@ -76521,7 +76481,7 @@ } }, "503": { - "description": "Session or service unavailable", + "description": "Connection or service unavailable", "content": { "application/json": { "schema": { @@ -76563,9 +76523,6 @@ } } }, - "x-mint": { - "content": "Linked Device API messages:write" - }, "x-protocols": [ "Linked Device API" ] @@ -76784,9 +76741,6 @@ } } }, - "x-mint": { - "content": "Linked Device API media:read" - }, "x-protocols": [ "Linked Device API" ], @@ -76999,9 +76953,6 @@ } } }, - "x-mint": { - "content": "Linked Device API media:read" - }, "x-protocols": [ "Linked Device API" ], @@ -77214,23 +77165,20 @@ } } }, - "x-mint": { - "content": "Linked Device API media:manage" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `media:manage`" } }, - "/messaging/{session}/templates": { + "/messaging/{connection}/templates": { "get": { "operationId": "listTemplates", "tags": [ "Templates" ], - "summary": "List templates for a Number", - "description": "**Protocols:** Meta Cloud API\n\n**Required scope:** `messages:write`\n\nFor a real Official API Number, including a Hybrid Number, reads the complete template catalog of its WhatsApp Business Account from Meta, stores it, and returns it. A test-mode Cloud Number uses its simulated catalog. A Number with only a Linked Devices connection receives 400. If a catalog read is incomplete, the request fails with 502 and the stored templates are unchanged.", + "summary": "List templates for a Connection", + "description": "**Protocols:** Meta Cloud API\n\n**Required scope:** `messages:write`\n\nFor a real Official API Connection, including a Hybrid Connection, reads the complete template catalog of its WhatsApp Business Account from Meta, stores it, and returns it. A test-mode Cloud Connection uses its simulated catalog. A Connection with only a Linked Devices connection receives 400. If a catalog read is incomplete, the request fails with 502 and the stored templates are unchanged.", "security": [ { "BearerAuth": [] @@ -77243,7 +77191,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -77462,7 +77410,7 @@ } }, "503": { - "description": "The Number's WhatsApp Business Account is not available", + "description": "The Connection's WhatsApp Business Account is not available", "content": { "application/json": { "schema": { @@ -77494,9 +77442,6 @@ } } }, - "x-mint": { - "content": "Meta Cloud API messages:write" - }, "x-protocols": [ "Meta Cloud API" ] @@ -77506,8 +77451,8 @@ "tags": [ "Templates" ], - "summary": "Create a template for a Number", - "description": "**Protocols:** Meta Cloud API\n\n**Required scope:** `messages:write`\n\nSubmits the template to Meta for a real Official API Number, including a Hybrid Number, or to the simulator for a test-mode Cloud Number, then stores the receipt. If the provider accepts the template but the receipt cannot be stored, the API imports it from one catalog read; if that also fails, it returns 500 with `template was submitted but could not be stored`. Do not resubmit in that case: list templates to load it. Keep the first response. A retry with the same `Idempotency-Key` does not submit the template again while its receipt is retained. Opaque responses are not retained by default; missing replay data returns `503 idempotency_replay_unavailable` without another provider write. Reconcile the catalog after any uncertain outcome. The returned status is the one in the response, or `PENDING` when none is returned. For real Official API Numbers, later approval, rejection and quality changes arrive as `template.status` webhook events and appear in the next list. A Number with only a Linked Devices connection receives 400.", + "summary": "Create a template for a Connection", + "description": "**Protocols:** Meta Cloud API\n\n**Required scope:** `messages:write`\n\nSubmits the template to Meta for a real Official API Connection, including a Hybrid Connection, or to the simulator for a test-mode Cloud Connection, then stores the receipt. If the provider accepts the template but the receipt cannot be stored, the API imports it from one catalog read; if that also fails, it returns 500 with `template was submitted but could not be stored`. Do not resubmit in that case: list templates to load it. Keep the first response. A retry with the same `Idempotency-Key` does not submit the template again while its receipt is retained. Opaque responses are not retained by default; missing replay data returns `503 idempotency_replay_unavailable` without another provider write. Reconcile the catalog after any uncertain outcome. The returned status is the one in the response, or `PENDING` when none is returned. For real Official API Connections, later approval, rejection and quality changes arrive as `template.status` webhook events and appear in the next list. A Connection with only a Linked Devices connection receives 400.", "security": [ { "BearerAuth": [] @@ -77520,7 +77465,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -77849,7 +77794,7 @@ } }, "503": { - "description": "The Number's WhatsApp Business Account is not available. For `idempotency_replay_unavailable` only: the exact response for this Idempotency-Key is unavailable (with Retry-After). Opaque responses are not retained by default. The write did not run again. Keep the first response and reconcile events or the resource; waiting does not guarantee that replay data becomes available. Do not switch keys to resend", + "description": "The Connection's WhatsApp Business Account is not available. For `idempotency_replay_unavailable` only: the exact response for this Idempotency-Key is unavailable (with Retry-After). Opaque responses are not retained by default. The write did not run again. Keep the first response and reconcile events or the resource; waiting does not guarantee that replay data becomes available. Do not switch keys to resend", "content": { "application/json": { "schema": { @@ -77920,22 +77865,19 @@ } } }, - "x-mint": { - "content": "Meta Cloud API messages:write" - }, "x-protocols": [ "Meta Cloud API" ] } }, - "/messaging/{session}/templates/{name}": { + "/messaging/{connection}/templates/{name}": { "get": { "operationId": "getTemplate", "tags": [ "Templates" ], "summary": "Get a template by name", - "description": "**Protocols:** Meta Cloud API\n\n**Required scope:** `messages:write`\n\nRefreshes the Number's provider or simulated template catalog and returns the template with this name and language. `language` defaults to `en_US`. Fails with 502 if the catalog read is incomplete. Real Official API Numbers, including Hybrid Numbers, and test-mode Cloud Numbers are supported. A Number with only a Linked Devices connection receives 400.", + "description": "**Protocols:** Meta Cloud API\n\n**Required scope:** `messages:write`\n\nRefreshes the Connection's provider or simulated template catalog and returns the template with this name and language. `language` defaults to `en_US`. Fails with 502 if the catalog read is incomplete. Real Official API Connections, including Hybrid Connections, and test-mode Cloud Connections are supported. A Connection with only a Linked Devices connection receives 400.", "security": [ { "BearerAuth": [] @@ -77948,7 +77890,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -78183,7 +78125,7 @@ } }, "503": { - "description": "The Number's WhatsApp Business Account is not available", + "description": "The Connection's WhatsApp Business Account is not available", "content": { "application/json": { "schema": { @@ -78215,9 +78157,6 @@ } } }, - "x-mint": { - "content": "Meta Cloud API messages:write" - }, "x-protocols": [ "Meta Cloud API" ] @@ -78228,7 +78167,7 @@ "Templates" ], "summary": "Submit a change to a Meta template", - "description": "**Protocols:** Meta Cloud API\n\n**Required scope:** `messages:write`\n\nChanges the components of one template language in the Number's owned WhatsApp Business Account. A 202 response means Meta accepted the edit request; read the template status to establish whether it is available to send. If the outcome is unknown, read the template again before deciding whether to retry. The Number needs an active Official API connection, including when it also has a Linked Devices connection. A test-mode Cloud Number or a Number with only a Linked Devices connection receives 400.", + "description": "**Protocols:** Meta Cloud API\n\n**Required scope:** `messages:write`\n\nChanges the components of one template language in the Connection's owned WhatsApp Business Account. A 202 response means Meta accepted the edit request; read the template status to establish whether it is available to send. If the outcome is unknown, read the template again before deciding whether to retry. The Connection needs an active Official API connection, including when it also has a Linked Devices connection. A test-mode Cloud Connection or a Connection with only a Linked Devices connection receives 400.", "security": [ { "BearerAuth": [] @@ -78241,7 +78180,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -78613,9 +78552,6 @@ } } }, - "x-mint": { - "content": "Meta Cloud API messages:write" - }, "x-protocols": [ "Meta Cloud API" ] @@ -78626,7 +78562,7 @@ "Templates" ], "summary": "Delete a template", - "description": "**Protocols:** Meta Cloud API\n\n**Required scope:** `messages:write`\n\nDeletes every language of the named template from Meta for a real Official API Number, including a Hybrid Number, or from the simulated catalog for a test-mode Cloud Number, then removes the stored copies. A confirmed provider deletion succeeds even if local cleanup fails; the next complete catalog read reconciles the mirror. If the provider rejects the deletion or its result is unknown, the stored templates are kept. A Number with only a Linked Devices connection receives 400.", + "description": "**Protocols:** Meta Cloud API\n\n**Required scope:** `messages:write`\n\nDeletes every language of the named template from Meta for a real Official API Connection, including a Hybrid Connection, or from the simulated catalog for a test-mode Cloud Connection, then removes the stored copies. A confirmed provider deletion succeeds even if local cleanup fails; the next complete catalog read reconciles the mirror. If the provider rejects the deletion or its result is unknown, the stored templates are kept. A Connection with only a Linked Devices connection receives 400.", "security": [ { "BearerAuth": [] @@ -78639,7 +78575,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -79037,22 +78973,19 @@ } } }, - "x-mint": { - "content": "Meta Cloud API messages:write" - }, "x-protocols": [ "Meta Cloud API" ] } }, - "/messaging/{session}/catalogs": { + "/messaging/{connection}/catalogs": { "get": { "operationId": "listCloudCatalogs", "tags": [ "Catalogs" ], - "summary": "List synced catalogs for an Official API Number", - "description": "**Protocols:** Meta Cloud API\n\n**Required scope:** `business:read`\n\nReturns the catalogs this project has synced for the WhatsApp Business Account of the Number's active Official connection, with each sync's state. It does not call Meta.", + "summary": "List synced catalogs for an Official API Connection", + "description": "**Protocols:** Meta Cloud API\n\n**Required scope:** `business:read`\n\nReturns the catalogs this project has synced for the WhatsApp Business Account of the Connection's active Official connection, with each sync's state. It does not call Meta.", "security": [ { "BearerAuth": [] @@ -79065,7 +78998,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -79252,7 +79185,7 @@ } }, "503": { - "description": "Catalog access or the Number's WhatsApp Business Account is unavailable", + "description": "Catalog access or the Connection's WhatsApp Business Account is unavailable", "content": { "application/json": { "schema": { @@ -79284,15 +79217,12 @@ } } }, - "x-mint": { - "content": "Meta Cloud API business:read" - }, "x-protocols": [ "Meta Cloud API" ] } }, - "/messaging/{session}/catalogs/{catalogId}": { + "/messaging/{connection}/catalogs/{catalogId}": { "get": { "operationId": "getCloudCatalog", "tags": [ @@ -79311,7 +79241,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -79508,7 +79438,7 @@ } }, "503": { - "description": "Catalog access or the Number's WhatsApp Business Account is unavailable", + "description": "Catalog access or the Connection's WhatsApp Business Account is unavailable", "content": { "application/json": { "schema": { @@ -79540,23 +79470,20 @@ } } }, - "x-mint": { - "content": "Meta Cloud API business:read" - }, "x-protocols": [ "Meta Cloud API" ], "description": "**Protocols:** Meta Cloud API\n\n**Required scope:** `business:read`" } }, - "/messaging/{session}/catalogs/{catalogId}/sync": { + "/messaging/{connection}/catalogs/{catalogId}/sync": { "post": { "operationId": "syncCloudCatalog", "tags": [ "Catalogs" ], "summary": "Sync a linked catalog from Meta", - "description": "**Protocols:** Meta Cloud API\n\n**Required scope:** `business:read`\n\nReads every product of a catalog linked to the Number's WhatsApp Business Account, up to 5,000, and replaces the stored copy only when the read is complete. A failed or incomplete read leaves the stored products unchanged. One sync per catalog can start every 2 minutes.", + "description": "**Protocols:** Meta Cloud API\n\n**Required scope:** `business:read`\n\nReads every product of a catalog linked to the Connection's WhatsApp Business Account, up to 5,000, and replaces the stored copy only when the read is complete. A failed or incomplete read leaves the stored products unchanged. One sync per catalog can start every 2 minutes.", "security": [ { "BearerAuth": [] @@ -79569,7 +79496,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -79702,7 +79629,7 @@ } }, "404": { - "description": "The Number was not found, or Meta does not list the catalog for this WhatsApp Business Account (`catalog_not_linked`). Stored products for it are removed.", + "description": "The Connection was not found, or Meta does not list the catalog for this WhatsApp Business Account (`catalog_not_linked`). Stored products for it are removed.", "content": { "application/json": { "schema": { @@ -79894,7 +79821,7 @@ } }, "503": { - "description": "Catalog access or the Number's WhatsApp Business Account is unavailable", + "description": "Catalog access or the Connection's WhatsApp Business Account is unavailable", "content": { "application/json": { "schema": { @@ -79926,15 +79853,12 @@ } } }, - "x-mint": { - "content": "Meta Cloud API business:read" - }, "x-protocols": [ "Meta Cloud API" ] } }, - "/messaging/{session}/catalogs/{catalogId}/products": { + "/messaging/{connection}/catalogs/{catalogId}/products": { "get": { "operationId": "listCloudCatalogProducts", "tags": [ @@ -79954,7 +79878,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -80204,7 +80128,7 @@ } }, "503": { - "description": "Catalog access or the Number's WhatsApp Business Account is unavailable", + "description": "Catalog access or the Connection's WhatsApp Business Account is unavailable", "content": { "application/json": { "schema": { @@ -80236,9 +80160,6 @@ } } }, - "x-mint": { - "content": "Meta Cloud API business:read" - }, "x-protocols": [ "Meta Cloud API" ] @@ -80450,9 +80371,6 @@ } } }, - "x-mint": { - "content": "templates:read" - }, "description": "**Required scope:** `templates:read`" }, "post": { @@ -80669,9 +80587,6 @@ } } }, - "x-mint": { - "content": "templates:manage" - }, "description": "**Required scope:** `templates:manage`" } }, @@ -80889,9 +80804,6 @@ } } }, - "x-mint": { - "content": "templates:read" - }, "description": "**Required scope:** `templates:read`" }, "patch": { @@ -81116,9 +81028,6 @@ } } }, - "x-mint": { - "content": "templates:manage" - }, "description": "**Required scope:** `templates:manage`" }, "delete": { @@ -81334,9 +81243,6 @@ } } }, - "x-mint": { - "content": "templates:manage" - }, "description": "**Required scope:** `templates:manage`" } }, @@ -81563,9 +81469,6 @@ } } }, - "x-mint": { - "content": "templates:read" - }, "description": "**Required scope:** `templates:read`" } }, @@ -81576,7 +81479,7 @@ "Templates" ], "summary": "Submit a project template for approval", - "description": "**Required scope:** `templates:manage`\n\nAccepts any number, so one integration handles both connection types; check `submission` in the response. A Cloud API number needs Meta approval: the template is rendered into a Meta create-template payload, submitted through that number, recorded as a per-number approval pointer (cloudLinks), and returned with `submission.status` PENDING. Read the Number's template catalog for Meta's review result. Any other number needs no review: nothing is sent to Meta and the template is returned with `submission.status` APPROVED and `submission.autoApproved` true. Incomplete or invalid definitions return 400 for every number; passing local validation does not guarantee Meta approval.", + "description": "**Required scope:** `templates:manage`\n\nAccepts any connection, so one integration handles both connection types; check `submission` in the response. A Cloud API connection needs Meta approval: the template is rendered into a Meta create-template payload, submitted through that connection, recorded as a per-connection approval pointer (cloudLinks), and returned with `submission.status` PENDING. Read the Connection's template catalog for Meta's review result. Any other number needs no review: nothing is sent to Meta and the template is returned with `submission.status` APPROVED and `submission.autoApproved` true. Incomplete or invalid definitions return 400 for every connection; passing local validation does not guarantee Meta approval.", "security": [ { "BearerAuth": [] @@ -81612,7 +81515,7 @@ }, "responses": { "200": { - "description": "Submitted to Meta (Cloud API number) or approved automatically (any other number)", + "description": "Submitted to Meta (Cloud API connection) or approved automatically (any other number)", "content": { "application/json": { "schema": { @@ -81792,9 +81695,6 @@ } } } - }, - "x-mint": { - "content": "templates:manage" } } }, @@ -82004,9 +81904,6 @@ } } }, - "x-mint": { - "content": "campaigns:read" - }, "description": "**Required scope:** `campaigns:read`" }, "post": { @@ -82015,7 +81912,7 @@ "Campaigns" ], "summary": "Create a campaign", - "description": "**Required scope:** `campaigns:manage`\n\nCreates a draft campaign on any plan. `senderConfig.sessionIds` may name numbers that are not yet on a plan that includes Campaigns; launch checks the selection. It is refused with `403 bansafe_team_suspended` while the team is suspended and `400` when `senderConfig.sessionIds` is malformed or a per-number cap is above its safety ceiling.", + "description": "**Required scope:** `campaigns:manage`\n\nCreates a draft campaign on any plan. `senderConfig.connectionIds` may name connections that are not yet on a plan that includes Campaigns; launch checks the selection. It is refused with `403 bansafe_team_suspended` while the team is suspended and `400` when `senderConfig.connectionIds` is malformed or a per-connection cap is above its safety ceiling.", "security": [ { "BearerAuth": [] @@ -82362,9 +82259,6 @@ } } } - }, - "x-mint": { - "content": "campaigns:manage" } } }, @@ -82582,9 +82476,6 @@ } } }, - "x-mint": { - "content": "campaigns:read" - }, "description": "**Required scope:** `campaigns:read`" }, "patch": { @@ -82716,7 +82607,7 @@ } }, "402": { - "description": "`campaigns_not_entitled`: a new sender selection on a launched campaign names a number whose plan does not include Campaigns", + "description": "`campaigns_not_entitled`: a new sender selection on a launched campaign names a connection whose plan does not include Campaigns", "content": { "application/json": { "schema": { @@ -82726,7 +82617,7 @@ "error": { "type": "billing_error", "code": "campaigns_not_entitled", - "message": "This number’s plan does not include Campaigns.", + "message": "This connection’s plan does not include Campaigns.", "param": null, "request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30" }, @@ -82812,7 +82703,7 @@ } }, "409": { - "description": "`state_conflict`: the campaign has launched and the audience or start time can no longer change, it launched while its sending numbers were being changed, its send window cannot change in the current state or while sends are in progress, or its tracked links cannot change after sending started", + "description": "`state_conflict`: the campaign has launched and the audience or start time can no longer change, it launched while its sending connections were being changed, its send window cannot change in the current state or while sends are in progress, or its tracked links cannot change after sending started", "content": { "application/json": { "schema": { @@ -82876,7 +82767,7 @@ } }, "503": { - "description": "`service_unavailable`: number eligibility for a launched campaign's new sender selection could not be checked. Nothing was changed", + "description": "`service_unavailable`: connection eligibility for a launched campaign's new sender selection could not be checked. Nothing was changed", "content": { "application/json": { "schema": { @@ -82907,9 +82798,6 @@ } } } - }, - "x-mint": { - "content": "campaigns:manage" } } }, @@ -83127,9 +83015,6 @@ } } }, - "x-mint": { - "content": "campaigns:read" - }, "description": "**Required scope:** `campaigns:read`" } }, @@ -83347,9 +83232,6 @@ } } } - }, - "x-mint": { - "content": "campaigns:read" } } }, @@ -83610,9 +83492,6 @@ } } } - }, - "x-mint": { - "content": "campaigns:manage" } } }, @@ -83623,7 +83502,7 @@ "Campaigns" ], "summary": "Launch a campaign", - "description": "**Required scope:** `campaigns:manage`\n\nStarts a draft campaign. It begins sending at `scheduledAt`, or right away when no start time is set. Launch checks the saved sender selection against live plans: `402 campaigns_not_entitled` when a selected number is missing or its plan does not include Campaigns, or when an unselected campaign's project has no such number; `400 invalid_parameter` on `senderConfig.sessionIds` when a selected number is not connected or the selection mixes sending types; `400 campaign_throughput_capped` when a requested throughput is above its ceiling. Segment campaigns require a team API key; project tokens answer `403 permission_denied`, and unavailable audience betas answer `403 feature_unavailable`. An audience change during launch answers `409 state_conflict`. Segment evaluation that exceeds its time limit also answers `409 state_conflict`; simplify the rules and retry. A launched campaign whose segment was deleted remains launched and cannot be launched again (`409 state_conflict`). A message that references a `{{link:}}` the campaign does not define, or tracked links on a campaign that would send from Official API numbers, answers `400 invalid_parameter` on `trackedLinks`; tracked links without the campaign link tracking beta answer `403 feature_unavailable`. A drip without a sendable composed message answers `400 invalid_parameter` on `messagesArray`. Saving a draft does not apply this check. The template must be complete and approved on every Cloud API number; every recipient needs a value or fallback for each variable unless `skipMissingVariables` is true. When the team requires approval above a recipient threshold and the launch would send to more recipients, it answers `409 campaign_approval_required`, sends nothing, and records a pending approval request for a team owner or admin. Launching again with the campaign unchanged returns the same request. A launch requested by an AI agent through the hosted MCP server is held the same way, whatever the threshold. The response returns the campaign as it was when the launch was accepted.", + "description": "**Required scope:** `campaigns:manage`\n\nStarts a draft campaign. It begins sending at `scheduledAt`, or right away when no start time is set. Launch checks the saved sender selection against live plans: `402 campaigns_not_entitled` when a selected connection is missing or its plan does not include Campaigns, or when an unselected campaign's project has no such number; `400 invalid_parameter` on `senderConfig.connectionIds` when a selected connection is not connected or the selection mixes sending types; `400 campaign_throughput_capped` when a requested throughput is above its ceiling. Segment campaigns require a team API key; project tokens answer `403 permission_denied`, and unavailable audience betas answer `403 feature_unavailable`. An audience change during launch answers `409 state_conflict`. Segment evaluation that exceeds its time limit also answers `409 state_conflict`; simplify the rules and retry. A launched campaign whose segment was deleted remains launched and cannot be launched again (`409 state_conflict`). A message that references a `{{link:}}` the campaign does not define, or tracked links on a campaign that would send from Official API connections, answers `400 invalid_parameter` on `trackedLinks`; tracked links without the campaign link tracking beta answer `403 feature_unavailable`. A drip without a sendable composed message answers `400 invalid_parameter` on `messagesArray`. Saving a draft does not apply this check. The template must be complete and approved on every Cloud API connection; every recipient needs a value or fallback for each variable unless `skipMissingVariables` is true. When the team requires approval above a recipient threshold and the launch would send to more recipients, it answers `409 campaign_approval_required`, sends nothing, and records a pending approval request for a team owner or admin. Launching again with the campaign unchanged returns the same request. A launch requested by an AI agent through the hosted MCP server is held the same way, whatever the threshold. The response returns the campaign as it was when the launch was accepted.", "security": [ { "BearerAuth": [] @@ -83700,7 +83579,7 @@ } }, "400": { - "description": "`invalid_parameter` naming the field: an unconnected or mixed sender selection (`senderConfig.sessionIds`), an incomplete or authentication template (`templateId`), a composed attachment without a public URL, or a `{{link:}}` the campaign does not define or tracked links on Official API numbers (`trackedLinks`). `campaign_throughput_capped` when a requested throughput is above its ceiling; `template_not_approved` when a Cloud API number has not approved the template.", + "description": "`invalid_parameter` naming the field: an unconnected or mixed sender selection (`senderConfig.connectionIds`), an incomplete or authentication template (`templateId`), a composed attachment without a public URL, or a `{{link:}}` the campaign does not define or tracked links on Official API connections (`trackedLinks`). `campaign_throughput_capped` when a requested throughput is above its ceiling; `template_not_approved` when a Cloud API connection has not approved the template.", "content": { "application/json": { "schema": { @@ -83764,7 +83643,7 @@ } }, "402": { - "description": "`campaigns_not_entitled`: a selected number is missing or its plan does not include Campaigns, or the project has no number on such a plan. Drafts are saved on every plan.", + "description": "`campaigns_not_entitled`: a selected connection is missing or its plan does not include Campaigns, or the project has no connection on such a plan. Drafts are saved on every plan.", "content": { "application/json": { "schema": { @@ -83774,7 +83653,7 @@ "error": { "type": "billing_error", "code": "campaigns_not_entitled", - "message": "This number’s plan does not include Campaigns.", + "message": "This connection’s plan does not include Campaigns.", "param": null, "request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30" }, @@ -83860,7 +83739,7 @@ } }, "409": { - "description": "`campaign_approval_required`: the launch is held for a team owner or admin and nothing was sent; the message names the approval request. `state_conflict`: the campaign is not a draft, is already launched and waiting for its start time, its sending numbers or audience changed during launch, or segment evaluation exceeded its time limit (simplify the rules and retry). A launched campaign whose segment was deleted cannot be launched again. The Idempotency-Key belongs to a request that is still running (`idempotency_in_progress`, with Retry-After) or whose outcome was not recorded (`idempotency_outcome_unknown`)", + "description": "`campaign_approval_required`: the launch is held for a team owner or admin and nothing was sent; the message names the approval request. `state_conflict`: the campaign is not a draft, is already launched and waiting for its start time, its sending connections or audience changed during launch, or segment evaluation exceeded its time limit (simplify the rules and retry). A launched campaign whose segment was deleted cannot be launched again. The Idempotency-Key belongs to a request that is still running (`idempotency_in_progress`, with Retry-After) or whose outcome was not recorded (`idempotency_outcome_unknown`)", "content": { "application/json": { "schema": { @@ -83975,7 +83854,7 @@ } }, "503": { - "description": "`service_unavailable`: the selected numbers' plans could not be checked; retry. For `idempotency_replay_unavailable` only: the exact response for this Idempotency-Key is unavailable (with Retry-After). Opaque responses are not retained by default. The write did not run again. Keep the first response and reconcile events or the resource; waiting does not guarantee that replay data becomes available. Do not switch keys to resend", + "description": "`service_unavailable`: the selected connections' plans could not be checked; retry. For `idempotency_replay_unavailable` only: the exact response for this Idempotency-Key is unavailable (with Retry-After). Opaque responses are not retained by default. The write did not run again. Keep the first response and reconcile events or the resource; waiting does not guarantee that replay data becomes available. Do not switch keys to resend", "content": { "application/json": { "schema": { @@ -84013,9 +83892,6 @@ } } } - }, - "x-mint": { - "content": "campaigns:manage" } } }, @@ -84373,9 +84249,6 @@ } } } - }, - "x-mint": { - "content": "campaigns:manage" } } }, @@ -84733,9 +84606,6 @@ } } } - }, - "x-mint": { - "content": "campaigns:manage" } } }, @@ -85093,9 +84963,6 @@ } } } - }, - "x-mint": { - "content": "campaigns:manage" } } }, @@ -85106,7 +84973,7 @@ "Campaigns" ], "summary": "Send a test of a draft campaign", - "description": "**Required scopes (all):** `campaigns:manage` · `campaigns:read`\n\nRequires campaigns:manage and campaigns:read because the test can use stored recipient samples. Sends one copy of a draft campaign's content to a seed recipient, through the same rendering, sending, and BanSafe checks as a launched campaign. The seed recipient must be a number connected to your team. A test is not a campaign recipient and is not counted in the campaign's statistics or webhooks. A team can send 20 tests an hour, and at most 5 an hour to one seed recipient.", + "description": "**Required scopes (all):** `campaigns:manage` · `campaigns:read`\n\nRequires campaigns:manage and campaigns:read because the test can use stored recipient samples. Sends one copy of a draft campaign's content to a seed recipient, through the same rendering, sending, and BanSafe checks as a launched campaign. The seed recipient must be the phone of a Connection connected to your team. A test is not a campaign recipient and is not counted in the campaign's statistics or webhooks. A team can send 20 tests an hour, and at most 5 an hour to one seed recipient.", "security": [ { "BearerAuth": [] @@ -85252,7 +85119,7 @@ } }, "402": { - "description": "`campaigns_not_entitled`: the sending number's plan does not include Campaigns.", + "description": "`campaigns_not_entitled`: the sending connection's plan does not include Campaigns.", "content": { "application/json": { "schema": { @@ -85262,7 +85129,7 @@ "error": { "type": "billing_error", "code": "campaigns_not_entitled", - "message": "This number’s plan does not include Campaigns.", + "message": "This connection’s plan does not include Campaigns.", "param": null, "request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30" }, @@ -85348,7 +85215,7 @@ } }, "409": { - "description": "`state_conflict`: The campaign is not a draft or has A/B or weighted content alternatives, the sending number is a Hybrid Link number, or the seed recipient opted out. `bansafe_cold_held`: the seed recipient has never written to the sending number and the campaign holds first messages. The Idempotency-Key belongs to a request that is still running (`idempotency_in_progress`, with Retry-After) or whose outcome was not recorded (`idempotency_outcome_unknown`)", + "description": "`state_conflict`: The campaign is not a draft or has A/B or weighted content alternatives, the sending connection is a Hybrid Link connection, or the seed recipient opted out. `bansafe_cold_held`: the seed recipient has never written to the sending connection and the campaign holds first messages. The Idempotency-Key belongs to a request that is still running (`idempotency_in_progress`, with Retry-After) or whose outcome was not recorded (`idempotency_outcome_unknown`)", "content": { "application/json": { "schema": { @@ -85431,7 +85298,7 @@ } }, "429": { - "description": "The team or seed recipient reached its test-send limit (`rate_limit_exceeded`), or BanSafe is pacing the sending number. Follow `Retry-After`.", + "description": "The team or seed recipient reached its test-send limit (`rate_limit_exceeded`), or BanSafe is pacing the sending connection. Follow `Retry-After`.", "headers": { "Retry-After": { "description": "Seconds to wait before retrying.", @@ -85534,7 +85401,7 @@ } }, "503": { - "description": "The test was not sent: the sending number is not connected (`session_not_ready`), test sends or the send path are unavailable (`service_unavailable`, `command_dispatch_failed`), or the sending number's allowance could not be checked (`bansafe_accounting_unavailable`). Retry later. For `idempotency_replay_unavailable` only: the exact response for this Idempotency-Key is unavailable (with Retry-After). Opaque responses are not retained by default. The write did not run again. Keep the first response and reconcile events or the resource; waiting does not guarantee that replay data becomes available. Do not switch keys to resend", + "description": "The test was not sent: the sending connection is not connected (`connection_not_ready`), test sends or the send path are unavailable (`service_unavailable`, `command_dispatch_failed`), or the sending connection's allowance could not be checked (`bansafe_accounting_unavailable`). Retry later. For `idempotency_replay_unavailable` only: the exact response for this Idempotency-Key is unavailable (with Retry-After). Opaque responses are not retained by default. The write did not run again. Keep the first response and reconcile events or the resource; waiting does not guarantee that replay data becomes available. Do not switch keys to resend", "content": { "application/json": { "schema": { @@ -85604,9 +85471,6 @@ } } } - }, - "x-mint": { - "content": "campaigns:manage campaigns:read" } } }, @@ -85974,9 +85838,6 @@ } } } - }, - "x-mint": { - "content": "campaigns:manage" } } }, @@ -86203,9 +86064,6 @@ } } }, - "x-mint": { - "content": "campaigns:manage" - }, "description": "**Required scope:** `campaigns:manage`" } }, @@ -86457,9 +86315,6 @@ } } } - }, - "x-mint": { - "content": "campaigns:manage" } } }, @@ -86678,9 +86533,6 @@ } } }, - "x-mint": { - "content": "campaigns:read" - }, "description": "**Required scope:** `campaigns:read`" } }, @@ -86941,9 +86793,6 @@ } } } - }, - "x-mint": { - "content": "campaigns:manage" } } }, @@ -87003,7 +86852,7 @@ "cold_held", "campaign_cancelled", "invalid_recipient", - "session_not_connected", + "connection_not_connected", "ack_timeout", "blocked_by_safety", "send_failed", @@ -87220,9 +87069,6 @@ } } } - }, - "x-mint": { - "content": "campaigns:read" } }, "post": { @@ -87536,9 +87382,6 @@ } } } - }, - "x-mint": { - "content": "campaigns:manage" } } }, @@ -87598,7 +87441,7 @@ "cold_held", "campaign_cancelled", "invalid_recipient", - "session_not_connected", + "connection_not_connected", "ack_timeout", "blocked_by_safety", "send_failed", @@ -87857,9 +87700,6 @@ } } } - }, - "x-mint": { - "content": "campaigns:read" } } }, @@ -87870,7 +87710,7 @@ "QuickLink" ], "summary": "Create a QuickLink", - "description": "**Required scope:** `quicklink:manage`\n\nCreates a persistent hosted link that connects one WhatsApp number to a new session in the project.", + "description": "**Required scope:** `quicklink:manage`\n\nCreates a persistent hosted link that connects one WhatsApp number to a new connection in the project.", "security": [ { "BearerAuth": [] @@ -88068,9 +87908,6 @@ } } } - }, - "x-mint": { - "content": "quicklink:manage" } } }, @@ -88080,7 +87917,7 @@ "tags": [ "QuickLink" ], - "summary": "Read connection addition availability", + "summary": "Read method addition availability", "security": [ { "BearerAuth": [] @@ -88104,7 +87941,7 @@ "maxLength": 128 }, "required": true, - "name": "session", + "name": "connection", "in": "query" } ], @@ -88291,9 +88128,6 @@ } } }, - "x-mint": { - "content": "quicklink:manage" - }, "description": "**Required scope:** `quicklink:manage`" } }, @@ -88503,9 +88337,6 @@ } } }, - "x-mint": { - "content": "quicklink:manage" - }, "description": "**Required scope:** `quicklink:manage`" }, "delete": { @@ -88514,7 +88345,7 @@ "QuickLink" ], "summary": "Cancel a QuickLink", - "description": "**Required scope:** `quicklink:manage`\n\nCancels pending onboarding. Initial Number cleanup is accepted asynchronously and completes only after runtime teardown. Supplementary and reauthorization links cancel only their pending attempts; the existing Number remains. Accepted provider work must finish before cancellation.", + "description": "**Required scope:** `quicklink:manage`\n\nCancels pending onboarding. Initial Connection cleanup is accepted asynchronously and completes only after runtime teardown. Supplementary and reauthorization links cancel only their pending attempts; the existing Connection remains. Accepted provider work must finish before cancellation.", "security": [ { "BearerAuth": [] @@ -88569,7 +88400,7 @@ } }, "202": { - "description": "QuickLink invalidated; Number cleanup pending", + "description": "QuickLink invalidated; Connection cleanup pending", "content": { "application/json": { "schema": { @@ -88764,26 +88595,23 @@ } } } - }, - "x-mint": { - "content": "quicklink:manage" } } }, - "/messaging/{session}/cloud-credentials": { + "/messaging/{connection}/cloud-credentials": { "get": { "operationId": "getCloudCredentialHealth", "tags": [ - "Sessions" + "Connections" ], "summary": "Read Meta Cloud API credential health", - "description": "**Protocols:** Meta Cloud API\n\n**Required scope:** `sessions:read`\n\nReturns the latest recurring validation of the Number's Meta Cloud API credentials: token validity, required permissions, phone registration and webhook subscription.", + "description": "**Protocols:** Meta Cloud API\n\n**Required scope:** `connections:read`\n\nReturns the latest recurring validation of the Connection's Meta Cloud API credentials: token validity, required permissions, phone registration and webhook subscription.", "security": [ { "BearerAuth": [] } ], - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "parameters": [ { "schema": { @@ -88792,7 +88620,7 @@ "maxLength": 128 }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -88966,22 +88794,19 @@ } } }, - "x-mint": { - "content": "Meta Cloud API sessions:read" - }, "x-protocols": [ "Meta Cloud API" ] } }, - "/messaging/{session}/cloud-credentials/reauthorize": { + "/messaging/{connection}/cloud-credentials/reauthorize": { "post": { "operationId": "reauthorizeCloudCredentials", "tags": [ - "Sessions" + "Connections" ], "summary": "Start guided Meta Cloud API reauthorization", - "description": "**Protocols:** Meta Cloud API\n\n**Required scope:** `quicklink:manage`\n\nRequires a project token with `quicklink:manage`. Creates a QuickLink with purpose `reauthorization` that renews the Number's Meta authorization through Embedded Signup. The link is bound to the same Number and phone number and always uses the Meta Cloud API. The Number must be stopped or disconnected; this request never stops it. Cancelling the link before Meta work starts keeps the Number.", + "description": "**Protocols:** Meta Cloud API\n\n**Required scope:** `quicklink:manage`\n\nRequires a project token with `quicklink:manage`. Creates a QuickLink with purpose `reauthorization` that renews the Connection's Meta authorization through Embedded Signup. The link is bound to the same Connection and phone number and always uses the Meta Cloud API. The Connection must be stopped or disconnected; this request never stops it. Cancelling the link before Meta work starts keeps the Connection.", "security": [ { "BearerAuth": [] @@ -88996,7 +88821,7 @@ "maxLength": 128 }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -89223,9 +89048,6 @@ } } }, - "x-mint": { - "content": "Meta Cloud API quicklink:manage" - }, "x-protocols": [ "Meta Cloud API" ] @@ -89261,7 +89083,7 @@ "type": "string", "maxLength": 32 }, - "noNumber": { + "noConnection": { "type": "boolean", "enum": [ true @@ -89516,14 +89338,14 @@ } } }, - "/quicklink/{token}/connection": { + "/quicklink/{token}/method": { "post": { - "operationId": "selectQuickLinkConnection", + "operationId": "selectQuickLinkMethod", "tags": [ "QuickLink" ], "security": [], - "summary": "Select an allowed connection type", + "summary": "Select an allowed method type", "parameters": [ { "schema": { @@ -89542,7 +89364,7 @@ "schema": { "type": "object", "properties": { - "connection": { + "method": { "type": "string", "enum": [ "cloud", @@ -89551,7 +89373,7 @@ } }, "required": [ - "connection" + "method" ], "additionalProperties": false } @@ -89569,7 +89391,7 @@ "data": { "type": "object", "properties": { - "connection": { + "method": { "type": "string", "enum": [ "cloud", @@ -89578,7 +89400,7 @@ } }, "required": [ - "connection" + "method" ] } }, @@ -90020,7 +89842,7 @@ "android", "ios" ], - "description": "Primary phone platform the Test number emulates. Defaults to `android`. Not accepted when `accountType` is `meta_cloud`.", + "description": "Primary phone platform the Test connection emulates. Defaults to `android`. Not accepted when `accountType` is `meta_cloud`.", "x-enumDescriptions": { "android": "An Android phone.", "ios": "An iPhone." @@ -90173,7 +89995,7 @@ ], "responses": { "200": { - "description": "Current test connection state", + "description": "Current test method state", "content": { "application/json": { "schema": { @@ -90281,7 +90103,7 @@ ], "security": [], "summary": "Read QuickLink state", - "description": "Returns the hosted page state for a QuickLink. Public; the token in the URL is the credential. Starts linked-device pairing after an allowed connection type has been selected.", + "description": "Returns the hosted page state for a QuickLink. Public; the token in the URL is the credential. Starts linked-device pairing after an allowed method type has been selected.", "parameters": [ { "schema": { @@ -90883,7 +90705,7 @@ } }, "202": { - "description": "QuickLink invalidated; Number cleanup pending", + "description": "QuickLink invalidated; Connection cleanup pending", "content": { "application/json": { "schema": { @@ -91193,7 +91015,7 @@ ], "security": [], "summary": "Redeem a pending passkey ceremony for a QuickLink", - "description": "The complete HTTP body is limited to 1048576 UTF-8 bytes before JSON parsing. Credential IDs allow at most 1023 decoded bytes; user handles allow 64. Opaque assertion fields share the body budget without independent small caps. Redeems a pending passkey ceremony challenge for the session bound to this QuickLink.", + "description": "The complete HTTP body is limited to 1048576 UTF-8 bytes before JSON parsing. Credential IDs allow at most 1023 decoded bytes; user handles allow 64. Opaque assertion fields share the body budget without independent small caps. Redeems a pending passkey ceremony challenge for the connection bound to this QuickLink.", "parameters": [ { "schema": { @@ -91351,7 +91173,7 @@ } }, "502": { - "description": "Session runner rejected the assertion", + "description": "Connection runner rejected the assertion", "content": { "application/json": { "schema": { @@ -91570,7 +91392,7 @@ } }, "410": { - "description": "Direct session signup was retired; create a QuickLink first", + "description": "Direct connection signup was retired; create a QuickLink first", "headers": { "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" @@ -91634,9 +91456,6 @@ } } }, - "x-mint": { - "content": "quicklink:manage" - }, "description": "**Required scope:** `quicklink:manage`" } }, @@ -91877,9 +91696,6 @@ } } }, - "x-mint": { - "content": "sandbox:write" - }, "description": "**Required scope:** `sandbox:write`" } }, @@ -91951,13 +91767,10 @@ } } }, - "x-mint": { - "content": "sandbox:read" - }, "description": "**Required scope:** `sandbox:read`" } }, - "/messaging/{session}/test-events": { + "/messaging/{connection}/test-events": { "post": { "operationId": "triggerTestEvent", "tags": [ @@ -91968,7 +91781,7 @@ "BearerAuth": [] } ], - "summary": "Trigger a test event for a Test number", + "summary": "Trigger a test event for a Test connection", "x-required-scope": "sandbox:write", "parameters": [ { @@ -91976,10 +91789,10 @@ "type": "string", "minLength": 1, "maxLength": 128, - "description": "Test Number ID." + "description": "Test Connection ID." }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -92058,7 +91871,7 @@ } }, "403": { - "description": "Test numbers access required, or a client token was used", + "description": "Test connections access required, or a client token was used", "headers": { "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" @@ -92186,16 +91999,13 @@ } } }, - "x-mint": { - "content": "Linked Device API sandbox:write" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `sandbox:write`" } }, - "/messaging/{session}/phone": { + "/messaging/{connection}/phone": { "get": { "operationId": "getTestingPhone", "tags": [ @@ -92206,7 +92016,7 @@ "BearerAuth": [] } ], - "summary": "Get a Test number's phone", + "summary": "Get a Test connection's phone", "x-required-scope": "sandbox:read", "parameters": [ { @@ -92214,10 +92024,10 @@ "type": "string", "minLength": 1, "maxLength": 256, - "description": "The Test number's session ID." + "description": "The Test connection's connection ID." }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -92244,7 +92054,7 @@ } }, "403": { - "description": "Test numbers access required, or a client token was used", + "description": "Test connections access required, or a client token was used", "headers": { "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" @@ -92340,16 +92150,13 @@ } } }, - "x-mint": { - "content": "Linked Device API sandbox:read" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `sandbox:read`" } }, - "/messaging/{session}/phone/messages": { + "/messaging/{connection}/phone/messages": { "post": { "operationId": "sendTestingPhoneMessage", "tags": [ @@ -92360,7 +92167,7 @@ "BearerAuth": [] } ], - "summary": "Send a message from a Test number's phone", + "summary": "Send a message from a Test connection's phone", "x-required-scope": "sandbox:write", "parameters": [ { @@ -92368,10 +92175,10 @@ "type": "string", "minLength": 1, "maxLength": 256, - "description": "The Test number's session ID." + "description": "The Test connection's connection ID." }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -92440,7 +92247,7 @@ } }, "403": { - "description": "Test numbers access required, or a client token was used", + "description": "Test connections access required, or a client token was used", "headers": { "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" @@ -92568,16 +92375,13 @@ } } }, - "x-mint": { - "content": "Linked Device API sandbox:write" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `sandbox:write`" } }, - "/messaging/{session}/phone/devices/{deviceId}/unlink": { + "/messaging/{connection}/phone/devices/{deviceId}/unlink": { "post": { "operationId": "unlinkTestingPhoneDevice", "tags": [ @@ -92588,7 +92392,7 @@ "BearerAuth": [] } ], - "summary": "Unlink a companion from a Test number's phone", + "summary": "Unlink a companion from a Test connection's phone", "x-required-scope": "sandbox:write", "parameters": [ { @@ -92596,10 +92400,10 @@ "type": "string", "minLength": 1, "maxLength": 256, - "description": "The Test number's session ID." + "description": "The Test connection's connection ID." }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -92669,7 +92473,7 @@ } }, "403": { - "description": "Test numbers access required, or a client token was used", + "description": "Test connections access required, or a client token was used", "headers": { "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" @@ -92765,16 +92569,13 @@ } } }, - "x-mint": { - "content": "Linked Device API sandbox:write" - }, "x-protocols": [ "Linked Device API" ], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `sandbox:write`" } }, - "/messaging/{session}/phone/account-mode": { + "/messaging/{connection}/phone/account-mode": { "put": { "operationId": "setTestingAccountMode", "tags": [ @@ -92785,8 +92586,8 @@ "BearerAuth": [] } ], - "summary": "Change a Test number's account type or phone platform", - "description": "**Protocols:** Linked Device API\n\n**Required scope:** `sandbox:write`\n\nChanges how the Test number presents itself. A change unlinks every companion, including the Number's own session, so each must pair again. Repeating the current mode changes nothing.", + "summary": "Change a Test connection's account type or phone platform", + "description": "**Protocols:** Linked Device API\n\n**Required scope:** `sandbox:write`\n\nChanges how the Test connection presents itself. A change unlinks every companion, including the Connection's own connection, so each must pair again. Repeating the current mode changes nothing.", "x-required-scope": "sandbox:write", "parameters": [ { @@ -92794,10 +92595,10 @@ "type": "string", "minLength": 1, "maxLength": 256, - "description": "The Test number's session ID." + "description": "The Test connection's connection ID." }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -92866,7 +92667,7 @@ } }, "403": { - "description": "Test numbers access required, or a client token was used", + "description": "Test connections access required, or a client token was used", "headers": { "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" @@ -92930,7 +92731,7 @@ } }, "409": { - "description": "The Test number is claimed in Inspector, or another mode change is pending. Unclaim it or retry.", + "description": "The Test connection is claimed in Inspector, or another mode change is pending. Unclaim it or retry.", "headers": { "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" @@ -92994,9 +92795,6 @@ } } }, - "x-mint": { - "content": "Linked Device API sandbox:write" - }, "x-protocols": [ "Linked Device API" ] @@ -93220,10 +93018,10 @@ } } }, - "session.status": { + "connection.status": { "post": { - "operationId": "onSessionStatus", - "summary": "Session status change", + "operationId": "onConnectionStatus", + "summary": "Connection status change", "tags": [ "Webhooks" ], @@ -93232,7 +93030,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SessionStatusEvent" + "$ref": "#/components/schemas/ConnectionStatusEvent" } } } @@ -93244,10 +93042,10 @@ } } }, - "session.connected": { + "connection.connected": { "post": { - "operationId": "onSessionConnected", - "summary": "Session connected to WhatsApp", + "operationId": "onConnectionConnected", + "summary": "Connection connected to WhatsApp", "tags": [ "Webhooks" ], @@ -93256,7 +93054,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SessionConnectedEvent" + "$ref": "#/components/schemas/ConnectionConnectedEvent" } } } @@ -93268,10 +93066,10 @@ } } }, - "session.logged_out": { + "connection.logged_out": { "post": { - "operationId": "onSessionLoggedOut", - "summary": "Session logged out", + "operationId": "onConnectionLoggedOut", + "summary": "Connection logged out", "tags": [ "Webhooks" ], @@ -93280,7 +93078,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SessionLoggedOutEvent" + "$ref": "#/components/schemas/ConnectionLoggedOutEvent" } } } @@ -93292,9 +93090,9 @@ } } }, - "session.phone_offline": { + "connection.phone_offline": { "post": { - "operationId": "onSessionPhoneOffline", + "operationId": "onConnectionPhoneOffline", "summary": "Primary phone has been offline for an extended period", "tags": [ "Webhooks" @@ -93304,7 +93102,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SessionPhoneOfflineEvent" + "$ref": "#/components/schemas/ConnectionPhoneOfflineEvent" } } } @@ -93316,10 +93114,10 @@ } } }, - "session.capabilities_updated": { + "connection.capabilities_updated": { "post": { - "operationId": "onSessionCapabilitiesUpdated", - "summary": "The number’s WhatsApp capabilities changed", + "operationId": "onConnectionCapabilitiesUpdated", + "summary": "The connection’s WhatsApp capabilities changed", "tags": [ "Webhooks" ], @@ -93328,7 +93126,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SessionCapabilitiesUpdatedEvent" + "$ref": "#/components/schemas/ConnectionCapabilitiesUpdatedEvent" } } } @@ -93340,10 +93138,10 @@ } } }, - "session.restriction_updated": { + "connection.restriction_updated": { "post": { - "operationId": "onSessionRestrictionUpdated", - "summary": "A WhatsApp restriction on the number started, changed or ended", + "operationId": "onConnectionRestrictionUpdated", + "summary": "A WhatsApp restriction on the connection started, changed or ended", "tags": [ "Webhooks" ], @@ -93352,7 +93150,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SessionRestrictionUpdatedEvent" + "$ref": "#/components/schemas/ConnectionRestrictionUpdatedEvent" } } } @@ -94444,10 +94242,10 @@ } } }, - "customer.number.attached": { + "customer.connection.attached": { "post": { - "operationId": "onCustomerNumberAttached", - "summary": "Number attached to a Customer", + "operationId": "onCustomerConnectionAttached", + "summary": "Connection attached to a Customer", "tags": [ "Webhooks" ], @@ -94456,7 +94254,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CustomerNumberAttachedEvent" + "$ref": "#/components/schemas/CustomerConnectionAttachedEvent" } } } @@ -94468,10 +94266,10 @@ } } }, - "customer.number.transferred": { + "customer.connection.transferred": { "post": { - "operationId": "onCustomerNumberTransferred", - "summary": "Number transferred to a Customer", + "operationId": "onCustomerConnectionTransferred", + "summary": "Connection transferred to a Customer", "tags": [ "Webhooks" ], @@ -94480,7 +94278,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CustomerNumberTransferredEvent" + "$ref": "#/components/schemas/CustomerConnectionTransferredEvent" } } } @@ -94492,10 +94290,10 @@ } } }, - "customer.number.disconnected": { + "customer.connection.disconnected": { "post": { - "operationId": "onCustomerNumberDisconnected", - "summary": "Customer Number disconnected", + "operationId": "onCustomerConnectionDisconnected", + "summary": "Customer Connection disconnected", "tags": [ "Webhooks" ], @@ -94504,7 +94302,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CustomerNumberDisconnectedEvent" + "$ref": "#/components/schemas/CustomerConnectionDisconnectedEvent" } } } @@ -94567,7 +94365,7 @@ "bansafe.action": { "post": { "operationId": "onBansafeAction", - "summary": "Polymorfa applied, changed, or lifted a safety restriction on a number", + "summary": "Polymorfa applied, changed, or lifted a safety restriction on a connection", "tags": [ "Webhooks" ], @@ -94615,7 +94413,7 @@ "bansafe.incident": { "post": { "operationId": "onBansafeIncident", - "summary": "A restriction was recorded on a number, or the record of one settled", + "summary": "A restriction was recorded on a connection, or the record of one settled", "tags": [ "Webhooks" ], @@ -95143,7 +94941,7 @@ "campaign.cap_reached": { "post": { "operationId": "onCampaignCapReached", - "summary": "A sending number reached its hourly or daily cap", + "summary": "A sending connection reached its hourly or daily cap", "tags": [ "Webhooks" ], diff --git a/contracts/openapi.platform.json b/contracts/openapi.platform.json index 24e089803..1e53c00a8 100644 --- a/contracts/openapi.platform.json +++ b/contracts/openapi.platform.json @@ -3,7 +3,7 @@ "info": { "title": "Polymorfa Console & Management API", "version": "1.0.0", - "description": "Complete console/management surface. Resource-oriented REST: `{param}` path variables, single-word action sub-resources.\n\nNamespaces decide inclusion:\n- `/platform/…` — **public registry** (283 endpoints): each endpoint declares either a scoped `pmfa_` team key or a verified live dashboard JWT, or dashboard-only authorization when a specific user's authority is required. Only implemented handlers are published to customers and SDKs.\n- `/console/…` — **console-only** (130 endpoints): verified dashboard identity. EXCLUDED from the published spec; reason per endpoint.\n\nThe published customer spec = this document filtered to `x-audience: public` endpoints with an implemented runtime handler.\nMost transitional body/response schemas remain loose (`additionalProperties: true`); session-control operations use explicit strict schemas." + "description": "Complete console/management surface. Resource-oriented REST: `{param}` path variables, single-word action sub-resources.\n\nNamespaces decide inclusion:\n- `/platform/…` — **public registry** (283 endpoints): each endpoint declares either a scoped `pmfa_` team key or a verified live dashboard JWT, or dashboard-only authorization when a specific user's authority is required. Only implemented handlers are published to customers and SDKs.\n- `/console/…` — **console-only** (130 endpoints): verified dashboard identity. EXCLUDED from the published spec; reason per endpoint.\n\nThe published customer spec = this document filtered to `x-audience: public` endpoints with an implemented runtime handler.\nMost transitional body/response schemas remain loose (`additionalProperties: true`); connection-control operations use explicit strict schemas." }, "servers": [ { @@ -292,7 +292,7 @@ "/api/account/cloud-health": { "get": { "operationId": "getAccountCloudHealth", - "summary": "Read a Number's redacted Meta account health", + "summary": "Read a Connection's redacted Meta account health", "tags": [ "Account" ], @@ -315,7 +315,7 @@ } }, { - "name": "session", + "name": "connection", "in": "query", "required": true, "schema": { @@ -335,7 +335,7 @@ } }, "400": { - "description": "Invalid project or Number" + "description": "Invalid project or Connection" }, "401": { "description": "Missing or invalid dashboard JWT, or identity no longer active", @@ -362,7 +362,7 @@ "/api/account/cloud-health/export": { "get": { "operationId": "exportAccountCloudHealth", - "summary": "Download a Number's redacted Meta account health", + "summary": "Download a Connection's redacted Meta account health", "tags": [ "Account" ], @@ -385,7 +385,7 @@ } }, { - "name": "session", + "name": "connection", "in": "query", "required": true, "schema": { @@ -413,7 +413,7 @@ } }, "400": { - "description": "Invalid project or Number" + "description": "Invalid project or Connection" }, "401": { "description": "Missing or invalid dashboard JWT, or identity no longer active", @@ -441,7 +441,7 @@ "get": { "operationId": "getRegionalDataSettings", "summary": "Read regional data settings for one scope", - "description": "Returns the saved values at one scope (team, project, Customer or Number) and, for a Number, the effective values with the scope each field came from.", + "description": "Returns the saved values at one scope (team, project, Customer or Connection) and, for a Connection, the effective values with the scope each field came from.", "tags": [ "Regional data" ], @@ -481,7 +481,7 @@ "name": "scopeId", "in": "query", "required": false, - "description": "Required for `customer` and `number`; for `project`, omit it or pass the project ID.", + "description": "Required for `customer` and `connection`; for `project`, omit it or pass the project ID.", "schema": { "type": "string", "format": "uuid" @@ -523,7 +523,7 @@ } }, "404": { - "description": "`project_not_found`, `scope_not_found` or `number_not_found`", + "description": "`project_not_found`, `scope_not_found` or `connection_not_found`", "content": { "application/json": { "schema": { @@ -557,7 +557,7 @@ "put": { "operationId": "putRegionalDataSettings", "summary": "Save regional data settings for one scope", - "description": "Revision-guarded write with exact replay. Turning Contacts, Chats or media on requires accepting the purpose. The response reports whether capture already follows the saved settings for every affected Number (`applied`) or is still being brought in line (`pending`). A change that would move a Number's existing regional data to another region is refused.", + "description": "Revision-guarded write with exact replay. Turning Contacts, Chats or media on requires accepting the purpose. The response reports whether capture already follows the saved settings for every affected Connection (`applied`) or is still being brought in line (`pending`). A change that would move a Connection's existing regional data to another region is refused.", "tags": [ "Regional data" ], @@ -597,7 +597,7 @@ "name": "scopeId", "in": "query", "required": false, - "description": "Required for `customer` and `number`; for `project`, omit it or pass the project ID.", + "description": "Required for `customer` and `connection`; for `project`, omit it or pass the project ID.", "schema": { "type": "string", "format": "uuid" @@ -649,7 +649,7 @@ } }, "404": { - "description": "`project_not_found`, `scope_not_found` or `number_not_found`", + "description": "`project_not_found`, `scope_not_found` or `connection_not_found`", "content": { "application/json": { "schema": { @@ -659,7 +659,7 @@ } }, "409": { - "description": "`stale_revision`, `terms_activation_blocked` when `acceptTerms` is supplied while these terms cannot be accepted yet, or `region_change_unsupported` when a Number's regional data already lives in another region", + "description": "`stale_revision`, `terms_activation_blocked` when `acceptTerms` is supplied while these terms cannot be accepted yet, or `region_change_unsupported` when a Connection's regional data already lives in another region", "content": { "application/json": { "schema": { @@ -736,8 +736,8 @@ "/console/projects/{projectId}/regional-data/client-tokens": { "post": { "operationId": "issueConsoleRegionalClientToken", - "summary": "Issue a session-bound regional Console client token", - "description": "Default-off Console beta. Platform issues a 60-second signed v1 binary client token bound to the live human/dashboard session, team, one region, one project, exact Number set (at most 64), origin and action ceiling. The dashboard JWT stays on Platform. The old access exchange remains supported until Phase 3 acceptance.", + "summary": "Issue a connection-bound regional Console client token", + "description": "Default-off Console beta. Platform issues a 60-second signed v1 binary client token bound to the live human/dashboard session, team, one region, one project, exact Connection set (at most 64), origin and action ceiling. The dashboard JWT stays on Platform. The old access exchange remains supported until Phase 3 acceptance.", "tags": [ "Regional data" ], @@ -768,16 +768,16 @@ "type": "object", "additionalProperties": false, "required": [ - "numberIds", + "connectionIds", "permissions" ], "properties": { "region": { "type": "string", "pattern": "^[a-z0-9][a-z0-9-]{0,31}$", - "description": "Omission derives the region from the first Number; all Numbers must share it." + "description": "Omission derives the region from the first Connection; all Connections must share it." }, - "numberIds": { + "connectionIds": { "type": "array", "minItems": 1, "maxItems": 64, @@ -821,7 +821,7 @@ } }, "400": { - "description": "invalid_access_request, including empty, duplicate or oversized Number sets", + "description": "invalid_access_request, including empty, duplicate or oversized Connection sets", "content": { "application/json": { "schema": { @@ -844,7 +844,7 @@ } }, "404": { - "description": "number_not_found", + "description": "connection_not_found", "content": { "application/json": { "schema": { @@ -899,8 +899,8 @@ "/console/projects/{projectId}/regional-data/access": { "post": { "operationId": "issueRegionalDataAccess", - "summary": "Issue short-lived regional access for one Number", - "description": "Returns a token of at most 60 seconds for reading and editing one Number's regional Contacts, reading its Chats, sending text messages, or archiving, pinning and changing the read state of a retained chat, directly from its region. Requires the Console origin, the purpose's feature and an applied regional grant. Reads and edits need an accepted purpose; `messages.send` needs the Chats feature and a team owner or admin, but no storage purpose; `chats.manage` needs the Chats feature, the accepted Chats purpose and a team owner or admin.", + "summary": "Issue short-lived regional access for one Connection", + "description": "Returns a token of at most 60 seconds for reading and editing one Connection's regional Contacts, reading its Chats, sending text messages, or archiving, pinning and changing the read state of a retained chat, directly from its region. Requires the Console origin, the purpose's feature and an applied regional grant. Reads and edits need an accepted purpose; `messages.send` needs the Chats feature and a team owner or admin, but no storage purpose; `chats.manage` needs the Chats feature, the accepted Chats purpose and a team owner or admin.", "tags": [ "Regional data" ], @@ -939,11 +939,11 @@ "type": "object", "additionalProperties": false, "required": [ - "numberId", + "connectionId", "permissions" ], "properties": { - "numberId": { + "connectionId": { "type": "string", "format": "uuid" }, @@ -1004,7 +1004,7 @@ } }, "404": { - "description": "`project_not_found` or `number_not_found`", + "description": "`project_not_found` or `connection_not_found`", "content": { "application/json": { "schema": { @@ -1112,16 +1112,16 @@ } } }, - "/console/projects/{projectId}/numbers/{session}/catalogs": { + "/console/projects/{projectId}/connections/{connection}/catalogs": { "get": { "operationId": "listConsoleCloudCatalogs", - "summary": "Read cached catalog metadata for a Console Number", + "summary": "Read cached catalog metadata for a Console Connection", "tags": [ "Catalogs" ], "x-audience": "console", "x-dashboard-only": true, - "x-excluded-reason": "Private dashboard catalog adapter. Live team membership, exact project/Number and existing catalog beta required; sync requires live owner/admin membership. Not a machine-credential operation.", + "x-excluded-reason": "Private dashboard catalog adapter. Live team membership, exact project/Connection and existing catalog beta required; sync requires live owner/admin membership. Not a machine-credential operation.", "security": [ { "ConsoleSession": [] @@ -1223,7 +1223,7 @@ } }, "400": { - "description": "Invalid selector/cursor or unsupported Number" + "description": "Invalid selector/cursor or unsupported Connection" }, "401": { "description": "Live dashboard JWT required" @@ -1232,7 +1232,7 @@ "description": "feature_unavailable, or permission_denied for a sync by a non-manager" }, "404": { - "description": "Number/project missing, catalog_not_synced, or catalog_not_linked after confirmed unlink" + "description": "Connection/project missing, catalog_not_synced, or catalog_not_linked after confirmed unlink" }, "409": { "description": "team_context_changed, catalog_snapshot_changed (restart without cursor), or catalog_sync_superseded" @@ -1281,7 +1281,7 @@ } }, { - "name": "session", + "name": "connection", "in": "path", "required": true, "schema": { @@ -1289,22 +1289,22 @@ "minLength": 1, "maxLength": 128 }, - "description": "Stable Number name in this project." + "description": "Stable Connection name in this project." } ], "description": "Uses the same catalog response and errors as the native Messaging API. Reads never call Meta. The catalog beta must be available; 403 feature_unavailable means hide this surface. Send the expected team header on every request. No request body for sync." } }, - "/console/projects/{projectId}/numbers/{session}/catalogs/{catalogId}": { + "/console/projects/{projectId}/connections/{connection}/catalogs/{catalogId}": { "get": { "operationId": "getConsoleCloudCatalog", - "summary": "Read cached catalog metadata for a Console Number", + "summary": "Read cached catalog metadata for a Console Connection", "tags": [ "Catalogs" ], "x-audience": "console", "x-dashboard-only": true, - "x-excluded-reason": "Private dashboard catalog adapter. Live team membership, exact project/Number and existing catalog beta required; sync requires live owner/admin membership. Not a machine-credential operation.", + "x-excluded-reason": "Private dashboard catalog adapter. Live team membership, exact project/Connection and existing catalog beta required; sync requires live owner/admin membership. Not a machine-credential operation.", "security": [ { "ConsoleSession": [] @@ -1394,7 +1394,7 @@ } }, "400": { - "description": "Invalid selector/cursor or unsupported Number" + "description": "Invalid selector/cursor or unsupported Connection" }, "401": { "description": "Live dashboard JWT required" @@ -1403,7 +1403,7 @@ "description": "feature_unavailable, or permission_denied for a sync by a non-manager" }, "404": { - "description": "Number/project missing, catalog_not_synced, or catalog_not_linked after confirmed unlink" + "description": "Connection/project missing, catalog_not_synced, or catalog_not_linked after confirmed unlink" }, "409": { "description": "team_context_changed, catalog_snapshot_changed (restart without cursor), or catalog_sync_superseded" @@ -1452,7 +1452,7 @@ } }, { - "name": "session", + "name": "connection", "in": "path", "required": true, "schema": { @@ -1460,7 +1460,7 @@ "minLength": 1, "maxLength": 128 }, - "description": "Stable Number name in this project." + "description": "Stable Connection name in this project." }, { "name": "catalogId", @@ -1475,16 +1475,16 @@ "description": "Uses the same catalog response and errors as the native Messaging API. Reads never call Meta. The catalog beta must be available; 403 feature_unavailable means hide this surface. Send the expected team header on every request. No request body for sync." } }, - "/console/projects/{projectId}/numbers/{session}/catalogs/{catalogId}/sync": { + "/console/projects/{projectId}/connections/{connection}/catalogs/{catalogId}/sync": { "post": { "operationId": "syncConsoleCloudCatalog", - "summary": "Sync a linked catalog for a Console Number", + "summary": "Sync a linked catalog for a Console Connection", "tags": [ "Catalogs" ], "x-audience": "console", "x-dashboard-only": true, - "x-excluded-reason": "Private dashboard catalog adapter. Live team membership, exact project/Number and existing catalog beta required; sync requires live owner/admin membership. Not a machine-credential operation.", + "x-excluded-reason": "Private dashboard catalog adapter. Live team membership, exact project/Connection and existing catalog beta required; sync requires live owner/admin membership. Not a machine-credential operation.", "security": [ { "ConsoleSession": [] @@ -1574,7 +1574,7 @@ } }, "400": { - "description": "Invalid selector/cursor or unsupported Number" + "description": "Invalid selector/cursor or unsupported Connection" }, "401": { "description": "Live dashboard JWT required" @@ -1583,7 +1583,7 @@ "description": "feature_unavailable, or permission_denied for a sync by a non-manager" }, "404": { - "description": "Number/project missing, catalog_not_synced, or catalog_not_linked after confirmed unlink" + "description": "Connection/project missing, catalog_not_synced, or catalog_not_linked after confirmed unlink" }, "409": { "description": "team_context_changed, catalog_snapshot_changed (restart without cursor), or catalog_sync_superseded" @@ -1632,7 +1632,7 @@ } }, { - "name": "session", + "name": "connection", "in": "path", "required": true, "schema": { @@ -1640,7 +1640,7 @@ "minLength": 1, "maxLength": 128 }, - "description": "Stable Number name in this project." + "description": "Stable Connection name in this project." }, { "name": "catalogId", @@ -1655,16 +1655,16 @@ "description": "Uses the same catalog response and errors as the native Messaging API. Reads never call Meta. The catalog beta must be available; 403 feature_unavailable means hide this surface. Send the expected team header on every request. No request body for sync." } }, - "/console/projects/{projectId}/numbers/{session}/catalogs/{catalogId}/products": { + "/console/projects/{projectId}/connections/{connection}/catalogs/{catalogId}/products": { "get": { "operationId": "listConsoleCloudCatalogProducts", - "summary": "Read cached catalog metadata for a Console Number", + "summary": "Read cached catalog metadata for a Console Connection", "tags": [ "Catalogs" ], "x-audience": "console", "x-dashboard-only": true, - "x-excluded-reason": "Private dashboard catalog adapter. Live team membership, exact project/Number and existing catalog beta required; sync requires live owner/admin membership. Not a machine-credential operation.", + "x-excluded-reason": "Private dashboard catalog adapter. Live team membership, exact project/Connection and existing catalog beta required; sync requires live owner/admin membership. Not a machine-credential operation.", "security": [ { "ConsoleSession": [] @@ -1811,7 +1811,7 @@ } }, "400": { - "description": "Invalid selector/cursor or unsupported Number" + "description": "Invalid selector/cursor or unsupported Connection" }, "401": { "description": "Live dashboard JWT required" @@ -1820,7 +1820,7 @@ "description": "feature_unavailable, or permission_denied for a sync by a non-manager" }, "404": { - "description": "Number/project missing, catalog_not_synced, or catalog_not_linked after confirmed unlink" + "description": "Connection/project missing, catalog_not_synced, or catalog_not_linked after confirmed unlink" }, "409": { "description": "team_context_changed, catalog_snapshot_changed (restart without cursor), or catalog_sync_superseded" @@ -1869,7 +1869,7 @@ } }, { - "name": "session", + "name": "connection", "in": "path", "required": true, "schema": { @@ -1877,7 +1877,7 @@ "minLength": 1, "maxLength": 128 }, - "description": "Stable Number name in this project." + "description": "Stable Connection name in this project." }, { "name": "catalogId", @@ -2548,8 +2548,8 @@ "ConsoleSession": [] } ], - "description": "**Required scope:** `sessions:read`\n\nReturns published feature terms and this scope's acceptance. Pending terms have no text or acceptance requirement. Terms that cannot be activated yet stay pending even after publication. Accepting terms grants no feature access. Requires a team API key or a signed-in team member. Number scope IDs are Number resource UUIDs.", - "x-required-scope": "sessions:read", + "description": "**Required scope:** `connections:read`\n\nReturns published feature terms and this scope's acceptance. Pending terms have no text or acceptance requirement. Terms that cannot be activated yet stay pending even after publication. Accepting terms grants no feature access. Requires a team API key or a signed-in team member. Connection scope IDs are Connection resource UUIDs.", + "x-required-scope": "connections:read", "parameters": [ { "schema": { @@ -2558,7 +2558,7 @@ "team", "project", "customer", - "number" + "connection" ], "default": "team" }, @@ -2570,10 +2570,10 @@ "schema": { "type": "string", "format": "uuid", - "description": "Required for project, customer and number scopes. Defaults to the authenticated team for team scope." + "description": "Required for project, customer and connection scopes. Defaults to the authenticated team for team scope." }, "required": false, - "description": "Required for project, customer and number scopes. Defaults to the authenticated team for team scope.", + "description": "Required for project, customer and connection scopes. Defaults to the authenticated team for team scope.", "name": "scopeId", "in": "query" }, @@ -2782,9 +2782,6 @@ } } }, - "x-mint": { - "content": "sessions:read" - }, "x-audience": "console", "x-dashboard-only": true, "x-excluded-reason": "Live dashboard membership; acceptance and withdrawal require a team owner or admin." @@ -2802,8 +2799,8 @@ "ConsoleSession": [] } ], - "description": "**Required scope:** `sessions:manage`\n\nRecords the exact published version, locale and text digest for this scope. Requires a team API key with sessions:manage, or a signed-in team owner or admin. Preview enrollment terms require a signed-in team owner or admin. Staff cannot accept for a customer. A repeated acceptance returns the existing record. This does not turn the feature on.", - "x-required-scope": "sessions:manage", + "description": "**Required scope:** `connections:manage`\n\nRecords the exact published version, locale and text digest for this scope. Requires a team API key with connections:manage, or a signed-in team owner or admin. Preview enrollment terms require a signed-in team owner or admin. Staff cannot accept for a customer. A repeated acceptance returns the existing record. This does not turn the feature on.", + "x-required-scope": "connections:manage", "parameters": [ { "schema": { @@ -2831,7 +2828,7 @@ "team", "project", "customer", - "number" + "connection" ] }, "id": { @@ -3064,9 +3061,6 @@ } } }, - "x-mint": { - "content": "sessions:manage" - }, "x-audience": "console", "x-dashboard-only": true, "x-excluded-reason": "Live dashboard membership; acceptance and withdrawal require a team owner or admin." @@ -3084,8 +3078,8 @@ "ConsoleSession": [] } ], - "description": "**Required scope:** `sessions:manage`\n\nAppends a withdrawal without changing the acceptance record. Requires a team API key with sessions:manage, or a signed-in team owner or admin. Preview enrollment terms require a signed-in team owner or admin. No current terms are required. Repeated withdrawals return the existing record; no previous acceptance returns null. Preview Contacts/Chats withdrawals reconcile capture before success; 503 service_unavailable means the withdrawal is recorded but capture is pending. Retrying the same withdrawal is safe. Other features must also be turned off through their settings to stop their work.", - "x-required-scope": "sessions:manage", + "description": "**Required scope:** `connections:manage`\n\nAppends a withdrawal without changing the acceptance record. Requires a team API key with connections:manage, or a signed-in team owner or admin. Preview enrollment terms require a signed-in team owner or admin. No current terms are required. Repeated withdrawals return the existing record; no previous acceptance returns null. Preview Contacts/Chats withdrawals reconcile capture before success; 503 service_unavailable means the withdrawal is recorded but capture is pending. Retrying the same withdrawal is safe. Other features must also be turned off through their settings to stop their work.", + "x-required-scope": "connections:manage", "parameters": [ { "schema": { @@ -3113,7 +3107,7 @@ "team", "project", "customer", - "number" + "connection" ] }, "id": { @@ -3327,9 +3321,6 @@ } } }, - "x-mint": { - "content": "sessions:manage" - }, "x-audience": "console", "x-dashboard-only": true, "x-excluded-reason": "Live dashboard membership; acceptance and withdrawal require a team owner or admin." @@ -3363,7 +3354,7 @@ "schema": { "type": "string", "description": "Comma-separated event types to include, or repeat the parameter. A trailing `*` matches a prefix, such as `message.*`. Omit for every type. At most 32 filters.", - "example": "message.*,session.connected" + "example": "message.*,connection.connected" }, "required": false, "name": "types", @@ -3612,9 +3603,6 @@ } } }, - "x-mint": { - "content": "events:listen" - }, "x-audience": "public" } }, @@ -3865,9 +3853,6 @@ } } }, - "x-mint": { - "content": "events:listen" - }, "x-audience": "public" } }, @@ -3878,14 +3863,14 @@ "Client Tokens" ], "summary": "Mint a short-lived browser-safe client token", - "description": "**Required scopes (all):** `sessions:manage` · `messages:write` · `contacts:read` · `presence:read` · `presence:observe` · `mcp`\n\nMinting requires an active, unrevoked issuer with the required scopes and current resource ownership. A human-owned issuer must belong to a current team owner or admin who is not banned. Service-account credentials can delegate only actions allowed by the issuing credential's live scopes. Test-key clients remain restricted to test numbers. Issuance eligibility denials return 403; unavailable issuance checks return 503 and no token.", + "description": "**Required scopes (all):** `connections:manage` · `messages:write` · `contacts:read` · `presence:read` · `presence:observe` · `mcp`\n\nMinting requires an active, unrevoked issuer with the required scopes and current resource ownership. A human-owned issuer must belong to a current team owner or admin who is not banned. Service-account credentials can delegate only actions allowed by the issuing credential's live scopes. Test-key clients remain restricted to test connections. Issuance eligibility denials return 403; unavailable issuance checks return 503 and no token.", "security": [ { "ApiKeyAuth": [] } ], "x-required-scopes": [ - "sessions:manage", + "connections:manage", "messages:write", "contacts:read", "presence:read", @@ -4085,32 +4070,29 @@ } } }, - "x-mint": { - "content": "sessions:manage messages:write contacts:read presence:read presence:observe mcp" - }, "x-audience": "public" } }, - "/platform/sessions/{session}/client-rules": { + "/platform/connections/{connection}/client-rules": { "get": { "operationId": "getClientRules", "tags": [ "Client Tokens" ], - "summary": "Get client-token rules for a session", + "summary": "Get client-token rules for a connection", "security": [ { "ApiKeyAuth": [] } ], - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "parameters": [ { "schema": { "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -4297,10 +4279,7 @@ } } }, - "x-mint": { - "content": "sessions:manage" - }, - "description": "**Required scope:** `sessions:manage`", + "description": "**Required scope:** `connections:manage`", "x-audience": "public" }, "put": { @@ -4308,14 +4287,14 @@ "tags": [ "Client Tokens" ], - "summary": "Set client-token rules for a session", + "summary": "Set client-token rules for a connection", "security": [ { "ApiKeyAuth": [] } ], "x-required-scopes": [ - "sessions:manage", + "connections:manage", "messages:write", "contacts:read", "presence:read", @@ -4329,7 +4308,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -4525,10 +4504,7 @@ } } }, - "x-mint": { - "content": "sessions:manage messages:write contacts:read presence:read presence:observe mcp" - }, - "description": "**Required scopes (all):** `sessions:manage` · `messages:write` · `contacts:read` · `presence:read` · `presence:observe` · `mcp`", + "description": "**Required scopes (all):** `connections:manage` · `messages:write` · `contacts:read` · `presence:read` · `presence:observe` · `mcp`", "x-audience": "public" }, "delete": { @@ -4536,20 +4512,20 @@ "tags": [ "Client Tokens" ], - "summary": "Delete client-token rules for a session", + "summary": "Delete client-token rules for a connection", "security": [ { "ApiKeyAuth": [] } ], - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "parameters": [ { "schema": { "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -4736,26 +4712,23 @@ } } }, - "x-mint": { - "content": "sessions:manage" - }, - "description": "**Required scope:** `sessions:manage`", + "description": "**Required scope:** `connections:manage`", "x-audience": "public" } }, - "/platform/sessions/{session}/call-settings": { + "/platform/connections/{connection}/call-settings": { "get": { "operationId": "getCallSettings", "tags": [ "Calls" ], - "summary": "Get call settings for a session", + "summary": "Get call settings for a connection", "security": [ { "ApiKeyAuth": [] } ], - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "parameters": [ { "schema": { @@ -4764,13 +4737,13 @@ "maxLength": 128 }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], "responses": { "200": { - "description": "Call settings. Sessions without saved settings return the defaults.", + "description": "Call settings. Connections without saved settings return the defaults.", "content": { "application/json": { "schema": { @@ -4951,10 +4924,7 @@ } } }, - "x-mint": { - "content": "sessions:read" - }, - "description": "**Required scope:** `sessions:read`", + "description": "**Required scope:** `connections:read`", "x-audience": "public" }, "put": { @@ -4962,14 +4932,14 @@ "tags": [ "Calls" ], - "summary": "Update call settings for a session", - "description": "**Required scope:** `sessions:manage`\n\nChanges the settings you send; omitted settings keep their current values. Send `expectedRevision` to refuse the update when someone else changed the settings after you read them.", + "summary": "Update call settings for a connection", + "description": "**Required scope:** `connections:manage`\n\nChanges the settings you send; omitted settings keep their current values. Send `expectedRevision` to refuse the update when someone else changed the settings after you read them.", "security": [ { "ApiKeyAuth": [] } ], - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "parameters": [ { "schema": { @@ -4978,7 +4948,7 @@ "maxLength": 128 }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -5207,9 +5177,6 @@ } } }, - "x-mint": { - "content": "sessions:manage" - }, "x-audience": "public" } }, @@ -5220,13 +5187,13 @@ "Calls" ], "summary": "Get your team's call data retention", - "description": "**Required scope:** `sessions:read`\n\nReturns how long Polymorfa keeps your team's call data. Teams without a saved setting return the default.", + "description": "**Required scope:** `connections:read`\n\nReturns how long Polymorfa keeps your team's call data. Teams without a saved setting return the default.", "security": [ { "ApiKeyAuth": [] } ], - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "responses": { "200": { "description": "The team's call data retention.", @@ -5410,9 +5377,6 @@ } } }, - "x-mint": { - "content": "sessions:read" - }, "x-audience": "public" }, "put": { @@ -5421,13 +5385,13 @@ "Calls" ], "summary": "Update your team's call data retention", - "description": "**Required scope:** `sessions:manage`\n\nRecords how long Polymorfa keeps your team's call data. Requires a team API key. Deletion of call data older than the period starts on a date Polymorfa announces in the changelog; until then, saving a period deletes nothing. Once deletion runs, a shorter period also applies to call data already stored, and deleted data cannot be recovered. Send `expectedRevision` to refuse the update when someone else changed the setting after you read it.", + "description": "**Required scope:** `connections:manage`\n\nRecords how long Polymorfa keeps your team's call data. Requires a team API key. Deletion of call data older than the period starts on a date Polymorfa announces in the changelog; until then, saving a period deletes nothing. Once deletion runs, a shorter period also applies to call data already stored, and deleted data cannot be recovered. Send `expectedRevision` to refuse the update when someone else changed the setting after you read it.", "security": [ { "ApiKeyAuth": [] } ], - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "requestBody": { "required": true, "content": { @@ -5653,9 +5617,6 @@ } } }, - "x-mint": { - "content": "sessions:manage" - }, "x-audience": "public" } }, @@ -5666,13 +5627,13 @@ "Calls" ], "summary": "Export call records", - "description": "**Required scope:** `sessions:read`\n\nReturns up to 1,000 call detail records per request as CSV or newline-delimited JSON, newest first, with the same fields and filters as List call records. The other party appears only as `peerRef`, a team-specific pseudonym. Each CSV page starts with a header row. When more records match, the `Polymorfa-Next-Cursor` response header carries the cursor for the next page; it is absent on the last page.", + "description": "**Required scope:** `connections:read`\n\nReturns up to 1,000 call detail records per request as CSV or newline-delimited JSON, newest first, with the same fields and filters as List call records. The other party appears only as `peerRef`, a team-specific pseudonym. Each CSV page starts with a header row. When more records match, the `Polymorfa-Next-Cursor` response header carries the cursor for the next page; it is absent on the last page.", "security": [ { "ApiKeyAuth": [] } ], - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "parameters": [ { "schema": { @@ -5690,11 +5651,11 @@ "type": "string", "minLength": 1, "maxLength": 128, - "description": "Session name of one number." + "description": "Connection name of one connection." }, "required": false, - "description": "Session name of one number.", - "name": "sessionId", + "description": "Connection name of one connection.", + "name": "connectionId", "in": "query" }, { @@ -5716,10 +5677,10 @@ "linked_device", "cloud_api" ], - "description": "How the number connects to WhatsApp." + "description": "How the connection connects to WhatsApp." }, "required": false, - "description": "How the number connects to WhatsApp.", + "description": "How the connection connects to WhatsApp.", "name": "upstream", "in": "query" }, @@ -5827,7 +5788,7 @@ "text/csv": { "schema": { "type": "string", - "description": "Header row, then one row per call. Columns: callId, projectId, sessionId, direction, upstream, outcome, state, hasVideo, peerRef, startedAt, connectedAt, endedAt, durationSeconds, endReason. Empty fields are null. Text that begins with =, +, -, @, tab or carriage return is prefixed with an apostrophe." + "description": "Header row, then one row per call. Columns: callId, projectId, connectionId, direction, upstream, outcome, state, hasVideo, peerRef, startedAt, connectedAt, endedAt, durationSeconds, endReason. Empty fields are null. Text that begins with =, +, -, @, tab or carriage return is prefixed with an apostrophe." } }, "application/x-ndjson": { @@ -5999,9 +5960,6 @@ } } }, - "x-mint": { - "content": "sessions:read" - }, "x-audience": "public" } }, @@ -6012,14 +5970,14 @@ "Analytics" ], "summary": "Export analytics metrics", - "description": "**Required scope:** `sessions:read`\n\nAuthenticated metrics for a customer's Prometheus or OpenTelemetry Collector. Requires live Analytics enablement. Disabled Analytics returns only enablement and export-window metrics, with no business measurements. All samples are gauges: counts describe an overlapping window, not monotonic counters. Do not use rate() or increase() on them. Labels contain number/project record IDs and bounded categories, never contact identities or message content. Null or unmeasured values are omitted; coverage and observation timestamps are included. API request vitals retain project/team scope even when filtering a number.", + "description": "**Required scope:** `connections:read`\n\nAuthenticated metrics for a customer's Prometheus or OpenTelemetry Collector. Requires live Analytics enablement. Disabled Analytics returns only enablement and export-window metrics, with no business measurements. All samples are gauges: counts describe an overlapping window, not monotonic counters. Do not use rate() or increase() on them. Labels contain connection/project record IDs and bounded categories, never contact identities or message content. Null or unmeasured values are omitted; coverage and observation timestamps are included. API request vitals retain project/team scope even when filtering a connection.", "security": [ { "ApiKeyAuth": [] } ], "x-polymorfa-resource-boundary": "project", - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "parameters": [ { "schema": { @@ -6034,11 +5992,11 @@ "schema": { "type": "string", "format": "uuid", - "description": "One number record UUID, within the authorized project or team." + "description": "One connection record UUID, within the authorized project or team." }, "required": false, - "description": "One number record UUID, within the authorized project or team.", - "name": "sessionId", + "description": "One connection record UUID, within the authorized project or team.", + "name": "connectionId", "in": "query" }, { @@ -6305,9 +6263,6 @@ } } }, - "x-mint": { - "content": "sessions:read" - }, "x-audience": "public" } }, @@ -6318,14 +6273,14 @@ "Analytics" ], "summary": "Export project analytics metrics", - "description": "**Required scope:** `sessions:read`\n\nAuthenticated metrics for a customer's Prometheus or OpenTelemetry Collector. Requires live Analytics enablement. Disabled Analytics returns only enablement and export-window metrics, with no business measurements. All samples are gauges: counts describe an overlapping window, not monotonic counters. Do not use rate() or increase() on them. Labels contain number/project record IDs and bounded categories, never contact identities or message content. Null or unmeasured values are omitted; coverage and observation timestamps are included. API request vitals retain project/team scope even when filtering a number.", + "description": "**Required scope:** `connections:read`\n\nAuthenticated metrics for a customer's Prometheus or OpenTelemetry Collector. Requires live Analytics enablement. Disabled Analytics returns only enablement and export-window metrics, with no business measurements. All samples are gauges: counts describe an overlapping window, not monotonic counters. Do not use rate() or increase() on them. Labels contain connection/project record IDs and bounded categories, never contact identities or message content. Null or unmeasured values are omitted; coverage and observation timestamps are included. API request vitals retain project/team scope even when filtering a connection.", "security": [ { "ApiKeyAuth": [] } ], "x-polymorfa-resource-boundary": "project", - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "parameters": [ { "schema": { @@ -6340,11 +6295,11 @@ "schema": { "type": "string", "format": "uuid", - "description": "One number record UUID, within the authorized project or team." + "description": "One connection record UUID, within the authorized project or team." }, "required": false, - "description": "One number record UUID, within the authorized project or team.", - "name": "sessionId", + "description": "One connection record UUID, within the authorized project or team.", + "name": "connectionId", "in": "query" }, { @@ -6611,9 +6566,6 @@ } } }, - "x-mint": { - "content": "sessions:read" - }, "x-audience": "public" } }, @@ -6624,13 +6576,13 @@ "SIP Trunks" ], "summary": "Get the SIP address", - "description": "**Required scope:** `sessions:read`\n\nReturns the host and ports your PBX sends SIP to, and the RTP port range to allow for call audio. When this environment does not host SIP, `status` is `sip_not_hosted` and no address is returned. The address is the same for every trunk of every project.", + "description": "**Required scope:** `connections:read`\n\nReturns the host and ports your PBX sends SIP to, and the RTP port range to allow for call audio. When this environment does not host SIP, `status` is `sip_not_hosted` and no address is returned. The address is the same for every trunk of every project.", "security": [ { "ApiKeyAuth": [] } ], - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "responses": { "200": { "description": "The SIP address, or `sip_not_hosted`.", @@ -6814,9 +6766,6 @@ } } }, - "x-mint": { - "content": "sessions:read" - }, "x-audience": "public" } }, @@ -6827,13 +6776,13 @@ "SIP Trunks" ], "summary": "List SIP trunks", - "description": "**Required scope:** `sessions:read`\n\nLists the SIP trunks of a project. Passwords are never returned.", + "description": "**Required scope:** `connections:read`\n\nLists the SIP trunks of a project. Passwords are never returned.", "security": [ { "ApiKeyAuth": [] } ], - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "parameters": [ { "schema": { @@ -7029,9 +6978,6 @@ } } }, - "x-mint": { - "content": "sessions:read" - }, "x-audience": "public" }, "post": { @@ -7040,13 +6986,13 @@ "SIP Trunks" ], "summary": "Create a SIP trunk", - "description": "**Required scope:** `sessions:manage`\n\nConnects a PBX or SIP trunk to WhatsApp calls. An `outbound` trunk receives the incoming WhatsApp calls of sessions whose call settings route to it. An `inbound` trunk lets your PBX place WhatsApp calls through a session. For trunks that accept calls from your PBX, the response contains the digest credentials once.", + "description": "**Required scope:** `connections:manage`\n\nConnects a PBX or SIP trunk to WhatsApp calls. An `outbound` trunk receives the incoming WhatsApp calls of connections whose call settings route to it. An `inbound` trunk lets your PBX place WhatsApp calls through a connection. For trunks that accept calls from your PBX, the response contains the digest credentials once.", "security": [ { "ApiKeyAuth": [] } ], - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "requestBody": { "required": true, "content": { @@ -7304,9 +7250,6 @@ } } }, - "x-mint": { - "content": "sessions:manage" - }, "x-audience": "public" } }, @@ -7322,7 +7265,7 @@ "ApiKeyAuth": [] } ], - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "parameters": [ { "schema": { @@ -7517,10 +7460,7 @@ } } }, - "x-mint": { - "content": "sessions:read" - }, - "description": "**Required scope:** `sessions:read`", + "description": "**Required scope:** `connections:read`", "x-audience": "public" }, "patch": { @@ -7529,13 +7469,13 @@ "SIP Trunks" ], "summary": "Update a SIP trunk", - "description": "**Required scope:** `sessions:manage`\n\nChanges the fields you send and keeps the others. Send `expectedRevision` to refuse the change with `409 sip_trunk_revision_conflict` when the trunk changed since you read it. Changes apply to new calls within about a minute; calls in progress continue.", + "description": "**Required scope:** `connections:manage`\n\nChanges the fields you send and keeps the others. Send `expectedRevision` to refuse the change with `409 sip_trunk_revision_conflict` when the trunk changed since you read it. Changes apply to new calls within about a minute; calls in progress continue.", "security": [ { "ApiKeyAuth": [] } ], - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "parameters": [ { "schema": { @@ -7804,9 +7744,6 @@ } } }, - "x-mint": { - "content": "sessions:manage" - }, "x-audience": "public" }, "delete": { @@ -7815,13 +7752,13 @@ "SIP Trunks" ], "summary": "Delete a SIP trunk", - "description": "**Required scope:** `sessions:manage`\n\nDeletes the trunk and its credentials. Returns `409 sip_trunk_in_use` while a session's call settings route incoming calls to it.", + "description": "**Required scope:** `connections:manage`\n\nDeletes the trunk and its credentials. Returns `409 sip_trunk_in_use` while a connection's call settings route incoming calls to it.", "security": [ { "ApiKeyAuth": [] } ], - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "parameters": [ { "schema": { @@ -7984,7 +7921,7 @@ } }, "409": { - "description": "`sip_trunk_in_use`: a session's call settings route incoming calls to the trunk.", + "description": "`sip_trunk_in_use`: a connection's call settings route incoming calls to the trunk.", "content": { "application/json": { "schema": { @@ -7994,7 +7931,7 @@ "error": { "type": "conflict_error", "code": "sip_trunk_in_use", - "message": "A session still sends incoming calls to this SIP trunk.", + "message": "A connection still sends incoming calls to this SIP trunk.", "param": null, "request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30" }, @@ -8048,9 +7985,6 @@ } } }, - "x-mint": { - "content": "sessions:manage" - }, "x-audience": "public" } }, @@ -8061,13 +7995,13 @@ "SIP Trunks" ], "summary": "Rotate SIP trunk credentials", - "description": "**Required scope:** `sessions:manage`\n\nReplaces the password your PBX uses to place calls. The previous password stops working within about a minute. Returns `409 state_conflict` for `outbound` trunks.", + "description": "**Required scope:** `connections:manage`\n\nReplaces the password your PBX uses to place calls. The previous password stops working within about a minute. Returns `409 state_conflict` for `outbound` trunks.", "security": [ { "ApiKeyAuth": [] } ], - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "parameters": [ { "schema": { @@ -8326,9 +8260,6 @@ } } }, - "x-mint": { - "content": "sessions:manage" - }, "x-audience": "public" } }, @@ -8339,13 +8270,13 @@ "Call Consent" ], "summary": "Get the team's call policy", - "description": "**Required scope:** `sessions:read`\n\nReturns the team's blocked country codes and the size of its do-not-call list.", + "description": "**Required scope:** `connections:read`\n\nReturns the team's blocked country codes and the size of its do-not-call list.", "security": [ { "ApiKeyAuth": [] } ], - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "responses": { "200": { "description": "The call policy.", @@ -8529,9 +8460,6 @@ } } }, - "x-mint": { - "content": "sessions:read" - }, "x-audience": "public" }, "put": { @@ -8540,13 +8468,13 @@ "Call Consent" ], "summary": "Update the team's blocked country codes", - "description": "**Required scope:** `sessions:manage`\n\nReplaces the blocked country codes. New calls are checked against the new list at once; calls in progress continue.", + "description": "**Required scope:** `connections:manage`\n\nReplaces the blocked country codes. New calls are checked against the new list at once; calls in progress continue.", "security": [ { "ApiKeyAuth": [] } ], - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "requestBody": { "required": true, "content": { @@ -8772,9 +8700,6 @@ } } }, - "x-mint": { - "content": "sessions:manage" - }, "x-audience": "public" } }, @@ -8785,13 +8710,13 @@ "Call Consent" ], "summary": "List the do-not-call list", - "description": "**Required scope:** `sessions:read`\n\nLists the team's do-not-call entries, newest first.", + "description": "**Required scope:** `connections:read`\n\nLists the team's do-not-call entries, newest first.", "security": [ { "ApiKeyAuth": [] } ], - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "parameters": [ { "schema": { @@ -9019,9 +8944,6 @@ } } }, - "x-mint": { - "content": "sessions:read" - }, "x-audience": "public" }, "post": { @@ -9030,13 +8952,13 @@ "Call Consent" ], "summary": "Add a person to the do-not-call list", - "description": "**Required scope:** `sessions:manage`\n\nAdds a phone number or BSUID. Calls to it are refused with `403 call_recipient_opted_out` from then on. Adding an entry that already exists returns it with `200`.", + "description": "**Required scope:** `connections:manage`\n\nAdds a phone number or BSUID. Calls to it are refused with `403 call_recipient_opted_out` from then on. Adding an entry that already exists returns it with `200`.", "security": [ { "ApiKeyAuth": [] } ], - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "requestBody": { "required": true, "content": { @@ -9283,9 +9205,6 @@ } } }, - "x-mint": { - "content": "sessions:manage" - }, "x-audience": "public" } }, @@ -9296,13 +9215,13 @@ "Call Consent" ], "summary": "Import do-not-call entries", - "description": "**Required scope:** `sessions:manage`\n\nAdds up to 5,000 entries in one request. Valid entries are added together; invalid ones are listed in `rejected`. If the valid entries would take the list past its limit, nothing is added and the request fails with `409 call_opt_out_limit`.", + "description": "**Required scope:** `connections:manage`\n\nAdds up to 5,000 entries in one request. Valid entries are added together; invalid ones are listed in `rejected`. If the valid entries would take the list past its limit, nothing is added and the request fails with `409 call_opt_out_limit`.", "security": [ { "ApiKeyAuth": [] } ], - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "requestBody": { "required": true, "content": { @@ -9528,9 +9447,6 @@ } } }, - "x-mint": { - "content": "sessions:manage" - }, "x-audience": "public" } }, @@ -9541,13 +9457,13 @@ "Call Consent" ], "summary": "Remove a person from the do-not-call list", - "description": "**Required scope:** `sessions:manage`\n\nRemoves one entry. The person can be called again.", + "description": "**Required scope:** `connections:manage`\n\nRemoves one entry. The person can be called again.", "security": [ { "ApiKeyAuth": [] } ], - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "parameters": [ { "schema": { @@ -9742,9 +9658,6 @@ } } }, - "x-mint": { - "content": "sessions:manage" - }, "x-audience": "public" } }, @@ -9986,9 +9899,6 @@ } } }, - "x-mint": { - "content": "voice:read" - }, "x-audience": "public" }, "post": { @@ -10293,9 +10203,6 @@ } } }, - "x-mint": { - "content": "voice:manage" - }, "x-audience": "public" } }, @@ -10634,9 +10541,6 @@ } } }, - "x-mint": { - "content": "voice:manage" - }, "x-audience": "public" } }, @@ -10912,9 +10816,6 @@ } } }, - "x-mint": { - "content": "voice:manage" - }, "x-audience": "public" } }, @@ -11125,9 +11026,6 @@ } } }, - "x-mint": { - "content": "voice:read" - }, "description": "**Required scope:** `voice:read`", "x-audience": "public" }, @@ -11380,9 +11278,6 @@ } } }, - "x-mint": { - "content": "voice:manage" - }, "x-audience": "public" }, "delete": { @@ -11624,9 +11519,6 @@ } } }, - "x-mint": { - "content": "voice:manage" - }, "x-audience": "public" } }, @@ -11902,9 +11794,6 @@ } } }, - "x-mint": { - "content": "voice:read" - }, "x-audience": "public" } }, @@ -12117,9 +12006,6 @@ } } }, - "x-mint": { - "content": "voice:read" - }, "x-audience": "public" }, "post": { @@ -12456,9 +12342,6 @@ } } }, - "x-mint": { - "content": "voice:manage" - }, "x-audience": "public" } }, @@ -12669,9 +12552,6 @@ } } }, - "x-mint": { - "content": "voice:read" - }, "description": "**Required scope:** `voice:read`", "x-audience": "public" }, @@ -12882,9 +12762,6 @@ } } }, - "x-mint": { - "content": "voice:manage" - }, "x-audience": "public" } }, @@ -13128,9 +13005,6 @@ } } }, - "x-mint": { - "content": "voice:manage" - }, "x-audience": "public" } }, @@ -13146,8 +13020,8 @@ "ApiKeyAuth": [] } ], - "description": "**Required scope:** `sessions:read`\n\nReturns published feature terms and this scope's acceptance. Pending terms have no text or acceptance requirement. Terms that cannot be activated yet stay pending even after publication. Accepting terms grants no feature access. Requires a team API key or a signed-in team member. Number scope IDs are Number resource UUIDs.", - "x-required-scope": "sessions:read", + "description": "**Required scope:** `connections:read`\n\nReturns published feature terms and this scope's acceptance. Pending terms have no text or acceptance requirement. Terms that cannot be activated yet stay pending even after publication. Accepting terms grants no feature access. Requires a team API key or a signed-in team member. Connection scope IDs are Connection resource UUIDs.", + "x-required-scope": "connections:read", "parameters": [ { "schema": { @@ -13156,7 +13030,7 @@ "team", "project", "customer", - "number" + "connection" ], "default": "team" }, @@ -13168,10 +13042,10 @@ "schema": { "type": "string", "format": "uuid", - "description": "Required for project, customer and number scopes. Defaults to the authenticated team for team scope." + "description": "Required for project, customer and connection scopes. Defaults to the authenticated team for team scope." }, "required": false, - "description": "Required for project, customer and number scopes. Defaults to the authenticated team for team scope.", + "description": "Required for project, customer and connection scopes. Defaults to the authenticated team for team scope.", "name": "scopeId", "in": "query" }, @@ -13380,9 +13254,6 @@ } } }, - "x-mint": { - "content": "sessions:read" - }, "x-audience": "public" } }, @@ -13398,8 +13269,8 @@ "ApiKeyAuth": [] } ], - "description": "**Required scope:** `sessions:manage`\n\nRecords the exact published version, locale and text digest for this scope. Requires a team API key with sessions:manage, or a signed-in team owner or admin. Preview enrollment terms require a signed-in team owner or admin. Staff cannot accept for a customer. A repeated acceptance returns the existing record. This does not turn the feature on.", - "x-required-scope": "sessions:manage", + "description": "**Required scope:** `connections:manage`\n\nRecords the exact published version, locale and text digest for this scope. Requires a team API key with connections:manage, or a signed-in team owner or admin. Preview enrollment terms require a signed-in team owner or admin. Staff cannot accept for a customer. A repeated acceptance returns the existing record. This does not turn the feature on.", + "x-required-scope": "connections:manage", "parameters": [ { "schema": { @@ -13427,7 +13298,7 @@ "team", "project", "customer", - "number" + "connection" ] }, "id": { @@ -13660,9 +13531,6 @@ } } }, - "x-mint": { - "content": "sessions:manage" - }, "x-audience": "public" } }, @@ -13678,8 +13546,8 @@ "ApiKeyAuth": [] } ], - "description": "**Required scope:** `sessions:manage`\n\nAppends a withdrawal without changing the acceptance record. Requires a team API key with sessions:manage, or a signed-in team owner or admin. Preview enrollment terms require a signed-in team owner or admin. No current terms are required. Repeated withdrawals return the existing record; no previous acceptance returns null. Preview Contacts/Chats withdrawals reconcile capture before success; 503 service_unavailable means the withdrawal is recorded but capture is pending. Retrying the same withdrawal is safe. Other features must also be turned off through their settings to stop their work.", - "x-required-scope": "sessions:manage", + "description": "**Required scope:** `connections:manage`\n\nAppends a withdrawal without changing the acceptance record. Requires a team API key with connections:manage, or a signed-in team owner or admin. Preview enrollment terms require a signed-in team owner or admin. No current terms are required. Repeated withdrawals return the existing record; no previous acceptance returns null. Preview Contacts/Chats withdrawals reconcile capture before success; 503 service_unavailable means the withdrawal is recorded but capture is pending. Retrying the same withdrawal is safe. Other features must also be turned off through their settings to stop their work.", + "x-required-scope": "connections:manage", "parameters": [ { "schema": { @@ -13707,7 +13575,7 @@ "team", "project", "customer", - "number" + "connection" ] }, "id": { @@ -13921,42 +13789,39 @@ } } }, - "x-mint": { - "content": "sessions:manage" - }, "x-audience": "public" } }, - "/platform/sessions/{sessionId}": { + "/platform/connections/{connectionId}": { "get": { - "operationId": "getSession", + "operationId": "getConnection", "tags": [ - "Sessions" + "Connections" ], - "summary": "Get session details", + "summary": "Get connection details", "security": [ { "ApiKeyAuth": [] } ], - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "parameters": [ { "schema": { "type": "string" }, "required": true, - "name": "sessionId", + "name": "connectionId", "in": "path" } ], "responses": { "200": { - "description": "Session details", + "description": "Connection details", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PlatformAccessGetSessionResponse" + "$ref": "#/components/schemas/PlatformAccessGetConnectionResponse" } } }, @@ -14133,31 +13998,28 @@ } } }, - "x-mint": { - "content": "sessions:read" - }, - "description": "**Required scope:** `sessions:read`", + "description": "**Required scope:** `connections:read`", "x-audience": "public" }, "put": { - "operationId": "updateSession", + "operationId": "updateConnection", "tags": [ - "Sessions" + "Connections" ], - "summary": "Update session configuration", + "summary": "Update connection configuration", "security": [ { "ApiKeyAuth": [] } ], - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "parameters": [ { "schema": { "type": "string" }, "required": true, - "name": "sessionId", + "name": "connectionId", "in": "path" } ], @@ -14165,7 +14027,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PlatformAccessUpdateSessionRequest" + "$ref": "#/components/schemas/PlatformAccessUpdateConnectionRequest" } } } @@ -14176,7 +14038,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PlatformAccessUpdateSessionResponse" + "$ref": "#/components/schemas/PlatformAccessUpdateConnectionResponse" } } }, @@ -14385,7 +14247,7 @@ } }, "503": { - "description": "Session configuration persistence is unavailable", + "description": "Connection configuration persistence is unavailable", "content": { "application/json": { "schema": { @@ -14417,23 +14279,20 @@ } } }, - "x-mint": { - "content": "sessions:manage" - }, - "description": "**Required scope:** `sessions:manage`", + "description": "**Required scope:** `connections:manage`", "x-audience": "public" }, "delete": { - "operationId": "deletePlatformSession", + "operationId": "deletePlatformConnection", "tags": [ - "sessions" + "connections" ], - "summary": "Remove a session", - "description": "Permanently removes a testing number. Production-number deletion requires support and returns 409 without removing the number.\n\nRequires `sessions:manage`. Project tokens only access resources in their own project.", + "summary": "Remove a connection", + "description": "Permanently removes a testing connection. Production-connection deletion requires support and returns 409 without removing the connection.\n\nRequires `connections:manage`. Project tokens only access resources in their own project.", "x-audience": "public", - "x-polymorfa-resource-boundary": "session", + "x-polymorfa-resource-boundary": "connection", "x-excluded-from-public": false, - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "security": [ { "ApiKeyAuth": [] @@ -14444,12 +14303,12 @@ ], "parameters": [ { - "name": "sessionId", + "name": "connectionId", "in": "path", "required": true, - "description": "Database session UUID or stable session slug.", + "description": "Database connection UUID or stable connection slug.", "schema": { - "$ref": "#/components/schemas/SessionIdentifier" + "$ref": "#/components/schemas/ConnectionIdentifier" } } ], @@ -14484,7 +14343,7 @@ "additionalProperties": false, "properties": { "data": { - "$ref": "#/components/schemas/SessionRemoveResult" + "$ref": "#/components/schemas/ConnectionRemoveResult" } }, "required": [ @@ -14509,16 +14368,16 @@ } }, "patch": { - "operationId": "setSessionTierOverride", + "operationId": "setConnectionTierOverride", "tags": [ - "sessions" + "connections" ], - "summary": "Confirm a number tier change", - "description": "Confirms a previously reviewed tier quote. An upgrade purchases a full fresh 24-hour window without refunding remaining time. A downgrade applies at the paid-window end. Poll the tier quote until applied or rejected; accepting the request does not grant the new tier.\n\nRequires `sessions:manage`. Project tokens only access resources in their own project.", + "summary": "Confirm a connection tier change", + "description": "Confirms a previously reviewed tier quote. An upgrade purchases a full fresh 24-hour window without refunding remaining time. A downgrade applies at the paid-window end. Poll the tier quote until applied or rejected; accepting the request does not grant the new tier.\n\nRequires `connections:manage`. Project tokens only access resources in their own project.", "x-audience": "public", - "x-polymorfa-resource-boundary": "session", + "x-polymorfa-resource-boundary": "connection", "x-excluded-from-public": false, - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "security": [ { "ApiKeyAuth": [] @@ -14529,12 +14388,12 @@ ], "parameters": [ { - "name": "sessionId", + "name": "connectionId", "in": "path", "required": true, - "description": "Database session UUID or stable session slug.", + "description": "Database connection UUID or stable connection slug.", "schema": { - "$ref": "#/components/schemas/SessionIdentifier" + "$ref": "#/components/schemas/ConnectionIdentifier" } } ], @@ -14543,7 +14402,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SessionTierOverrideRequest" + "$ref": "#/components/schemas/ConnectionTierOverrideRequest" } } } @@ -14579,7 +14438,7 @@ "additionalProperties": false, "properties": { "data": { - "$ref": "#/components/schemas/NumberTierChange" + "$ref": "#/components/schemas/ConnectionTierChange" } }, "required": [ @@ -14607,27 +14466,27 @@ } } }, - "/platform/sessions/{sessionId}/restart": { + "/platform/connections/{connectionId}/restart": { "post": { - "operationId": "restartSession", + "operationId": "restartConnection", "tags": [ - "Sessions" + "Connections" ], - "summary": "Restart a session", - "description": "**Required scope:** `sessions:manage`\n\nTesting Numbers wait for confirmed stop before starting the same Number again. An accepted request remains pending until the Number connects. Repeating a pending request retains the same attempt; unconfirmed cleanup must be resolved before another attempt.", + "summary": "Restart a connection", + "description": "**Required scope:** `connections:manage`\n\nTesting Connections wait for confirmed stop before starting the same Connection again. An accepted request remains pending until the Connection connects. Repeating a pending request retains the same attempt; unconfirmed cleanup must be resolved before another attempt.", "security": [ { "ApiKeyAuth": [] } ], - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "parameters": [ { "schema": { "type": "string" }, "required": true, - "name": "sessionId", + "name": "connectionId", "in": "path" } ], @@ -14814,38 +14673,35 @@ } } }, - "x-mint": { - "content": "sessions:manage" - }, "x-audience": "public" } }, - "/platform/sessions/{sessionId}/logout": { + "/platform/connections/{connectionId}/logout": { "post": { - "operationId": "logoutSession", + "operationId": "logoutConnection", "tags": [ - "Sessions" + "Connections" ], - "summary": "Log the session out of WhatsApp", + "summary": "Log the connection out of WhatsApp", "security": [ { "ApiKeyAuth": [] } ], - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "parameters": [ { "schema": { "type": "string" }, "required": true, - "name": "sessionId", + "name": "connectionId", "in": "path" } ], "responses": { "202": { - "description": "Session logout scheduled", + "description": "Connection logout scheduled", "content": { "application/json": { "schema": { @@ -15026,18 +14882,15 @@ } } }, - "x-mint": { - "content": "sessions:manage" - }, - "description": "**Required scope:** `sessions:manage`", + "description": "**Required scope:** `connections:manage`", "x-audience": "public" } }, - "/platform/sessions/{sessionId}/me": { + "/platform/connections/{connectionId}/me": { "get": { - "operationId": "getSessionAccount", + "operationId": "getConnectionAccount", "tags": [ - "Sessions" + "Connections" ], "summary": "Get the connected WhatsApp account info", "security": [ @@ -15045,14 +14898,14 @@ "ApiKeyAuth": [] } ], - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "parameters": [ { "schema": { "type": "string" }, "required": true, - "name": "sessionId", + "name": "connectionId", "in": "path" } ], @@ -15062,7 +14915,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PlatformAccessGetSessionAccountResponse" + "$ref": "#/components/schemas/PlatformAccessGetConnectionAccountResponse" } } }, @@ -15239,18 +15092,15 @@ } } }, - "x-mint": { - "content": "sessions:read" - }, - "description": "**Required scope:** `sessions:read`", + "description": "**Required scope:** `connections:read`", "x-audience": "public" } }, - "/platform/sessions/{sessionId}/handoff-keys": { + "/platform/connections/{connectionId}/handoff-keys": { "post": { - "operationId": "sessionHandoffKeys", + "operationId": "connectionHandoffKeys", "tags": [ - "Sessions" + "Connections" ], "summary": "Initiate M↔P toggle: fetch the destination Curve25519 pubkey", "security": [ @@ -15258,14 +15108,14 @@ "ApiKeyAuth": [] } ], - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "parameters": [ { "schema": { "type": "string" }, "required": true, - "name": "sessionId", + "name": "connectionId", "in": "path" } ], @@ -15452,18 +15302,15 @@ } } }, - "x-mint": { - "content": "sessions:manage" - }, - "description": "**Required scope:** `sessions:manage`", + "description": "**Required scope:** `connections:manage`", "x-audience": "public" } }, - "/platform/sessions/{sessionId}/handoff-import": { + "/platform/connections/{connectionId}/handoff-import": { "post": { - "operationId": "sessionHandoffImport", + "operationId": "connectionHandoffImport", "tags": [ - "Sessions" + "Connections" ], "summary": "Ship a sealed SignalStoreSnapshot from customer Baileys to the runner", "security": [ @@ -15471,14 +15318,14 @@ "ApiKeyAuth": [] } ], - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "parameters": [ { "schema": { "type": "string" }, "required": true, - "name": "sessionId", + "name": "connectionId", "in": "path" } ], @@ -15674,18 +15521,15 @@ } } }, - "x-mint": { - "content": "sessions:manage" - }, - "description": "**Required scope:** `sessions:manage`", + "description": "**Required scope:** `connections:manage`", "x-audience": "public" } }, - "/platform/sessions/{sessionId}/upload-appstate-keys": { + "/platform/connections/{connectionId}/upload-appstate-keys": { "post": { - "operationId": "sessionUploadAppStateKeys", + "operationId": "connectionUploadAppStateKeys", "tags": [ - "Sessions" + "Connections" ], "summary": "Upload selected AppStateSyncKeys (Track P+ tier)", "security": [ @@ -15693,14 +15537,14 @@ "ApiKeyAuth": [] } ], - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "parameters": [ { "schema": { "type": "string" }, "required": true, - "name": "sessionId", + "name": "connectionId", "in": "path" } ], @@ -15896,18 +15740,15 @@ } } }, - "x-mint": { - "content": "sessions:manage" - }, - "description": "**Required scope:** `sessions:manage`", + "description": "**Required scope:** `connections:manage`", "x-audience": "public" } }, - "/platform/sessions/{sessionId}/handoff-ack": { + "/platform/connections/{connectionId}/handoff-ack": { "post": { - "operationId": "sessionHandoffAck", + "operationId": "connectionHandoffAck", "tags": [ - "Sessions" + "Connections" ], "summary": "Acknowledge receipt of an M→P export; API flips bartenderMode after hash verify", "security": [ @@ -15915,14 +15756,14 @@ "ApiKeyAuth": [] } ], - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "parameters": [ { "schema": { "type": "string" }, "required": true, - "name": "sessionId", + "name": "connectionId", "in": "path" } ], @@ -16118,10 +15959,7 @@ } } }, - "x-mint": { - "content": "sessions:manage" - }, - "description": "**Required scope:** `sessions:manage`", + "description": "**Required scope:** `connections:manage`", "x-audience": "public" } }, @@ -17773,11 +17611,11 @@ "signal-custody" ], "summary": "Read Project Signal custody default", - "description": "Returns the custody default for future Number reservations. Existing Number custody is immutable. Customer null defaults inherit the Project default.\n\nRequires `sessions:read`. Project tokens only access resources in their own project.", + "description": "Returns the custody default for future Connection reservations. Existing Connection custody is immutable. Customer null defaults inherit the Project default.\n\nRequires `connections:read`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "security": [ { "ApiKeyAuth": [] @@ -17858,11 +17696,11 @@ "signal-custody" ], "summary": "Update Project Signal custody default", - "description": "Changes the default for future Number reservations with a revision check. Customer-owned custody requires beta admission and runtime availability. Existing Numbers keep their custody. Dashboard writes require a team owner or admin. Setting a Customer default to null restores Project inheritance.\n\nRequires `sessions:manage`. Project tokens only access resources in their own project.", + "description": "Changes the default for future Connection reservations with a revision check. Customer-owned custody requires beta admission and runtime availability. Existing Connections keep their custody. Dashboard writes require a team owner or admin. Setting a Customer default to null restores Project inheritance.\n\nRequires `connections:manage`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "security": [ { "ApiKeyAuth": [] @@ -17958,11 +17796,11 @@ "signal-custody" ], "summary": "Read Customer Signal custody default", - "description": "Returns the custody default for future Number reservations. Existing Number custody is immutable. Customer null defaults inherit the Project default.\n\nRequires `sessions:read`. Project tokens only access resources in their own project.", + "description": "Returns the custody default for future Connection reservations. Existing Connection custody is immutable. Customer null defaults inherit the Project default.\n\nRequires `connections:read`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "security": [ { "ApiKeyAuth": [] @@ -18052,11 +17890,11 @@ "signal-custody" ], "summary": "Update Customer Signal custody default", - "description": "Changes the default for future Number reservations with a revision check. Customer-owned custody requires beta admission and runtime availability. Existing Numbers keep their custody. Dashboard writes require a team owner or admin. Setting a Customer default to null restores Project inheritance.\n\nRequires `sessions:manage`. Project tokens only access resources in their own project.", + "description": "Changes the default for future Connection reservations with a revision check. Customer-owned custody requires beta admission and runtime availability. Existing Connections keep their custody. Dashboard writes require a team owner or admin. Setting a Customer default to null restores Project inheritance.\n\nRequires `connections:manage`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "security": [ { "ApiKeyAuth": [] @@ -18154,18 +17992,18 @@ } } }, - "/platform/session-configuration": { + "/platform/connection-configuration": { "get": { - "operationId": "getSessionConfigurationDefaults", + "operationId": "getConnectionConfigurationDefaults", "tags": [ - "session-configuration" + "connection-configuration" ], - "summary": "Read session configuration defaults", - "description": "Returns effective team or project defaults, explicit overrides, and their source.\n\nRequires `sessions:read`. Project tokens only access resources in their own project.", + "summary": "Read connection configuration defaults", + "description": "Returns effective team or project defaults, explicit overrides, and their source.\n\nRequires `connections:read`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "security": [ { "ApiKeyAuth": [] @@ -18215,7 +18053,7 @@ "additionalProperties": false, "properties": { "data": { - "$ref": "#/components/schemas/SessionConfigurationView" + "$ref": "#/components/schemas/ConnectionConfigurationView" } }, "required": [ @@ -18237,16 +18075,16 @@ } }, "put": { - "operationId": "updateSessionConfigurationDefaults", + "operationId": "updateConnectionConfigurationDefaults", "tags": [ - "session-configuration" + "connection-configuration" ], - "summary": "Update session configuration defaults", - "description": "Updates explicit defaults using a revision check. Existing sessions inherit fields they have not overridden. Switching an existing Number to descriptor history delivery requires confirmed cleanup; otherwise the entire update returns 409 and nothing is saved. A reset can inherit descriptor delivery and has the same requirement. Runtime application is asynchronous.\n\nRequires `sessions:manage`. Project tokens only access resources in their own project.", + "summary": "Update connection configuration defaults", + "description": "Updates explicit defaults using a revision check. Existing connections inherit fields they have not overridden. Switching an existing Connection to descriptor history delivery requires confirmed cleanup; otherwise the entire update returns 409 and nothing is saved. A reset can inherit descriptor delivery and has the same requirement. Runtime application is asynchronous.\n\nRequires `connections:manage`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "security": [ { "ApiKeyAuth": [] @@ -18260,7 +18098,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SessionConfigurationUpdateRequest" + "$ref": "#/components/schemas/ConnectionConfigurationUpdateRequest" } } } @@ -18296,7 +18134,7 @@ "additionalProperties": false, "properties": { "data": { - "$ref": "#/components/schemas/SessionConfigurationView" + "$ref": "#/components/schemas/ConnectionConfigurationView" } }, "required": [ @@ -18324,18 +18162,18 @@ } } }, - "/console/session-configuration/{sessionId}": { + "/console/connection-configuration/{connectionId}": { "get": { - "operationId": "getSessionConfiguration", + "operationId": "getConnectionConfiguration", "tags": [ - "session-configuration" + "connection-configuration" ], - "summary": "Read session configuration", - "description": "Returns effective configuration, overrides, and runtime application status for an owned session.\n\nRequires a verified dashboard bearer and current team authorization. Team keys and project tokens are not accepted.", + "summary": "Read connection configuration", + "description": "Returns effective configuration, overrides, and runtime application status for an owned connection.\n\nRequires a verified dashboard bearer and current team authorization. Team keys and project tokens are not accepted.", "x-audience": "console", "x-polymorfa-resource-boundary": "human_only", "x-excluded-from-public": true, - "x-exclusion-reason": "Private Console session configuration; requires live dashboard membership.", + "x-exclusion-reason": "Private Console connection configuration; requires live dashboard membership.", "security": [ { "ConsoleSession": [] @@ -18343,12 +18181,12 @@ ], "parameters": [ { - "name": "sessionId", + "name": "connectionId", "in": "path", "required": true, - "description": "Database session UUID or stable session slug.", + "description": "Database connection UUID or stable connection slug.", "schema": { - "$ref": "#/components/schemas/SessionIdentifier" + "$ref": "#/components/schemas/ConnectionIdentifier" } }, { @@ -18391,7 +18229,7 @@ "additionalProperties": false, "properties": { "data": { - "$ref": "#/components/schemas/SessionConfigurationView" + "$ref": "#/components/schemas/ConnectionConfigurationView" } }, "required": [ @@ -18413,16 +18251,16 @@ } }, "put": { - "operationId": "updateSessionConfiguration", + "operationId": "updateConnectionConfiguration", "tags": [ - "session-configuration" + "connection-configuration" ], - "summary": "Update session configuration", - "description": "Sets or resets explicit configuration for an owned session using a revision check. Switching to descriptor history delivery requires confirmed cleanup; otherwise the update returns 409 and nothing is saved. A reset inherits project or team settings and can have the same requirement.\n\nRequires a verified dashboard bearer and current team authorization. Team keys and project tokens are not accepted.", + "summary": "Update connection configuration", + "description": "Sets or resets explicit configuration for an owned connection using a revision check. Switching to descriptor history delivery requires confirmed cleanup; otherwise the update returns 409 and nothing is saved. A reset inherits project or team settings and can have the same requirement.\n\nRequires a verified dashboard bearer and current team authorization. Team keys and project tokens are not accepted.", "x-audience": "console", "x-polymorfa-resource-boundary": "human_only", "x-excluded-from-public": true, - "x-exclusion-reason": "Private Console session configuration; requires live dashboard membership.", + "x-exclusion-reason": "Private Console connection configuration; requires live dashboard membership.", "security": [ { "ConsoleSession": [] @@ -18430,12 +18268,12 @@ ], "parameters": [ { - "name": "sessionId", + "name": "connectionId", "in": "path", "required": true, - "description": "Database session UUID or stable session slug.", + "description": "Database connection UUID or stable connection slug.", "schema": { - "$ref": "#/components/schemas/SessionIdentifier" + "$ref": "#/components/schemas/ConnectionIdentifier" } } ], @@ -18444,7 +18282,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SessionConfigurationUpdateRequest" + "$ref": "#/components/schemas/ConnectionConfigurationUpdateRequest" } } } @@ -18480,7 +18318,7 @@ "additionalProperties": false, "properties": { "data": { - "$ref": "#/components/schemas/SessionConfigurationView" + "$ref": "#/components/schemas/ConnectionConfigurationView" } }, "required": [ @@ -18508,18 +18346,18 @@ } } }, - "/console/call-settings/{sessionId}": { + "/console/call-settings/{connectionId}": { "get": { - "operationId": "getSessionCallSettings", + "operationId": "getConnectionCallSettings", "tags": [ "calls" ], - "summary": "Read session call settings", - "description": "Returns the call settings for an owned session. Sessions without saved settings return the defaults and a null `updatedAt`.\n\nRequires a verified dashboard bearer and current team authorization. Team keys and project tokens are not accepted.", + "summary": "Read connection call settings", + "description": "Returns the call settings for an owned connection. Connections without saved settings return the defaults and a null `updatedAt`.\n\nRequires a verified dashboard bearer and current team authorization. Team keys and project tokens are not accepted.", "x-audience": "console", "x-polymorfa-resource-boundary": "human_only", "x-excluded-from-public": true, - "x-exclusion-reason": "Private Console call settings; requires live dashboard membership. The Platform API publishes the same settings under /platform/sessions/{session}/call-settings.", + "x-exclusion-reason": "Private Console call settings; requires live dashboard membership. The Platform API publishes the same settings under /platform/connections/{connection}/call-settings.", "security": [ { "ConsoleSession": [] @@ -18527,12 +18365,12 @@ ], "parameters": [ { - "name": "sessionId", + "name": "connectionId", "in": "path", "required": true, - "description": "Database session UUID or stable session slug.", + "description": "Database connection UUID or stable connection slug.", "schema": { - "$ref": "#/components/schemas/SessionIdentifier" + "$ref": "#/components/schemas/ConnectionIdentifier" } }, { @@ -18575,7 +18413,7 @@ "additionalProperties": false, "properties": { "data": { - "$ref": "#/components/schemas/SessionCallSettings" + "$ref": "#/components/schemas/ConnectionCallSettings" } }, "required": [ @@ -18600,16 +18438,16 @@ } }, "put": { - "operationId": "updateSessionCallSettings", + "operationId": "updateConnectionCallSettings", "tags": [ "calls" ], - "summary": "Update session call settings", - "description": "Updates the call settings for an owned session. Omitted fields keep their values. New calls use the saved settings. Routing to a SIP trunk requires a trunk in the session's project that can receive calls. `expectedRevision` refuses an update to settings that changed since they were read.\n\nRequires a verified dashboard bearer and current team authorization. The signed-in member must be a team owner or admin. Team keys and project tokens are not accepted.", + "summary": "Update connection call settings", + "description": "Updates the call settings for an owned connection. Omitted fields keep their values. New calls use the saved settings. Routing to a SIP trunk requires a trunk in the connection's project that can receive calls. `expectedRevision` refuses an update to settings that changed since they were read.\n\nRequires a verified dashboard bearer and current team authorization. The signed-in member must be a team owner or admin. Team keys and project tokens are not accepted.", "x-audience": "console", "x-polymorfa-resource-boundary": "human_only", "x-excluded-from-public": true, - "x-exclusion-reason": "Private Console call settings; requires live dashboard membership. The Platform API publishes the same settings under /platform/sessions/{session}/call-settings.", + "x-exclusion-reason": "Private Console call settings; requires live dashboard membership. The Platform API publishes the same settings under /platform/connections/{connection}/call-settings.", "x-required-team-role": "owner_or_admin", "security": [ { @@ -18618,12 +18456,12 @@ ], "parameters": [ { - "name": "sessionId", + "name": "connectionId", "in": "path", "required": true, - "description": "Database session UUID or stable session slug.", + "description": "Database connection UUID or stable connection slug.", "schema": { - "$ref": "#/components/schemas/SessionIdentifier" + "$ref": "#/components/schemas/ConnectionIdentifier" } } ], @@ -18632,7 +18470,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/UpdateSessionCallSettingsRequest" + "$ref": "#/components/schemas/UpdateConnectionCallSettingsRequest" } } } @@ -18668,7 +18506,7 @@ "additionalProperties": false, "properties": { "data": { - "$ref": "#/components/schemas/SessionCallSettings" + "$ref": "#/components/schemas/ConnectionCallSettings" } }, "required": [ @@ -19199,7 +19037,7 @@ "calls" ], "summary": "Delete a SIP trunk", - "description": "Deletes a SIP trunk that no session routes incoming calls to.\n\nRequires a verified dashboard bearer and current team authorization. The signed-in member must be a team owner or admin. Team keys and project tokens are not accepted.", + "description": "Deletes a SIP trunk that no connection routes incoming calls to.\n\nRequires a verified dashboard bearer and current team authorization. The signed-in member must be a team owner or admin. Team keys and project tokens are not accepted.", "x-audience": "console", "x-polymorfa-resource-boundary": "human_only", "x-excluded-from-public": true, @@ -21125,20 +20963,20 @@ } } }, - "/platform/sessions": { + "/platform/connections": { "get": { - "operationId": "listPlatformSessions", + "operationId": "listPlatformConnections", "tags": [ - "sessions" + "connections" ], - "summary": "List sessions", - "description": "Lists sessions in the authenticated team or selected project, including disconnected sessions and their latest status reason. A Test key returns only test numbers in its project, or an empty list when there are none. Other project tokens return all sessions in their own project.\n\nRequires `sessions:read`. Project tokens only access resources in their own project.", + "summary": "List connections", + "description": "Lists connections in the authenticated team or selected project, including disconnected connections and their latest status reason. A Test key returns only test connections in its project, or an empty list when there are none. Other project tokens return all connections in their own project.\n\nRequires `connections:read`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "x-merged-endpoints": [ - "listSessionsByTeam" + "listConnectionsByTeam" ], "security": [ { @@ -21191,7 +21029,7 @@ "data": { "type": "array", "items": { - "$ref": "#/components/schemas/PlatformSession" + "$ref": "#/components/schemas/PlatformConnection" } } }, @@ -21214,18 +21052,18 @@ } } }, - "/platform/sessions/{sessionId}/start": { + "/platform/connections/{connectionId}/start": { "post": { - "operationId": "startPlatformSession", + "operationId": "startPlatformConnection", "tags": [ - "sessions" + "connections" ], - "summary": "Start a session", - "description": "Requests an asynchronous start. Testing Numbers retain the original attempt: a ready Number resumes the same runtime, while a stopped Number requires confirmed cleanup before a successor starts. Acceptance does not mean the Number is connected. An unfinished testing invitation must resume through its original link. A hosted paid number must reserve credit before connecting; insufficient available credit returns 402. A new paid window is charged only after the messaging connection succeeds. Monthly project and number credit limits also apply: a new charge that would exceed either limit returns 409 state_conflict. Already-paid service remains available until its paid window ends. The identifier may be the session UUID or stable session slug.\n\nRequires `sessions:manage`. Project tokens only access resources in their own project.", + "summary": "Start a connection", + "description": "Requests an asynchronous start. Testing Connections retain the original attempt: a ready Connection resumes the same runtime, while a stopped Connection requires confirmed cleanup before a successor starts. Acceptance does not mean the Connection is connected. An unfinished testing invitation must resume through its original link. A hosted paid number must reserve credit before connecting; insufficient available credit returns 402. A new paid window is charged only after the messaging method succeeds. Monthly project and number credit limits also apply: a new charge that would exceed either limit returns 409 state_conflict. Already-paid service remains available until its paid window ends. The identifier may be the connection UUID or stable connection slug.\n\nRequires `connections:manage`. Project tokens only access resources in their own project.", "x-audience": "public", - "x-polymorfa-resource-boundary": "session", + "x-polymorfa-resource-boundary": "connection", "x-excluded-from-public": false, - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "security": [ { "ApiKeyAuth": [] @@ -21236,12 +21074,12 @@ ], "parameters": [ { - "name": "sessionId", + "name": "connectionId", "in": "path", "required": true, - "description": "Database session UUID or stable session slug.", + "description": "Database connection UUID or stable connection slug.", "schema": { - "$ref": "#/components/schemas/SessionIdentifier" + "$ref": "#/components/schemas/ConnectionIdentifier" } } ], @@ -21250,7 +21088,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SessionProjectContext" + "$ref": "#/components/schemas/ConnectionProjectContext" } } } @@ -21286,7 +21124,7 @@ "additionalProperties": false, "properties": { "data": { - "$ref": "#/components/schemas/SessionStartResult" + "$ref": "#/components/schemas/ConnectionStartResult" } }, "required": [ @@ -21317,18 +21155,18 @@ } } }, - "/platform/sessions/{sessionId}/stop": { + "/platform/connections/{connectionId}/stop": { "post": { - "operationId": "stopPlatformSession", + "operationId": "stopPlatformConnection", "tags": [ - "sessions" + "connections" ], - "summary": "Stop a session", - "description": "Requests an asynchronous stop for one session. The identifier may be the session UUID or stable session slug.\n\nRequires `sessions:manage`. Project tokens only access resources in their own project.", + "summary": "Stop a connection", + "description": "Requests an asynchronous stop for one connection. The identifier may be the connection UUID or stable connection slug.\n\nRequires `connections:manage`. Project tokens only access resources in their own project.", "x-audience": "public", - "x-polymorfa-resource-boundary": "session", + "x-polymorfa-resource-boundary": "connection", "x-excluded-from-public": false, - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "security": [ { "ApiKeyAuth": [] @@ -21339,12 +21177,12 @@ ], "parameters": [ { - "name": "sessionId", + "name": "connectionId", "in": "path", "required": true, - "description": "Database session UUID or stable session slug.", + "description": "Database connection UUID or stable connection slug.", "schema": { - "$ref": "#/components/schemas/SessionIdentifier" + "$ref": "#/components/schemas/ConnectionIdentifier" } } ], @@ -21353,7 +21191,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SessionProjectContext" + "$ref": "#/components/schemas/ConnectionProjectContext" } } } @@ -21389,7 +21227,7 @@ "additionalProperties": false, "properties": { "data": { - "$ref": "#/components/schemas/SessionStopResult" + "$ref": "#/components/schemas/ConnectionStopResult" } }, "required": [ @@ -21414,18 +21252,18 @@ } } }, - "/platform/sessions/{sessionId}/tier-quotes": { + "/platform/connections/{connectionId}/tier-quotes": { "post": { - "operationId": "quoteSessionTierChange", + "operationId": "quoteConnectionTierChange", "tags": [ - "sessions" + "connections" ], - "summary": "Preview a number tier change", - "description": "Returns the full credit charge and effective time before confirmation. Null tierOverride restores project inheritance. Creating a quote does not change the number or consume credit. Quotes expire after ten minutes and are invalidated when the number or price changes.\n\n**Hybrid Link.** A Hybrid Link Number leaving Pro requires `hybridResolution`: keep one connection, or split the Number into two Standard Numbers; without it the quote returns `409` with code `hybrid_choice_required`. The choice runs when the paid Pro window ends. An upgrade to Pro can merge two same-number Numbers with `hybridMerge`; the Number in the path keeps its ID. An ineligible change returns `409` with code `hybrid_transition_ineligible`.\n\nRequires `sessions:manage`. Project tokens only access resources in their own project.", + "summary": "Preview a connection tier change", + "description": "Returns the full credit charge and effective time before confirmation. Null tierOverride restores project inheritance. Creating a quote does not change the connection or consume credit. Quotes expire after ten minutes and are invalidated when the connection or price changes.\n\n**Hybrid Link.** A Hybrid Link Connection leaving Pro requires `hybridResolution`: keep one method, or split the Connection into two Standard Connections; without it the quote returns `409` with code `hybrid_choice_required`. The choice runs when the paid Pro window ends. An upgrade to Pro can merge two same-number Connections with `hybridMerge`; the Connection in the path keeps its ID. An ineligible change returns `409` with code `hybrid_transition_ineligible`.\n\nRequires `connections:manage`. Project tokens only access resources in their own project.", "x-audience": "public", - "x-polymorfa-resource-boundary": "session", + "x-polymorfa-resource-boundary": "connection", "x-excluded-from-public": false, - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "security": [ { "ApiKeyAuth": [] @@ -21436,12 +21274,12 @@ ], "parameters": [ { - "name": "sessionId", + "name": "connectionId", "in": "path", "required": true, - "description": "Database session UUID or stable session slug.", + "description": "Database connection UUID or stable connection slug.", "schema": { - "$ref": "#/components/schemas/SessionIdentifier" + "$ref": "#/components/schemas/ConnectionIdentifier" } } ], @@ -21450,7 +21288,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/NumberTierQuoteRequest" + "$ref": "#/components/schemas/ConnectionTierQuoteRequest" } } } @@ -21486,7 +21324,7 @@ "additionalProperties": false, "properties": { "data": { - "$ref": "#/components/schemas/NumberTierChange" + "$ref": "#/components/schemas/ConnectionTierChange" } }, "required": [ @@ -21514,18 +21352,18 @@ } } }, - "/platform/sessions/{sessionId}/tier-quotes/{quoteId}": { + "/platform/connections/{connectionId}/tier-quotes/{quoteId}": { "get": { - "operationId": "getSessionTierChange", + "operationId": "getConnectionTierChange", "tags": [ - "sessions" + "connections" ], - "summary": "Read a number tier change", - "description": "Reads the quote and durable result for a number in the authenticated project scope.\n\n**Hybrid Link.** For a Hybrid Link change, `quote.hybridTransition.status` reports the connection change separately from the tier change: `scheduled`, `running`, `completed`, `failed` or `cancelled`.\n\nRequires `sessions:read`. Project tokens only access resources in their own project.", + "summary": "Read a connection tier change", + "description": "Reads the quote and durable result for a connection in the authenticated project scope.\n\n**Hybrid Link.** For a Hybrid Link change, `quote.hybridTransition.status` reports the method change separately from the tier change: `scheduled`, `running`, `completed`, `failed` or `cancelled`.\n\nRequires `connections:read`. Project tokens only access resources in their own project.", "x-audience": "public", - "x-polymorfa-resource-boundary": "session", + "x-polymorfa-resource-boundary": "connection", "x-excluded-from-public": false, - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "security": [ { "ApiKeyAuth": [] @@ -21536,12 +21374,12 @@ ], "parameters": [ { - "name": "sessionId", + "name": "connectionId", "in": "path", "required": true, - "description": "Database session UUID or stable session slug.", + "description": "Database connection UUID or stable connection slug.", "schema": { - "$ref": "#/components/schemas/SessionIdentifier" + "$ref": "#/components/schemas/ConnectionIdentifier" } }, { @@ -21584,7 +21422,7 @@ "additionalProperties": false, "properties": { "data": { - "$ref": "#/components/schemas/NumberTierChange" + "$ref": "#/components/schemas/ConnectionTierChange" } }, "required": [ @@ -21609,18 +21447,18 @@ } } }, - "/platform/sessions/{sessionId}/capabilities": { + "/platform/connections/{connectionId}/capabilities": { "get": { - "operationId": "getSessionCapabilities", + "operationId": "getConnectionCapabilities", "tags": [ - "sessions" + "connections" ], - "summary": "Get a number's WhatsApp capabilities", - "description": "Returns which WhatsApp features WhatsApp has enabled for this number, and the limits it applies, as of the number's last configuration sync. Each value reflects WhatsApp's configuration at `syncedAt`, not a live check. Values describe the WhatsApp account last linked to the number, whether or not it is connected now; read the session for its connection status. Before the first sync, from the first sync attempt of another linked WhatsApp account until its configuration is synced, and when Polymorfa cannot tell whether the stored configuration belongs to the account linked now, `status` is `unknown` and every value is null. Values come from a linked-device connection: a number that has never had one (Official API only) reports `unknown`, and a number whose linked-device connection was removed keeps the values last synced. A capability reports what WhatsApp allows the number; it does not mean the Polymorfa API offers an operation for that feature. This is a beta: teams that are not enrolled receive 403.\n\nRequires `sessions:read`. Project tokens only access resources in their own project.", + "summary": "Get a connection's WhatsApp capabilities", + "description": "Returns which WhatsApp features WhatsApp has enabled for this connection, and the limits it applies, as of the connection's last configuration sync. Each value reflects WhatsApp's configuration at `syncedAt`, not a live check. Values describe the WhatsApp account last linked to the connection, whether or not it is connected now; read the connection for its method status. Before the first sync, from the first sync attempt of another linked WhatsApp account until its configuration is synced, and when Polymorfa cannot tell whether the stored configuration belongs to the account linked now, `status` is `unknown` and every value is null. Values come from a linked-device method: a connection that has never had one (Official API only) reports `unknown`, and a connection whose linked-device method was removed keeps the values last synced. A capability reports what WhatsApp allows the connection; it does not mean the Polymorfa API offers an operation for that feature. This is a beta: teams that are not enrolled receive 403.\n\nRequires `connections:read`. Project tokens only access resources in their own project.", "x-audience": "public", - "x-polymorfa-resource-boundary": "session", + "x-polymorfa-resource-boundary": "connection", "x-excluded-from-public": false, - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "security": [ { "ApiKeyAuth": [] @@ -21631,12 +21469,12 @@ ], "parameters": [ { - "name": "sessionId", + "name": "connectionId", "in": "path", "required": true, - "description": "Database session UUID or stable session slug.", + "description": "Database connection UUID or stable connection slug.", "schema": { - "$ref": "#/components/schemas/SessionIdentifier" + "$ref": "#/components/schemas/ConnectionIdentifier" } } ], @@ -21671,7 +21509,7 @@ "additionalProperties": false, "properties": { "data": { - "$ref": "#/components/schemas/SessionCapabilities" + "$ref": "#/components/schemas/ConnectionCapabilities" } }, "required": [ @@ -21696,19 +21534,19 @@ } } }, - "/platform/sessions/{sessionId}/inspector/claim/release": { + "/platform/connections/{connectionId}/inspector/claim/release": { "post": { - "operationId": "releaseSessionInspectorClaim", + "operationId": "releaseConnectionInspectorClaim", "tags": [ - "sessions" + "connections" ], - "summary": "Unclaim a Number in Inspector", - "description": "Releases the Number's Inspector claim. Polymorfa first removes the claimant's Inspector device from the Number; the claim is released only after that succeeds. On a real Number, only the Inspector device is removed: your phone and Polymorfa's own linked device stay connected. Any team member can then claim the Number by pairing it in Inspector. A Number that is already unclaimed returns `released: false`. Pass `expectedClaimedAt` from your last read to avoid releasing a newer claim; a different current claim returns `409`. When the device cannot be removed, the Number stays claimed and the request returns `503` with `Retry-After`; repeating it is safe.\n\nA test Number requires `sandbox:write`; a real Number requires `sessions:manage`. Project tokens only access Numbers in their own project. A signed-in Console member must be the claimant or a team owner or admin.", + "summary": "Unclaim a Connection in Inspector", + "description": "Releases the Connection's Inspector claim. Polymorfa first removes the claimant's Inspector device from the Connection; the claim is released only after that succeeds. On a real Connection, only the Inspector device is removed: your phone and Polymorfa's own linked device stay connected. Any team member can then claim the Connection by pairing it in Inspector. A Connection that is already unclaimed returns `released: false`. Pass `expectedClaimedAt` from your last read to avoid releasing a newer claim; a different current claim returns `409`. When the device cannot be removed, the Connection stays claimed and the request returns `503` with `Retry-After`; repeating it is safe.\n\nA test Connection requires `sandbox:write`; a real Connection requires `connections:manage`. Project tokens only access Connections in their own project. A signed-in Console member must be the claimant or a team owner or admin.", "x-audience": "public", - "x-polymorfa-resource-boundary": "session", + "x-polymorfa-resource-boundary": "connection", "x-excluded-from-public": false, "x-required-scopes": [ - "sessions:manage", + "connections:manage", "sandbox:write" ], "x-required-scope-mode": "any", @@ -21722,12 +21560,12 @@ ], "parameters": [ { - "name": "sessionId", + "name": "connectionId", "in": "path", "required": true, - "description": "Database session UUID or stable session slug.", + "description": "Database connection UUID or stable connection slug.", "schema": { - "$ref": "#/components/schemas/SessionIdentifier" + "$ref": "#/components/schemas/ConnectionIdentifier" } } ], @@ -21803,18 +21641,18 @@ } } }, - "/platform/sessions/stop": { + "/platform/connections/stop": { "post": { - "operationId": "stopSessions", + "operationId": "stopConnections", "tags": [ - "sessions" + "connections" ], - "summary": "Stop multiple sessions", - "description": "Requests asynchronous stops for up to 100 session UUIDs or slugs in the authenticated project scope.\n\nRequires `sessions:manage`. Project tokens only access resources in their own project.", + "summary": "Stop multiple connections", + "description": "Requests asynchronous stops for up to 100 connection UUIDs or slugs in the authenticated project scope.\n\nRequires `connections:manage`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "security": [ { "ApiKeyAuth": [] @@ -21828,7 +21666,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SessionBatchRequest" + "$ref": "#/components/schemas/ConnectionBatchRequest" } } } @@ -21864,7 +21702,7 @@ "additionalProperties": false, "properties": { "data": { - "$ref": "#/components/schemas/SessionBatchStopResult" + "$ref": "#/components/schemas/ConnectionBatchStopResult" } }, "required": [ @@ -21889,18 +21727,18 @@ } } }, - "/platform/sessions/delete": { + "/platform/connections/delete": { "post": { - "operationId": "deleteSessions", + "operationId": "deleteConnections", "tags": [ - "sessions" + "connections" ], - "summary": "Remove multiple sessions", - "description": "Permanently removes up to 100 testing numbers. A batch containing a production number returns 409 without removing any number.\n\nRequires `sessions:manage`. Project tokens only access resources in their own project.", + "summary": "Remove multiple connections", + "description": "Permanently removes up to 100 testing connections. A batch containing a production connection returns 409 without removing any connection.\n\nRequires `connections:manage`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "security": [ { "ApiKeyAuth": [] @@ -21914,7 +21752,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SessionBatchRequest" + "$ref": "#/components/schemas/ConnectionBatchRequest" } } } @@ -21950,7 +21788,7 @@ "additionalProperties": false, "properties": { "data": { - "$ref": "#/components/schemas/SessionBatchRemoveResult" + "$ref": "#/components/schemas/ConnectionBatchRemoveResult" } }, "required": [ @@ -21977,16 +21815,16 @@ }, "/platform/bans": { "get": { - "operationId": "listSessionBans", + "operationId": "listConnectionBans", "tags": [ "bans" ], - "summary": "List session bans", - "description": "Public Management API. Team keys require `sessions:read`. Project tokens are not accepted.", + "summary": "List connection bans", + "description": "Public Management API. Team keys require `connections:read`. Project tokens are not accepted.", "x-audience": "public", "x-polymorfa-resource-boundary": "team", "x-excluded-from-public": false, - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "security": [ { "ApiKeyAuth": [] @@ -22041,16 +21879,16 @@ }, "/platform/bans/active": { "get": { - "operationId": "listActiveSessionBans", + "operationId": "listActiveConnectionBans", "tags": [ "bans" ], - "summary": "List active session bans", - "description": "Public Management API. Team keys require `sessions:read`. Project tokens are not accepted.", + "summary": "List active connection bans", + "description": "Public Management API. Team keys require `connections:read`. Project tokens are not accepted.", "x-audience": "public", "x-polymorfa-resource-boundary": "team", "x-excluded-from-public": false, - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "security": [ { "ApiKeyAuth": [] @@ -22109,12 +21947,12 @@ "tags": [ "bansafe" ], - "summary": "List number safety", - "description": "Lists present Health, findings counts, and the active Polymorfa restriction for every number in one project. Health is a 0 to 100 estimate from rules v1 or a validated learned model. It remains null until enough fresh evidence is available.\n\nRequires `sessions:read`. Project tokens only access resources in their own project.", + "summary": "List connection safety", + "description": "Lists present Health, findings counts, and the active Polymorfa restriction for every connection in one project. Health is a 0 to 100 estimate from rules v1 or a validated learned model. It remains null until enough fresh evidence is available.\n\nRequires `connections:read`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "security": [ { "ApiKeyAuth": [] @@ -22185,7 +22023,7 @@ "data": { "type": "array", "items": { - "$ref": "#/components/schemas/BanSafeNumber" + "$ref": "#/components/schemas/BanSafeConnection" } }, "page": { @@ -22215,18 +22053,18 @@ } } }, - "/platform/bansafe/health/{session}": { + "/platform/bansafe/health/{connection}": { "get": { "operationId": "getBanSafeHealth", "tags": [ "bansafe" ], - "summary": "Get number safety", - "description": "Returns one number's present Health estimate and model metadata, retained open and acknowledged findings with their observation times, directly observed account state, the active Polymorfa restriction, and how that restriction lifts. Recorded findings and observed state remain separate from the estimate.\n\nRequires `sessions:read`. Project tokens only access resources in their own project.", + "summary": "Get connection safety", + "description": "Returns one connection's present Health estimate and model metadata, retained open and acknowledged findings with their observation times, directly observed account state, the active Polymorfa restriction, and how that restriction lifts. Recorded findings and observed state remain separate from the estimate.\n\nRequires `connections:read`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "security": [ { "ApiKeyAuth": [] @@ -22237,7 +22075,7 @@ ], "parameters": [ { - "name": "session", + "name": "connection", "in": "path", "required": true, "schema": { @@ -22276,7 +22114,7 @@ "additionalProperties": false, "properties": { "data": { - "$ref": "#/components/schemas/BanSafeNumberDetail" + "$ref": "#/components/schemas/BanSafeConnectionDetail" } }, "required": [ @@ -22301,18 +22139,18 @@ } } }, - "/platform/bansafe/health/{session}/history": { + "/platform/bansafe/health/{connection}/history": { "get": { "operationId": "listBanSafeHealthHistory", "tags": [ "bansafe" ], - "summary": "List number health history", - "description": "Returns the newest Health evaluations since the requested date, up to the limit, ordered oldest to newest. Each point carries its estimator source and version, evidence coverage, reliability, and availability reason.\n\nRequires `sessions:read`. Project tokens only access resources in their own project.", + "summary": "List connection health history", + "description": "Returns the newest Health evaluations since the requested date, up to the limit, ordered oldest to newest. Each point carries its estimator source and version, evidence coverage, reliability, and availability reason.\n\nRequires `connections:read`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "security": [ { "ApiKeyAuth": [] @@ -22323,7 +22161,7 @@ ], "parameters": [ { - "name": "session", + "name": "connection", "in": "path", "required": true, "schema": { @@ -22414,11 +22252,11 @@ "bansafe" ], "summary": "List BanSafe telemetry signals", - "description": "Lists the bounded numeric, boolean, enum, histogram, and error-code aggregate signals that BanSafe can return. The catalogue contains no message content, recipient identifiers, or raw telemetry records.\n\nRequires `sessions:read`. Project tokens only access resources in their own project.", + "description": "Lists the bounded numeric, boolean, enum, histogram, and error-code aggregate signals that BanSafe can return. The catalogue contains no message content, recipient identifiers, or raw telemetry records.\n\nRequires `connections:read`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "security": [ { "ApiKeyAuth": [] @@ -22486,18 +22324,18 @@ } } }, - "/platform/bansafe/telemetry/{session}": { + "/platform/bansafe/telemetry/{connection}": { "get": { "operationId": "getBanSafeTelemetry", "tags": [ "bansafe" ], "summary": "Get latest BanSafe telemetry", - "description": "Returns collection availability and the latest supported telemetry snapshot for one number. Empty collection is reported as not collected, not as a disabled collector.\n\nRequires `sessions:read`. Project tokens only access resources in their own project.", + "description": "Returns collection availability and the latest supported telemetry snapshot for one connection. Empty collection is reported as not collected, not as a disabled collector.\n\nRequires `connections:read`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "security": [ { "ApiKeyAuth": [] @@ -22508,7 +22346,7 @@ ], "parameters": [ { - "name": "session", + "name": "connection", "in": "path", "required": true, "schema": { @@ -22572,18 +22410,18 @@ } } }, - "/platform/bansafe/telemetry/{session}/history": { + "/platform/bansafe/telemetry/{connection}/history": { "get": { "operationId": "listBanSafeTelemetryHistory", "tags": [ "bansafe" ], "summary": "List BanSafe telemetry history", - "description": "Returns the newest supported telemetry snapshots for one number. Signals are fixed-schema safe aggregates with explicit measured state; raw records and identifiers inside them are not returned.\n\nRequires `sessions:read`. Project tokens only access resources in their own project.", + "description": "Returns the newest supported telemetry snapshots for one connection. Signals are fixed-schema safe aggregates with explicit measured state; raw records and identifiers inside them are not returned.\n\nRequires `connections:read`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "security": [ { "ApiKeyAuth": [] @@ -22594,7 +22432,7 @@ ], "parameters": [ { - "name": "session", + "name": "connection", "in": "path", "required": true, "schema": { @@ -22709,11 +22547,11 @@ "bansafe" ], "summary": "List BanSafe collection status", - "description": "Lists telemetry collection freshness for the numbers in one project. Status is derived from ingested records and does not guess whether a collector flag is configured.\n\nRequires `sessions:read`. Project tokens only access resources in their own project.", + "description": "Lists telemetry collection freshness for the connections in one project. Status is derived from ingested records and does not guess whether a collector flag is configured.\n\nRequires `connections:read`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "security": [ { "ApiKeyAuth": [] @@ -22784,7 +22622,7 @@ "data": { "type": "array", "items": { - "$ref": "#/components/schemas/BanSafeCollectionSession" + "$ref": "#/components/schemas/BanSafeCollectionConnection" } }, "page": { @@ -22821,11 +22659,11 @@ "bansafe" ], "summary": "List Health rule actions", - "description": "Lists the durable customer-visible outcomes of project Health rule actions, newest first. Internal leases, retry bookkeeping, runtime identifiers, and free-form outcomes are omitted.\n\nRequires `sessions:read`. Project tokens only access resources in their own project.", + "description": "Lists the durable customer-visible outcomes of project Health rule actions, newest first. Internal leases, retry bookkeeping, runtime identifiers, and free-form outcomes are omitted.\n\nRequires `connections:read`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "security": [ { "ApiKeyAuth": [] @@ -22844,7 +22682,7 @@ } }, { - "name": "session", + "name": "connection", "in": "query", "required": false, "schema": { @@ -22958,11 +22796,11 @@ "bansafe" ], "summary": "List safety findings", - "description": "Lists safety findings across the team, filterable by project, number, status, and severity. Evidence is numbers only and never contains message content or a recipient identifier.\n\nRequires `sessions:read`. Project tokens only access resources in their own project.", + "description": "Lists safety findings across the team, filterable by project, number, status, and severity. Evidence is connections only and never contains message content or a recipient identifier.\n\nRequires `connections:read`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "security": [ { "ApiKeyAuth": [] @@ -22981,7 +22819,7 @@ } }, { - "name": "session", + "name": "connection", "in": "query", "required": false, "schema": { @@ -23200,11 +23038,11 @@ "bansafe" ], "summary": "List number restrictions", - "description": "Lists every number Polymorfa is currently restricting, what the restriction blocks, and the exact condition that lifts it.\n\nRequires `sessions:read`. Project tokens only access resources in their own project.", + "description": "Lists every connection Polymorfa is currently restricting, what the restriction blocks, and the exact condition that lifts it.\n\nRequires `connections:read`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "security": [ { "ApiKeyAuth": [] @@ -23320,14 +23158,14 @@ } } }, - "/console/bansafe/enforcement/{session}/appeal": { + "/console/bansafe/enforcement/{connection}/appeal": { "post": { "operationId": "appealBanSafeEnforcement", "tags": [ "bansafe" ], - "summary": "Appeal a number restriction", - "description": "Files one appeal against a number's restriction. Every open finding on the number must be acknowledged first, otherwise the request is refused with `findings_unacknowledged`. Filing an appeal does not change the restriction. Requires a signed-in team owner, admin, or developer.\n\nRequires a verified dashboard bearer and current team authorization. Team keys and project tokens are not accepted.", + "summary": "Appeal a connection restriction", + "description": "Files one appeal against a connection's restriction. Every open finding on the connection must be acknowledged first, otherwise the request is refused with `findings_unacknowledged`. Filing an appeal does not change the restriction. Requires a signed-in team owner, admin, or developer.\n\nRequires a verified dashboard bearer and current team authorization. Team keys and project tokens are not accepted.", "x-audience": "console", "x-polymorfa-resource-boundary": "team", "x-excluded-from-public": true, @@ -23339,7 +23177,7 @@ ], "parameters": [ { - "name": "session", + "name": "connection", "in": "path", "required": true, "schema": { @@ -23423,11 +23261,11 @@ "bansafe" ], "summary": "List safety incidents", - "description": "Lists the WhatsApp restrictions and customer reports recorded for the team's numbers.\n\nRequires `sessions:read`. Project tokens only access resources in their own project.", + "description": "Lists the WhatsApp restrictions and customer reports recorded for the team's connections.\n\nRequires `connections:read`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "security": [ { "ApiKeyAuth": [] @@ -23446,7 +23284,7 @@ } }, { - "name": "session", + "name": "connection", "in": "query", "required": false, "schema": { @@ -23543,11 +23381,11 @@ "bansafe" ], "summary": "Report a ban", - "description": "Records that WhatsApp restricted or banned one of your numbers. Send the same `Idempotency-Key` to retry safely for the same number; a repeat returns the original report. Reusing the key for a different number returns `422 bansafe_incident_idempotency_scope_conflict`.\n\nRequires `sessions:manage`. Project tokens only access resources in their own project.", + "description": "Records that WhatsApp restricted or banned one of your connections. Send the same `Idempotency-Key` to retry safely for the same connection; a repeat returns the original report. Reusing the key for a different connection returns `422 bansafe_incident_idempotency_scope_conflict`.\n\nRequires `connections:manage`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "security": [ { "ApiKeyAuth": [] @@ -23647,11 +23485,11 @@ "bansafe" ], "summary": "Withdraw a ban report", - "description": "Withdraws a customer report and returns its incident record. Repeating the request returns the closed record. An incident observed from WhatsApp cannot be withdrawn and returns `409 bansafe_incident_not_a_report`. An unknown incident returns 404.\n\nTeam keys require `sessions:manage`. Project tokens are not accepted.", + "description": "Withdraws a customer report and returns its incident record. Repeating the request returns the closed record. An incident observed from WhatsApp cannot be withdrawn and returns `409 bansafe_incident_not_a_report`. An unknown incident returns 404.\n\nTeam keys require `connections:manage`. Project tokens are not accepted.", "x-audience": "public", "x-polymorfa-resource-boundary": "team", "x-excluded-from-public": false, - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "security": [ { "ApiKeyAuth": [] @@ -23736,11 +23574,11 @@ "bansafe" ], "summary": "List Ban Credit claims", - "description": "Lists the Ban Credit claims filed on your numbers, newest first. A claim is filed automatically when a ban is recorded on a number whose plan includes Ban Credit; there is no request to file one.\n\nRequires `sessions:read`. Project tokens only access resources in their own project.", + "description": "Lists the Ban Credit claims filed on your connections, newest first. A claim is filed automatically when a ban is recorded on a connection whose plan includes Ban Credit; there is no request to file one.\n\nRequires `connections:read`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "security": [ { "ApiKeyAuth": [] @@ -23759,7 +23597,7 @@ } }, { - "name": "session", + "name": "connection", "in": "query", "required": false, "schema": { @@ -23874,11 +23712,11 @@ "bansafe" ], "summary": "Get a Ban Credit claim", - "description": "Returns one claim: the 30 days it covers, the credits that number consumed in them, the most the plan returns, what the claim returns, what the ban was attributed to, and the evidence counts behind that.\n\nRequires `sessions:read`. Project tokens only access resources in their own project.", + "description": "Returns one claim: the 30 days it covers, the credits that connection consumed in them, the most the plan returns, what the claim returns, what the ban was attributed to, and the evidence counts behind that.\n\nRequires `connections:read`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "security": [ { "ApiKeyAuth": [] @@ -23960,11 +23798,11 @@ "bansafe" ], "summary": "Get a project's Safe Mode ceiling", - "description": "Returns the most visible sending behaviour any number in this project may use. Every setting is off by default. `entitled` reports whether the plan includes BanSafe Lite, which Safe Mode is part of, and `entitlementReason` gives the reason a raise would be refused.\n\nRequires `sessions:read`. Project tokens only access resources in their own project.", + "description": "Returns the most visible sending behaviour any connection in this project may use. Every setting is off by default. `entitled` reports whether the plan includes BanSafe Lite, which Safe Mode is part of, and `entitlementReason` gives the reason a raise would be refused.\n\nRequires `connections:read`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "security": [ { "ApiKeyAuth": [] @@ -24045,11 +23883,11 @@ "bansafe" ], "summary": "Set a project's Safe Mode ceiling", - "description": "Sets the most visible behaviour any number in this project may use. Send only the settings you want to change. Presence and read receipts are visible to the people these numbers message: turning them on makes a number appear online, exposes last seen subject to the account's privacy settings, and puts blue ticks on incoming messages. Raising a setting requires a plan that includes BanSafe Lite, and lowering one is always allowed. A signed-in caller must be a team owner, admin, or developer.\n\nRequires `sessions:manage`. Project tokens only access resources in their own project.", + "description": "Sets the most visible behaviour any connection in this project may use. Send only the settings you want to change. Presence and read receipts are visible to the people these connections message: turning them on makes a connection appear online, exposes last seen subject to the account's privacy settings, and puts blue ticks on incoming messages. Raising a setting requires a plan that includes BanSafe Lite, and lowering one is always allowed. A signed-in caller must be a team owner, admin, or developer.\n\nRequires `connections:manage`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "security": [ { "ApiKeyAuth": [] @@ -24141,18 +23979,18 @@ } } }, - "/platform/sessions/{sessionId}/safe-mode": { + "/platform/connections/{connectionId}/safe-mode": { "get": { - "operationId": "getNumberSafeMode", + "operationId": "getPlatformConnectionSafeMode", "tags": [ "bansafe" ], - "summary": "Get a number's Safe Mode", - "description": "Returns the project ceiling, this number's override, the policy in force, and what the number last reported it is running. `mismatch` is true when the two differ. `entitled` reports whether the plan includes BanSafe Lite, which Safe Mode is part of, and `entitlementReason` gives the reason a raise would be refused.\n\nRequires `sessions:read`. Project tokens only access resources in their own project.", + "summary": "Get a connection's Safe Mode", + "description": "Returns the project ceiling, this connection's override, the policy in force, and what the connection last reported it is running. `mismatch` is true when the two differ. `entitled` reports whether the plan includes BanSafe Lite, which Safe Mode is part of, and `entitlementReason` gives the reason a raise would be refused.\n\nRequires `connections:read`. Project tokens only access resources in their own project.", "x-audience": "public", - "x-polymorfa-resource-boundary": "session", + "x-polymorfa-resource-boundary": "connection", "x-excluded-from-public": false, - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "security": [ { "ApiKeyAuth": [] @@ -24163,12 +24001,12 @@ ], "parameters": [ { - "name": "sessionId", + "name": "connectionId", "in": "path", "required": true, - "description": "Database session UUID or stable session slug.", + "description": "Database connection UUID or stable connection slug.", "schema": { - "$ref": "#/components/schemas/SessionIdentifier" + "$ref": "#/components/schemas/ConnectionIdentifier" } } ], @@ -24203,7 +24041,7 @@ "additionalProperties": false, "properties": { "data": { - "$ref": "#/components/schemas/SessionSafeMode" + "$ref": "#/components/schemas/ConnectionSafeMode" } }, "required": [ @@ -24228,16 +24066,16 @@ } }, "put": { - "operationId": "updateNumberSafeMode", + "operationId": "updatePlatformConnectionSafeMode", "tags": [ "bansafe" ], - "summary": "Set a number's Safe Mode", - "description": "Sets one number's Safe Mode. Each setting accepts `inherit` to follow the project ceiling. An override may only be equally or more conservative than the ceiling; a more visible value is refused with `safe_mode_exceeds_project_ceiling`. Raising a setting requires a plan that includes BanSafe Lite, and lowering one is always allowed. A signed-in caller must be a team owner, admin, or developer.\n\nRequires `sessions:manage`. Project tokens only access resources in their own project.", + "summary": "Set a connection's Safe Mode", + "description": "Sets one connection's Safe Mode. Each setting accepts `inherit` to follow the project ceiling. An override may only be equally or more conservative than the ceiling; a more visible value is refused with `safe_mode_exceeds_project_ceiling`. Raising a setting requires a plan that includes BanSafe Lite, and lowering one is always allowed. A signed-in caller must be a team owner, admin, or developer.\n\nRequires `connections:manage`. Project tokens only access resources in their own project.", "x-audience": "public", - "x-polymorfa-resource-boundary": "session", + "x-polymorfa-resource-boundary": "connection", "x-excluded-from-public": false, - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "security": [ { "ApiKeyAuth": [] @@ -24248,12 +24086,12 @@ ], "parameters": [ { - "name": "sessionId", + "name": "connectionId", "in": "path", "required": true, - "description": "Database session UUID or stable session slug.", + "description": "Database connection UUID or stable connection slug.", "schema": { - "$ref": "#/components/schemas/SessionIdentifier" + "$ref": "#/components/schemas/ConnectionIdentifier" } } ], @@ -24262,7 +24100,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/UpdateSessionSafeModeInput" + "$ref": "#/components/schemas/UpdateConnectionSafeModeInput" } } } @@ -24298,7 +24136,7 @@ "additionalProperties": false, "properties": { "data": { - "$ref": "#/components/schemas/SessionSafeMode" + "$ref": "#/components/schemas/ConnectionSafeMode" } }, "required": [ @@ -24336,11 +24174,11 @@ "bansafe" ], "summary": "Get a project's warm-up plan", - "description": "Returns whether numbers in this project have a daily allowance, the two settings that shape the ramp, the per-number daily cap it climbs to, and the projected allowance day by day. `entitled` reports whether the plan includes BanSafe Lite, which the warm-up plan is part of.\n\nRequires `sessions:read`. Project tokens only access resources in their own project.", + "description": "Returns whether connections in this project have a daily allowance, the two settings that shape the ramp, the per-connection daily cap it climbs to, and the projected allowance day by day. `entitled` reports whether the plan includes BanSafe Lite, which the warm-up plan is part of.\n\nRequires `connections:read`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "security": [ { "ApiKeyAuth": [] @@ -24421,11 +24259,11 @@ "bansafe" ], "summary": "Set a project's warm-up plan", - "description": "Turns the warm-up plan on or off for a project and sets how long the ramp takes and how many messages a number may send on its first day. Send only the settings you want to change. While the plan is on, a send past a number's allowance is refused with `bansafe_daily_allowance_reached` and campaign recipients are deferred to the next reset. Turning the plan on requires a plan that includes BanSafe Lite; turning it off is always allowed. A signed-in caller must be a team owner, admin, or developer.\n\nRequires `sessions:manage`. Project tokens only access resources in their own project.", + "description": "Turns the warm-up plan on or off for a project and sets how long the ramp takes and how many messages a connection may send on its first day. Send only the settings you want to change. While the plan is on, a send past a connection's allowance is refused with `bansafe_daily_allowance_reached` and campaign recipients are deferred to the next reset. Turning the plan on requires a plan that includes BanSafe Lite; turning it off is always allowed. A signed-in caller must be a team owner, admin, or developer.\n\nRequires `connections:manage`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "security": [ { "ApiKeyAuth": [] @@ -24524,11 +24362,11 @@ "bansafe" ], "summary": "Get a project's health policy", - "description": "Returns the health threshold and the actions configured for numbers in this project. Integration flags report whether email and webhook delivery are ready to use.\n\nRequires `sessions:read`. Project tokens only access resources in their own project.", + "description": "Returns the health threshold and the actions configured for connections in this project. Integration flags report whether email and webhook delivery are ready to use.\n\nRequires `connections:read`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "security": [ { "ApiKeyAuth": [] @@ -24609,11 +24447,11 @@ "bansafe" ], "summary": "Set a project's health policy", - "description": "Replaces the project policy when the supplied version matches the stored version. The rule applies only when an available health estimate is below the threshold; an unavailable estimate triggers no action. Stopping disconnects a session and retains its linked credentials. Logging out requires relinking.\n\nRequires `sessions:manage`. Project tokens only access resources in their own project.", + "description": "Replaces the project policy when the supplied version matches the stored version. The rule applies only when an available health estimate is below the threshold; an unavailable estimate triggers no action. Stopping disconnects a connection and retains its linked credentials. Logging out requires relinking.\n\nRequires `connections:manage`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "security": [ { "ApiKeyAuth": [] @@ -24709,11 +24547,11 @@ "bansafe" ], "summary": "Get a project's Ban Credit evidence setting", - "description": "Returns whether evidence collection about other linked devices is enabled and whether any number in the project has Ban Credit included in its plan. Collection is off until explicitly enabled.\n\nRequires `sessions:read`. Project tokens only access resources in their own project.", + "description": "Returns whether evidence collection about other linked devices is enabled and whether any connection in the project has Ban Credit included in its plan. Collection is off until explicitly enabled.\n\nRequires `connections:read`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "security": [ { "ApiKeyAuth": [] @@ -24794,11 +24632,11 @@ "bansafe" ], "summary": "Set a project's Ban Credit evidence setting", - "description": "Enables or disables collection of counts about other linked devices. Collection never includes messages, recipient identities, or device names. Disabling collection discards stored device evidence. A 503 `propagation_pending` means the setting was stored but a connected number has not confirmed it; retry the request. A signed-in caller must be an team owner, admin, or developer.\n\nRequires `sessions:manage`. Project tokens only access resources in their own project.", + "description": "Enables or disables collection of counts about other linked devices. Collection never includes messages, recipient identities, or device names. Disabling collection discards stored device evidence. A 503 `propagation_pending` means the setting was stored but a connected connection has not confirmed it; retry the request. A signed-in caller must be an team owner, admin, or developer.\n\nRequires `connections:manage`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "security": [ { "ApiKeyAuth": [] @@ -24989,7 +24827,7 @@ "campaigns" ], "summary": "Create campaign", - "description": "Creates a draft campaign on any plan. `messagesArray` holds up to 10 composed messages, with each `delayAfterSec` from 0 to 86400, or 2592000 for a drip. `drip` requires the default-off drip sequences beta (`403 feature_unavailable`). Only an unlaunched draft can change drip settings, except a running or paused continuous drip can close enrollment by setting enrollment to audience with the same exit settings. `senderConfig.sessionIds` may name numbers that are not yet on a plan that includes Campaigns; launch checks the selection. `templateId` must name a template in the campaign's project, and a malformed `variableMapping` answers `400 invalid_parameter` naming the field. It is refused with `403 bansafe_team_suspended` while the team is suspended, `400 invalid_parameter` when `senderConfig.sessionIds` is malformed, and `400 campaign_throughput_capped` when a per-number cap is above its safety ceiling. Setting `trackedLinks` requires the campaign link tracking beta and otherwise answers `403 feature_unavailable`. `variants` and `variantStrategy` make an A/B test, a beta: without enrollment it answers `403 feature_unavailable`, and a template with variants answers `400 invalid_parameter`.\n\nRequires `campaigns:manage`. Project tokens only access resources in their own project.", + "description": "Creates a draft campaign on any plan. `messagesArray` holds up to 10 composed messages, with each `delayAfterSec` from 0 to 86400, or 2592000 for a drip. `drip` requires the default-off drip sequences beta (`403 feature_unavailable`). Only an unlaunched draft can change drip settings, except a running or paused continuous drip can close enrollment by setting enrollment to audience with the same exit settings. `senderConfig.connectionIds` may name connections that are not yet on a plan that includes Campaigns; launch checks the selection. `templateId` must name a template in the campaign's project, and a malformed `variableMapping` answers `400 invalid_parameter` naming the field. It is refused with `403 bansafe_team_suspended` while the team is suspended, `400 invalid_parameter` when `senderConfig.connectionIds` is malformed, and `400 campaign_throughput_capped` when a per-connection cap is above its safety ceiling. Setting `trackedLinks` requires the campaign link tracking beta and otherwise answers `403 feature_unavailable`. `variants` and `variantStrategy` make an A/B test, a beta: without enrollment it answers `403 feature_unavailable`, and a template with variants answers `400 invalid_parameter`.\n\nRequires `campaigns:manage`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, @@ -25392,7 +25230,7 @@ "campaigns" ], "summary": "Launch campaign", - "description": "Starts a draft campaign. It begins sending at `scheduledAt`, or right away when no start time is set. Launch checks the stored sender selection against live plans: `402 campaigns_not_entitled` when a selected number is missing or its plan does not include Campaigns, or when an unselected campaign's project has no such number; `400 invalid_parameter` on `senderConfig.sessionIds` when a selected number is not connected or the selection mixes sending types; `400 campaign_throughput_capped` when a requested throughput is above its ceiling. A segment campaign requires a team API key or signed-in dashboard session; project tokens answer `403 permission_denied`. Both audience betas must be available, otherwise launch answers `403 feature_unavailable`. An audience change while launch is being authorized answers `409 state_conflict`. Segment evaluation that exceeds its time limit also answers `409 state_conflict`; simplify the rules and retry. A launched campaign whose segment was deleted remains launched and cannot be launched again (`409 state_conflict`). A drip without a sendable composed message answers `400 invalid_parameter` on `messagesArray`. Saving a draft does not apply this check. A composed attachment requires a public `media.url` (`400 invalid_parameter`). The template must be complete (`400 invalid_parameter`) and approved on every Cloud API number (`400 template_not_approved`). Every recipient needs a value or fallback for each variable (`422 campaign_variables_missing`); `skipMissingVariables: true` skips those recipients before the first send. A message that references a `{{link:}}` the campaign does not define, or tracked links on a campaign that would send from Official API numbers, answers `400 invalid_parameter` on `trackedLinks`; tracked links without the campaign link tracking beta answer `403 feature_unavailable`. `409` means the campaign is not a draft, is already launched and waiting for its start time, or its sending numbers changed during the launch. When the team requires approval above a recipient threshold and the launch would send to more recipients, a launch by anyone other than a team owner or admin signed in to the console answers `409 campaign_approval_required`, sends nothing, and records a pending approval request that `GET /platform/campaigns/{campaignId}/approvals` lists. Launching again with the campaign unchanged returns the same request. A launch requested by an AI agent through the hosted MCP server is held the same way, whatever the threshold.\n\nRequires `campaigns:manage`. Project tokens only access resources in their own project.", + "description": "Starts a draft campaign. It begins sending at `scheduledAt`, or right away when no start time is set. Launch checks the stored sender selection against live plans: `402 campaigns_not_entitled` when a selected connection is missing or its plan does not include Campaigns, or when an unselected campaign's project has no such number; `400 invalid_parameter` on `senderConfig.connectionIds` when a selected connection is not connected or the selection mixes sending types; `400 campaign_throughput_capped` when a requested throughput is above its ceiling. A segment campaign requires a team API key or signed-in dashboard session; project tokens answer `403 permission_denied`. Both audience betas must be available, otherwise launch answers `403 feature_unavailable`. An audience change while launch is being authorized answers `409 state_conflict`. Segment evaluation that exceeds its time limit also answers `409 state_conflict`; simplify the rules and retry. A launched campaign whose segment was deleted remains launched and cannot be launched again (`409 state_conflict`). A drip without a sendable composed message answers `400 invalid_parameter` on `messagesArray`. Saving a draft does not apply this check. A composed attachment requires a public `media.url` (`400 invalid_parameter`). The template must be complete (`400 invalid_parameter`) and approved on every Cloud API connection (`400 template_not_approved`). Every recipient needs a value or fallback for each variable (`422 campaign_variables_missing`); `skipMissingVariables: true` skips those recipients before the first send. A message that references a `{{link:}}` the campaign does not define, or tracked links on a campaign that would send from Official API connections, answers `400 invalid_parameter` on `trackedLinks`; tracked links without the campaign link tracking beta answer `403 feature_unavailable`. `409` means the campaign is not a draft, is already launched and waiting for its start time, or its sending connections changed during the launch. When the team requires approval above a recipient threshold and the launch would send to more recipients, a launch by anyone other than a team owner or admin signed in to the console answers `409 campaign_approval_required`, sends nothing, and records a pending approval request that `GET /platform/campaigns/{campaignId}/approvals` lists. Launching again with the campaign unchanged returns the same request. A launch requested by an AI agent through the hosted MCP server is held the same way, whatever the threshold.\n\nRequires `campaigns:manage`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, @@ -25572,7 +25410,7 @@ } }, "503": { - "description": "`idempotency_replay_unavailable`: the recorded response cannot be read. The original request is not run again, and its execution fence remains in place. Keep the first response; do not switch keys to resend. The selected numbers' plans can also fail to be checked (`service_unavailable`), before anything is launched or saved.", + "description": "`idempotency_replay_unavailable`: the recorded response cannot be read. The original request is not run again, and its execution fence remains in place. Keep the first response; do not switch keys to resend. The selected connections' plans can also fail to be checked (`service_unavailable`), before anything is launched or saved.", "headers": { "X-Request-Id": { "schema": { @@ -26756,7 +26594,7 @@ "campaigns" ], "summary": "Send a test of a draft campaign", - "description": "Requires campaigns:manage and campaigns:read because the test can use stored recipient samples. Sends one copy of a draft campaign's content to a seed recipient, through the same rendering, sending and BanSafe checks as a launched campaign. The seed recipient must be a number connected to your team. The sending number must be connected, on a plan that includes Campaigns and, when the campaign selects numbers, one of them. A test is not a campaign recipient and is not counted in the campaign's statistics or webhooks. A team can send 20 tests an hour, and at most 5 an hour to one seed recipient. `429` means one of these limits was reached or BanSafe is pacing the sending number; follow `Retry-After`. `409 bansafe_cold_held` means the seed recipient has never written to the sending number and the campaign holds first messages. `409 state_conflict` means the campaign is not a draft or has A/B or weighted content alternatives, the sending number is a Hybrid Link number, or the seed recipient opted out. `504 result_unknown` means the outcome was not received in time and the test may still arrive. Send `projectId` in the body when using a team API key. `422 campaign_variables_missing` means the test's sample values, the mapped recipient value and the fallback all leave a variable in the campaign content empty.\n\nRequires `campaigns:manage` and `campaigns:read`. Project tokens only access resources in their own project.", + "description": "Requires campaigns:manage and campaigns:read because the test can use stored recipient samples. Sends one copy of a draft campaign's content to a seed recipient, through the same rendering, sending and BanSafe checks as a launched campaign. The seed recipient must be the phone of a Connection connected to your team. The sending connection must be connected, on a plan that includes Campaigns and, when the campaign selects connections, one of them. A test is not a campaign recipient and is not counted in the campaign's statistics or webhooks. A team can send 20 tests an hour, and at most 5 an hour to one seed recipient. `429` means one of these limits was reached or BanSafe is pacing the sending connection; follow `Retry-After`. `409 bansafe_cold_held` means the seed recipient has never written to the sending connection and the campaign holds first messages. `409 state_conflict` means the campaign is not a draft or has A/B or weighted content alternatives, the sending connection is a Hybrid Link connection, or the seed recipient opted out. `504 result_unknown` means the outcome was not received in time and the test may still arrive. Send `projectId` in the body when using a team API key. `422 campaign_variables_missing` means the test's sample values, the mapped recipient value and the fallback all leave a variable in the campaign content empty.\n\nRequires `campaigns:manage` and `campaigns:read`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, @@ -26916,7 +26754,7 @@ "$ref": "#/components/responses/UpstreamFailure" }, "503": { - "description": "`idempotency_replay_unavailable`: the recorded response cannot be read. The original request is not run again, and its execution fence remains in place. Keep the first response; do not switch keys to resend. The send path can also be unavailable before a send (`session_not_ready`, `command_dispatch_failed`, `service_unavailable`, or `bansafe_accounting_unavailable`).", + "description": "`idempotency_replay_unavailable`: the recorded response cannot be read. The original request is not run again, and its execution fence remains in place. Keep the first response; do not switch keys to resend. The send path can also be unavailable before a send (`connection_not_ready`, `command_dispatch_failed`, `service_unavailable`, or `bansafe_accounting_unavailable`).", "headers": { "X-Request-Id": { "schema": { @@ -26966,7 +26804,7 @@ "campaigns" ], "summary": "Create campaign reply flow", - "description": "Creates an immutable reply flow revision: the steps a campaign runs when a recipient replies. Each step can send a text, reply buttons, a list, or a Flow form (Official numbers only), and branches on the button or list row chosen, an exact keyword, or a Flow form submission. Beta: returns `403` unless campaign reply flows are enabled for the team. `409` means this flow key and revision already exist.\n\nRequires `campaigns:manage`. Project tokens only access resources in their own project.", + "description": "Creates an immutable reply flow revision: the steps a campaign runs when a recipient replies. Each step can send a text, reply buttons, a list, or a Flow form (Official connections only), and branches on the button or list row chosen, an exact keyword, or a Flow form submission. Beta: returns `403` unless campaign reply flows are enabled for the team. `409` means this flow key and revision already exist.\n\nRequires `campaigns:manage`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, @@ -28270,7 +28108,7 @@ "campaigns" ], "summary": "Approve a campaign launch", - "description": "Approves a pending request and runs its `action` in the same step: launches the campaign, resumes it, or moves its start. The action runs every check it would run on its own again and is bound to the request: if the campaign's content, sending numbers, schedule, template or frozen audience changed since the request, or the request is no longer pending, nothing is sent and the answer is `409 campaign_approval_stale`. A requested start time that has already passed starts the campaign when approved. A request can be approved once.\n\nRequires a verified dashboard bearer and current team authorization. The signed-in member must be a team owner or admin. Team keys and project tokens are not accepted.", + "description": "Approves a pending request and runs its `action` in the same step: launches the campaign, resumes it, or moves its start. The action runs every check it would run on its own again and is bound to the request: if the campaign's content, sending connections, schedule, template or frozen audience changed since the request, or the request is no longer pending, nothing is sent and the answer is `409 campaign_approval_stale`. A requested start time that has already passed starts the campaign when approved. A request can be approved once.\n\nRequires a verified dashboard bearer and current team authorization. The signed-in member must be a team owner or admin. Team keys and project tokens are not accepted.", "x-audience": "console", "x-polymorfa-resource-boundary": "human_only", "x-excluded-from-public": true, @@ -28891,7 +28729,7 @@ "audiences" ], "summary": "Create an audience", - "description": "Creates an audience from inline `members` (at most 1,000) or from an uploaded CSV file (`fileId` + `mapping`). Numbers are normalized to E.164 and repeated numbers are kept once. A file import accepts at most 100,000 data rows; a larger file is refused with `413` and must be split. The response reports how many rows were invalid, with up to 20 samples. `recipientCount` is the number of stored members; any client-supplied count is ignored. If your team deleted an audience profile for one of these numbers in the last 30 days, the request returns `409` naming the row (numbered as in `invalidRows`), and nothing is added.\n\nTeam keys require `campaigns:manage`. Project tokens are not accepted.", + "description": "Creates an audience from inline `members` (at most 1,000) or from an uploaded CSV file (`fileId` + `mapping`). Phone numbers are normalized to E.164 and repeated phone numbers are kept once. A file import accepts at most 100,000 data rows; a larger file is refused with `413` and must be split. The response reports how many rows were invalid, with up to 20 samples. `recipientCount` is the number of stored members; any client-supplied count is ignored. If your team deleted an audience profile for one of these phone numbers in the last 30 days, the request returns `409` naming the row (numbered as in `invalidRows`), and nothing is added.\n\nTeam keys require `campaigns:manage`. Project tokens are not accepted.", "x-audience": "public", "x-polymorfa-resource-boundary": "team", "x-excluded-from-public": false, @@ -29011,7 +28849,7 @@ "audiences" ], "summary": "Create an audience from a campaign", - "description": "Creates an audience from the recipients of a previous campaign that had one `outcome`, to send them a follow-up campaign. The members are a snapshot taken when the request runs: later receipts, reads or replies on the source campaign do not change the audience. Numbers on the team's opt-out list are left out and counted in `optedOutCount`; each member keeps the template variables it had on the source campaign. Outcomes: `delivered` (the device confirmed delivery), `not_delivered` (sent, with no delivery confirmation), `read`, `not_read` (sent and not read, including sends never delivered), `replied`, `not_replied` (sent and no reply was attributed), and `failed` (confirmed failed sends; sends whose outcome is uncertain, such as a timeout waiting for WhatsApp, are excluded). Read outcomes depend on the recipient's read receipts. `404` means the campaign is not in your team (or not in `projectId` when given); `409` means no recipient that is not opted out has the outcome, and nothing is created.\n\nTeam keys require `campaigns:manage`. Project tokens are not accepted.", + "description": "Creates an audience from the recipients of a previous campaign that had one `outcome`, to send them a follow-up campaign. The members are a snapshot taken when the request runs: later receipts, reads or replies on the source campaign do not change the audience. Phone numbers on the team's opt-out list are left out and counted in `optedOutCount`; each member keeps the template variables it had on the source campaign. Outcomes: `delivered` (the device confirmed delivery), `not_delivered` (sent, with no delivery confirmation), `read`, `not_read` (sent and not read, including sends never delivered), `replied`, `not_replied` (sent and no reply was attributed), and `failed` (confirmed failed sends; sends whose outcome is uncertain, such as a timeout waiting for WhatsApp, are excluded). Read outcomes depend on the recipient's read receipts. `404` means the campaign is not in your team (or not in `projectId` when given); `409` means no recipient that is not opted out has the outcome, and nothing is created.\n\nTeam keys require `campaigns:manage`. Project tokens are not accepted.", "x-audience": "public", "x-polymorfa-resource-boundary": "team", "x-excluded-from-public": false, @@ -29356,7 +29194,7 @@ "audiences" ], "summary": "Add audience members", - "description": "Adds up to 1,000 members to an audience. A number already in the audience is skipped. Invalid entries are reported, not added. If your team deleted an audience profile for one of these numbers in the last 30 days, the request returns `409` naming the row (numbered as in `invalidRows`), and nothing is added.\n\nTeam keys require `campaigns:manage`. Project tokens are not accepted.", + "description": "Adds up to 1,000 members to an audience. A number already in the audience is skipped. Invalid entries are reported, not added. If your team deleted an audience profile for one of these phone numbers in the last 30 days, the request returns `409` naming the row (numbered as in `invalidRows`), and nothing is added.\n\nTeam keys require `campaigns:manage`. Project tokens are not accepted.", "x-audience": "public", "x-polymorfa-resource-boundary": "team", "x-excluded-from-public": false, @@ -32571,11 +32409,11 @@ "flows" ], "summary": "List Flow drafts", - "description": "Lists compact WhatsApp Flow draft summaries in one project.\n\nRequires `sessions:read`. Project tokens only access resources in their own project.", + "description": "Lists compact WhatsApp Flow draft summaries in one project.\n\nRequires `connections:read`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "security": [ { "ApiKeyAuth": [] @@ -32659,11 +32497,11 @@ "flows" ], "summary": "Create a Flow draft", - "description": "Creates a project-scoped WhatsApp Flow draft. A supplied draftId makes retries idempotent.\n\nRequires `sessions:manage`. Project tokens only access resources in their own project.", + "description": "Creates a project-scoped WhatsApp Flow draft. A supplied draftId makes retries idempotent.\n\nRequires `connections:manage`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "security": [ { "ApiKeyAuth": [] @@ -32745,11 +32583,11 @@ "flows" ], "summary": "Get a Flow draft", - "description": "Gets one project-scoped WhatsApp Flow draft.\n\nRequires `sessions:read`. Project tokens only access resources in their own project.", + "description": "Gets one project-scoped WhatsApp Flow draft.\n\nRequires `connections:read`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "security": [ { "ApiKeyAuth": [] @@ -32843,11 +32681,11 @@ "flows" ], "summary": "Update a Flow draft", - "description": "Updates a Flow draft when expectedUpdatedAt matches the stored revision.\n\nRequires `sessions:manage`. Project tokens only access resources in their own project.", + "description": "Updates a Flow draft when expectedUpdatedAt matches the stored revision.\n\nRequires `connections:manage`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "security": [ { "ApiKeyAuth": [] @@ -32940,11 +32778,11 @@ "flows" ], "summary": "Delete a Flow draft", - "description": "Deletes a local Flow draft without deleting linked Meta Flow assets.\n\nRequires `sessions:manage`. Project tokens only access resources in their own project.", + "description": "Deletes a local Flow draft without deleting linked Meta Flow assets.\n\nRequires `connections:manage`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "security": [ { "ApiKeyAuth": [] @@ -33033,12 +32871,12 @@ "tags": [ "flows" ], - "summary": "Upload a Flow to a Number", - "description": "Sends the saved Flow draft to the WhatsApp Business Account of one Number. The first upload to a Number, or the first upload after the Number's Flow was deprecated, creates a WhatsApp Flow and needs `categories`; later uploads replace the JSON of that Flow while it is still a WhatsApp draft. The response lists the validation errors WhatsApp reported, and `uploadState` is `valid` only when there are none. The Number needs an active WhatsApp Business Platform connection and the Cloud onboarding beta; test Numbers use the simulation. A Flow with `data_api_version` needs an enabled data endpoint for the Number (see Configure a Flow's data endpoint); its endpoint URI is attached during the upload. Test Numbers cannot use data endpoints. A supplied `requestId` makes retries return the original operation instead of sending again.\n\nRequires `sessions:manage`. Project tokens only access resources in their own project.", + "summary": "Upload a Flow to a Connection", + "description": "Sends the saved Flow draft to the WhatsApp Business Account of one Connection. The first upload to a Connection, or the first upload after the Connection's Flow was deprecated, creates a WhatsApp Flow and needs `categories`; later uploads replace the JSON of that Flow while it is still a WhatsApp draft. The response lists the validation errors WhatsApp reported, and `uploadState` is `valid` only when there are none. The Connection needs an active WhatsApp Business Platform method and the Cloud onboarding beta; test Connections use the simulation. A Flow with `data_api_version` needs an enabled data endpoint for the Connection (see Configure a Flow's data endpoint); its endpoint URI is attached during the upload. Test Connections cannot use data endpoints. A supplied `requestId` makes retries return the original operation instead of sending again.\n\nRequires `connections:manage`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "security": [ { "ApiKeyAuth": [] @@ -33138,12 +32976,12 @@ "tags": [ "flows" ], - "summary": "Publish a Flow on a Number", - "description": "Publishes the Number's WhatsApp Flow. The last upload must match the saved draft, and for a Flow with a data endpoint the endpoint's current URI, and have no validation errors. A published Flow cannot be changed or deleted; it can only be deprecated. The Flow counts as published only after WhatsApp confirms it: when the response is lost, the operation state is `uncertain` until a provider read settles it, and publishing is never sent twice.\n\nRequires `sessions:manage`. Project tokens only access resources in their own project.", + "summary": "Publish a Flow on a Connection", + "description": "Publishes the Connection's WhatsApp Flow. The last upload must match the saved draft, and for a Flow with a data endpoint the endpoint's current URI, and have no validation errors. A published Flow cannot be changed or deleted; it can only be deprecated. The Flow counts as published only after WhatsApp confirms it: when the response is lost, the operation state is `uncertain` until a provider read settles it, and publishing is never sent twice.\n\nRequires `connections:manage`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "security": [ { "ApiKeyAuth": [] @@ -33243,12 +33081,12 @@ "tags": [ "flows" ], - "summary": "Deprecate a Flow on a Number", - "description": "Deprecates the Number's published WhatsApp Flow so it can no longer be sent. Deprecation cannot be undone; upload the draft again to create a new WhatsApp Flow. It remains available while the team's service is restricted.\n\nRequires `sessions:manage`. Project tokens only access resources in their own project.", + "summary": "Deprecate a Flow on a Connection", + "description": "Deprecates the Connection's published WhatsApp Flow so it can no longer be sent. Deprecation cannot be undone; upload the draft again to create a new WhatsApp Flow. It remains available while the team's service is restricted.\n\nRequires `connections:manage`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "security": [ { "ApiKeyAuth": [] @@ -33345,12 +33183,12 @@ "tags": [ "flows" ], - "summary": "Delete a Flow from a Number", - "description": "Deletes the Number's WhatsApp Flow while it is still a WhatsApp draft and removes the Number's link. The saved Polymorfa draft is kept. A Flow that was published cannot be deleted; deprecate it instead.\n\nRequires `sessions:manage`. Project tokens only access resources in their own project.", + "summary": "Delete a Flow from a Connection", + "description": "Deletes the Connection's WhatsApp Flow while it is still a WhatsApp draft and removes the Connection's link. The saved Polymorfa draft is kept. A Flow that was published cannot be deleted; deprecate it instead.\n\nRequires `connections:manage`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "security": [ { "ApiKeyAuth": [] @@ -33447,12 +33285,12 @@ "tags": [ "flows" ], - "summary": "Sync a Flow's status from a Number", - "description": "Reads the Number's WhatsApp Flow status, validation errors and preview link, and settles an earlier operation whose outcome was unknown. It never repeats a change.\n\nRequires `sessions:manage`. Project tokens only access resources in their own project.", + "summary": "Sync a Flow's status from a Connection", + "description": "Reads the Connection's WhatsApp Flow status, validation errors and preview link, and settles an earlier operation whose outcome was unknown. It never repeats a change.\n\nRequires `connections:manage`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "security": [ { "ApiKeyAuth": [] @@ -33550,11 +33388,11 @@ "flows" ], "summary": "List a Flow's provider operations", - "description": "Lists up to 50 recent upload, publish, deprecate and delete operations for a Flow draft across Numbers, newest first.\n\nRequires `sessions:read`. Project tokens only access resources in their own project.", + "description": "Lists up to 50 recent upload, publish, deprecate and delete operations for a Flow draft across Connections, newest first.\n\nRequires `connections:read`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "security": [ { "ApiKeyAuth": [] @@ -33647,12 +33485,12 @@ "tags": [ "flows" ], - "summary": "Get a Flow's data endpoint on a Number", - "description": "Returns the data endpoint configured for a Flow on one Number, the endpoint URI WhatsApp calls, and the Number's Flow encryption custody. `endpoint` is null when none is configured.\n\nRequires `sessions:read`. Project tokens only access resources in their own project.", + "summary": "Get a Flow's data endpoint on a Connection", + "description": "Returns the data endpoint configured for a Flow on one Connection, the endpoint URI WhatsApp calls, and the Connection's Flow encryption custody. `endpoint` is null when none is configured.\n\nRequires `connections:read`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "security": [ { "ApiKeyAuth": [] @@ -33679,7 +33517,7 @@ } }, { - "name": "sessionId", + "name": "connectionId", "in": "query", "required": true, "schema": { @@ -33750,12 +33588,12 @@ "tags": [ "flows" ], - "summary": "Configure a Flow's data endpoint on a Number", - "description": "Creates or replaces the data endpoint of a dynamic Flow on one Number. `forward` decrypts each WhatsApp request with the Number's Polymorfa-managed key and forwards the request JSON to your HTTPS `url`, signed with `X-Polymorfa-Flow-Signature`; your JSON response is encrypted and returned to WhatsApp. `function` runs a deployed Function with the request JSON as the body. `direct` attaches your own `url` and requires your own encryption key on the Number; Polymorfa never decrypts that traffic. A new forward endpoint, a switch to forward and `rotateSigningSecret` return `signingSecret` once. Upload the Flow after configuring its endpoint so the endpoint URI is attached. Request and response contents are never stored.\n\nRequires `sessions:manage`. Project tokens only access resources in their own project.", + "summary": "Configure a Flow's data endpoint on a Connection", + "description": "Creates or replaces the data endpoint of a dynamic Flow on one Connection. `forward` decrypts each WhatsApp request with the Connection's Polymorfa-managed key and forwards the request JSON to your HTTPS `url`, signed with `X-Polymorfa-Flow-Signature`; your JSON response is encrypted and returned to WhatsApp. `function` runs a deployed Function with the request JSON as the body. `direct` attaches your own `url` and requires your own encryption key on the Connection; Polymorfa never decrypts that traffic. A new forward endpoint, a switch to forward and `rotateSigningSecret` return `signingSecret` once. Upload the Flow after configuring its endpoint so the endpoint URI is attached. Request and response contents are never stored.\n\nRequires `connections:manage`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "security": [ { "ApiKeyAuth": [] @@ -33853,12 +33691,12 @@ "tags": [ "flows" ], - "summary": "Remove a Flow's data endpoint on a Number", - "description": "Removes the endpoint configuration. Requests to its URI are refused afterwards. Receipts are kept.\n\nRequires `sessions:manage`. Project tokens only access resources in their own project.", + "summary": "Remove a Flow's data endpoint on a Connection", + "description": "Removes the endpoint configuration. Requests to its URI are refused afterwards. Receipts are kept.\n\nRequires `connections:manage`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "security": [ { "ApiKeyAuth": [] @@ -33885,7 +33723,7 @@ } }, { - "name": "sessionId", + "name": "connectionId", "in": "query", "required": true, "schema": { @@ -33956,11 +33794,11 @@ "flows" ], "summary": "List a Flow's data endpoint receipts", - "description": "Lists up to 100 recent data-exchange receipts for a Flow, newest first. Receipts record the action, outcome, HTTP status returned to WhatsApp, an error code and timing. They never contain form data, Flow tokens or responses.\n\nRequires `sessions:read`. Project tokens only access resources in their own project.", + "description": "Lists up to 100 recent data-exchange receipts for a Flow, newest first. Receipts record the action, outcome, HTTP status returned to WhatsApp, an error code and timing. They never contain form data, Flow tokens or responses.\n\nRequires `connections:read`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "security": [ { "ApiKeyAuth": [] @@ -33987,7 +33825,7 @@ } }, { - "name": "sessionId", + "name": "connectionId", "in": "query", "required": false, "schema": { @@ -34072,12 +33910,12 @@ "tags": [ "flow-encryption-keys" ], - "summary": "Get a Number's Flow encryption custody", - "description": "Returns whether Polymorfa holds the Number's active Flow encryption key (`managed`) or not (`customer`), and recent managed keys. Private keys are never returned.\n\nRequires `sessions:read`. Project tokens only access resources in their own project.", + "summary": "Get a Connection's Flow encryption custody", + "description": "Returns whether Polymorfa holds the Connection's active Flow encryption key (`managed`) or not (`customer`), and recent managed keys. Private keys are never returned.\n\nRequires `connections:read`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "security": [ { "ApiKeyAuth": [] @@ -34096,7 +33934,7 @@ } }, { - "name": "sessionId", + "name": "connectionId", "in": "query", "required": true, "schema": { @@ -34169,12 +34007,12 @@ "tags": [ "flow-encryption-keys" ], - "summary": "Rotate a Number's managed Flow encryption key", - "description": "Generates a 2048-bit RSA key pair, keeps the private key sealed, and registers the public key with WhatsApp for the Number. Every dynamic Flow on the Number uses this key. The previous managed key keeps decrypting for 24 hours. A lost WhatsApp response is settled by reading the registered key; the key is `uncertain` until then and is never registered twice.\n\nRequires `sessions:manage`. Project tokens only access resources in their own project.", + "summary": "Rotate a Connection's managed Flow encryption key", + "description": "Generates a 2048-bit RSA key pair, keeps the private key sealed, and registers the public key with WhatsApp for the Connection. Every dynamic Flow on the Connection uses this key. The previous managed key keeps decrypting for 24 hours. A lost WhatsApp response is settled by reading the registered key; the key is `uncertain` until then and is never registered twice.\n\nRequires `connections:manage`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "security": [ { "ApiKeyAuth": [] @@ -34622,7 +34460,7 @@ "optouts" ], "summary": "Update opt-out keyword settings", - "description": "Replaces the team's keyword opt-out settings. When enabled, a direct text reply whose whole body matches an opt-out keyword, from a number that received a campaign message from the team in the last 30 days, adds that number to the opt-out list with source `stop-keyword` and emits `contact.opted_out`. Matching ignores letter case and surrounding punctuation and whitespace. An opt-in keyword removes only an opt-out created this way and emits `contact.opted_in`; opt-outs added manually, by file or through the API are never removed by a reply. Each list holds at most 50 keywords of 1 to 32 characters, the opt-out list needs at least one keyword, and the two lists must not share a keyword. Keywords are stored in upper case. Changes apply to replies within 30 seconds.\n\nTeam keys require `campaigns:manage`. Project tokens are not accepted.", + "description": "Replaces the team's keyword opt-out settings. When enabled, a direct text reply whose whole body matches an opt-out keyword, from a phone number that received a campaign message from the team in the last 30 days, adds that phone number to the opt-out list with source `stop-keyword` and emits `contact.opted_out`. Matching ignores letter case and surrounding punctuation and whitespace. An opt-in keyword removes only an opt-out created this way and emits `contact.opted_in`; opt-outs added manually, by file or through the API are never removed by a reply. Each list holds at most 50 keywords of 1 to 32 characters, the opt-out list needs at least one keyword, and the two lists must not share a keyword. Keywords are stored in upper case. Changes apply to replies within 30 seconds.\n\nTeam keys require `campaigns:manage`. Project tokens are not accepted.", "x-audience": "public", "x-polymorfa-resource-boundary": "team", "x-excluded-from-public": false, @@ -34776,7 +34614,7 @@ "optouts" ], "summary": "Update STOP confirmation settings", - "description": "Replaces the team's preference using the observed revision. Enabling requires STOP confirmations beta access and a selected locale. A team owner or admin can also change it in the console. A new STOP opt-out queues at most one plain acknowledgement from the receiving connection; manual opt-outs, repeated STOP while suppressed and START produce none. A confirmation cannot undo suppression. Disabling remains available after beta withdrawal and cancels queued acknowledgements. A changed revision returns 409. Unknown send outcomes are never resent with a new operation identity.\n\nTeam keys require `campaigns:manage`. Project tokens are not accepted.", + "description": "Replaces the team's preference using the observed revision. Enabling requires STOP confirmations beta access and a selected locale. A team owner or admin can also change it in the console. A new STOP opt-out queues at most one plain acknowledgement from the receiving method; manual opt-outs, repeated STOP while suppressed and START produce none. A confirmation cannot undo suppression. Disabling remains available after beta withdrawal and cancels queued acknowledgements. A changed revision returns 409. Unknown send outcomes are never resent with a new operation identity.\n\nTeam keys require `campaigns:manage`. Project tokens are not accepted.", "x-audience": "public", "x-polymorfa-resource-boundary": "team", "x-excluded-from-public": false, @@ -35191,7 +35029,7 @@ "billing" ], "summary": "Read a resource's limit and priority", - "description": "Reads one project, customer or real number without loading the team directory. Requires a team key with the stated billing scope, or a signed-in team owner or admin. Project and client credentials cannot access these controls. Billing must be configured. Writes require Pay-As-You-Go. These controls never enable charging of unpriced usage.\n\nTeam keys require `billing:read`. Project tokens are not accepted.", + "description": "Reads one project, customer or real connection without loading the team directory. Requires a team key with the stated billing scope, or a signed-in team owner or admin. Project and client credentials cannot access these controls. Billing must be configured. Writes require Pay-As-You-Go. These controls never enable charging of unpriced usage.\n\nTeam keys require `billing:read`. Project tokens are not accepted.", "x-audience": "public", "x-polymorfa-resource-boundary": "team", "x-excluded-from-public": false, @@ -35439,7 +35277,7 @@ "billing" ], "summary": "Read monthly spending limits", - "description": "Reads attributed charges and active reservations in Polymorfa credits. Months reset at 00:00 UTC on the first day. Omit projectId for project limits across the team; pass it to include that project's customer and number limits. Pass scope=project to read only project limits. Requires a team key with the stated billing scope, or a signed-in team owner or admin. Project and client credentials cannot access these controls. Billing must be configured. Writes require Pay-As-You-Go. These controls never enable charging of unpriced usage.\n\nTeam keys require `billing:read`. Project tokens are not accepted.", + "description": "Reads attributed charges and active reservations in Polymorfa credits. Months reset at 00:00 UTC on the first day. Omit projectId for project limits across the team; pass it to include that project's customer and connection limits. Pass scope=project to read only project limits. Requires a team key with the stated billing scope, or a signed-in team owner or admin. Project and client credentials cannot access these controls. Billing must be configured. Writes require Pay-As-You-Go. These controls never enable charging of unpriced usage.\n\nTeam keys require `billing:read`. Project tokens are not accepted.", "x-audience": "public", "x-polymorfa-resource-boundary": "team", "x-excluded-from-public": false, @@ -35684,7 +35522,7 @@ "billing" ], "summary": "Read funding priorities", - "description": "Lists active projects, customers and real numbers. Pass scope=project to read only project ranks. Pass projectId to read one project and its customer/number leaderboard. Project priority takes precedence. Within a project, numbers inherit their customer priority; a higher number priority overrides it. Number priority then breaks ties before renewal due time and stable number identity. Numbers are ranked within a project. Requires a team key with the stated billing scope, or a signed-in team owner or admin. Project and client credentials cannot access these controls. Billing must be configured. Writes require Pay-As-You-Go. These controls never enable charging of unpriced usage.\n\nTeam keys require `billing:read`. Project tokens are not accepted.", + "description": "Lists active projects, customers and real connections. Pass scope=project to read only project ranks. Pass projectId to read one project and its customer/connection leaderboard. Project priority takes precedence. Within a project, connections inherit their customer priority; a higher connection priority overrides it. Connection priority then breaks ties before renewal due time and stable connection identity. Connections are ranked within a project. Requires a team key with the stated billing scope, or a signed-in team owner or admin. Project and client credentials cannot access these controls. Billing must be configured. Writes require Pay-As-You-Go. These controls never enable charging of unpriced usage.\n\nTeam keys require `billing:read`. Project tokens are not accepted.", "x-audience": "public", "x-polymorfa-resource-boundary": "team", "x-excluded-from-public": false, @@ -35783,7 +35621,7 @@ "billing" ], "summary": "Reorder funding priorities", - "description": "resourceIds is the complete list in highest-first order. Project order includes every active project; customer and number orders include every active customer or real number in projectId. Use scope=resource with projectId and a complete resources array of {scope: customer or number, resourceId} for one mixed leaderboard. Saves the whole order atomically. Concurrent changes or an incomplete list return 409. Retrying the same successful order is harmless. Requires a team key with the stated billing scope, or a signed-in team owner or admin. Project and client credentials cannot access these controls. Billing must be configured. Writes require Pay-As-You-Go. These controls never enable charging of unpriced usage.\n\nTeam keys require `billing:manage`. Project tokens are not accepted.", + "description": "resourceIds is the complete list in highest-first order. Project order includes every active project; customer and connection orders include every active customer or real connection in projectId. Use scope=resource with projectId and a complete resources array of {scope: customer or connection, resourceId} for one mixed leaderboard. Saves the whole order atomically. Concurrent changes or an incomplete list return 409. Retrying the same successful order is harmless. Requires a team key with the stated billing scope, or a signed-in team owner or admin. Project and client credentials cannot access these controls. Billing must be configured. Writes require Pay-As-You-Go. These controls never enable charging of unpriced usage.\n\nTeam keys require `billing:manage`. Project tokens are not accepted.", "x-audience": "public", "x-polymorfa-resource-boundary": "team", "x-excluded-from-public": false, @@ -36130,11 +35968,11 @@ "usage" ], "summary": "Get usage", - "description": "Returns metered usage for one calendar month (UTC), by meter and by number. Omit `period` for the current month. Usage is measured, not charged: `billingEnabled` is false and no credits are deducted for it. A project token reads its own project; `session` narrows to one number.\n\nRequires `sessions:read`. Project tokens only access resources in their own project.", + "description": "Returns metered usage for one calendar month (UTC), by meter and by connection. Omit `period` for the current month. Usage is measured, not charged: `billingEnabled` is false and no credits are deducted for it. A project token reads its own project; `connection` narrows to one connection.\n\nRequires `connections:read`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "security": [ { "ApiKeyAuth": [] @@ -36154,14 +35992,14 @@ } }, { - "name": "session", + "name": "connection", "in": "query", "required": false, "schema": { "type": "string", "minLength": 1, "maxLength": 128, - "description": "Number (session name)." + "description": "Connection (connection name)." } }, { @@ -36235,11 +36073,11 @@ "usage" ], "summary": "List usage records", - "description": "Lists usage records, newest first. Filter by project, number (`session`), call (`callId`), meter or calendar month; without `period`, records from every month are listed. A call has one `call.duration` record, and an outgoing Cloud API call also a `call.cloud_pulses` record. Pass `nextCursor` as `cursor` to read the next page with the same filters.\n\nRequires `sessions:read`. Project tokens only access resources in their own project.", + "description": "Lists usage records, newest first. Filter by project, connection (`connection`), call (`callId`), meter or calendar month; without `period`, records from every month are listed. A call has one `call.duration` record, and an outgoing Cloud API call also a `call.cloud_pulses` record. Pass `nextCursor` as `cursor` to read the next page with the same filters.\n\nRequires `connections:read`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "security": [ { "ApiKeyAuth": [] @@ -36259,14 +36097,14 @@ } }, { - "name": "session", + "name": "connection", "in": "query", "required": false, "schema": { "type": "string", "minLength": 1, "maxLength": 128, - "description": "Number (session name)." + "description": "Connection (connection name)." } }, { @@ -36380,11 +36218,11 @@ "usage" ], "summary": "List usage gates", - "description": "Returns every usage gate with its mode, limit, current usage and decisions in the last 30 days. Gate state covers the whole team, so it needs a team API key; project tokens are refused. Pass `session` to include limits that apply per number, and `projectId` to require that the number belongs to that project. The active outbound monthly gate is record-only: an action over its limit is counted but allowed. It cannot be switched to enforce until placement reservations are available. An action whose limit cannot be checked fails with `503`.\n\nTeam keys require `sessions:read`. Project tokens are not accepted.", + "description": "Returns every usage gate with its mode, limit, current usage and decisions in the last 30 days. Gate state covers the whole team, so it needs a team API key; project tokens are refused. Pass `connection` to include limits that apply per connection, and `projectId` to require that the connection belongs to that project. The active outbound monthly gate is record-only: an action over its limit is counted but allowed. It cannot be switched to enforce until placement reservations are available. An action whose limit cannot be checked fails with `503`.\n\nTeam keys require `connections:read`. Project tokens are not accepted.", "x-audience": "public", "x-polymorfa-resource-boundary": "team", "x-excluded-from-public": false, - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "security": [ { "ApiKeyAuth": [] @@ -36398,20 +36236,20 @@ "name": "projectId", "in": "query", "required": false, - "description": "Use with `session` to require that the number belongs to this project. Gate limits and usage remain team-wide or per number.", + "description": "Use with `connection` to require that the connection belongs to this project. Gate limits and usage remain team-wide or per connection.", "schema": { "type": "string" } }, { - "name": "session", + "name": "connection", "in": "query", "required": false, "schema": { "type": "string", "minLength": 1, "maxLength": 128, - "description": "Number (session name)." + "description": "Connection (connection name)." } } ], @@ -36478,11 +36316,11 @@ "team" ], "summary": "Get team", - "description": "Public Management API. Team keys require `sessions:read`. Project tokens are not accepted.", + "description": "Public Management API. Team keys require `connections:read`. Project tokens are not accepted.", "x-audience": "public", "x-polymorfa-resource-boundary": "team", "x-excluded-from-public": false, - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "security": [ { "ApiKeyAuth": [] @@ -36616,11 +36454,11 @@ "projects" ], "summary": "List projects", - "description": "Public Management API. Team keys require `sessions:read`. Project tokens are not accepted.", + "description": "Public Management API. Team keys require `connections:read`. Project tokens are not accepted.", "x-audience": "public", "x-polymorfa-resource-boundary": "team", "x-excluded-from-public": false, - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "security": [ { "ApiKeyAuth": [] @@ -36678,11 +36516,11 @@ "projects" ], "summary": "Create a project", - "description": "Creates a project in development. A Free team can have one active project; creating another returns `409` with code `payg_required` until the team upgrades to Pay-As-You-Go. Pay-As-You-Go teams have no project limit.\n\nTeam keys require `sessions:manage`. Project tokens are not accepted.", + "description": "Creates a project in development. A Free team can have one active project; creating another returns `409` with code `payg_required` until the team upgrades to Pay-As-You-Go. Pay-As-You-Go teams have no project limit.\n\nTeam keys require `connections:manage`. Project tokens are not accepted.", "x-audience": "public", "x-polymorfa-resource-boundary": "team", "x-excluded-from-public": false, - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "security": [ { "ApiKeyAuth": [] @@ -36897,7 +36735,7 @@ "connectionPath", "audience", "events", - "sessionSource", + "connectionSource", "goals" ], "properties": { @@ -36975,7 +36813,7 @@ "unsure" ] }, - "sessionSource": { + "connectionSource": { "type": "string", "enum": [ "new", @@ -37016,7 +36854,7 @@ "connectionPath", "audience", "events", - "sessionSource", + "connectionSource", "goals" ], "properties": { @@ -37124,7 +36962,7 @@ ] } }, - "sessionSource": { + "connectionSource": { "type": "array", "minItems": 1, "maxItems": 4, @@ -37170,7 +37008,7 @@ "connectionPath", "audience", "events", - "sessionSource", + "connectionSource", "goals", "journey" ], @@ -37279,7 +37117,7 @@ ] } }, - "sessionSource": { + "connectionSource": { "type": "array", "minItems": 1, "maxItems": 4, @@ -37428,7 +37266,7 @@ "connectionPath", "audience", "events", - "sessionSource", + "connectionSource", "goals", "journey" ], @@ -37537,7 +37375,7 @@ ] } }, - "sessionSource": { + "connectionSource": { "type": "array", "minItems": 1, "maxItems": 4, @@ -37581,7 +37419,7 @@ "data", "hosting", "existingSolutions", - "connectedNumbers" + "connectedConnections" ], "properties": { "mode": { @@ -37680,7 +37518,7 @@ "additionalProperties": false, "required": [ "kind", - "connection", + "method", "packageName", "name", "url" @@ -37694,7 +37532,7 @@ "meta-direct" ] }, - "connection": { + "method": { "type": "string", "enum": [ "meta", @@ -37736,7 +37574,7 @@ "enum": [ "audience", "existingUsers", - "connectedNumbers", + "connectedConnections", "source", "connectionPath", "assets", @@ -37747,7 +37585,7 @@ ] } }, - "connectedNumbers": { + "connectedConnections": { "type": "object", "additionalProperties": false, "required": [ @@ -37859,7 +37697,7 @@ ] ] }, - "connectedNumbers": { + "connectedConnections": { "properties": { "exact": { "type": "integer", @@ -37917,9 +37755,9 @@ "type": "object", "additionalProperties": false, "required": [ - "numberCreated", + "connectionCreated", "webhookCreated", - "numberConnected", + "connectionConnected", "credentialCreated", "apiUsed", "webhookEnabled", @@ -37935,13 +37773,13 @@ "safetyViewed" ], "properties": { - "numberCreated": { + "connectionCreated": { "type": "boolean" }, "webhookCreated": { "type": "boolean" }, - "numberConnected": { + "connectionConnected": { "type": "boolean" }, "credentialCreated": { @@ -38043,7 +37881,7 @@ "projects" ], "summary": "Save a project integration plan", - "description": "Saves reviewed setup answers. Version 4 includes bounded source identities and agent-observed count provenance or human ranges. Versions 2, 3 and 4 accept multiple selections per question except connectionPath; version 1 scalar plans remain readable and accepted. Unresolved choices use unsure alone; version 4 can also retain explicitly unanswered business decisions. Request bodies are bounded to 8 KiB and do not accept query parameters. Server SDK choices require TypeScript or JavaScript; browser calling requires client code and the Calls feature. Requires a current owner or admin and the expected revision; stale writes return 409. Does not grant access, enable features, import a session or configure resources.\n\nRequires a verified dashboard bearer and current team authorization. The signed-in member must be a team owner or admin. Team keys and project tokens are not accepted.", + "description": "Saves reviewed setup answers. Version 4 includes bounded source identities and agent-observed count provenance or human ranges. Versions 2, 3 and 4 accept multiple selections per question except connectionPath; version 1 scalar plans remain readable and accepted. Unresolved choices use unsure alone; version 4 can also retain explicitly unanswered business decisions. Request bodies are bounded to 8 KiB and do not accept query parameters. Server SDK choices require TypeScript or JavaScript; browser calling requires client code and the Calls feature. Requires a current owner or admin and the expected revision; stale writes return 409. Does not grant access, enable features, import a connection or configure resources.\n\nRequires a verified dashboard bearer and current team authorization. The signed-in member must be a team owner or admin. Team keys and project tokens are not accepted.", "x-audience": "console", "x-polymorfa-resource-boundary": "human_only", "x-excluded-from-public": true, @@ -38096,7 +37934,7 @@ "connectionPath", "audience", "events", - "sessionSource", + "connectionSource", "goals" ], "properties": { @@ -38174,7 +38012,7 @@ "unsure" ] }, - "sessionSource": { + "connectionSource": { "type": "string", "enum": [ "new", @@ -38215,7 +38053,7 @@ "connectionPath", "audience", "events", - "sessionSource", + "connectionSource", "goals" ], "properties": { @@ -38323,7 +38161,7 @@ ] } }, - "sessionSource": { + "connectionSource": { "type": "array", "minItems": 1, "maxItems": 4, @@ -38369,7 +38207,7 @@ "connectionPath", "audience", "events", - "sessionSource", + "connectionSource", "goals", "journey" ], @@ -38478,7 +38316,7 @@ ] } }, - "sessionSource": { + "connectionSource": { "type": "array", "minItems": 1, "maxItems": 4, @@ -38627,7 +38465,7 @@ "connectionPath", "audience", "events", - "sessionSource", + "connectionSource", "goals", "journey" ], @@ -38736,7 +38574,7 @@ ] } }, - "sessionSource": { + "connectionSource": { "type": "array", "minItems": 1, "maxItems": 4, @@ -38780,7 +38618,7 @@ "data", "hosting", "existingSolutions", - "connectedNumbers" + "connectedConnections" ], "properties": { "mode": { @@ -38879,7 +38717,7 @@ "additionalProperties": false, "required": [ "kind", - "connection", + "method", "packageName", "name", "url" @@ -38893,7 +38731,7 @@ "meta-direct" ] }, - "connection": { + "method": { "type": "string", "enum": [ "meta", @@ -38935,7 +38773,7 @@ "enum": [ "audience", "existingUsers", - "connectedNumbers", + "connectedConnections", "source", "connectionPath", "assets", @@ -38946,7 +38784,7 @@ ] } }, - "connectedNumbers": { + "connectedConnections": { "type": "object", "additionalProperties": false, "required": [ @@ -39058,7 +38896,7 @@ ] ] }, - "connectedNumbers": { + "connectedConnections": { "properties": { "exact": { "type": "integer", @@ -39260,7 +39098,7 @@ "connectionPath", "audience", "events", - "sessionSource", + "connectionSource", "goals", "connect", "webhook", @@ -39360,11 +39198,11 @@ "projects" ], "summary": "Update project settings", - "description": "Updates the display name, icon, or default number plan without changing the project ID, URL, stage, or individual number overrides.\n\n**Hybrid Link.** A default plan without Hybrid Link returns `409` with code `hybrid_choice_required` while a Hybrid Link Number inherits the project plan. Change each such Number's tier first and choose which connection it keeps.\n\nRequires a verified dashboard bearer and current team authorization. The signed-in member must be a team owner or admin. Team keys and project tokens are not accepted.", + "description": "Updates the display name, icon, or default connection plan without changing the project ID, URL, stage, or individual connection overrides.\n\n**Hybrid Link.** A default plan without Hybrid Link returns `409` with code `hybrid_choice_required` while a Hybrid Link Connection inherits the project plan. Change each such Connection's tier first and choose which method it keeps.\n\nRequires a verified dashboard bearer and current team authorization. The signed-in member must be a team owner or admin. Team keys and project tokens are not accepted.", "x-audience": "console", "x-polymorfa-resource-boundary": "human_only", "x-excluded-from-public": true, - "x-exclusion-reason": "Dashboard project name, icon, and default number plan settings. Requires a current owner or admin.", + "x-exclusion-reason": "Dashboard project name, icon, and default connection plan settings. Requires a current owner or admin.", "x-required-team-role": "owner_or_admin", "security": [ { @@ -39518,11 +39356,11 @@ "projects" ], "summary": "Request production enrollment", - "description": "Creates a durable production-enrollment operation. The team must be on Pay-As-You-Go; a Free team receives `409` with code `payg_required` and upgrades from Billing first. The project stays in development until provisioning succeeds. Poll the returned operationId for progress.\n\nRequires `sessions:manage`. Project tokens only access resources in their own project.", + "description": "Creates a durable production-enrollment operation. The team must be on Pay-As-You-Go; a Free team receives `409` with code `payg_required` and upgrades from Billing first. The project stays in development until provisioning succeeds. Poll the returned operationId for progress.\n\nRequires `connections:manage`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "security": [ { "ApiKeyAuth": [] @@ -39705,7 +39543,7 @@ "customers" ], "summary": "Enable Customers", - "description": "Enables Customers once, creates the default Customer, and assigns every existing Number in the project to it atomically.\n\nRequires `customers:manage`. Project tokens only access resources in their own project.", + "description": "Enables Customers once, creates the default Customer, and assigns every existing Connection in the project to it atomically.\n\nRequires `customers:manage`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, @@ -39808,11 +39646,11 @@ "projects" ], "summary": "Approve production enrollment", - "description": "Resumes a production-enrollment operation that requires approval.\n\nRequires `sessions:manage`. Project tokens only access resources in their own project.", + "description": "Resumes a production-enrollment operation that requires approval.\n\nRequires `connections:manage`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "security": [ { "ApiKeyAuth": [] @@ -39915,11 +39753,11 @@ "projects" ], "summary": "Cancel production enrollment", - "description": "Requests cancellation of an active production-enrollment operation. Provisioned resources are compensated before cancellation completes.\n\nRequires `sessions:manage`. Project tokens only access resources in their own project.", + "description": "Requests cancellation of an active production-enrollment operation. Provisioned resources are compensated before cancellation completes.\n\nRequires `connections:manage`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "security": [ { "ApiKeyAuth": [] @@ -40021,12 +39859,12 @@ "tags": [ "projects" ], - "summary": "List Numbers that can merge into Hybrid Link", - "description": "Lists pairs of Numbers in the project that are the same WhatsApp Business number: one connected through Linked Devices and one through the Official API with the WhatsApp Business app (coexistence). Merge an eligible pair with a Pro tier quote on the Number you want to keep and `hybridMerge.absorbNumberId` set to the other Number. Neither side needs to pair or sign up again. Returns `403` with code `feature_unavailable` when the team has no Hybrid Link access. Each Number reports `canBeAbsorbed`; a Number with hosted message storage must be the one you keep.\n\nRequires `sessions:read`. Project tokens only access resources in their own project.", + "summary": "List Connections that can merge into Hybrid Link", + "description": "Lists pairs of Connections in the project that are the same WhatsApp Business number: one connected through Linked Devices and one through the Official API with the WhatsApp Business app (coexistence). Merge an eligible pair with a Pro tier quote on the Connection you want to keep and `hybridMerge.absorbConnectionId` set to the other Connection. Neither side needs to pair or sign up again. Returns `403` with code `feature_unavailable` when the team has no Hybrid Link access. Each Connection reports `canBeAbsorbed`; a Connection with hosted message storage must be the one you keep.\n\nRequires `connections:read`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "security": [ { "ApiKeyAuth": [] @@ -41539,7 +41377,7 @@ "webhooks" ], "summary": "Send a project webhook test", - "description": "Creates a synthetic project event and a traceable webhook delivery. An optional complete native envelope is accepted only with an exact HMS-enabled project session.\n\nRequires `webhooks:manage`. Project tokens only access resources in their own project.", + "description": "Creates a synthetic project event and a traceable webhook delivery. An optional complete native envelope is accepted only with an exact HMS-enabled project connection.\n\nRequires `webhooks:manage`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, @@ -42484,7 +42322,7 @@ "name": "route", "in": "query", "required": false, - "description": "Exact route pattern, for example `/messaging/:session/messages`.", + "description": "Exact route pattern, for example `/messaging/:connection/messages`.", "schema": { "type": "string", "minLength": 1, @@ -43807,8 +43645,8 @@ "type": "string", "enum": [ "auth_projection_repair", - "session_lifecycle", - "auth_session_purge", + "connection_lifecycle", + "auth_connection_purge", "label_projection_purge", "billing_reconciliation", "auto_top_up", @@ -44347,8 +44185,8 @@ "type": "string", "enum": [ "auth_projection_repair", - "session_lifecycle", - "auth_session_purge", + "connection_lifecycle", + "auth_connection_purge", "label_projection_purge", "billing_reconciliation", "auto_top_up", @@ -44918,7 +44756,7 @@ } }, { - "name": "hasNumbers", + "name": "hasConnections", "in": "query", "required": false, "schema": { @@ -45518,14 +45356,14 @@ } } }, - "/platform/customers/{customerId}/numbers": { + "/platform/customers/{customerId}/connections": { "get": { - "operationId": "listCustomerNumbers", + "operationId": "listCustomerConnections", "tags": [ "customers" ], - "summary": "List Customer Numbers", - "description": "Lists Numbers assigned to one Customer in the exact project.\n\nRequires `customers:read`. Project tokens only access resources in their own project.", + "summary": "List Customer Connections", + "description": "Lists Connections assigned to one Customer in the exact project.\n\nRequires `customers:read`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, @@ -45590,7 +45428,7 @@ "data": { "type": "array", "items": { - "$ref": "#/components/schemas/CustomerNumber" + "$ref": "#/components/schemas/CustomerConnection" } } }, @@ -46040,14 +45878,14 @@ } } }, - "/platform/customers/{customerId}/numbers/{sessionId}/transfer": { + "/platform/customers/{customerId}/connections/{connectionId}/transfer": { "post": { - "operationId": "transferCustomerNumber", + "operationId": "transferCustomerConnection", "tags": [ "customers" ], - "summary": "Transfer a Customer Number", - "description": "Atomically transfers one eligible Number from the explicitly confirmed source Customer to the destination Customer.\n\nRequires `customers:manage`. Project tokens only access resources in their own project.", + "summary": "Transfer a Customer Connection", + "description": "Atomically transfers one eligible Connection from the explicitly confirmed source Customer to the destination Customer.\n\nRequires `customers:manage`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, @@ -46071,12 +45909,12 @@ } }, { - "name": "sessionId", + "name": "connectionId", "in": "path", "required": true, - "description": "Database session UUID or stable session slug.", + "description": "Database connection UUID or stable connection slug.", "schema": { - "$ref": "#/components/schemas/SessionIdentifier" + "$ref": "#/components/schemas/ConnectionIdentifier" } }, { @@ -46095,7 +45933,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/TransferCustomerNumberRequest" + "$ref": "#/components/schemas/TransferCustomerConnectionRequest" } } } @@ -46131,7 +45969,7 @@ "additionalProperties": false, "properties": { "data": { - "$ref": "#/components/schemas/CustomerNumber" + "$ref": "#/components/schemas/CustomerConnection" } }, "required": [ @@ -46169,11 +46007,11 @@ "members" ], "summary": "List members", - "description": "Public Management API. Team keys require `sessions:read`. Project tokens are not accepted.", + "description": "Public Management API. Team keys require `connections:read`. Project tokens are not accepted.", "x-audience": "public", "x-polymorfa-resource-boundary": "team", "x-excluded-from-public": false, - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "security": [ { "ApiKeyAuth": [] @@ -46664,11 +46502,11 @@ "audit" ], "summary": "List audit logs", - "description": "Public Management API. Team keys require `sessions:read`. Project tokens are not accepted.", + "description": "Public Management API. Team keys require `connections:read`. Project tokens are not accepted.", "x-audience": "public", "x-polymorfa-resource-boundary": "team", "x-excluded-from-public": false, - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "security": [ { "ApiKeyAuth": [] @@ -46728,11 +46566,11 @@ "incidents" ], "summary": "List security incidents", - "description": "Public Management API. Team keys require `sessions:read`. Project tokens are not accepted.", + "description": "Public Management API. Team keys require `connections:read`. Project tokens are not accepted.", "x-audience": "public", "x-polymorfa-resource-boundary": "team", "x-excluded-from-public": false, - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "security": [ { "ApiKeyAuth": [] @@ -46792,11 +46630,11 @@ "incidents" ], "summary": "Acknowledge security incident", - "description": "Public Management API. Team keys require `sessions:manage`. Project tokens are not accepted.", + "description": "Public Management API. Team keys require `connections:manage`. Project tokens are not accepted.", "x-audience": "public", "x-polymorfa-resource-boundary": "team", "x-excluded-from-public": false, - "x-required-scope": "sessions:manage", + "x-required-scope": "connections:manage", "security": [ { "ApiKeyAuth": [] @@ -47613,11 +47451,11 @@ "teams" ], "summary": "Ensure for current user team", - "description": "**EXCLUDED from the public API** (`console`). First-sign-in bootstrap for the session user.", + "description": "**EXCLUDED from the public API** (`console`). First-sign-in bootstrap for the connection user.", "x-audience": "console", "x-polymorfa-resource-boundary": "human_only", "x-excluded-from-public": true, - "x-exclusion-reason": "First-sign-in bootstrap for the session user.", + "x-exclusion-reason": "First-sign-in bootstrap for the connection user.", "security": [ { "ConsoleSession": [] @@ -47768,11 +47606,11 @@ "profile" ], "summary": "Get user profile", - "description": "Read the signed-in account profile, including the saved language. Session-only; never available to team API keys.\n\nRequires a verified dashboard bearer and current team authorization. Team keys and project tokens are not accepted.", + "description": "Read the signed-in account profile, including the saved language. Connection-only; never available to team API keys.\n\nRequires a verified dashboard bearer and current team authorization. Team keys and project tokens are not accepted.", "x-audience": "console", "x-polymorfa-resource-boundary": "human_only", "x-excluded-from-public": true, - "x-exclusion-reason": "'Current user' only exists for a session; keys are team-scoped, not user-scoped.", + "x-exclusion-reason": "'Current user' only exists for a connection; keys are team-scoped, not user-scoped.", "security": [ { "ConsoleSession": [] @@ -47852,7 +47690,7 @@ "profile" ], "summary": "Update user profile field", - "description": "Edit the signed-in account profile. Set locale to en or pt-BR; null restores Automatic. Session-only.\n\nRequires a verified dashboard bearer and current team authorization. Team keys and project tokens are not accepted.", + "description": "Edit the signed-in account profile. Set locale to en or pt-BR; null restores Automatic. Connection-only.\n\nRequires a verified dashboard bearer and current team authorization. Team keys and project tokens are not accepted.", "x-audience": "console", "x-polymorfa-resource-boundary": "human_only", "x-excluded-from-public": true, @@ -48116,11 +47954,11 @@ "teams" ], "summary": "List user profile teams", - "description": "**EXCLUDED from the public API** (`console`). Session user's team switcher.", + "description": "**EXCLUDED from the public API** (`console`). Connection user's team switcher.", "x-audience": "console", "x-polymorfa-resource-boundary": "human_only", "x-excluded-from-public": true, - "x-exclusion-reason": "Session user's team switcher.", + "x-exclusion-reason": "Connection user's team switcher.", "security": [ { "ConsoleSession": [] @@ -48380,11 +48218,11 @@ "auth" ], "summary": "Get user profile auth methods", - "description": "**EXCLUDED from the public API** (`console`). Account-security introspection for the session user.", + "description": "**EXCLUDED from the public API** (`console`). Account-security introspection for the connection user.", "x-audience": "console", "x-polymorfa-resource-boundary": "human_only", "x-excluded-from-public": true, - "x-exclusion-reason": "Account-security introspection for the session user.", + "x-exclusion-reason": "Account-security introspection for the connection user.", "security": [ { "ConsoleSession": [] @@ -48788,11 +48626,11 @@ "teams" ], "summary": "Leave team user profile", - "description": "**EXCLUDED from the public API** (`console`). Acts on the session user's own membership.", + "description": "**EXCLUDED from the public API** (`console`). Acts on the connection user's own membership.", "x-audience": "console", "x-polymorfa-resource-boundary": "human_only", "x-excluded-from-public": true, - "x-exclusion-reason": "Acts on the session user's own membership.", + "x-exclusion-reason": "Acts on the connection user's own membership.", "security": [ { "ConsoleSession": [] @@ -50432,11 +50270,11 @@ "calls" ], "summary": "List call records", - "description": "Lists call detail records, newest first. Filter by project, number, direction, connection, outcome and start time. The other party appears only as `peerRef`, a team-specific pseudonym; phone numbers are never returned. Pass `page.nextCursor` as `cursor` with the same filters to read the next page.\n\nRequires `sessions:read`. Project tokens only access resources in their own project.", + "description": "Lists call detail records, newest first. Filter by project, number, direction, method, outcome and start time. The other party appears only as `peerRef`, a team-specific pseudonym; phone numbers are never returned. Pass `page.nextCursor` as `cursor` with the same filters to read the next page.\n\nRequires `connections:read`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "security": [ { "ApiKeyAuth": [] @@ -50456,14 +50294,14 @@ } }, { - "name": "sessionId", + "name": "connectionId", "in": "query", "required": false, "schema": { "type": "string", "minLength": 1, "maxLength": 128, - "description": "Session name of one number." + "description": "Connection name of one connection." } }, { @@ -50488,7 +50326,7 @@ "linked_device", "cloud_api" ], - "description": "How the number connects to WhatsApp." + "description": "How the connection connects to WhatsApp." } }, { @@ -50504,7 +50342,7 @@ "failed", "in_progress" ], - "description": "How the call went. `answered`: media connected, including answered calls still in progress. `declined`: declined by a participant or the other party, or the line was busy. `missed`: nobody answered before ringing stopped or the caller hung up. `failed`: ended before it connected for any other reason, such as a connection or capacity failure. `in_progress`: still ringing." + "description": "How the call went. `answered`: media connected, including answered calls still in progress. `declined`: declined by a participant or the other party, or the line was busy. `missed`: nobody answered before ringing stopped or the caller hung up. `failed`: ended before it connected for any other reason, such as a method or capacity failure. `in_progress`: still ringing." } }, { @@ -50617,11 +50455,11 @@ "calls" ], "summary": "Get call statistics", - "description": "Returns call volume, outcomes, answer rate and connected duration for a time range, grouped by day, hour, number or outcome, with an hour-of-week heatmap. Filters match the call records endpoints. Without `since` and `until` the range is the last 7 days. Day and hour groups use the requested `timezone` and include empty buckets.\n\nRequires `sessions:read`. Project tokens only access resources in their own project.", + "description": "Returns call volume, outcomes, answer rate and connected duration for a time range, grouped by day, hour, number or outcome, with an hour-of-week heatmap. Filters match the call records endpoints. Without `since` and `until` the range is the last 7 days. Day and hour groups use the requested `timezone` and include empty buckets.\n\nRequires `connections:read`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "security": [ { "ApiKeyAuth": [] @@ -50641,14 +50479,14 @@ } }, { - "name": "sessionId", + "name": "connectionId", "in": "query", "required": false, "schema": { "type": "string", "minLength": 1, "maxLength": 128, - "description": "Session name of one number." + "description": "Connection name of one connection." } }, { @@ -50673,7 +50511,7 @@ "linked_device", "cloud_api" ], - "description": "How the number connects to WhatsApp." + "description": "How the connection connects to WhatsApp." } }, { @@ -50689,7 +50527,7 @@ "failed", "in_progress" ], - "description": "How the call went. `answered`: media connected, including answered calls still in progress. `declined`: declined by a participant or the other party, or the line was busy. `missed`: nobody answered before ringing stopped or the caller hung up. `failed`: ended before it connected for any other reason, such as a connection or capacity failure. `in_progress`: still ringing." + "description": "How the call went. `answered`: media connected, including answered calls still in progress. `declined`: declined by a participant or the other party, or the line was busy. `missed`: nobody answered before ringing stopped or the caller hung up. `failed`: ended before it connected for any other reason, such as a method or capacity failure. `in_progress`: still ringing." } }, { @@ -50721,11 +50559,11 @@ "enum": [ "day", "hour", - "session", + "connection", "outcome" ], "default": "day", - "description": "`day` and `hour` return one group per bucket in `timezone`, covering at most 366 and 31 days. `session` returns one group per number, most calls first, up to 500. `outcome` returns one group per outcome." + "description": "`day` and `hour` return one group per bucket in `timezone`, covering at most 366 and 31 days. `connection` returns one group per connection, most calls first, up to 500. `outcome` returns one group per outcome." } }, { @@ -50804,11 +50642,11 @@ "calls" ], "summary": "Get a call record and history", - "description": "Returns one stored call with its participant and connection lifetimes, bounded event history, media measurements and app-reported diagnostics. Requires sessions:read. Project credentials can read only the call's original owning project, including after a number is deleted. Unknown measurements are null. Webhook deliveries require the separate webhook-deliveries:read endpoints. This read does not retrieve audio, video or event payloads and does not control a live call.\n\nRequires `sessions:read`. Project tokens only access resources in their own project.", + "description": "Returns one stored call with its participant and method lifetimes, bounded event history, media measurements and app-reported diagnostics. Requires connections:read. Project credentials can read only the call's original owning project, including after a connection is deleted. Unknown measurements are null. Webhook deliveries require the separate webhook-deliveries:read endpoints. This read does not retrieve audio, video or event payloads and does not control a live call.\n\nRequires `connections:read`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "security": [ { "ApiKeyAuth": [] @@ -50903,7 +50741,7 @@ "calls" ], "summary": "List calls", - "description": "Lists the team's calls, newest first. Filter by project, session, state, direction, start time, or live calls only. `live=true` returns offered and answered calls; `live=false` returns declined, missed, and ended calls. Pass `nextCursor` as `cursor` to read the next page with the same filters.\n\nRequires a verified dashboard bearer and current team authorization. Team keys and project tokens are not accepted.", + "description": "Lists the team's calls, newest first. Filter by project, connection, state, direction, start time, or live calls only. `live=true` returns offered and answered calls; `live=false` returns declined, missed, and ended calls. Pass `nextCursor` as `cursor` to read the next page with the same filters.\n\nRequires a verified dashboard bearer and current team authorization. Team keys and project tokens are not accepted.", "x-audience": "console", "x-polymorfa-resource-boundary": "human_only", "x-excluded-from-public": true, @@ -50924,14 +50762,14 @@ } }, { - "name": "sessionId", + "name": "connectionId", "in": "query", "required": false, "schema": { "type": "string", "minLength": 1, "maxLength": 128, - "description": "Session name." + "description": "Connection name." } }, { @@ -51070,7 +50908,7 @@ "calls" ], "summary": "Get call detail", - "description": "Returns one call with its participants, connections, media measurements, webhook delivery outcomes, and correlation identifiers. Measurements that were not reported are null. Webhook delivery records are kept for 30 days.\n\nRequires a verified dashboard bearer and current team authorization. Team keys and project tokens are not accepted.", + "description": "Returns one call with its participants, methods, media measurements, webhook delivery outcomes, and correlation identifiers. Measurements that were not reported are null. Webhook delivery records are kept for 30 days.\n\nRequires a verified dashboard bearer and current team authorization. Team keys and project tokens are not accepted.", "x-audience": "console", "x-polymorfa-resource-boundary": "human_only", "x-excluded-from-public": true, @@ -51264,12 +51102,12 @@ "tags": [ "calls" ], - "summary": "Remove a call connection", - "description": "Closes one client connection of a live call. The call continues for everyone else. Returns 409 when the call is not live or the connection now belongs to another participant. Every attempt is recorded in the audit log.\n\nRequires a verified dashboard bearer and current team authorization. The signed-in member must be a team owner or admin. Team keys and project tokens are not accepted.", + "summary": "Remove a call method", + "description": "Closes one client method of a live call. The call continues for everyone else. Returns 409 when the call is not live or the method now belongs to another participant. Every attempt is recorded in the audit log.\n\nRequires a verified dashboard bearer and current team authorization. The signed-in member must be a team owner or admin. Team keys and project tokens are not accepted.", "x-audience": "console", "x-polymorfa-resource-boundary": "human_only", "x-excluded-from-public": true, - "x-exclusion-reason": "Console call control; requires a live team owner or admin. Server integrations close their own connections with POST /messaging/voip/calls/{callId}/leave.", + "x-exclusion-reason": "Console call control; requires a live team owner or admin. Server integrations close their own media connections with POST /messaging/voip/calls/{callId}/leave.", "x-required-team-role": "owner_or_admin", "security": [ { @@ -51293,10 +51131,9 @@ "name": "connectionId", "in": "path", "required": true, - "description": "Client-chosen connection identifier.", + "description": "Database connection UUID or stable connection slug.", "schema": { - "type": "string", - "pattern": "^[A-Za-z0-9_-]{8,64}$" + "$ref": "#/components/schemas/ConnectionIdentifier" } } ], @@ -51575,7 +51412,7 @@ "enum": [ "api", "webhooks", - "sessions" + "connections" ] }, "kind": { @@ -51587,11 +51424,11 @@ "type": "string", "enum": [ "requestId", - "sessionId", + "connectionId", "eventId", "webhookId", "customerId", - "numberId", + "connectionId", "conversationId" ] }, @@ -51613,7 +51450,7 @@ "id", "name", "dataset", - "sessionId", + "connectionId", "windowHours", "encoding", "url", @@ -51648,7 +51485,7 @@ "ndjson" ] }, - "sessionId": { + "connectionId": { "type": "string", "format": "uuid", "nullable": true @@ -51796,7 +51633,7 @@ "enum": [ "api", "webhooks", - "sessions" + "connections" ] }, "kind": { @@ -51808,11 +51645,11 @@ "type": "string", "enum": [ "requestId", - "sessionId", + "connectionId", "eventId", "webhookId", "customerId", - "numberId", + "connectionId", "conversationId" ] }, @@ -51975,7 +51812,7 @@ "ndjson" ] }, - "sessionId": { + "connectionId": { "type": "string", "format": "uuid", "nullable": true @@ -52277,7 +52114,7 @@ "all", "api", "webhooks", - "sessions", + "connections", "errors", "audit" ], @@ -52517,12 +52354,12 @@ "tags": [ "Analytics" ], - "summary": "Get WhatsApp number analytics", - "description": "Aggregated number activity and operational vitals. Returns disabled with null summary and empty data until a team owner or admin enables Analytics. Conversation rates use completed 24-hour direct-chat cohorts, booked in the period when they mature; missing or dropped cohort coverage returns null rates. Read means an observed read receipt, not a verified app open. No contact identifiers or message content. Linked Devices telemetry only; unsupported or unobserved numbers carry measured=false. Bucket timestamps use UTC. Activity series use hourly buckets for ranges up to 48 hours and daily buckets for longer ranges. Call series use daily buckets. Message metadata compares direct sends and completed conversations by type, coarse text/caption length, source, calling code and observed device count. Device observations are bounded samples. Calling-code shares describe conversations, not distinct people or location. Presence signals require existing subscriptions. Primary phone activity spans end at their last observed signal and close after 15 minutes without evidence. Quiet gaps end at the next observed signal. Duration sums and averages count completed intervals and exclude open or restart-censored intervals; they do not measure phone online/offline or power state. Metadata collection uses the current team opt-in; disable erases these aggregates and stale queued metadata is rejected. Calls aggregate retained records by their immutable original number/project ownership, including supported Official API calls; message measured/coverage fields do not apply to calls. Call series groups starts by UTC day. Answer rate excludes still-ringing calls; timing fields have explicit observation counts. Missed-call follow-up observes an answered outgoing call to the same pseudonymous contact within 24h, including after the requested end; only completed windows with a known contact form the denominator. It does not prove callback intent. Quality uses reported measurements, latest cumulative app reports per connection and per-call averages. Breakdown counts can overlap. Disabling hides this call view without deleting operational call history. Device analytics estimates sending client families from message ID prefixes, not verified hardware. Customer/account distributions count observed live direct messages, not unique people or installed devices; unknown is included. Older retained buckets lack device coverage and return null shares. Each number exposes at most 25 of its own device indexes, coarse reported class and last observed sending activity. A list change makes inventory membership/count unknown until another full list. Inventory is null in the combined summary. No recipient device identity or raw message ID is retained by this analytics block. Joint conversation breakdown rows retain first outgoing message type, length band, send source, inferred calling code and observed customer device-count class together with UTC completion bucket. Combine rows matching all selected categories to drill into countries and message attributes without inferring intersections from independent marginal totals. Calling codes do not establish current location and shared codes do not identify a unique country. Counts describe completed 24-hour conversation cohorts, not distinct customers. Rates and averages are null when coverage is missing, dropped or truncated. At most 4096 number/time/category groups are returned in one scope, prioritizing largest groups and marking truncation; raw reply latency sums support weighted aggregation. Connection/call vitals and live message platform distributions are separate measurements, not recipient-country filtered cohorts. Recipient country and recipient linked-device-count fields refine joint conversation metadata. Recipient activity remains hourly even for long date ranges, supporting incoming-message timing in an explicit time zone. Delivery signals do not prove reading; read signals are distinct. Presence subscriptions are best-effort around permitted direct sends, reuse a live bounded local lease, preserve observation-off policies and never poll every contact. Missing presence is Unknown, not offline.\n\nRequires `sessions:read`. Project tokens only access resources in their own project.", + "summary": "Get WhatsApp connection analytics", + "description": "Aggregated connection activity and operational vitals. Returns disabled with null summary and empty data until a team owner or admin enables Analytics. Conversation rates use completed 24-hour direct-chat cohorts, booked in the period when they mature; missing or dropped cohort coverage returns null rates. Read means an observed read receipt, not a verified app open. No contact identifiers or message content. Linked Devices telemetry only; unsupported or unobserved connections carry measured=false. Bucket timestamps use UTC. Activity series use hourly buckets for ranges up to 48 hours and daily buckets for longer ranges. Call series use daily buckets. Message metadata compares direct sends and completed conversations by type, coarse text/caption length, source, calling code and observed device count. Device observations are bounded samples. Calling-code shares describe conversations, not distinct people or location. Presence signals require existing subscriptions. Primary phone activity spans end at their last observed signal and close after 15 minutes without evidence. Quiet gaps end at the next observed signal. Duration sums and averages count completed intervals and exclude open or restart-censored intervals; they do not measure phone online/offline or power state. Metadata collection uses the current team opt-in; disable erases these aggregates and stale queued metadata is rejected. Calls aggregate retained records by their immutable original connection/project ownership, including supported Official API calls; message measured/coverage fields do not apply to calls. Call series groups starts by UTC day. Answer rate excludes still-ringing calls; timing fields have explicit observation counts. Missed-call follow-up observes an answered outgoing call to the same pseudonymous contact within 24h, including after the requested end; only completed windows with a known contact form the denominator. It does not prove callback intent. Quality uses reported measurements, latest cumulative app reports per connection and per-call averages. Breakdown counts can overlap. Disabling hides this call view without deleting operational call history. Device analytics estimates sending client families from message ID prefixes, not verified hardware. Customer/account distributions count observed live direct messages, not unique people or installed devices; unknown is included. Older retained buckets lack device coverage and return null shares. Each number exposes at most 25 of its own device indexes, coarse reported class and last observed sending activity. A list change makes inventory membership/count unknown until another full list. Inventory is null in the combined summary. No recipient device identity or raw message ID is retained by this analytics block. Joint conversation breakdown rows retain first outgoing message type, length band, send source, inferred calling code and observed customer device-count class together with UTC completion bucket. Combine rows matching all selected categories to drill into countries and message attributes without inferring intersections from independent marginal totals. Calling codes do not establish current location and shared codes do not identify a unique country. Counts describe completed 24-hour conversation cohorts, not distinct customers. Rates and averages are null when coverage is missing, dropped or truncated. At most 4096 connection/time/category groups are returned in one scope, prioritizing largest groups and marking truncation; raw reply latency sums support weighted aggregation. Connection/call vitals and live message platform distributions are separate measurements, not recipient-country filtered cohorts. Recipient country and recipient linked-device-count fields refine joint conversation metadata. Recipient activity remains hourly even for long date ranges, supporting incoming-message timing in an explicit time zone. Delivery signals do not prove reading; read signals are distinct. Presence subscriptions are best-effort around permitted direct sends, reuse a live bounded local lease, preserve observation-off policies and never poll every contact. Missing presence is Unknown, not offline.\n\nRequires `connections:read`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "security": [ { "ApiKeyAuth": [] @@ -52542,13 +52379,13 @@ } }, { - "name": "sessionId", + "name": "connectionId", "in": "query", "required": false, "schema": { "type": "string", "format": "uuid", - "description": "Number record UUID." + "description": "Connection record UUID." } }, { @@ -52637,12 +52474,12 @@ "tags": [ "Analytics" ], - "summary": "Get WhatsApp number analytics", - "description": "Aggregated number activity and operational vitals. Returns disabled with null summary and empty data until a team owner or admin enables Analytics. Conversation rates use completed 24-hour direct-chat cohorts, booked in the period when they mature; missing or dropped cohort coverage returns null rates. Read means an observed read receipt, not a verified app open. No contact identifiers or message content. Linked Devices telemetry only; unsupported or unobserved numbers carry measured=false. Bucket timestamps use UTC. Activity series use hourly buckets for ranges up to 48 hours and daily buckets for longer ranges. Call series use daily buckets. Message metadata compares direct sends and completed conversations by type, coarse text/caption length, source, calling code and observed device count. Device observations are bounded samples. Calling-code shares describe conversations, not distinct people or location. Presence signals require existing subscriptions. Primary phone activity spans end at their last observed signal and close after 15 minutes without evidence. Quiet gaps end at the next observed signal. Duration sums and averages count completed intervals and exclude open or restart-censored intervals; they do not measure phone online/offline or power state. Metadata collection uses the current team opt-in; disable erases these aggregates and stale queued metadata is rejected. Calls aggregate retained records by their immutable original number/project ownership, including supported Official API calls; message measured/coverage fields do not apply to calls. Call series groups starts by UTC day. Answer rate excludes still-ringing calls; timing fields have explicit observation counts. Missed-call follow-up observes an answered outgoing call to the same pseudonymous contact within 24h, including after the requested end; only completed windows with a known contact form the denominator. It does not prove callback intent. Quality uses reported measurements, latest cumulative app reports per connection and per-call averages. Breakdown counts can overlap. Disabling hides this call view without deleting operational call history. Device analytics estimates sending client families from message ID prefixes, not verified hardware. Customer/account distributions count observed live direct messages, not unique people or installed devices; unknown is included. Older retained buckets lack device coverage and return null shares. Each number exposes at most 25 of its own device indexes, coarse reported class and last observed sending activity. A list change makes inventory membership/count unknown until another full list. Inventory is null in the combined summary. No recipient device identity or raw message ID is retained by this analytics block. Joint conversation breakdown rows retain first outgoing message type, length band, send source, inferred calling code and observed customer device-count class together with UTC completion bucket. Combine rows matching all selected categories to drill into countries and message attributes without inferring intersections from independent marginal totals. Calling codes do not establish current location and shared codes do not identify a unique country. Counts describe completed 24-hour conversation cohorts, not distinct customers. Rates and averages are null when coverage is missing, dropped or truncated. At most 4096 number/time/category groups are returned in one scope, prioritizing largest groups and marking truncation; raw reply latency sums support weighted aggregation. Connection/call vitals and live message platform distributions are separate measurements, not recipient-country filtered cohorts. Recipient country and recipient linked-device-count fields refine joint conversation metadata. Recipient activity remains hourly even for long date ranges, supporting incoming-message timing in an explicit time zone. Delivery signals do not prove reading; read signals are distinct. Presence subscriptions are best-effort around permitted direct sends, reuse a live bounded local lease, preserve observation-off policies and never poll every contact. Missing presence is Unknown, not offline.\n\nRequires `sessions:read`. Project tokens only access resources in their own project.", + "summary": "Get WhatsApp connection analytics", + "description": "Aggregated connection activity and operational vitals. Returns disabled with null summary and empty data until a team owner or admin enables Analytics. Conversation rates use completed 24-hour direct-chat cohorts, booked in the period when they mature; missing or dropped cohort coverage returns null rates. Read means an observed read receipt, not a verified app open. No contact identifiers or message content. Linked Devices telemetry only; unsupported or unobserved connections carry measured=false. Bucket timestamps use UTC. Activity series use hourly buckets for ranges up to 48 hours and daily buckets for longer ranges. Call series use daily buckets. Message metadata compares direct sends and completed conversations by type, coarse text/caption length, source, calling code and observed device count. Device observations are bounded samples. Calling-code shares describe conversations, not distinct people or location. Presence signals require existing subscriptions. Primary phone activity spans end at their last observed signal and close after 15 minutes without evidence. Quiet gaps end at the next observed signal. Duration sums and averages count completed intervals and exclude open or restart-censored intervals; they do not measure phone online/offline or power state. Metadata collection uses the current team opt-in; disable erases these aggregates and stale queued metadata is rejected. Calls aggregate retained records by their immutable original connection/project ownership, including supported Official API calls; message measured/coverage fields do not apply to calls. Call series groups starts by UTC day. Answer rate excludes still-ringing calls; timing fields have explicit observation counts. Missed-call follow-up observes an answered outgoing call to the same pseudonymous contact within 24h, including after the requested end; only completed windows with a known contact form the denominator. It does not prove callback intent. Quality uses reported measurements, latest cumulative app reports per connection and per-call averages. Breakdown counts can overlap. Disabling hides this call view without deleting operational call history. Device analytics estimates sending client families from message ID prefixes, not verified hardware. Customer/account distributions count observed live direct messages, not unique people or installed devices; unknown is included. Older retained buckets lack device coverage and return null shares. Each number exposes at most 25 of its own device indexes, coarse reported class and last observed sending activity. A list change makes inventory membership/count unknown until another full list. Inventory is null in the combined summary. No recipient device identity or raw message ID is retained by this analytics block. Joint conversation breakdown rows retain first outgoing message type, length band, send source, inferred calling code and observed customer device-count class together with UTC completion bucket. Combine rows matching all selected categories to drill into countries and message attributes without inferring intersections from independent marginal totals. Calling codes do not establish current location and shared codes do not identify a unique country. Counts describe completed 24-hour conversation cohorts, not distinct customers. Rates and averages are null when coverage is missing, dropped or truncated. At most 4096 connection/time/category groups are returned in one scope, prioritizing largest groups and marking truncation; raw reply latency sums support weighted aggregation. Connection/call vitals and live message platform distributions are separate measurements, not recipient-country filtered cohorts. Recipient country and recipient linked-device-count fields refine joint conversation metadata. Recipient activity remains hourly even for long date ranges, supporting incoming-message timing in an explicit time zone. Delivery signals do not prove reading; read signals are distinct. Presence subscriptions are best-effort around permitted direct sends, reuse a live bounded local lease, preserve observation-off policies and never poll every contact. Missing presence is Unknown, not offline.\n\nRequires `connections:read`. Project tokens only access resources in their own project.", "x-audience": "public", "x-polymorfa-resource-boundary": "project", "x-excluded-from-public": false, - "x-required-scope": "sessions:read", + "x-required-scope": "connections:read", "security": [ { "ApiKeyAuth": [] @@ -52662,13 +52499,13 @@ } }, { - "name": "sessionId", + "name": "connectionId", "in": "query", "required": false, "schema": { "type": "string", "format": "uuid", - "description": "Number record UUID." + "description": "Connection record UUID." } }, { @@ -52751,14 +52588,14 @@ } } }, - "/console/insights/number-options": { + "/console/insights/connection-options": { "get": { - "operationId": "listConsoleNumberOptions", + "operationId": "listConsoleConnectionOptions", "tags": [ "insights" ], - "summary": "Search Console number options", - "description": "Private dashboard-only, team-scoped production number labels for selectors. Optional projectId must name an active, nondeleting project. Search is a literal case-insensitive substring of display name, current phone, session name or immutable number UUID, evaluated before pagination. Numbers in testing, deletion or deleted status and inactive/deleting projects are excluded; expired number history remains selectable. Results use immutable UUID ascending keyset order, default 25 and maximum 100; a cursor is bound to team, project and normalized search. It is navigation only and never grants authority. Response includes only number ID, project ID and a display label, with no configuration, owner, customer or provider fields. Public session listing is unchanged.\n\nRequires a verified dashboard bearer and current team authorization. Team keys and project tokens are not accepted.", + "summary": "Search Console connection options", + "description": "Private dashboard-only, team-scoped production connection labels for selectors. Optional projectId must name an active, nondeleting project. Search is a literal case-insensitive substring of display name, current phone, connection name or immutable connection UUID, evaluated before pagination. Connections in testing, deletion or deleted status and inactive/deleting projects are excluded; expired connection history remains selectable. Results use immutable UUID ascending keyset order, default 25 and maximum 100; a cursor is bound to team, project and normalized search. It is navigation only and never grants authority. Response includes only connection ID, project ID and a display label, with no configuration, owner, customer or provider fields. Public connection listing is unchanged.\n\nRequires a verified dashboard bearer and current team authorization. Team keys and project tokens are not accepted.", "x-audience": "console", "x-polymorfa-resource-boundary": "human_only", "x-excluded-from-public": true, @@ -52841,7 +52678,7 @@ "additionalProperties": false, "properties": { "data": { - "$ref": "#/components/schemas/ConsoleNumberOptionsPage" + "$ref": "#/components/schemas/ConsoleConnectionOptionsPage" } }, "required": [ @@ -52873,7 +52710,7 @@ "insights" ], "summary": "Read Console usage", - "description": "Private Console usage for the authenticated team or one active project. `start` and `end` are inclusive Unix-millisecond boundaries, with a maximum span of 366 days. A missing end defaults to now; a missing start defaults to 29 days before the end. Daily buckets use UTC dates and include only dates with observed audit or credit-ledger activity. API request counts include API and MCP operations; peak request rate is the busiest one-minute bucket, not a sum of daily peaks. Number and connection metrics are live snapshots, and message-rate usage remains null because its peak is not measured. The project breakdown includes active projects and omits unattributed team activity, which remains in team totals.\n\nRequires a verified dashboard bearer and current team authorization. Team keys and project tokens are not accepted.", + "description": "Private Console usage for the authenticated team or one active project. `start` and `end` are inclusive Unix-millisecond boundaries, with a maximum span of 366 days. A missing end defaults to now; a missing start defaults to 29 days before the end. Daily buckets use UTC dates and include only dates with observed audit or credit-ledger activity. API request counts include API and MCP operations; peak request rate is the busiest one-minute bucket, not a sum of daily peaks. Connection and method metrics are live snapshots, and message-rate usage remains null because its peak is not measured. The project breakdown includes active projects and omits unattributed team activity, which remains in team totals.\n\nRequires a verified dashboard bearer and current team authorization. Team keys and project tokens are not accepted.", "x-audience": "console", "x-polymorfa-resource-boundary": "human_only", "x-excluded-from-public": true, @@ -52895,10 +52732,10 @@ } }, { - "name": "numberId", + "name": "connectionId", "in": "query", "required": false, - "description": "Immutable production number UUID. Requires projectId; missing, deleted, testing or mismatched numbers return 404. Filters only immutable attributed records; request logs and serverless receipts have no number attribution.", + "description": "Immutable production connection UUID. Requires projectId; missing, deleted, testing or mismatched connections return 404. Filters only immutable attributed records; request logs and serverless receipts have no connection attribution.", "schema": { "type": "string", "format": "uuid" @@ -52988,7 +52825,7 @@ "insights" ], "summary": "Analytics insight", - "description": "Team/project-scoped recorded API, event, webhook and number analytics. Event and webhook counts include unexpired metadata only; current snapshots are independent of dates. No message bodies or identity fields are returned.\n\nRequires a verified dashboard bearer and current team authorization. Team keys and project tokens are not accepted.", + "description": "Team/project-scoped recorded API, event, webhook and connection analytics. Event and webhook counts include unexpired metadata only; current snapshots are independent of dates. No message bodies or identity fields are returned.\n\nRequires a verified dashboard bearer and current team authorization. Team keys and project tokens are not accepted.", "x-audience": "console", "x-polymorfa-resource-boundary": "human_only", "x-excluded-from-public": true, @@ -53775,7 +53612,7 @@ }, "capture": { "type": "object", - "description": "Present for features that control data capture: whether capture already follows the change for every affected Number (`applied`) or is still being brought in line (`pending`).", + "description": "Present for features that control data capture: whether capture already follows the change for every affected Connection (`applied`) or is still being brought in line (`pending`).", "additionalProperties": false, "required": [ "state" @@ -54688,7 +54525,7 @@ ] } }, - "numbers": { + "connections": { "type": "array", "items": { "type": "object", @@ -54724,7 +54561,7 @@ "revision", "projects", "customers", - "numbers" + "connections" ] }, "BillingLimit": { @@ -54911,7 +54748,7 @@ "type": "object", "additionalProperties": false, "required": [ - "session", + "connection", "phone", "appId", "wabaId", @@ -54922,21 +54759,6 @@ "diagnostic" ], "properties": { - "session": { - "type": "string" - }, - "phone": { - "type": "string", - "nullable": true - }, - "appId": { - "type": "string", - "nullable": true - }, - "wabaId": { - "type": "string", - "nullable": true - }, "connection": { "type": "object", "additionalProperties": false, @@ -54955,10 +54777,22 @@ }, "sendingPaused": { "type": "boolean", - "description": "Whether Hybrid sending is paused for this Number. Always false for Numbers without a Hybrid Link." + "description": "Whether Hybrid sending is paused for this Connection. Always false for Connections without a Hybrid Link." } } }, + "phone": { + "type": "string", + "nullable": true + }, + "appId": { + "type": "string", + "nullable": true + }, + "wabaId": { + "type": "string", + "nullable": true + }, "credentials": { "type": "object", "additionalProperties": false, @@ -55103,7 +54937,7 @@ "nextAction": { "type": "string", "enum": [ - "reconnect_number", + "reconnect_connection", "reauthorize", "complete_registration", "check_webhook_subscription", @@ -55274,7 +55108,7 @@ "properties": { "effective": { "type": "object", - "description": "Present for the `number` scope.", + "description": "Present for the `connection` scope.", "required": [ "region", "contacts", @@ -55673,7 +55507,7 @@ "applied", "pending" ], - "description": "`pending` while some affected Numbers are still being brought in line with the saved settings." + "description": "`pending` while some affected Connections are still being brought in line with the saved settings." } } } @@ -55786,7 +55620,7 @@ "type": "integer", "minimum": 0 }, - "sessionDays": { + "connectionDays": { "type": "integer", "minimum": 0 }, @@ -55794,7 +55628,7 @@ "type": "number", "minimum": 0 }, - "newNumbers": { + "newConnections": { "type": "integer", "minimum": 0 } @@ -55807,9 +55641,9 @@ "avgLatencyMs", "durationSumMs", "p95LatencyMs", - "sessionDays", + "connectionDays", "credits", - "newNumbers" + "newConnections" ] } }, @@ -55826,7 +55660,7 @@ "minimum": 0, "maximum": 1 }, - "sessionDays": { + "connectionDays": { "type": "integer", "minimum": 0 }, @@ -55834,7 +55668,7 @@ "type": "number", "minimum": 0 }, - "newNumbers": { + "newConnections": { "type": "integer", "minimum": 0 } @@ -55842,9 +55676,9 @@ "required": [ "apiRequests", "failureRate", - "sessionDays", + "connectionDays", "credits", - "newNumbers" + "newConnections" ] }, "byProject": { @@ -55866,7 +55700,7 @@ "minimum": 0, "maximum": 1 }, - "sessionDays": { + "connectionDays": { "type": "integer", "minimum": 0 }, @@ -55874,7 +55708,7 @@ "type": "number", "minimum": 0 }, - "newNumbers": { + "newConnections": { "type": "integer", "minimum": 0 } @@ -55883,9 +55717,9 @@ "projectId", "apiRequests", "failureRate", - "sessionDays", + "connectionDays", "credits", - "newNumbers" + "newConnections" ] } }, @@ -55896,7 +55730,7 @@ "type": "object", "additionalProperties": false, "properties": { - "totalNumbers": { + "totalConnections": { "type": "integer", "minimum": 0 }, @@ -55919,7 +55753,7 @@ } }, "required": [ - "totalNumbers", + "totalConnections", "businessAccounts", "platformCoverage", "platforms" @@ -56338,7 +56172,7 @@ "count" ] }, - "description": "Current number snapshot, independent of the date range." + "description": "Current connection snapshot, independent of the date range." } }, "required": [ @@ -56568,15 +56402,15 @@ "droppedReceiptJoins" ] }, - "totalNumbers": { + "totalConnections": { "type": "integer", "minimum": 0 }, - "measuredNumbers": { + "measuredConnections": { "type": "integer", "minimum": 0 }, - "connectedNumbers": { + "connectedConnections": { "type": "integer", "minimum": 0 }, @@ -57524,7 +57358,7 @@ "properties": { "listObserved": { "type": "boolean", - "description": "True after a full device list for this number was observed." + "description": "True after a full device list for this connection was observed." }, "listCurrent": { "type": "boolean", @@ -57642,7 +57476,7 @@ "accountPlatforms", "inventory" ], - "description": "Observed message client-family distributions and a bounded inventory of this number's own devices. The combined summary has null inventory." + "description": "Observed message client-family distributions and a bounded inventory of this connection's own devices. The combined summary has null inventory." }, "conversationBreakdown": { "type": "object", @@ -57666,7 +57500,7 @@ }, "truncated": { "type": "boolean", - "description": "True when the requested scope exceeded 4096 number/time/category groups. The largest groups are retained; rates and averages are null." + "description": "True when the requested scope exceeded 4096 connection/time/category groups. The largest groups are retained; rates and averages are null." }, "buckets": { "type": "array", @@ -57680,7 +57514,7 @@ }, "complete": { "type": "boolean", - "description": "True when this UTC time bucket has joint category coverage and no conversations or records were dropped. A summary bucket also requires every scoped number to have a bucket." + "description": "True when this UTC time bucket has joint category coverage and no conversations or records were dropped. A summary bucket also requires every scoped connection to have a bucket." } }, "required": [ @@ -57740,7 +57574,7 @@ "recipientCountry": { "type": "string", "pattern": "^(unknown|[A-Z]{2})$", - "description": "Numbering country inferred from a full phone number or valid BSUID prefix; Unknown for missing historical metadata. Not current location." + "description": "Calling country inferred from a full phone number or valid BSUID prefix; Unknown for missing historical metadata. Not current location." }, "recipientDeviceCount": { "type": "string", @@ -57957,7 +57791,7 @@ "truncated", "rows" ], - "description": "Hourly aggregate recipient observations, grouped jointly by numbering country, observed linked-device count and sender-device class. Incoming messages and matched delivery/read receipts are deduplicated by native message and device in bounded memory. Presence is user-level and uses Unknown device source. Quiet gaps of at least 15 minutes are completed gaps between observed signals on the same device, never verified offline periods. No recipient identity, native message ID or recipient device index is retained. Coverage is explicit; older retained buckets are unmeasured. Message telemetry remains Linked Devices only; Official API message activity is not measured." + "description": "Hourly aggregate recipient observations, grouped jointly by connectioning country, observed linked-device count and sender-device class. Incoming messages and matched delivery/read receipts are deduplicated by native message and device in bounded memory. Presence is user-level and uses Unknown device source. Quiet gaps of at least 15 minutes are completed gaps between observed signals on the same device, never verified offline periods. No recipient identity, native message ID or recipient device index is retained. Coverage is explicit; older retained buckets are unmeasured. Message telemetry remains Linked Devices only; Official API message activity is not measured." } }, "required": [ @@ -57977,9 +57811,9 @@ "streamErrors", "keepaliveTimeouts", "engagement", - "totalNumbers", - "measuredNumbers", - "connectedNumbers", + "totalConnections", + "measuredConnections", + "connectedConnections", "messageAnalysis", "customerActivity", "accountActivity", @@ -57991,13 +57825,13 @@ } ] }, - "numbers": { + "connections": { "type": "array", "items": { "type": "object", "additionalProperties": false, "properties": { - "sessionId": { + "connectionId": { "type": "string", "format": "uuid" }, @@ -59105,7 +58939,7 @@ "properties": { "listObserved": { "type": "boolean", - "description": "True after a full device list for this number was observed." + "description": "True after a full device list for this connection was observed." }, "listCurrent": { "type": "boolean", @@ -59223,7 +59057,7 @@ "accountPlatforms", "inventory" ], - "description": "Observed message client-family distributions and a bounded inventory of this number's own devices. The combined summary has null inventory." + "description": "Observed message client-family distributions and a bounded inventory of this connection's own devices. The combined summary has null inventory." }, "conversationBreakdown": { "type": "object", @@ -59247,7 +59081,7 @@ }, "truncated": { "type": "boolean", - "description": "True when the requested scope exceeded 4096 number/time/category groups. The largest groups are retained; rates and averages are null." + "description": "True when the requested scope exceeded 4096 connection/time/category groups. The largest groups are retained; rates and averages are null." }, "buckets": { "type": "array", @@ -59261,7 +59095,7 @@ }, "complete": { "type": "boolean", - "description": "True when this UTC time bucket has joint category coverage and no conversations or records were dropped. A summary bucket also requires every scoped number to have a bucket." + "description": "True when this UTC time bucket has joint category coverage and no conversations or records were dropped. A summary bucket also requires every scoped connection to have a bucket." } }, "required": [ @@ -59321,7 +59155,7 @@ "recipientCountry": { "type": "string", "pattern": "^(unknown|[A-Z]{2})$", - "description": "Numbering country inferred from a full phone number or valid BSUID prefix; Unknown for missing historical metadata. Not current location." + "description": "Calling country inferred from a full phone number or valid BSUID prefix; Unknown for missing historical metadata. Not current location." }, "recipientDeviceCount": { "type": "string", @@ -59538,11 +59372,11 @@ "truncated", "rows" ], - "description": "Hourly aggregate recipient observations, grouped jointly by numbering country, observed linked-device count and sender-device class. Incoming messages and matched delivery/read receipts are deduplicated by native message and device in bounded memory. Presence is user-level and uses Unknown device source. Quiet gaps of at least 15 minutes are completed gaps between observed signals on the same device, never verified offline periods. No recipient identity, native message ID or recipient device index is retained. Coverage is explicit; older retained buckets are unmeasured. Message telemetry remains Linked Devices only; Official API message activity is not measured." + "description": "Hourly aggregate recipient observations, grouped jointly by connectioning country, observed linked-device count and sender-device class. Incoming messages and matched delivery/read receipts are deduplicated by native message and device in bounded memory. Presence is user-level and uses Unknown device source. Quiet gaps of at least 15 minutes are completed gaps between observed signals on the same device, never verified offline periods. No recipient identity, native message ID or recipient device index is retained. Coverage is explicit; older retained buckets are unmeasured. Message telemetry remains Linked Devices only; Official API message activity is not measured." } }, "required": [ - "sessionId", + "connectionId", "projectId", "name", "backend", @@ -59613,7 +59447,7 @@ "type": "integer", "minimum": 0 }, - "sessionId": { + "connectionId": { "type": "string", "format": "uuid" }, @@ -59667,7 +59501,7 @@ "averageBusinessResponseMs", "onlineMs", "disconnects", - "sessionId", + "connectionId", "customerOnlineSignals", "customerTypingSignals", "primaryPhoneMessages", @@ -59762,7 +59596,7 @@ "type": "integer", "minimum": 0 }, - "sessionId": { + "connectionId": { "type": "string", "format": "uuid" }, @@ -59789,7 +59623,7 @@ "p95PickupMs", "shortAnswered", "video", - "sessionId", + "connectionId", "ts" ] } @@ -59800,7 +59634,7 @@ "period", "requestVitals", "summary", - "numbers", + "connections", "series", "callSeries" ] @@ -59816,7 +59650,7 @@ "data" ] }, - "ConsoleNumberOptionsPage": { + "ConsoleConnectionOptionsPage": { "type": "object", "additionalProperties": false, "properties": { @@ -59843,7 +59677,7 @@ "type": "array", "maxItems": 100, "items": { - "$ref": "#/components/schemas/ConsoleNumberOption" + "$ref": "#/components/schemas/ConsoleConnectionOption" } }, "nextCursor": { @@ -59858,14 +59692,14 @@ "nextCursor" ] }, - "ConsoleNumberOption": { + "ConsoleConnectionOption": { "type": "object", "additionalProperties": false, "properties": { "id": { "type": "string", "format": "uuid", - "description": "Immutable number UUID, never its reusable session name." + "description": "Immutable connection UUID, never its reusable connection name." }, "projectId": { "type": "string", @@ -59874,7 +59708,7 @@ "name": { "type": "string", "minLength": 1, - "description": "Trimmed number name, else current phone, else session name (UUID fallback when all labels are blank)." + "description": "Trimmed display name, else current phone, else connection name (UUID fallback when all labels are blank)." } }, "required": [ @@ -59898,7 +59732,7 @@ "$ref": "#/components/schemas/ConsoleMonthlyOutgoingCalls" } ], - "description": "Known-tier selected-number included outgoing allowance and completed-call usage for the current UTC month. Null for team/project reads or an unknown number tier. Independent of the requested chart period and of staff gate overrides; never a hard admission cap or charged-credit quote." + "description": "Known-tier selected-connection included outgoing allowance and completed-call usage for the current UTC month. Null for team/project reads or an unknown connection tier. Independent of the requested chart period and of staff gate overrides; never a hard admission cap or charged-credit quote." }, "period": { "type": "object", @@ -59932,15 +59766,15 @@ "type": "integer", "minimum": 0, "nullable": true, - "description": "Null for a number read: audit logs have no immutable number attribution." + "description": "Null for a connection read: audit logs have no immutable connection attribution." }, - "sessionDayCredits": { + "connectionDayCredits": { "type": "number" } }, "required": [ "failedRequests", - "sessionDayCredits" + "connectionDayCredits" ] }, "daily": { @@ -59954,14 +59788,14 @@ "consumption": { "type": "array", "maxItems": 18, - "description": "Credit-ledger number windows, registered meters and priced overage families. Outbound calls count completed call.duration records, matching the monthly gate. Serverless counts surviving admitted project invocation receipts, including failed or uncertain outcomes; receipts have no per-number allowance attribution. WhatsApp data covers media and enabled HMS but has no approved complete GB-month aggregate source. Pricing and measurement availability never establish a charge; credits come only from the number-window debit ledger.", + "description": "Credit-ledger connection windows, registered meters and priced overage families. Outbound calls count completed call.duration records, matching the monthly gate. Serverless counts surviving admitted project invocation receipts, including failed or uncertain outcomes; receipts have no per-connection allowance attribution. WhatsApp data covers media and enabled HMS but has no approved complete GB-month aggregate source. Pricing and measurement availability never establish a charge; credits come only from the connection-window debit ledger.", "items": { "$ref": "#/components/schemas/ConsoleConsumption" } }, "byProject": { "type": "array", - "description": "Included for a team-wide read; omitted for a selected project or number. Active projects only. Team-level activity without a project is included in totals but has no project row.", + "description": "Included for a team-wide read; omitted for a selected project or connection. Active projects only. Team-level activity without a project is included in totals but has no project row.", "items": { "$ref": "#/components/schemas/ConsoleProjectUsage" } @@ -59986,7 +59820,7 @@ "enum": [ "team", "project", - "number" + "connection" ] }, "teamId": { @@ -59998,23 +59832,23 @@ "format": "uuid", "nullable": true }, - "numberId": { + "connectionId": { "type": "string", "format": "uuid", "nullable": true }, - "numberName": { + "connectionName": { "type": "string", "nullable": true, - "description": "Selected number display name or session name; null without a selected number." + "description": "Selected connection display name or connection name; null without a selected connection." } }, "required": [ "kind", "teamId", "projectId", - "numberId", - "numberName" + "connectionId", + "connectionName" ] }, "ConsoleMonthlyOutgoingCalls": { @@ -60034,13 +59868,13 @@ "used": { "type": "integer", "minimum": 0, - "description": "Completed outbound call.duration records for the exact number and project, including zero-duration calls. In-flight placements are not included." + "description": "Completed outbound call.duration records for the exact connection and project, including zero-duration calls. In-flight placements are not included." }, "limit": { "type": "integer", "minimum": 0, "nullable": true, - "description": "Included number-tier monthly outgoing calls, using the runtime gate tier lookup. Null means a known unlimited tier. Separate staff gate overrides are not the included allowance." + "description": "Included connection-tier monthly outgoing calls, using the runtime gate tier lookup. Null means a known unlimited tier. Separate staff gate overrides are not the included allowance." } }, "required": [ @@ -60057,10 +59891,10 @@ "key": { "type": "string", "enum": [ - "number.free", - "number.standard", - "number.pro", - "number.other", + "connection.free", + "connection.standard", + "connection.pro", + "connection.other", "call.duration", "call.cloud_pulses", "campaign.call", @@ -60080,7 +59914,7 @@ "group": { "type": "string", "enum": [ - "numbers", + "connections", "calls", "voice", "agents", @@ -60198,9 +60032,9 @@ "key": { "type": "string", "enum": [ - "numbers", + "connections", "connected", - "session-days", + "connection-days", "api-requests", "request-rate", "message-rate", @@ -60216,8 +60050,8 @@ "unit": { "type": "string", "enum": [ - "numbers", - "sessions", + "connections", + "connections", "days", "requests", "req/min", @@ -60233,7 +60067,7 @@ "limit": { "type": "integer", "minimum": -1, - "description": "-1 means no limit. Session-days uses 0 because every observed session-day is metered." + "description": "-1 means no limit. Connection-days uses 0 because every observed connection-day is metered." }, "overage": { "type": "number", @@ -60264,18 +60098,18 @@ "format": "date", "description": "UTC date, YYYY-MM-DD." }, - "sessionDays": { + "connectionDays": { "type": "integer", "minimum": 0 }, - "sessionDayCredits": { + "connectionDayCredits": { "type": "number" }, "apiRequests": { "type": "integer", "minimum": 0, "nullable": true, - "description": "Null for number scope: request logs have no immutable number attribution." + "description": "Null for connection scope: request logs have no immutable connection attribution." }, "failedRequests": { "type": "integer", @@ -60286,20 +60120,20 @@ "type": "integer", "minimum": 0, "nullable": true, - "description": "Null for number scope. Maximum API and MCP request count in one UTC minute on this date within the requested range." + "description": "Null for connection scope. Maximum API and MCP request count in one UTC minute on this date within the requested range." }, "activeDays": { "type": "integer", "enum": [ 1 ], - "description": "This date has at least one observed audit, credit-ledger, usage-meter or admitted function invocation row, including activity that is not an API request or session charge." + "description": "This date has at least one observed audit, credit-ledger, usage-meter or admitted function invocation row, including activity that is not an API request or connection charge." } }, "required": [ "date", - "sessionDays", - "sessionDayCredits", + "connectionDays", + "connectionDayCredits", "apiRequests", "failedRequests", "peakRequestRate", @@ -60318,11 +60152,11 @@ "type": "integer", "minimum": 0 }, - "sessionDays": { + "connectionDays": { "type": "integer", "minimum": 0 }, - "sessionDayCredits": { + "connectionDayCredits": { "type": "number" }, "apiRequests": { @@ -60337,8 +60171,8 @@ "required": [ "projectId", "connected", - "sessionDays", - "sessionDayCredits", + "connectionDays", + "connectionDayCredits", "apiRequests", "failedRequests" ] @@ -60525,11 +60359,11 @@ "format": "int64", "nullable": true }, - "numberCount": { + "connectionCount": { "type": "integer", "minimum": 0 }, - "connectedNumberCount": { + "connectedConnectionCount": { "type": "integer", "minimum": 0 }, @@ -60563,8 +60397,8 @@ "status", "isDefault", "archivedAt", - "numberCount", - "connectedNumberCount", + "connectionCount", + "connectedConnectionCount", "activePairingLinkState", "lastActivityAt", "needsAttention", @@ -60630,7 +60464,7 @@ ], "nullable": true }, - "migratedNumberCount": { + "migratedConnectionCount": { "type": "integer", "minimum": 0 } @@ -60640,7 +60474,7 @@ "enabledAt", "enabledBy", "defaultCustomer", - "migratedNumberCount" + "migratedConnectionCount" ] }, "CustomerProjectRequest": { @@ -60695,7 +60529,7 @@ } } }, - "CustomerNumber": { + "CustomerConnection": { "type": "object", "additionalProperties": false, "properties": { @@ -60706,7 +60540,7 @@ "customerId": { "$ref": "#/components/schemas/CustomerId" }, - "sessionId": { + "connectionId": { "type": "string" }, "name": { @@ -60732,7 +60566,7 @@ "required": [ "id", "customerId", - "sessionId", + "connectionId", "name", "phoneMasked", "status", @@ -60761,7 +60595,7 @@ "type": "string", "nullable": true }, - "sessionId": { + "connectionId": { "type": "string", "format": "uuid", "nullable": true @@ -60799,7 +60633,7 @@ "action", "fromStatus", "toStatus", - "sessionId", + "connectionId", "pairingLinkId", "metadata", "occurredAt" @@ -60884,7 +60718,7 @@ "minimum": 1, "maximum": 20 }, - "pendingSessionId": { + "pendingConnectionId": { "type": "string", "format": "uuid", "nullable": true @@ -60964,7 +60798,7 @@ "status", "attemptCount", "maxAttempts", - "pendingSessionId", + "pendingConnectionId", "createdBy", "reservedAt", "openedAt", @@ -61059,7 +60893,7 @@ "minimum": 1, "maximum": 20 }, - "pendingSessionId": { + "pendingConnectionId": { "type": "string", "format": "uuid", "nullable": true @@ -61145,7 +60979,7 @@ "status", "attemptCount", "maxAttempts", - "pendingSessionId", + "pendingConnectionId", "createdBy", "reservedAt", "openedAt", @@ -61195,7 +61029,7 @@ } } }, - "TransferCustomerNumberRequest": { + "TransferCustomerConnectionRequest": { "type": "object", "additionalProperties": false, "properties": { @@ -61418,7 +61252,7 @@ "removed" ] }, - "SessionConfigurationView": { + "ConnectionConfigurationView": { "type": "object", "properties": { "requestedHistory": { @@ -61625,7 +61459,7 @@ "enum": [ "descriptor" ], - "description": "Polymorfa-Version 2026-10-14 and later. `descriptor` makes history.sync carry the chunk descriptor or inline payload; Polymorfa never downloads the chunk. Reset it to inherit the project or team delivery setting. Without an inherited choice, delivery is archive. Existing Numbers require confirmed cleanup before switching to descriptor delivery." + "description": "Polymorfa-Version 2026-10-14 and later. `descriptor` makes history.sync carry the chunk descriptor or inline payload; Polymorfa never downloads the chunk. Reset it to inherit the project or team delivery setting. Without an inherited choice, delivery is archive. Existing Connections require confirmed cleanup before switching to descriptor delivery." } }, "additionalProperties": false @@ -61744,7 +61578,7 @@ "platform", "team", "project", - "session" + "connection" ] }, "observation.typingMode": { @@ -61753,7 +61587,7 @@ "platform", "team", "project", - "session" + "connection" ] }, "observation.labelMode": { @@ -61762,7 +61596,7 @@ "platform", "team", "project", - "session" + "connection" ] }, "observation.quickReplyMode": { @@ -61771,7 +61605,7 @@ "platform", "team", "project", - "session" + "connection" ] }, "historySync.mode": { @@ -61780,7 +61614,7 @@ "platform", "team", "project", - "session", + "connection", "consent" ] }, @@ -61790,7 +61624,7 @@ "platform", "team", "project", - "session", + "connection", "consent" ] }, @@ -61800,7 +61634,7 @@ "platform", "team", "project", - "session" + "connection" ] }, "hms": { @@ -61809,7 +61643,7 @@ "platform", "team", "project", - "session" + "connection" ] } }, @@ -61835,7 +61669,7 @@ "type": "integer", "minimum": 0 }, - "session": { + "connection": { "type": "integer", "minimum": 0 } @@ -61843,7 +61677,7 @@ "required": [ "team", "project", - "session" + "connection" ], "additionalProperties": false }, @@ -61883,7 +61717,7 @@ ], "additionalProperties": false }, - "SessionConfigurationUpdateRequest": { + "ConnectionConfigurationUpdateRequest": { "type": "object", "properties": { "projectId": { @@ -61918,7 +61752,7 @@ "enum": [ "descriptor" ], - "description": "Polymorfa-Version 2026-10-14 and later. `descriptor` makes history.sync carry the chunk descriptor or inline payload; Polymorfa never downloads the chunk. Reset it to inherit the project or team delivery setting. Without an inherited choice, delivery is archive. Existing Numbers require confirmed cleanup before switching to descriptor delivery." + "description": "Polymorfa-Version 2026-10-14 and later. `descriptor` makes history.sync carry the chunk descriptor or inline payload; Polymorfa never downloads the chunk. Reset it to inherit the project or team delivery setting. Without an inherited choice, delivery is archive. Existing Connections require confirmed cleanup before switching to descriptor delivery." } }, "additionalProperties": false @@ -62134,17 +61968,17 @@ "signalModeDefault" ] }, - "SessionCallSettings": { + "ConnectionCallSettings": { "type": "object", "additionalProperties": false, "properties": { "callsEnabled": { "type": "boolean", - "description": "Whether the session can place, answer and receive calls." + "description": "Whether the connection can place, answer and receive calls." }, "conferenceMode": { "type": "boolean", - "description": "Conference mode. When true, every participant you connect to a call (including SIP trunk callers) hears the WhatsApp party and every other participant you connected. When false, each of them hears only the WhatsApp party. The WhatsApp party always hears all of your participants, and no participant hears their own audio. Sessions without saved settings report true." + "description": "Conference mode. When true, every participant you connect to a call (including SIP trunk callers) hears the WhatsApp party and every other participant you connected. When false, each of them hears only the WhatsApp party. The WhatsApp party always hears all of your participants, and no participant hears their own audio. Connections without saved settings report true." }, "inboundRoute": { "type": "string", @@ -62166,28 +62000,28 @@ }, "hostCloudApiCalls": { "type": "boolean", - "description": "Whether Polymorfa Calls answers the session's incoming calls when the session uses the Cloud API. When false (the default), your app answers them through the Graph API `/calls` endpoint and Polymorfa Calls does not host them. Sessions on a linked device ignore it." + "description": "Whether Polymorfa Calls answers the connection's incoming calls when the connection uses the Cloud API. When false (the default), your app answers them through the Graph API `/calls` endpoint and Polymorfa Calls does not host them. Connections on a linked device ignore it." }, "simultaneousCalls": { "type": "boolean", - "description": "Whether this Number may hold more than one call at a time, with no limit. Linked-device sessions only; Cloud API sessions ignore it. It voids Ban Credit: a ban whose 30-day window overlaps any period this setting was on is not covered. Defaults to false." + "description": "Whether this Connection may hold more than one call at a time, with no limit. Linked-device connections only; Cloud API connections ignore it. It voids Ban Credit: a ban whose 30-day window overlaps any period this setting was on is not covered. Defaults to false." }, "simultaneousCallsCoverageExcludedUntil": { "type": "string", "format": "date-time", "nullable": true, - "description": "Read-only. While `simultaneousCalls` is false, when Ban Credit stops excluding this Number because of an earlier period with it on: 30 days after the latest period ended. A ban is excluded when the setting was on at any time in the 30 days before it, so until this time, a new ban is not covered. Null while `simultaneousCalls` is true, and null when no period ended in the last 30 days. Null does not mean the Number is covered: the other Ban Credit conditions still apply." + "description": "Read-only. While `simultaneousCalls` is false, when Ban Credit stops excluding this Connection because of an earlier period with it on: 30 days after the latest period ended. A ban is excluded when the setting was on at any time in the 30 days before it, so until this time, a new ban is not covered. Null while `simultaneousCalls` is true, and null when no period ended in the last 30 days. Null does not mean the Connection is covered: the other Ban Credit conditions still apply." }, "revision": { "type": "integer", "minimum": 0, - "description": "Increases on every change; 0 while the session uses the defaults. Send it as `expectedRevision` to refuse an update that would overwrite someone else's change." + "description": "Increases on every change; 0 while the connection uses the defaults. Send it as `expectedRevision` to refuse an update that would overwrite someone else's change." }, "updatedAt": { "type": "string", "format": "date-time", "nullable": true, - "description": "When the settings were last changed, or null when the session uses the defaults." + "description": "When the settings were last changed, or null when the connection uses the defaults." } }, "required": [ @@ -62294,11 +62128,11 @@ "type": "string", "format": "uuid", "nullable": true, - "description": "Original owning project, retained after number deletion. Null when the original owner is unknown; those records appear only in team-wide reads." + "description": "Original owning project, retained after connection deletion. Null when the original owner is unknown; those records appear only in team-wide reads." }, - "sessionId": { + "connectionId": { "type": "string", - "description": "Session name of the number that placed or received the call." + "description": "Connection name of the connection that placed or received the call." }, "direction": { "type": "string", @@ -62313,7 +62147,7 @@ "linked_device", "cloud_api" ], - "description": "How the number connects to WhatsApp." + "description": "How the connection connects to WhatsApp." }, "outcome": { "type": "string", @@ -62324,7 +62158,7 @@ "failed", "in_progress" ], - "description": "How the call went. `answered`: media connected, including answered calls still in progress. `declined`: declined by a participant or the other party, or the line was busy. `missed`: nobody answered before ringing stopped or the caller hung up. `failed`: ended before it connected for any other reason, such as a connection or capacity failure. `in_progress`: still ringing." + "description": "How the call went. `answered`: media connected, including answered calls still in progress. `declined`: declined by a participant or the other party, or the line was busy. `missed`: nobody answered before ringing stopped or the caller hung up. `failed`: ended before it connected for any other reason, such as a method or capacity failure. `in_progress`: still ringing." }, "state": { "type": "string", @@ -62376,7 +62210,7 @@ "required": [ "callId", "projectId", - "sessionId", + "connectionId", "direction", "upstream", "outcome", @@ -62457,13 +62291,13 @@ "properties": { "key": { "type": "string", - "description": "Local date (`2026-09-18`) for `day`, local hour (`2026-09-18T14:00`) for `hour`, session name for `session`, or outcome for `outcome`." + "description": "Local date (`2026-09-18`) for `day`, local hour (`2026-09-18T14:00`) for `hour`, connection name for `connection`, or outcome for `outcome`." }, "start": { "type": "string", "format": "date-time", "nullable": true, - "description": "Start of the day or hour bucket. Null for `session` and `outcome` groups." + "description": "Start of the day or hour bucket. Null for `connection` and `outcome` groups." }, "calls": { "type": "integer", @@ -62575,7 +62409,7 @@ "enum": [ "day", "hour", - "session", + "connection", "outcome" ] }, @@ -62590,7 +62424,7 @@ }, "groupsTruncated": { "type": "boolean", - "description": "True when a `session` grouping left out numbers beyond the first 500. Totals still count every call." + "description": "True when a `connection` grouping left out connections beyond the first 500. Totals still count every call." }, "heatmap": { "type": "array", @@ -62641,9 +62475,9 @@ "type": "string", "format": "uuid" }, - "sessionId": { + "connectionId": { "type": "string", - "description": "Session name." + "description": "Connection name." }, "callId": { "type": "string" @@ -62720,7 +62554,7 @@ }, "required": [ "id", - "sessionId", + "connectionId", "callId", "projectId", "direction", @@ -62809,7 +62643,7 @@ } ] }, - "description": "Closed, per-meter attributes. Call meters carry `direction`, `upstream` (`linked_device` or `cloud_api`), `origin`, `participants`, `connections`, `sipLegs` and `video`." + "description": "Closed, per-meter attributes. Call meters carry `direction`, `upstream` (`linked_device` or `cloud_api`), `origin`, `participants`, `methods`, `sipLegs` and `video`." }, "keySource": { "$ref": "#/components/schemas/UsageKeySource" @@ -62833,12 +62667,12 @@ "type": "string", "format": "uuid", "nullable": true, - "description": "Original owning project, preserved across usage revisions and number deletion. Null when unknown; project-filtered reads exclude unattributed records." + "description": "Original owning project, preserved across usage revisions and connection deletion. Null when unknown; project-filtered reads exclude unattributed records." }, - "session": { + "connection": { "type": "string", "nullable": true, - "description": "The number (session name) the usage belongs to." + "description": "The connection (connection name) the usage belongs to." }, "occurredAt": { "type": "string", @@ -62852,7 +62686,7 @@ "revision": { "type": "integer", "minimum": 1, - "description": "Increases when a later observation corrects the record, for example a call end reported after a lost connection." + "description": "Increases when a later observation corrects the record, for example a call end reported after a lost method." }, "pricingState": { "type": "string", @@ -62899,7 +62733,7 @@ "sourceKind", "sourceId", "projectId", - "session", + "connection", "occurredAt", "recordedAt", "revision", @@ -62982,7 +62816,7 @@ "format": "uuid", "nullable": true }, - "session": { + "connection": { "type": "string", "nullable": true }, @@ -62996,15 +62830,15 @@ "$ref": "#/components/schemas/UsageMeterTotal" } }, - "numbers": { + "connections": { "type": "array", "maxItems": 100, - "description": "Totals per number, most call time first.", + "description": "Totals per connection, most call time first.", "items": { "type": "object", "additionalProperties": false, "properties": { - "session": { + "connection": { "type": "string" }, "projectId": { @@ -63020,15 +62854,15 @@ } }, "required": [ - "session", + "connection", "projectId", "meters" ] } }, - "numbersTruncated": { + "connectionsTruncated": { "type": "boolean", - "description": "True when more than 100 numbers had usage." + "description": "True when more than 100 connections had usage." } }, "required": [ @@ -63036,11 +62870,11 @@ "start", "end", "projectId", - "session", + "connection", "billingEnabled", "meters", - "numbers", - "numbersTruncated" + "connections", + "connectionsTruncated" ] }, "UsageGate": { @@ -63104,12 +62938,12 @@ "limit": { "type": "number", "nullable": true, - "description": "For capability gates, 1 when included and 0 when not. Otherwise the limit, or -1 for no limit. Null when the limit applies per number and no `session` was given." + "description": "For capability gates, 1 when included and 0 when not. Otherwise the limit, or -1 for no limit. Null when the limit applies per connection and no `connection` was given." }, "used": { "type": "number", "nullable": true, - "description": "Usage this calendar month (UTC) counted against a quota. Per-number quotas count only the current number; retained usage from a deleted number with the same name is excluded." + "description": "Usage this calendar month (UTC) counted against a quota. Per-connection quotas count only the current connection; retained usage from a deleted connection with the same name is excluded." }, "unit": { "type": "string", @@ -63178,7 +63012,7 @@ "type": "object", "additionalProperties": false, "properties": { - "session": { + "connection": { "type": "string", "nullable": true }, @@ -63190,7 +63024,7 @@ } }, "required": [ - "session", + "connection", "gates" ] }, @@ -63227,9 +63061,9 @@ "callId": { "type": "string" }, - "sessionId": { + "connectionId": { "type": "string", - "description": "Session name." + "description": "Connection name." }, "projectId": { "type": "string", @@ -63259,7 +63093,7 @@ }, "backend": { "type": "string", - "description": "How the number reaches WhatsApp for this call." + "description": "How the connection reaches WhatsApp for this call." }, "hasVideo": { "type": "boolean" @@ -63308,7 +63142,7 @@ }, "required": [ "callId", - "sessionId", + "connectionId", "projectId", "direction", "state", @@ -63494,7 +63328,7 @@ "appReports": { "type": "object", "additionalProperties": false, - "description": "Diagnostics your app sent with `POST /messaging/voip/calls/{id}/reports`, by connection. Figures the app did not report are null.", + "description": "Diagnostics your app sent with `POST /messaging/voip/calls/{id}/reports`, by method. Figures the app did not report are null.", "properties": { "status": { "type": "string", @@ -63523,7 +63357,7 @@ "type": "object", "nullable": true, "additionalProperties": false, - "description": "The SDK named by the connection's most recent report. Null when that report named none.", + "description": "The SDK named by the method's most recent report. Null when that report named none.", "properties": { "sdk": { "type": "string", @@ -63552,7 +63386,7 @@ "type": "object", "nullable": true, "additionalProperties": false, - "description": "The connection's latest quality report. Null when it sent none.", + "description": "The method's latest quality report. Null when it sent none.", "properties": { "reportedAt": { "type": "string", @@ -63661,7 +63495,7 @@ }, "required": [ "status", - "connections", + "methods", "truncated" ] }, @@ -63813,20 +63647,20 @@ "callId": { "type": "string" }, - "sessionId": { + "connectionId": { "type": "string" } }, "required": [ "callId", - "sessionId" + "connectionId" ] } }, "required": [ "call", "participants", - "connections", + "methods", "telemetry", "appReports", "webhookDeliveries", @@ -63860,7 +63694,7 @@ "projectId": { "type": "string", "format": "uuid", - "description": "Project that owns the call's session." + "description": "Project that owns the call's connection." } } }, @@ -63887,13 +63721,13 @@ "removed" ] }, - "UpdateSessionCallSettingsRequest": { + "UpdateConnectionCallSettingsRequest": { "type": "object", "additionalProperties": false, "properties": { "callsEnabled": { "type": "boolean", - "description": "False refuses new and incoming calls on the session." + "description": "False refuses new and incoming calls on the connection." }, "conferenceMode": { "type": "boolean", @@ -63917,17 +63751,17 @@ }, "hostCloudApiCalls": { "type": "boolean", - "description": "True has Polymorfa Calls answer the session's Cloud API calls instead of your Graph API integration." + "description": "True has Polymorfa Calls answer the connection's Cloud API calls instead of your Graph API integration." }, "simultaneousCalls": { "type": "boolean", - "description": "True lets this Number hold more than one call at a time. Requires a team owner or admin and current risk acknowledgement through acceptTerms, a recorded acceptance, or the original acknowledgeRisk alias. It voids Ban Credit for this Number. False returns to one call at a time." + "description": "True lets this Connection hold more than one call at a time. Requires a team owner or admin and current risk acknowledgement through acceptTerms, a recorded acceptance, or the original acknowledgeRisk alias. It voids Ban Credit for this Connection. False returns to one call at a time." }, "acceptTerms": { "type": "string", "minLength": 1, "maxLength": 100, - "description": "Published simultaneous-call terms version accepted inline for this Number. Unpublished terms add no requirement." + "description": "Published simultaneous-call terms version accepted inline for this Connection. Unpublished terms add no requirement." }, "termsLocale": { "type": "string", @@ -63949,7 +63783,7 @@ "projectId": { "type": "string", "format": "uuid", - "description": "Project that owns the session." + "description": "Project that owns the connection." } }, "minProperties": 1 @@ -63975,7 +63809,7 @@ "type": "string", "format": "uri", "nullable": true, - "description": "Project-owned HTTPS destination after connection confirmation." + "description": "Project-owned HTTPS destination after method confirmation." }, "failureCallbackUrl": { "type": "string", @@ -64149,7 +63983,7 @@ "pattern": "^[Hh][Tt][Tt][Pp][Ss]://", "maxLength": 2048, "nullable": true, - "description": "Project-only destination after connection confirmation. Snapshotted when issuing a link." + "description": "Project-only destination after method confirmation. Snapshotted when issuing a link." }, "failureCallbackUrl": { "type": "string", @@ -64180,7 +64014,7 @@ "type": "string", "maxLength": 280, "nullable": true, - "description": "Message shown after the number connects." + "description": "Message shown after the connection connects." }, "supportUrl": { "type": "string", @@ -64331,7 +64165,7 @@ "metaLinks": { "type": "array", "items": { - "$ref": "#/components/schemas/FlowNumberLink" + "$ref": "#/components/schemas/FlowConnectionLink" } }, "createdAt": { @@ -64456,11 +64290,11 @@ "projectId": { "$ref": "#/components/schemas/ProjectId" }, - "sessionId": { + "connectionId": { "type": "string", "minLength": 1, "maxLength": 256, - "description": "Number (session) name or id in the Flow's project." + "description": "Connection name or ID in the Flow's project." }, "categories": { "type": "array", @@ -64470,7 +64304,7 @@ "items": { "$ref": "#/components/schemas/FlowCategory" }, - "description": "WhatsApp Flow categories. Required for an upload that creates the Number's Flow; ignored otherwise." + "description": "WhatsApp Flow categories. Required for an upload that creates the Connection's Flow; ignored otherwise." }, "requestId": { "type": "string", @@ -64480,7 +64314,7 @@ }, "required": [ "projectId", - "sessionId" + "connectionId" ] }, "FlowValidationIssue": { @@ -64534,18 +64368,18 @@ } } }, - "FlowNumberLink": { + "FlowConnectionLink": { "type": "object", "additionalProperties": false, - "description": "The Flow as WhatsApp last reported it for one Number.", + "description": "The Flow as WhatsApp last reported it for one Connection.", "properties": { - "session": { + "connection": { "type": "string" }, - "sessionId": { + "connectionId": { "type": "string", "format": "uuid", - "description": "Stable Number ID. A Number recreated under the same name does not reuse this link." + "description": "Connection record UUID. A Connection recreated under the same name does not reuse this link." }, "wabaId": { "type": "string", @@ -64601,11 +64435,11 @@ }, "simulated": { "type": "boolean", - "description": "True for a test Number." + "description": "True for a test Connection." } }, "required": [ - "session", + "connection", "wabaId", "metaFlowId", "status", @@ -64631,11 +64465,11 @@ "flowId": { "$ref": "#/components/schemas/FlowId" }, - "sessionId": { + "connectionId": { "type": "string", "format": "uuid" }, - "session": { + "connection": { "type": "string" }, "flowName": { @@ -64720,8 +64554,8 @@ "id", "requestId", "flowId", - "sessionId", - "session", + "connectionId", + "connection", "flowName", "action", "state", @@ -64778,7 +64612,7 @@ "flowId": { "$ref": "#/components/schemas/FlowId" }, - "sessionId": { + "connectionId": { "type": "string", "format": "uuid" }, @@ -64832,7 +64666,7 @@ "teamId", "projectId", "flowId", - "sessionId", + "connectionId", "mode", "url", "functionId", @@ -64911,7 +64745,7 @@ "managed", "customer" ], - "description": "`managed`: Polymorfa holds the Number's active key. `customer`: it does not; register your own key to use direct endpoints." + "description": "`managed`: Polymorfa holds the Connection's active key. `customer`: it does not; register your own key to use direct endpoints." }, "activeKeyId": { "type": "string", @@ -64957,16 +64791,16 @@ "projectId": { "$ref": "#/components/schemas/ProjectId" }, - "sessionId": { + "connectionId": { "type": "string", "minLength": 1, "maxLength": 256, - "description": "Number (session) name or id." + "description": "Connection name or ID." } }, "required": [ "projectId", - "sessionId" + "connectionId" ] }, "FlowEndpointState": { @@ -65018,11 +64852,11 @@ "projectId": { "$ref": "#/components/schemas/ProjectId" }, - "sessionId": { + "connectionId": { "type": "string", "minLength": 1, "maxLength": 256, - "description": "Number (session) name or id in the Flow's project." + "description": "Connection name or ID in the Flow's project." }, "mode": { "type": "string", @@ -65065,7 +64899,7 @@ }, "required": [ "projectId", - "sessionId", + "connectionId", "mode" ] }, @@ -65084,7 +64918,7 @@ "type": "string", "format": "uuid" }, - "sessionId": { + "connectionId": { "type": "string", "format": "uuid" }, @@ -65155,7 +64989,7 @@ "id", "flowId", "endpointId", - "sessionId", + "connectionId", "mode", "action", "outcome", @@ -65330,13 +65164,13 @@ "ok" ] }, - "SessionIdentifier": { + "ConnectionIdentifier": { "type": "string", "minLength": 1, "maxLength": 64, - "description": "Database session UUID or stable session slug." + "description": "Database connection UUID or stable connection slug." }, - "SessionProjectContext": { + "ConnectionProjectContext": { "type": "object", "additionalProperties": false, "properties": { @@ -65345,7 +65179,7 @@ } } }, - "SessionTierOverrideRequest": { + "ConnectionTierOverrideRequest": { "type": "object", "additionalProperties": false, "properties": { @@ -65361,7 +65195,7 @@ "quoteId" ] }, - "NumberTierChange": { + "ConnectionTierChange": { "type": "object", "additionalProperties": false, "properties": { @@ -65422,7 +65256,7 @@ "nullable": true }, "hybridTransition": { - "$ref": "#/components/schemas/NumberHybridTransition" + "$ref": "#/components/schemas/ConnectionHybridTransition" } }, "required": [ @@ -65444,7 +65278,7 @@ "quote" ] }, - "NumberTierQuoteRequest": { + "ConnectionTierQuoteRequest": { "type": "object", "additionalProperties": false, "properties": { @@ -65480,7 +65314,7 @@ ] }, "HybridResolution": { - "description": "Required when a Hybrid Link Number moves to a tier without Hybrid Link. `keep` retires the other connection. `split` keeps `existingNumberTransport` on this Number and moves the other connection to a new Standard Number named `newNumberName`, without pairing or signing up again.", + "description": "Required when a Hybrid Link Connection moves to a tier without Hybrid Link. `keep` retires the other method. `split` keeps `existingConnectionTransport` on this Connection and moves the other method to a new Standard Connection named `newConnectionName`, without pairing or signing up again.", "oneOf": [ { "type": "object", @@ -65511,18 +65345,18 @@ "split" ] }, - "existingNumberTransport": { + "existingConnectionTransport": { "$ref": "#/components/schemas/HybridTransport" }, - "newNumberName": { + "newConnectionName": { "type": "string", "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,63}$" } }, "required": [ "action", - "existingNumberTransport", - "newNumberName" + "existingConnectionTransport", + "newConnectionName" ] } ], @@ -65533,18 +65367,18 @@ "HybridMerge": { "type": "object", "additionalProperties": false, - "description": "Merges another Number into this one as a Hybrid Link Number. The other Number's connection moves here and the other Number is removed.", + "description": "Merges another Connection into this one as a Hybrid Link Connection. The other Connection's method moves here and the other Connection is removed.", "properties": { - "absorbNumberId": { + "absorbConnectionId": { "type": "string", "format": "uuid" } }, "required": [ - "absorbNumberId" + "absorbConnectionId" ] }, - "NumberHybridTransition": { + "ConnectionHybridTransition": { "type": "object", "additionalProperties": false, "properties": { @@ -65559,24 +65393,24 @@ "keepTransport": { "$ref": "#/components/schemas/HybridTransport" }, - "existingNumberTransport": { + "existingConnectionTransport": { "$ref": "#/components/schemas/HybridTransport" }, - "newNumberName": { + "newConnectionName": { "type": "string" }, - "absorbNumberId": { + "absorbConnectionId": { "type": "string", "format": "uuid" }, - "survivingNumberId": { + "survivingConnectionId": { "type": "string", "format": "uuid" }, - "newNumberId": { + "newConnectionId": { "type": "string", "format": "uuid", - "description": "The Number created by a completed split." + "description": "The Connection created by a completed split." }, "status": { "type": "string", @@ -65594,7 +65428,7 @@ }, "metaDisconnectRequired": { "type": "boolean", - "description": "True after an Official API connection that shares the number with the WhatsApp Business app is dropped. Polymorfa has stopped using it; disconnect it in the WhatsApp Business app under Settings > Account > Business Platform." + "description": "True after an Official API method that shares the connection with the WhatsApp Business app is dropped. Polymorfa has stopped using it; disconnect it in the WhatsApp Business app under Settings > Account > Business Platform." }, "effectiveAtMs": { "type": "integer", @@ -65603,7 +65437,7 @@ }, "required": [ "action", - "survivingNumberId" + "survivingConnectionId" ] }, "HybridMergeCandidateList": { @@ -65612,7 +65446,7 @@ "type": "object", "additionalProperties": false, "properties": { - "numbers": { + "connections": { "type": "array", "minItems": 2, "maxItems": 2, @@ -65635,7 +65469,7 @@ }, "canBeAbsorbed": { "type": "boolean", - "description": "False when this Number has hosted message storage enabled. Keep this Number and absorb the other one." + "description": "False when this Connection has hosted message storage enabled. Keep this Connection and absorb the other one." } }, "required": [ @@ -65665,33 +65499,33 @@ } }, "required": [ - "numbers", + "connections", "eligible" ] } }, - "SessionBatchRequest": { + "ConnectionBatchRequest": { "type": "object", "additionalProperties": false, "properties": { "projectId": { "$ref": "#/components/schemas/ProjectId" }, - "sessionIds": { + "connectionIds": { "type": "array", "minItems": 1, "maxItems": 100, "uniqueItems": true, "items": { - "$ref": "#/components/schemas/SessionIdentifier" + "$ref": "#/components/schemas/ConnectionIdentifier" } } }, "required": [ - "sessionIds" + "connectionIds" ] }, - "CreateTestingNumberRequest": { + "CreateTestingConnectionRequest": { "type": "object", "additionalProperties": false, "properties": { @@ -65964,7 +65798,7 @@ "projectId" ] }, - "ManagedSession": { + "ManagedConnection": { "type": "object", "additionalProperties": false, "properties": { @@ -65972,9 +65806,9 @@ "type": "string", "format": "uuid" }, - "sessionId": { + "connectionId": { "type": "string", - "description": "Stable session slug." + "description": "Stable connection slug." }, "status": { "type": "string" @@ -65992,12 +65826,12 @@ }, "required": [ "id", - "sessionId", + "connectionId", "status", "tierOverride" ] }, - "PlatformSession": { + "PlatformConnection": { "type": "object", "additionalProperties": false, "properties": { @@ -66012,8 +65846,8 @@ "projectId": { "$ref": "#/components/schemas/ProjectId" }, - "sessionId": { - "$ref": "#/components/schemas/SessionIdentifier" + "connectionId": { + "$ref": "#/components/schemas/ConnectionIdentifier" }, "name": { "type": "string", @@ -66046,12 +65880,12 @@ }, "status": { "type": "string", - "description": "Latest runtime connection status." + "description": "Latest runtime method status." }, "statusReason": { "type": "string", "nullable": true, - "description": "Machine-readable reason for the latest connection status, when available." + "description": "Machine-readable reason for the latest method status, when available." }, "messageCount": { "type": "integer", @@ -66158,7 +65992,7 @@ "_id", "_creationTime", "projectId", - "sessionId", + "connectionId", "name", "phone", "platform", @@ -66192,7 +66026,7 @@ "properties": { "released": { "type": "boolean", - "description": "False when the Number was already unclaimed." + "description": "False when the Connection was already unclaimed." } }, "required": [ @@ -66202,7 +66036,7 @@ "InspectorClaimState": { "type": "object", "additionalProperties": false, - "description": "Whether a team member has claimed this Number in Inspector. The claimant's identity is not included.", + "description": "Whether a team member has claimed this Connection in Inspector. The claimant's identity is not included.", "properties": { "claimed": { "type": "boolean" @@ -66219,7 +66053,7 @@ "claimedAt" ] }, - "SessionStopResult": { + "ConnectionStopResult": { "type": "object", "additionalProperties": false, "properties": { @@ -66229,17 +66063,17 @@ true ] }, - "sessionId": { + "connectionId": { "type": "string", "format": "uuid" } }, "required": [ "stopping", - "sessionId" + "connectionId" ] }, - "SessionStartResult": { + "ConnectionStartResult": { "type": "object", "additionalProperties": false, "properties": { @@ -66249,17 +66083,17 @@ true ] }, - "sessionId": { + "connectionId": { "type": "string", "format": "uuid" } }, "required": [ "starting", - "sessionId" + "connectionId" ] }, - "SessionRemoveResult": { + "ConnectionRemoveResult": { "type": "object", "additionalProperties": false, "properties": { @@ -66269,17 +66103,17 @@ true ] }, - "sessionId": { + "connectionId": { "type": "string", "format": "uuid" } }, "required": [ "removed", - "sessionId" + "connectionId" ] }, - "SessionBatchStopResult": { + "ConnectionBatchStopResult": { "type": "object", "additionalProperties": false, "properties": { @@ -66293,7 +66127,7 @@ "stopping" ] }, - "SessionBatchRemoveResult": { + "ConnectionBatchRemoveResult": { "type": "object", "additionalProperties": false, "properties": { @@ -66307,10 +66141,10 @@ "removed" ] }, - "TestingSessionId": { + "TestingConnectionId": { "type": "string", "pattern": "^[1-9][0-9]{0,18}$", - "description": "Opaque Number ID. Keep it as a string; use testMode to identify Test Numbers." + "description": "Opaque Connection ID. Keep it as a string; use testMode to identify Test Connections." }, "ProductionEnrollmentRequest": { "type": "object", @@ -66513,7 +66347,7 @@ "type": "string", "minLength": 1, "maxLength": 64, - "description": "Number in international format, for example `+14155550100`. Spaces, dots, hyphens and parentheses are ignored; a leading `00` is read as `+`; digits without `+` are read as including the country code." + "description": "Connection in international format, for example `+14155550100`. Spaces, dots, hyphens and parentheses are ignored; a leading `00` is read as `+`; digits without `+` are read as including the country code." }, "variables": { "type": "object", @@ -66569,7 +66403,7 @@ "required": [ "message" ], - "description": "One optional receipt-timed follow-up, sent from the Number that sent the first message. A beta; a team that is not enrolled gets `403 feature_unavailable`. Expiry must exceed delay and is counted from the first send. Configuration freezes at launch. The first read takes precedence over the first delivery; additional reads do not move it. Replies and opt-outs cancel it. Without a delivery or read receipt it never arms, and an expired wait never sends. Requires a single first message, and the text cannot contain tracked links.", + "description": "One optional receipt-timed follow-up, sent from the Connection that sent the first message. A beta; a team that is not enrolled gets `403 feature_unavailable`. Expiry must exceed delay and is counted from the first send. Configuration freezes at launch. The first read takes precedence over the first delivery; additional reads do not move it. Replies and opt-outs cancel it. Without a delivery or read receipt it never arms, and an expired wait never sends. Requires a single first message, and the text cannot contain tracked links.", "properties": { "delaySeconds": { "type": "integer", @@ -66635,7 +66469,7 @@ "additionalProperties": false, "required": [ "id", - "numberId", + "connectionId", "status", "anchorKind", "firstDeliveredAt", @@ -66654,7 +66488,7 @@ "type": "string", "format": "uuid" }, - "numberId": { + "connectionId": { "type": "string", "format": "uuid" }, @@ -66813,16 +66647,16 @@ "format": "uuid", "description": "Required when using a team API key. Project tokens derive the project from the credential." }, - "sessionId": { + "connectionId": { "type": "string", "format": "uuid", - "description": "The number to send the test from. It must be connected, on a plan that includes Campaigns and, when the campaign selects numbers, one of them." + "description": "The connection to send the test from. It must be connected, on a plan that includes Campaigns and, when the campaign selects connections, one of them." }, "to": { "type": "string", "minLength": 1, "maxLength": 32, - "description": "The seed recipient in international format. It must be the phone of a number connected to your team.", + "description": "The seed recipient in international format. It must be the phone of a connection connected to your team.", "example": "+5511999990000" }, "sampleRecipientId": { @@ -66851,7 +66685,7 @@ } }, "required": [ - "sessionId", + "connectionId", "to" ] }, @@ -66878,7 +66712,7 @@ "type": "object", "additionalProperties": false, "properties": { - "sessionId": { + "connectionId": { "type": "string", "format": "uuid" }, @@ -66887,10 +66721,10 @@ } }, "required": [ - "sessionId", + "connectionId", "phone" ], - "description": "The number the test was sent from." + "description": "The connection the test was sent from." }, "to": { "type": "string", @@ -67473,7 +67307,7 @@ "templateId": { "type": "string", "format": "uuid", - "description": "Template in the campaign's project to send instead of composed messages. On Cloud API numbers it must be approved by WhatsApp before launch." + "description": "Template in the campaign's project to send instead of composed messages. On Cloud API connections it must be approved by WhatsApp before launch." }, "variableMapping": { "$ref": "#/components/schemas/CampaignVariableMapping" @@ -67511,7 +67345,7 @@ "items": { "$ref": "#/components/schemas/CampaignTrackedLink" }, - "description": "Beta. Links to track, at most 5. Each message reference `{{link:}}` is replaced with a short link per recipient that redirects to `url`. Only campaigns sent from linked-device numbers track links. `null` or `[]` stores none." + "description": "Beta. Links to track, at most 5. Each message reference `{{link:}}` is replaced with a short link per recipient that redirects to `url`. Only campaigns sent from linked-device connections track links. `null` or `[]` stores none." }, "drip": { "nullable": true, @@ -67594,7 +67428,7 @@ }, "messageVariations": { "$ref": "#/components/schemas/CampaignMessageVariations", - "description": "Two to five message alternatives for linked-device numbers. Each recipient receives one, chosen by weight, and keeps it across retries. Cannot be combined with composed messages, a template or an A/B test. A beta; a team that is not enrolled gets `403 feature_unavailable`." + "description": "Two to five message alternatives for linked-device connections. Each recipient receives one, chosen by weight, and keeps it across retries. Cannot be combined with composed messages, a template or an A/B test. A beta; a team that is not enrolled gets `403 feature_unavailable`." } }, "required": [ @@ -67609,7 +67443,7 @@ "exitOnReply", "exitOnLinkClick" ], - "description": "Beta drip settings. Defaults: audience enrollment, exit on reply true, exit on link open false. Opt-outs always stop remaining steps. Cannot combine with a template, A/B variants, weighted alternatives or receipt-timed followUp. Linked-device and test numbers only.", + "description": "Beta drip settings. Defaults: audience enrollment, exit on reply true, exit on link open false. Opt-outs always stop remaining steps. Cannot combine with a template, A/B variants, weighted alternatives or receipt-timed followUp. Linked-device and test connections only.", "properties": { "enrollment": { "type": "string", @@ -67623,7 +67457,7 @@ "exitOnReply": { "type": "boolean", "default": true, - "description": "When true, a contact who replies to the sending number gets no further steps." + "description": "When true, a contact who replies to the sending connection gets no further steps." }, "exitOnLinkClick": { "type": "boolean", @@ -67635,7 +67469,7 @@ "CampaignDripInput": { "type": "object", "additionalProperties": false, - "description": "Beta drip settings. Defaults: audience enrollment, exit on reply true, exit on link open false. Opt-outs always stop remaining steps. Cannot combine with a template, A/B variants, weighted alternatives or receipt-timed followUp. Linked-device and test numbers only.", + "description": "Beta drip settings. Defaults: audience enrollment, exit on reply true, exit on link open false. Opt-outs always stop remaining steps. Cannot combine with a template, A/B variants, weighted alternatives or receipt-timed followUp. Linked-device and test connections only.", "properties": { "enrollment": { "type": "string", @@ -67649,7 +67483,7 @@ "exitOnReply": { "type": "boolean", "default": true, - "description": "When true, a contact who replies to the sending number gets no further steps." + "description": "When true, a contact who replies to the sending connection gets no further steps." }, "exitOnLinkClick": { "type": "boolean", @@ -67673,7 +67507,7 @@ }, "exitOnReply": { "type": "boolean", - "description": "When true, a contact who replies to the sending number gets no further steps." + "description": "When true, a contact who replies to the sending connection gets no further steps." }, "exitOnLinkClick": { "type": "boolean", @@ -67872,7 +67706,7 @@ "url": { "type": "string", "format": "uri", - "description": "Public https URL the sending number downloads the file from. Launch is refused with `400 invalid_parameter` when an attachment has no URL." + "description": "Public https URL the sending connection downloads the file from. Launch is refused with `400 invalid_parameter` when an attachment has no URL." }, "filename": { "type": "string" @@ -67885,7 +67719,7 @@ }, "buttons": { "type": "array", - "description": "On WhatsApp numbers, link and call buttons are sent as text lines and quick replies are left out.", + "description": "On WhatsApp connections, link and call buttons are sent as text lines and quick replies are left out.", "items": { "type": "object", "additionalProperties": true, @@ -68359,7 +68193,7 @@ "kind" ], "additionalProperties": true, - "description": "`text` (`text`), `buttons` (`body`, up to 3 `buttons` with `id` and `text`), `list` (`body`, `buttonText`, up to 10 `rows`), or `flow_form` (`flowId`, `body`, `buttonText`, `screen`; Official numbers only).", + "description": "`text` (`text`), `buttons` (`body`, up to 3 `buttons` with `id` and `text`), `list` (`body`, `buttonText`, up to 10 `rows`), or `flow_form` (`flowId`, `body`, `buttonText`, `screen`; Official connections only).", "properties": { "kind": { "type": "string", @@ -69831,7 +69665,7 @@ "cold_held", "campaign_cancelled", "invalid_recipient", - "session_not_connected", + "connection_not_connected", "ack_timeout", "blocked_by_safety", "send_failed", @@ -69839,7 +69673,7 @@ "frequency_cap", "other" ], - "description": "Why the recipient was not sent, or why its last attempt did not succeed. Null when nothing went wrong. `opted_out`: the number is on the team's opt-out list. `cold_held`: the number never wrote to the sending number and the campaign holds cold sends. `campaign_cancelled`: the campaign was stopped before this recipient was sent. `invalid_recipient`: the number is not a valid WhatsApp address. `session_not_connected`: the sending number was not connected. `ack_timeout`: WhatsApp did not acknowledge the send in time. `blocked_by_safety`: a safety check refused the send before it was attempted; the recipient waits for the campaign to resume. `send_failed`: WhatsApp refused the send, or its outcome could not be confirmed. `missing_variable`: the campaign was launched with `skipMissingVariables` and the recipient had no value and no fallback for a variable. `frequency_cap`: the recipient reached the team's or campaign's rolling contact frequency cap. `other`: any other reason. New codes may be added." + "description": "Why the recipient was not sent, or why its last attempt did not succeed. Null when nothing went wrong. `opted_out`: the phone number is on the team's opt-out list. `cold_held`: the recipient never wrote to the sending connection and the campaign holds cold sends. `campaign_cancelled`: the campaign was stopped before this recipient was sent. `invalid_recipient`: the recipient is not a valid WhatsApp address. `connection_not_connected`: the sending connection was not connected. `ack_timeout`: WhatsApp did not acknowledge the send in time. `blocked_by_safety`: a safety check refused the send before it was attempted; the recipient waits for the campaign to resume. `send_failed`: WhatsApp refused the send, or its outcome could not be confirmed. `missing_variable`: the campaign was launched with `skipMissingVariables` and the recipient had no value and no fallback for a variable. `frequency_cap`: the recipient reached the team's or campaign's rolling contact frequency cap. `other`: any other reason. New codes may be added." }, "RecordCampaignConversionRequest": { "type": "object", @@ -70308,7 +70142,7 @@ "enum": [ "direct_condition", "delivery", - "connection", + "method", "conduct", "cadence" ] @@ -70373,7 +70207,7 @@ "minimum": 0, "maximum": 100 }, - "connection": { + "method": { "type": "number", "minimum": 0, "maximum": 100 @@ -70392,7 +70226,7 @@ "required": [ "conduct", "delivery", - "connection", + "method", "restriction", "total" ] @@ -70413,7 +70247,7 @@ "enum": [ "direct_condition", "delivery", - "connection", + "method", "conduct", "cadence" ] @@ -70428,7 +70262,7 @@ "enum": [ "direct_condition", "delivery", - "connection", + "method", "conduct", "cadence" ] @@ -70690,15 +70524,15 @@ "signals" ] }, - "BanSafeCollectionSession": { + "BanSafeCollectionConnection": { "type": "object", "additionalProperties": false, "properties": { - "sessionId": { + "connectionId": { "type": "string", "format": "uuid" }, - "session": { + "connection": { "type": "string" }, "projectId": { @@ -70710,8 +70544,8 @@ } }, "required": [ - "sessionId", - "session", + "connectionId", + "connection", "projectId", "collection" ] @@ -70720,11 +70554,11 @@ "type": "object", "additionalProperties": false, "properties": { - "sessionId": { + "connectionId": { "type": "string", "format": "uuid" }, - "session": { + "connection": { "type": "string" }, "projectId": { @@ -70744,8 +70578,8 @@ } }, "required": [ - "sessionId", - "session", + "connectionId", + "connection", "projectId", "collection", "snapshot" @@ -70759,11 +70593,11 @@ "type": "string", "format": "uuid" }, - "sessionId": { + "connectionId": { "type": "string", "format": "uuid" }, - "session": { + "connection": { "type": "string" }, "projectId": { @@ -70857,8 +70691,8 @@ }, "required": [ "id", - "sessionId", - "session", + "connectionId", + "connection", "projectId", "mode", "action", @@ -70875,7 +70709,7 @@ "outcome" ] }, - "BanSafeNumberEnforcement": { + "BanSafeConnectionEnforcement": { "type": "object", "additionalProperties": false, "properties": { @@ -70908,7 +70742,7 @@ "block_cold", "suspend" ], - "description": "The lowest restriction every number in this workspace is held to." + "description": "The lowest restriction every connection in this workspace is held to." }, "reason": { "type": "string" @@ -70923,15 +70757,15 @@ "throughputPerMinute": { "type": "number", "nullable": true, - "description": "Messages per minute this number is paced to, or null when it is not paced." + "description": "Messages per minute this connection is paced to, or null when it is not paced." }, "blocksUnsolicited": { "type": "boolean", - "description": "First messages to people who never wrote to this number are refused outside Campaigns." + "description": "First messages to people who never wrote to this connection are refused outside Campaigns." }, "suspended": { "type": "boolean", - "description": "This number cannot originate a message. It still receives, reads, and shows presence." + "description": "This connection cannot originate a message. It still receives, reads, and shows presence." }, "startedAt": { "type": "string", @@ -70971,7 +70805,7 @@ "applied", "applying" ], - "description": "`applying` while the number has not confirmed the restriction." + "description": "`applying` while the connection has not confirmed the restriction." } }, "required": [ @@ -70992,15 +70826,15 @@ "state" ] }, - "BanSafeNumber": { + "BanSafeConnection": { "type": "object", "additionalProperties": false, "properties": { - "sessionId": { + "connectionId": { "type": "string", "format": "uuid" }, - "session": { + "connection": { "type": "string" }, "phoneNumber": { @@ -71115,14 +70949,14 @@ "nullable": true, "allOf": [ { - "$ref": "#/components/schemas/BanSafeNumberEnforcement" + "$ref": "#/components/schemas/BanSafeConnectionEnforcement" } ] } }, "required": [ - "sessionId", - "session", + "connectionId", + "connection", "phoneNumber", "projectId", "health", @@ -71197,13 +71031,13 @@ "evidence": { "type": "object", "additionalProperties": true, - "description": "Numbers only. Never message content, a message identifier, or a recipient identifier." + "description": "Connections only. Never message content, a message identifier, or a recipient identifier." }, - "sessionId": { + "connectionId": { "type": "string", "format": "uuid" }, - "session": { + "connection": { "type": "string" }, "phoneNumber": { @@ -71249,7 +71083,7 @@ "enum": [ "clean", "key_retired", - "number_removed", + "connection_removed", "stale", null ] @@ -71266,8 +71100,8 @@ "occurrences", "reopenedCount", "evidence", - "sessionId", - "session", + "connectionId", + "connection", "phoneNumber", "firstSeenAt", "lastSeenAt", @@ -71279,7 +71113,7 @@ "resolveReason" ] }, - "BanSafeNumberDetail": { + "BanSafeConnectionDetail": { "type": "object", "additionalProperties": false, "properties": { @@ -71385,7 +71219,7 @@ ] }, "warmup": { - "$ref": "#/components/schemas/BanSafeNumberWarmup" + "$ref": "#/components/schemas/BanSafeConnectionWarmup" }, "findings": { "type": "array", @@ -71409,8 +71243,8 @@ } }, "required": [ - "sessionId", - "session", + "connectionId", + "connection", "phoneNumber", "projectId", "health", @@ -71433,7 +71267,7 @@ "appealState" ] }, - "BanSafeNumberWarmup": { + "BanSafeConnectionWarmup": { "type": "object", "additionalProperties": false, "properties": { @@ -71454,7 +71288,7 @@ "tenureDay": { "type": "integer", "minimum": 0, - "description": "Whole days since the number's known tenure lower bound; zero when unknown." + "description": "Whole days since the connection's known tenure lower bound; zero when unknown." }, "allowance": { "type": "integer", @@ -72061,11 +71895,11 @@ "type": "object", "additionalProperties": false, "properties": { - "sessionId": { + "connectionId": { "type": "string", "format": "uuid" }, - "session": { + "connection": { "type": "string" }, "points": { @@ -72076,8 +71910,8 @@ } }, "required": [ - "sessionId", - "session", + "connectionId", + "connection", "points" ] }, @@ -72102,11 +71936,11 @@ "type": "object", "additionalProperties": false, "properties": { - "sessionId": { + "connectionId": { "type": "string", "format": "uuid" }, - "session": { + "connection": { "type": "string" }, "phoneNumber": { @@ -72271,7 +72105,7 @@ "nullable": true, "allOf": [ { - "$ref": "#/components/schemas/BanSafeNumberEnforcement" + "$ref": "#/components/schemas/BanSafeConnectionEnforcement" } ] }, @@ -72314,8 +72148,8 @@ } }, "required": [ - "sessionId", - "session", + "connectionId", + "connection", "phoneNumber", "projectId", "rung", @@ -72352,11 +72186,11 @@ "type": "object", "additionalProperties": false, "properties": { - "sessionId": { + "connectionId": { "type": "string", "format": "uuid" }, - "session": { + "connection": { "type": "string" }, "rung": { @@ -72391,8 +72225,8 @@ } }, "required": [ - "sessionId", - "session", + "connectionId", + "connection", "rung", "appealState", "requestedAt", @@ -72408,11 +72242,11 @@ "type": "string", "format": "uuid" }, - "sessionId": { + "connectionId": { "type": "string", "format": "uuid" }, - "session": { + "connection": { "type": "string" }, "phoneNumber": { @@ -72486,8 +72320,8 @@ }, "required": [ "id", - "sessionId", - "session", + "connectionId", + "connection", "phoneNumber", "projectId", "kind", @@ -72516,11 +72350,11 @@ "type": "boolean", "description": "False when the same Idempotency-Key already recorded this report." }, - "sessionId": { + "connectionId": { "type": "string", "format": "uuid" }, - "session": { + "connection": { "type": "string" }, "occurredAt": { @@ -72531,8 +72365,8 @@ "required": [ "incidentId", "created", - "sessionId", - "session", + "connectionId", + "connection", "occurredAt" ] }, @@ -72561,7 +72395,7 @@ }, "restrictedInWindow": { "type": "boolean", - "description": "Whether Polymorfa was restricting this number's sending inside the window." + "description": "Whether Polymorfa was restricting this connection's sending inside the window." }, "criticalFindingDays": { "type": "integer", @@ -72570,7 +72404,7 @@ }, "sharedConnection": { "type": "boolean", - "description": "Whether this number shared its connection with numbers that were being restricted." + "description": "Whether this connection shared its method with connections that were being restricted." }, "measuredHours": { "type": "integer", @@ -72579,11 +72413,11 @@ }, "simultaneousCalls": { "type": "boolean", - "description": "Whether simultaneous calls were on for this number inside the window. When true, Ban Credit does not cover the ban and the claim is denied when filed." + "description": "Whether simultaneous calls were on for this connection inside the window. When true, Ban Credit does not cover the ban and the claim is denied when filed." }, "linkedDeviceInteractive": { "type": "boolean", - "description": "Whether this number sent an interactive message (buttons, lists, product messages, Flows and similar) from a linked device inside the window. When true, Ban Credit does not cover the ban and the claim is denied when filed. False can also mean not recorded: earlier claims report false, and sends before recording began are not backfilled." + "description": "Whether this connection sent an interactive message (buttons, lists, product messages, Flows and similar) from a linked device inside the window. When true, Ban Credit does not cover the ban and the claim is denied when filed. False can also mean not recorded: earlier claims report false, and sends before recording began are not backfilled." } }, "required": [ @@ -72611,11 +72445,11 @@ "type": "string", "format": "uuid" }, - "sessionId": { + "connectionId": { "type": "string", "format": "uuid" }, - "session": { + "connection": { "type": "string" }, "phoneNumber": { @@ -72660,7 +72494,7 @@ "type": "number", "minimum": 0, "multipleOf": 0.000001, - "description": "Credit quantity this number consumed inside the window, with up to six decimal places." + "description": "Credit quantity this connection consumed inside the window, with up to six decimal places." }, "capCents": { "type": "number", @@ -72701,8 +72535,8 @@ "required": [ "id", "incidentId", - "sessionId", - "session", + "connectionId", + "connection", "phoneNumber", "projectId", "status", @@ -72754,7 +72588,7 @@ "type": "object", "additionalProperties": false, "properties": { - "session": { + "connection": { "type": "string", "minLength": 1, "maxLength": 256 @@ -72769,7 +72603,7 @@ } }, "required": [ - "session" + "connection" ] }, "SafeModeSettings": { @@ -72879,7 +72713,7 @@ "SafeModeApplied": { "type": "object", "additionalProperties": false, - "description": "What the number itself last reported it is running. An observation, not a claim.", + "description": "What the connection itself last reported it is running. An observation, not a claim.", "properties": { "observedAt": { "type": "string", @@ -72938,13 +72772,13 @@ "entitlementReason" ] }, - "SessionCapabilities": { + "ConnectionCapabilities": { "type": "object", "additionalProperties": false, "properties": { - "session": { + "connection": { "type": "string", - "description": "The session name." + "description": "The connection name." }, "projectId": { "type": "string", @@ -72956,7 +72790,7 @@ "synced", "unknown" ], - "description": "`synced` when the values reflect WhatsApp's configuration for the account last linked to the number. `unknown` before the first sync, from the first sync attempt of another linked WhatsApp account until its configuration is synced, and when Polymorfa cannot tell whether the stored configuration belongs to the account linked now; every capability value is then null." + "description": "`synced` when the values reflect WhatsApp's configuration for the account last linked to the connection. `unknown` before the first sync, from the first sync attempt of another linked WhatsApp account until its configuration is synced, and when Polymorfa cannot tell whether the stored configuration belongs to the account linked now; every capability value is then null." }, "syncedAt": { "type": "string", @@ -72968,7 +72802,7 @@ "type": "string", "format": "date-time", "nullable": true, - "description": "When Polymorfa last asked WhatsApp for the number's configuration, whether or not anything changed. Null before the first request." + "description": "When Polymorfa last asked WhatsApp for the connection's configuration, whether or not anything changed. Null before the first request." }, "accountType": { "type": "string", @@ -72985,12 +72819,12 @@ "maxItems": 100, "description": "Every capability, always in the same order. Ignore keys your app does not recognize; new keys can be added.", "items": { - "$ref": "#/components/schemas/SessionCapability" + "$ref": "#/components/schemas/ConnectionCapability" } } }, "required": [ - "session", + "connection", "projectId", "status", "syncedAt", @@ -72999,7 +72833,7 @@ "capabilities" ] }, - "SessionCapability": { + "ConnectionCapability": { "type": "object", "additionalProperties": false, "properties": { @@ -73062,11 +72896,11 @@ "source" ] }, - "SessionSafeMode": { + "ConnectionSafeMode": { "type": "object", "additionalProperties": false, "properties": { - "session": { + "connection": { "type": "string" }, "projectId": { @@ -73093,11 +72927,11 @@ }, "mismatch": { "type": "boolean", - "description": "True when the number reports something other than the policy in force." + "description": "True when the connection reports something other than the policy in force." }, "entitled": { "type": "boolean", - "description": "Whether this number's plan includes BanSafe Lite, which Safe Mode is part of. When false, a request that raises a setting is refused." + "description": "Whether this connection's plan includes BanSafe Lite, which Safe Mode is part of. When false, a request that raises a setting is refused." }, "entitlementReason": { "type": "string", @@ -73106,7 +72940,7 @@ } }, "required": [ - "session", + "connection", "projectId", "project", "override", @@ -73166,7 +73000,7 @@ } } }, - "UpdateSessionSafeModeInput": { + "UpdateConnectionSafeModeInput": { "type": "object", "additionalProperties": false, "description": "A partial update. `inherit` follows the project ceiling.", @@ -73215,19 +73049,19 @@ "properties": { "enabled": { "type": "boolean", - "description": "Whether every number in this project has a daily allowance." + "description": "Whether every connection in this project has a daily allowance." }, "warmupDays": { "type": "integer", "minimum": 1, "maximum": 90, - "description": "Days the ramp takes to reach the per-number daily cap." + "description": "Days the ramp takes to reach the per-connection daily cap." }, "dailyStart": { "type": "integer", "minimum": 1, "maximum": 2000, - "description": "Messages a number may send on its first day." + "description": "Messages a connection may send on its first day." } }, "required": [ @@ -73243,7 +73077,7 @@ "day": { "type": "integer", "minimum": 0, - "description": "Days since the number's first proven activity." + "description": "Days since the connection's first proven activity." }, "allowance": { "type": "integer", @@ -73270,7 +73104,7 @@ "ceiling": { "type": "integer", "minimum": 1, - "description": "The per-number daily cap the ramp climbs to." + "description": "The per-connection daily cap the ramp climbs to." }, "curve": { "type": "array", @@ -73278,7 +73112,7 @@ "items": { "$ref": "#/components/schemas/WarmupCurvePoint" }, - "description": "The projected allowance day by day for a number whose health is good. A number in a lower health band gets less." + "description": "The projected allowance day by day for a connection whose health is good. A connection in a lower health band gets less." }, "entitled": { "type": "boolean", @@ -73359,7 +73193,7 @@ "maximum": 100, "description": "Actions trigger only when an available health estimate is below this value." }, - "sessionAction": { + "connectionAction": { "type": "string", "enum": [ "none", @@ -73389,7 +73223,7 @@ "version", "enabled", "threshold", - "sessionAction", + "connectionAction", "slowDownMps", "emailNotification", "webhookNotification", @@ -73412,7 +73246,7 @@ "minimum": 0, "maximum": 100 }, - "sessionAction": { + "connectionAction": { "type": "string", "enum": [ "none", @@ -73438,7 +73272,7 @@ "version", "enabled", "threshold", - "sessionAction", + "connectionAction", "slowDownMps", "emailNotification", "webhookNotification" @@ -73696,7 +73530,7 @@ "minimum": 7, "maximum": 13, "default": 10, - "description": "First day without the phone on which this endpoint receives session.phone_offline. WhatsApp signs the linked device out on day 14. On PATCH, omission preserves the stored value. To stop the warning, remove session.phone_offline from eventTypes." + "description": "First day without the phone on which this endpoint receives connection.phone_offline. WhatsApp signs the linked device out on day 14. On PATCH, omission preserves the stored value. To stop the warning, remove connection.phone_offline from eventTypes." }, "headers": { "type": "array", @@ -73756,7 +73590,7 @@ "minimum": 7, "maximum": 13, "default": 10, - "description": "First day without the phone on which this endpoint receives session.phone_offline. WhatsApp signs the linked device out on day 14. On PATCH, omission preserves the stored value. To stop the warning, remove session.phone_offline from eventTypes." + "description": "First day without the phone on which this endpoint receives connection.phone_offline. WhatsApp signs the linked device out on day 14. On PATCH, omission preserves the stored value. To stop the warning, remove connection.phone_offline from eventTypes." }, "headers": { "type": "array", @@ -73813,7 +73647,7 @@ "type": "integer", "minimum": 7, "maximum": 13, - "description": "First day without the phone on which this endpoint receives session.phone_offline. WhatsApp signs the linked device out on day 14. On PATCH, omission preserves the stored value. To stop the warning, remove session.phone_offline from eventTypes." + "description": "First day without the phone on which this endpoint receives connection.phone_offline. WhatsApp signs the linked device out on day 14. On PATCH, omission preserves the stored value. To stop the warning, remove connection.phone_offline from eventTypes." }, "headers": { "type": "array", @@ -73867,7 +73701,7 @@ "type": "integer", "minimum": 7, "maximum": 13, - "description": "First day without the phone on which this endpoint receives session.phone_offline. WhatsApp signs the linked device out on day 14. On PATCH, omission preserves the stored value. To stop the warning, remove session.phone_offline from eventTypes." + "description": "First day without the phone on which this endpoint receives connection.phone_offline. WhatsApp signs the linked device out on day 14. On PATCH, omission preserves the stored value. To stop the warning, remove connection.phone_offline from eventTypes." }, "headers": { "type": "array", @@ -73952,7 +73786,7 @@ "type": "integer", "minimum": 7, "maximum": 13, - "description": "First day without the phone on which this endpoint receives session.phone_offline." + "description": "First day without the phone on which this endpoint receives connection.phone_offline." }, "headers": { "type": "array", @@ -74049,7 +73883,7 @@ "type": "integer", "minimum": 7, "maximum": 13, - "description": "First day without the phone on which this endpoint receives session.phone_offline." + "description": "First day without the phone on which this endpoint receives connection.phone_offline." }, "headers": { "type": "array", @@ -74576,7 +74410,7 @@ }, "route": { "type": "string", - "description": "Matched route pattern, for example `/messaging/:session/messages`. Path values are not included." + "description": "Matched route pattern, for example `/messaging/:connection/messages`. Path values are not included." }, "status": { "type": "integer", @@ -75327,8 +75161,8 @@ "type": "string", "enum": [ "auth_projection_repair", - "session_lifecycle", - "auth_session_purge", + "connection_lifecycle", + "auth_connection_purge", "label_projection_purge", "billing_reconciliation", "auto_top_up", @@ -75458,8 +75292,8 @@ "type": "string", "enum": [ "auth_projection_repair", - "session_lifecycle", - "auth_session_purge", + "connection_lifecycle", + "auth_connection_purge", "label_projection_purge", "billing_reconciliation", "auto_top_up", @@ -75716,7 +75550,7 @@ "TestTeamWebhookInput": { "type": "object", "additionalProperties": false, - "description": "A team webhook test accepts an optional event type. Supplied event bodies and session IDs are rejected with HTTP 400.", + "description": "A team webhook test accepts an optional event type. Supplied event bodies and connection IDs are rejected with HTTP 400.", "properties": { "eventType": { "type": "string", @@ -75750,14 +75584,14 @@ "body": { "$ref": "#/components/schemas/EncodedEventPayload" }, - "sessionId": { + "connectionId": { "type": "string", "format": "uuid" } }, "required": [ "body", - "sessionId" + "connectionId" ] } ] @@ -76050,7 +75884,7 @@ "team", "project", "customer", - "number" + "connection" ] }, "id": { @@ -76072,7 +75906,7 @@ "team", "project", "customer", - "number" + "connection" ] } }, @@ -76260,7 +76094,7 @@ "code": { "type": "string", "enum": [ - "zero_knowledge_session", + "zero_knowledge_connection", "invalid_parameter", "invalid_credential", "entitlement_required", @@ -76311,7 +76145,7 @@ "order_status_transition_invalid", "order_cancellation_failed", "call_opt_out_limit", - "number_restricted", + "connection_restricted", "sip_trunk_in_use", "sip_trunk_revision_conflict", "sip_trunk_limit", @@ -76329,7 +76163,7 @@ "upstream_failure", "service_unavailable", "credential_verification_unavailable", - "session_not_ready", + "connection_not_ready", "command_dispatch_failed", "result_unknown", "parent_bsuid_not_supported", @@ -77325,15 +77159,15 @@ "PlatformAccessMintClientTokenRequest": { "type": "object", "properties": { - "session": { + "connection": { "type": "string", "minLength": 1, - "description": "ID of the session this token can access. Provide exactly one of `session` or `customer`." + "description": "ID of the connection this token can access. Provide exactly one of `connection` or `customer`." }, "customer": { "type": "string", "format": "uuid", - "description": "Polymorfa Customer ID. The token covers the numbers this Customer owns when it is minted, and only while the Customer still owns each one. Provide exactly one of `session` or `customer`. Requires the `customers:read` scope and enrollment in the Customer-scoped client tokens beta." + "description": "Polymorfa Customer ID. The token covers the connections this Customer owns when it is minted, and only while the Customer still owns each one. Provide exactly one of `connection` or `customer`. Requires the `customers:read` scope and enrollment in the Customer-scoped client tokens beta." }, "allow": { "type": "array", @@ -77374,7 +77208,7 @@ }, "minItems": 0, "maxItems": 30, - "description": "Immutable action ceiling, intersected with live client rules. Session allow requires the action-ceilings beta. With ceiling issuance enabled, session omission snapshots its configured actions. For a Customer, omission uses the original Customer action set. An empty session allow grants no actions; Customer allow must be non-empty. Regional actions are reserved for enrolled beta access." + "description": "Immutable action ceiling, intersected with live client rules. Connection allow requires the action-ceilings beta. With ceiling issuance enabled, connection omission snapshots its configured actions. For a Customer, omission uses the original Customer action set. An empty connection allow grants no actions; Customer allow must be non-empty. Regional actions are reserved for enrolled beta access." }, "ephemeralId": { "type": "string", @@ -77429,7 +77263,7 @@ }, "allowedNumber": { "type": "string", - "description": "Comma-separated E.164 numbers client tokens may call. Empty allows any number." + "description": "Comma-separated E.164 connections client tokens may call. Empty allows any connection." }, "maxSetupsPerMinute": { "type": "integer", @@ -77446,7 +77280,7 @@ }, "enabled": { "type": "boolean", - "description": "Whether client tokens are accepted for this session." + "description": "Whether client tokens are accepted for this connection." } }, "required": [ @@ -77555,7 +77389,7 @@ "properties": { "callsEnabled": { "type": "boolean", - "description": "Whether the session can place, answer and receive calls. When false, placing, answering, joining and attaching media fail with `403 calls_disabled`, incoming calls are declined, and SIP trunks cannot place calls through the session. Calls in progress continue, and the participant that answered or placed one can reconnect to it. Defaults to true." + "description": "Whether the connection can place, answer and receive calls. When false, placing, answering, joining and attaching media fail with `403 calls_disabled`, incoming calls are declined, and SIP trunks cannot place calls through the connection. Calls in progress continue, and the participant that answered or placed one can reconnect to it. Defaults to true." }, "conferenceMode": { "type": "boolean", @@ -77576,28 +77410,28 @@ }, "hostCloudApiCalls": { "type": "boolean", - "description": "Whether Polymorfa Calls answers the session's incoming calls when the session uses the Cloud API. When false (the default), your app answers them through the Graph API `/calls` endpoint and Polymorfa Calls does not host them. Sessions on a linked device ignore it." + "description": "Whether Polymorfa Calls answers the connection's incoming calls when the connection uses the Cloud API. When false (the default), your app answers them through the Graph API `/calls` endpoint and Polymorfa Calls does not host them. Connections on a linked device ignore it." }, "simultaneousCalls": { "type": "boolean", - "description": "Whether this Number may hold more than one call at a time, with no limit. Linked-device sessions only; Cloud API sessions ignore it. WhatsApp's own apps never hold two calls at once, so this behavior is unusual for WhatsApp, and it voids Ban Credit: a ban whose 30-day window overlaps any period this setting was on is not covered. Defaults to false." + "description": "Whether this Connection may hold more than one call at a time, with no limit. Linked-device connections only; Cloud API connections ignore it. WhatsApp's own apps never hold two calls at once, so this behavior is unusual for WhatsApp, and it voids Ban Credit: a ban whose 30-day window overlaps any period this setting was on is not covered. Defaults to false." }, "simultaneousCallsCoverageExcludedUntil": { "type": "string", "nullable": true, "format": "date-time", - "description": "Read-only. While `simultaneousCalls` is false, when Ban Credit stops excluding this Number because of an earlier period with it on: 30 days after the latest period ended. A ban is excluded when the setting was on at any time in the 30 days before it, so until this time, a new ban is not covered; from this time on, that period no longer excludes a ban. Null while `simultaneousCalls` is true, because the exclusion has no end yet, and null when no period ended in the last 30 days. Null does not mean the Number is covered: the other Ban Credit conditions still apply." + "description": "Read-only. While `simultaneousCalls` is false, when Ban Credit stops excluding this Connection because of an earlier period with it on: 30 days after the latest period ended. A ban is excluded when the setting was on at any time in the 30 days before it, so until this time, a new ban is not covered; from this time on, that period no longer excludes a ban. Null while `simultaneousCalls` is true, because the exclusion has no end yet, and null when no period ended in the last 30 days. Null does not mean the Connection is covered: the other Ban Credit conditions still apply." }, "revision": { "type": "integer", "minimum": 0, - "description": "Increases on every change; 0 while the session uses the defaults. Send it as `expectedRevision` to refuse an update that would overwrite someone else's change." + "description": "Increases on every change; 0 while the connection uses the defaults. Send it as `expectedRevision` to refuse an update that would overwrite someone else's change." }, "updatedAt": { "type": "string", "nullable": true, "format": "date-time", - "description": "When the settings were last changed, or null when the session uses the defaults." + "description": "When the settings were last changed, or null when the connection uses the defaults." } }, "required": [ @@ -77655,7 +77489,7 @@ "properties": { "callsEnabled": { "type": "boolean", - "description": "Set to false to refuse new and incoming calls on the session; true allows them again." + "description": "Set to false to refuse new and incoming calls on the connection; true allows them again." }, "conferenceMode": { "type": "boolean", @@ -77675,7 +77509,7 @@ "type": "string", "nullable": true, "format": "uuid", - "description": "The SIP trunk for `sip_trunk`: a trunk in the session's project whose direction is `outbound` or `both`. Required when switching the route to `sip_trunk`; omit it to keep the stored trunk. With `clients` send `null` or omit it: a trunk ID is refused, and `clients` clears the stored trunk." + "description": "The SIP trunk for `sip_trunk`: a trunk in the connection's project whose direction is `outbound` or `both`. Required when switching the route to `sip_trunk`; omit it to keep the stored trunk. With `clients` send `null` or omit it: a trunk ID is refused, and `clients` clears the stored trunk." }, "sipClaim": { "type": "boolean", @@ -77683,11 +77517,11 @@ }, "hostCloudApiCalls": { "type": "boolean", - "description": "Set to true to have Polymorfa Calls answer the session's Cloud API calls instead of your Graph API integration. Applies to calls that arrive after the change." + "description": "Set to true to have Polymorfa Calls answer the connection's Cloud API calls instead of your Graph API integration. Applies to calls that arrive after the change." }, "simultaneousCalls": { "type": "boolean", - "description": "Set to true to let this Number hold more than one call at a time, with no limit. Turning it on requires a team API key and risk acknowledgement, using `acceptTerms`, a recorded current acceptance, or the original `acknowledgeRisk: true` alias; it voids Ban Credit for any ban whose 30-day window overlaps a period it was on. Set to false to return to one call at a time. Applies to calls that start after the change." + "description": "Set to true to let this Connection hold more than one call at a time, with no limit. Turning it on requires a team API key and risk acknowledgement, using `acceptTerms`, a recorded current acceptance, or the original `acknowledgeRisk: true` alias; it voids Ban Credit for any ban whose 30-day window overlaps a period it was on. Set to false to return to one call at a time. Applies to calls that start after the change." }, "termsLocale": { "type": "string", @@ -77701,16 +77535,16 @@ "type": "string", "minLength": 1, "maxLength": 100, - "description": "The published simultaneous-call terms version to accept for this Number. The original acknowledgeRisk: true remains an alias for simultaneous-calls-v1. Unpublished terms add no requirement." + "description": "The published simultaneous-call terms version to accept for this Connection. The original acknowledgeRisk: true remains an alias for simultaneous-calls-v1. Unpublished terms add no requirement." }, "acknowledgeRisk": { "type": "boolean", - "description": "Confirms the original simultaneous-calls-v1 risk acknowledgement. A later published version requires acceptTerms or a recorded current acceptance. Confirms the unusual-behavior risk and loss of Ban Credit for this Number." + "description": "Confirms the original simultaneous-calls-v1 risk acknowledgement. A later published version requires acceptTerms or a recorded current acceptance. Confirms the unusual-behavior risk and loss of Ban Credit for this Connection." }, "expectedRevision": { "type": "integer", "minimum": 0, - "description": "Apply the update only if the settings still have this `revision` (0 for a session using the defaults). Otherwise the update fails with `409 state_conflict`." + "description": "Apply the update only if the settings still have this `revision` (0 for a connection using the defaults). Otherwise the update fails with `409 state_conflict`." } }, "additionalProperties": false @@ -78066,10 +77900,10 @@ "type": "string", "description": "Digest realm for `username`." }, - "session": { + "connection": { "type": "string", "nullable": true, - "description": "Session that places the WhatsApp calls your PBX sends, or null when none is set. Calls from the PBX are refused until a session is set." + "description": "Connection that places the WhatsApp calls your PBX sends, or null when none is set. Calls from the PBX are refused until a connection is set." }, "allowedAddresses": { "type": "array", @@ -78089,7 +77923,7 @@ "required": [ "username", "realm", - "session", + "connection", "allowedAddresses", "allowedDestinations" ], @@ -78293,12 +78127,12 @@ "PlatformAccessSipTrunkInboundInput": { "type": "object", "properties": { - "session": { + "connection": { "type": "string", "nullable": true, "minLength": 1, "maxLength": 64, - "description": "Session in the same project that places calls from your PBX." + "description": "Connection in the same project that places calls from your PBX." }, "allowedAddresses": { "type": "array", @@ -78457,12 +78291,12 @@ "PlatformAccessSipTrunkInboundPatch": { "type": "object", "properties": { - "session": { + "connection": { "type": "string", "nullable": true, "minLength": 1, "maxLength": 64, - "description": "Session in the same project that places calls from your PBX." + "description": "Connection in the same project that places calls from your PBX." }, "allowedAddresses": { "type": "array", @@ -79815,7 +79649,7 @@ "data" ] }, - "PlatformAccessSessionConfigurationView": { + "PlatformAccessConnectionConfigurationView": { "type": "object", "properties": { "requestedHistory": { @@ -80022,7 +79856,7 @@ "enum": [ "descriptor" ], - "description": "Polymorfa-Version 2026-10-14 and later. `descriptor` makes history.sync carry the chunk descriptor or inline payload; Polymorfa never downloads the chunk. Reset it to inherit the project or team delivery setting. Without an inherited choice, delivery is archive. Existing Numbers require confirmed cleanup before switching to descriptor delivery." + "description": "Polymorfa-Version 2026-10-14 and later. `descriptor` makes history.sync carry the chunk descriptor or inline payload; Polymorfa never downloads the chunk. Reset it to inherit the project or team delivery setting. Without an inherited choice, delivery is archive. Existing Connections require confirmed cleanup before switching to descriptor delivery." } }, "additionalProperties": false @@ -80141,7 +79975,7 @@ "platform", "team", "project", - "session" + "connection" ] }, "observation.typingMode": { @@ -80150,7 +79984,7 @@ "platform", "team", "project", - "session" + "connection" ] }, "observation.labelMode": { @@ -80159,7 +79993,7 @@ "platform", "team", "project", - "session" + "connection" ] }, "observation.quickReplyMode": { @@ -80168,7 +80002,7 @@ "platform", "team", "project", - "session" + "connection" ] }, "historySync.mode": { @@ -80177,7 +80011,7 @@ "platform", "team", "project", - "session", + "connection", "consent" ] }, @@ -80187,7 +80021,7 @@ "platform", "team", "project", - "session", + "connection", "consent" ] }, @@ -80197,7 +80031,7 @@ "platform", "team", "project", - "session" + "connection" ] }, "hms": { @@ -80206,7 +80040,7 @@ "platform", "team", "project", - "session" + "connection" ] } }, @@ -80232,7 +80066,7 @@ "type": "integer", "minimum": 0 }, - "session": { + "connection": { "type": "integer", "minimum": 0 } @@ -80240,7 +80074,7 @@ "required": [ "team", "project", - "session" + "connection" ], "additionalProperties": false }, @@ -80287,11 +80121,11 @@ "enabled": { "type": "boolean", "nullable": true, - "description": "Whether WhatsApp enabled its new-chat cap for this number. WhatsApp decides this per number; `false` means no cap applies. `null` means WhatsApp's configuration for this number could not be read to a decision, and Polymorfa does not pace to a cap." + "description": "Whether WhatsApp enabled its new-chat cap for this connection. WhatsApp decides this per connection; `false` means no cap applies. `null` means WhatsApp's configuration for this connection could not be read to a decision, and Polymorfa does not pace to a cap." }, "pacing": { "type": "boolean", - "description": "Whether Polymorfa is holding back sends that would start a new chat while the number is capped. True only when `enabled` is true." + "description": "Whether Polymorfa is holding back sends that would start a new chat while the connection is capped. True only when `enabled` is true." }, "status": { "type": "string", @@ -80303,18 +80137,18 @@ "capped", null ], - "description": "The number's cap status as WhatsApp last reported it: `none`, `first_warning`, `second_warning` or `capped`. `null` until WhatsApp reported one. Reads `none` once the reported cycle has ended.", + "description": "The connection's cap status as WhatsApp last reported it: `none`, `first_warning`, `second_warning` or `capped`. `null` until WhatsApp reported one. Reads `none` once the reported cycle has ended.", "example": "first_warning" }, "capped": { "type": "boolean", - "description": "True while WhatsApp reports the number capped and Polymorfa paces it (`pacing` is true), until `resetsAt`. New-chat sends are then held back; messages to existing chats still send." + "description": "True while WhatsApp reports the connection capped and Polymorfa paces it (`pacing` is true), until `resetsAt`. New-chat sends are then held back; messages to existing chats still send." }, "limit": { "type": "integer", "nullable": true, "minimum": 0, - "description": "New chats the number may start in the current cycle, as WhatsApp reported it.", + "description": "New chats the connection may start in the current cycle, as WhatsApp reported it.", "example": 50 }, "used": { @@ -80339,7 +80173,7 @@ "resetsAt": { "type": "string", "nullable": true, - "description": "ISO 8601 end of the current cycle as WhatsApp reported it. While Polymorfa holds a number that WhatsApp rejected for a new chat without reporting a cycle, the end of that one-hour hold." + "description": "ISO 8601 end of the current cycle as WhatsApp reported it. While Polymorfa holds a connection that WhatsApp rejected for a new chat without reporting a cycle, the end of that one-hour hold." }, "observedAt": { "type": "string", @@ -80358,14 +80192,14 @@ "resetsAt", "observedAt" ], - "description": "WhatsApp's new-chat cap for this linked-device number. Returned by Get session only. `null` when Polymorfa has not observed the number's configuration yet." + "description": "WhatsApp's new-chat cap for this linked-device connection. Returned by Get connection only. `null` when Polymorfa has not observed the connection's configuration yet." }, "PlatformAccessInspectorClaimState": { "type": "object", "properties": { "claimed": { "type": "boolean", - "description": "Whether a team member has claimed this Number in Inspector." + "description": "Whether a team member has claimed this Connection in Inspector." }, "claimedAt": { "type": "string", @@ -80378,9 +80212,9 @@ "claimed", "claimedAt" ], - "description": "Whether a team member has claimed this Number in Inspector. The claimant's identity is not included." + "description": "Whether a team member has claimed this Connection in Inspector. The claimant's identity is not included." }, - "PlatformAccessSession": { + "PlatformAccessConnection": { "type": "object", "properties": { "signalMode": { @@ -80391,32 +80225,42 @@ ], "description": "Immutable Signal key custody selected before pairing. Customer-owned custody is a gated beta for real Linked Devices." }, - "sessionId": { + "connectionId": { "type": "string", - "description": "Session ID. Use it to address this session in Platform and Messaging requests." + "description": "Connection ID. Use it to address this connection in Platform and Messaging requests." }, "name": { "type": "string", - "description": "Display label, or the session identifier when no label is set." + "description": "Display label, or the connection identifier when no label is set." }, "externalId": { "type": "string", - "description": "Integrator correlation supplied when creating the QuickLink for this session." + "description": "Integrator correlation supplied when creating the QuickLink for this connection." }, "tenantId": { "type": "string" }, "type": { + "type": "string", + "enum": [ + "whatsapp" + ] + }, + "phoneNumberId": { + "type": "string" + }, + "method": { "type": "string", "enum": [ "linked_device", - "cloud_api" + "cloud_api", + "hybrid" ], - "description": "How the session connects to WhatsApp. 'linked_device' pairs as a WhatsApp linked device; 'cloud_api' uses the Meta Cloud API. Immutable after create." + "description": "How the connection connects to WhatsApp. 'linked_device' pairs as a WhatsApp linked device; 'cloud_api' uses the Meta Cloud API. Immutable after create." }, "testMode": { "type": "boolean", - "description": "Whether this session was created as a simulated testing number." + "description": "Whether this connection was created as a simulated testing connection." }, "status": { "type": "string", @@ -80426,7 +80270,7 @@ "type": "string" }, "configuration": { - "$ref": "#/components/schemas/PlatformAccessSessionConfigurationView" + "$ref": "#/components/schemas/PlatformAccessConnectionConfigurationView" }, "newChatCapping": { "$ref": "#/components/schemas/PlatformAccessNewChatCapping" @@ -80441,7 +80285,7 @@ "required": [ "claim" ], - "description": "Inspector state for this Number. Returned by Get session only." + "description": "Inspector state for this Connection. Returned by Get connection only." }, "createdAt": { "type": "string" @@ -80451,17 +80295,18 @@ } }, "required": [ - "sessionId", + "connectionId", "name", "tenantId", "type", + "method", "testMode", "status", "createdAt", "updatedAt" ] }, - "PlatformAccessGetSessionResponse": { + "PlatformAccessGetConnectionResponse": { "type": "object", "properties": { "success": { @@ -80471,7 +80316,7 @@ ] }, "data": { - "$ref": "#/components/schemas/PlatformAccessSession" + "$ref": "#/components/schemas/PlatformAccessConnection" } }, "required": [ @@ -80479,7 +80324,7 @@ "data" ] }, - "PlatformAccessUpdateSessionResponse": { + "PlatformAccessUpdateConnectionResponse": { "type": "object", "properties": { "success": { @@ -80489,7 +80334,7 @@ ] }, "data": { - "$ref": "#/components/schemas/PlatformAccessSession" + "$ref": "#/components/schemas/PlatformAccessConnection" } }, "required": [ @@ -80497,7 +80342,7 @@ "data" ] }, - "PlatformAccessUpdateSessionRequest": { + "PlatformAccessUpdateConnectionRequest": { "type": "object", "properties": { "configuration": { @@ -80524,7 +80369,7 @@ "enum": [ "descriptor" ], - "description": "Polymorfa-Version 2026-10-14 and later. `descriptor` makes history.sync carry the chunk descriptor or inline payload; Polymorfa never downloads the chunk. Reset it to inherit the project or team delivery setting. Without an inherited choice, delivery is archive. Existing Numbers require confirmed cleanup before switching to descriptor delivery." + "description": "Polymorfa-Version 2026-10-14 and later. `descriptor` makes history.sync carry the chunk descriptor or inline payload; Polymorfa never downloads the chunk. Reset it to inherit the project or team delivery setting. Without an inherited choice, delivery is archive. Existing Connections require confirmed cleanup before switching to descriptor delivery." } }, "additionalProperties": false @@ -80724,7 +80569,7 @@ "x-enumDescriptions": { "android": "WhatsApp or WhatsApp Business on an Android phone.", "ios": "WhatsApp or WhatsApp Business on an iPhone.", - "meta_cloud": "Meta hosts the number through Cloud API.", + "meta_cloud": "Meta hosts the connection through Cloud API.", "unknown": "The phone has not reported a recognized platform." } }, @@ -80752,7 +80597,7 @@ "pushName" ] }, - "PlatformAccessGetSessionAccountResponse": { + "PlatformAccessGetConnectionAccountResponse": { "type": "object", "properties": { "success": { @@ -80900,7 +80745,7 @@ "enum": [ "passthrough_plus" ], - "description": "When set, atomically flips sessions.config.bartenderMode → passthrough_plus after the keys persist. Eliminates the window where mode is set but no keys are staged." + "description": "When set, atomically flips connections.config.bartenderMode → passthrough_plus after the keys persist. Eliminates the window where mode is set but no keys are staged." } }, "required": [ @@ -80972,9 +80817,9 @@ "callId": { "type": "string" }, - "sessionId": { + "connectionId": { "type": "string", - "description": "Session name." + "description": "Connection name." }, "projectId": { "type": "string", @@ -81004,7 +80849,7 @@ }, "backend": { "type": "string", - "description": "How the number reaches WhatsApp for this call." + "description": "How the connection reaches WhatsApp for this call." }, "hasVideo": { "type": "boolean" @@ -81053,7 +80898,7 @@ }, "required": [ "callId", - "sessionId", + "connectionId", "projectId", "direction", "state", @@ -81239,7 +81084,7 @@ "appReports": { "type": "object", "additionalProperties": false, - "description": "Diagnostics your app sent with `POST /messaging/voip/calls/{id}/reports`, by connection. Figures the app did not report are null.", + "description": "Diagnostics your app sent with `POST /messaging/voip/calls/{id}/reports`, by method. Figures the app did not report are null.", "properties": { "status": { "type": "string", @@ -81268,7 +81113,7 @@ "type": "object", "nullable": true, "additionalProperties": false, - "description": "The SDK named by the connection's most recent report. Null when that report named none.", + "description": "The SDK named by the method's most recent report. Null when that report named none.", "properties": { "sdk": { "type": "string", @@ -81297,7 +81142,7 @@ "type": "object", "nullable": true, "additionalProperties": false, - "description": "The connection's latest quality report. Null when it sent none.", + "description": "The method's latest quality report. Null when it sent none.", "properties": { "reportedAt": { "type": "string", @@ -81406,7 +81251,7 @@ }, "required": [ "status", - "connections", + "methods", "truncated" ] }, @@ -81456,20 +81301,20 @@ "callId": { "type": "string" }, - "sessionId": { + "connectionId": { "type": "string" } }, "required": [ "callId", - "sessionId" + "connectionId" ] } }, "required": [ "call", "participants", - "connections", + "methods", "telemetry", "appReports", "history", @@ -81749,7 +81594,7 @@ "error": { "type": "billing_error", "code": "billing_credit_required", - "message": "Credit is unavailable for this number. Add credit or review team billing.", + "message": "Credit is unavailable for this connection. Add credit or review team billing.", "param": null, "request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30" }, @@ -81760,7 +81605,7 @@ } }, "CampaignsNotEntitled": { - "description": "`campaigns_not_entitled`: a sending number is missing or its plan does not include Campaigns.", + "description": "`campaigns_not_entitled`: a sending connection is missing or its plan does not include Campaigns.", "headers": { "X-Request-Id": { "schema": { @@ -81791,7 +81636,7 @@ "error": { "type": "billing_error", "code": "campaigns_not_entitled", - "message": "This number’s plan does not include Campaigns.", + "message": "This connection’s plan does not include Campaigns.", "param": null, "request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30" }, @@ -81802,7 +81647,7 @@ } }, "SafeModeNotEntitled": { - "description": "`safe_mode_not_entitled`: Safe Mode is part of BanSafe Lite, which is not included on this number's plan. Lowering a setting always works.", + "description": "`safe_mode_not_entitled`: Safe Mode is part of BanSafe Lite, which is not included on this connection's plan. Lowering a setting always works.", "headers": { "X-Request-Id": { "schema": { @@ -81833,7 +81678,7 @@ "error": { "type": "billing_error", "code": "safe_mode_not_entitled", - "message": "Safe Mode is not included on this number’s plan.", + "message": "Safe Mode is not included on this connection’s plan.", "param": null, "request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30" }, @@ -82054,7 +81899,7 @@ } }, "SendPathUnavailable": { - "description": "The send path is unavailable or the sending number is not ready (`session_not_ready`, `command_dispatch_failed`, `service_unavailable`, or `bansafe_accounting_unavailable`). No message was sent.", + "description": "The send path is unavailable or the sending connection is not ready (`connection_not_ready`, `command_dispatch_failed`, `service_unavailable`, or `bansafe_accounting_unavailable`). No message was sent.", "headers": { "X-Request-Id": { "schema": { @@ -82085,7 +81930,7 @@ } }, "CampaignEligibilityUnavailable": { - "description": "`service_unavailable`: the selected numbers' plans could not be checked. Nothing was launched or saved; retry the request.", + "description": "`service_unavailable`: the selected connections' plans could not be checked. Nothing was launched or saved; retry the request.", "headers": { "X-Request-Id": { "schema": { @@ -82116,7 +81961,7 @@ } }, "InspectorClaimReleaseUnavailable": { - "description": "`service_unavailable`: the claimant's Inspector device could not be removed, so the Number is still claimed. Nothing changed. Retry after `Retry-After` seconds; repeating the request is safe.", + "description": "`service_unavailable`: the claimant's Inspector device could not be removed, so the Connection is still claimed. Nothing changed. Retry after `Retry-After` seconds; repeating the request is safe.", "headers": { "X-Request-Id": { "schema": { @@ -82185,7 +82030,7 @@ } }, "PropagationPending": { - "description": "The change was stored, but a connected number has not confirmed it. Retry the request; the stored setting is already correct and is retried automatically.", + "description": "The change was stored, but a connected connection has not confirmed it. Retry the request; the stored setting is already correct and is retried automatically.", "headers": { "X-Request-Id": { "schema": { @@ -82309,7 +82154,7 @@ } }, "CampaignLaunchConflict": { - "description": "`campaign_approval_required`: the launch is held for a team owner or admin and nothing was sent; the message names the approval request. `state_conflict`: the campaign is not a draft, is already launched and waiting for its start, its sending numbers or audience changed during launch, or segment evaluation exceeded its time limit (simplify the rules and retry). A launched campaign whose segment was deleted cannot be launched again.", + "description": "`campaign_approval_required`: the launch is held for a team owner or admin and nothing was sent; the message names the approval request. `state_conflict`: the campaign is not a draft, is already launched and waiting for its start, its sending connections or audience changed during launch, or segment evaluation exceeded its time limit (simplify the rules and retry). A launched campaign whose segment was deleted cannot be launched again.", "headers": { "X-Request-Id": { "schema": { @@ -82433,7 +82278,7 @@ } }, "BanSafeIncidentKeyReused": { - "description": "`bansafe_incident_idempotency_scope_conflict`: this key was already used to report a different number. Use a different key only for a different report.", + "description": "`bansafe_incident_idempotency_scope_conflict`: this key was already used to report a different connection. Use a different key only for a different report.", "headers": { "X-Request-Id": { "schema": { @@ -82501,7 +82346,7 @@ } }, "InternalError": { - "description": "The session-control publisher or testing-number persistence path is temporarily unavailable.", + "description": "The connection-control publisher or testing-connection persistence path is temporarily unavailable.", "headers": { "X-Request-Id": { "schema": { diff --git a/contracts/source.json b/contracts/source.json index c5a16b8e3..684101636 100644 --- a/contracts/source.json +++ b/contracts/source.json @@ -1,19 +1,19 @@ { "repository": "polymorfa/polymorfa", - "commit": "f180dc1ee2bd45dbecf01702f73bdd75c664634b", - "branch": "recovery/org-team-backend-20261028", - "published": true, - "note": "Full Messaging and Platform snapshots are byte-identical copies of the API specifications at polymorfa/polymorfa#887 pushed head f180dc1ee2 (contract revision f180dc1ee2). That head includes the team rename and later dev changes. SDK publication and API deployment remain separate gates.", + "commit": "1c1c88f04bac58ba1f006af9d4879fa0648576cb", + "branch": "rajeh/connection-rename-backend-completion", + "published": false, + "note": "Breaking Connection source candidate at held API date 2026-09-22. Exact committed producer snapshots; no source merge, deployed API acceptance or package publication is inferred. Nightly/stable release gates remain closed until matching staging/production acceptance.", "contracts": { "messaging": { "sourcePath": "apps/api/docs/openapi.json", "snapshotPath": "contracts/openapi.messaging.json", - "sha256": "0c66f1ee93923cf57425ac29c01a84c5c140b703ace2160e1b899ee6dad0b071" + "sha256": "11346736cdb19b4124d34b193a5a563d4f6ad1800d07785b5fb0aae9f0923f43" }, "platform": { "sourcePath": "apps/api/docs/openapi.management.json", "snapshotPath": "contracts/openapi.platform.json", - "sha256": "bee9be6cc08d2ec78f5eb5e05135bea3751f93af917b8dd6983b26029feac485" + "sha256": "e48b8a83648b2c010f26c522de8c7a9f9e772df5b6b39ed0e43a64ed296d289b" } } } diff --git a/contracts/testing-events.json b/contracts/testing-events.json index 270ee3d03..a3968c7a4 100644 --- a/contracts/testing-events.json +++ b/contracts/testing-events.json @@ -1,8 +1,8 @@ { "repository": "polymorfa/polymorfa", - "commit": "6839976e7ad54e044c4d789fd296edc44772a907", + "commit": "1c1c88f04bac58ba1f006af9d4879fa0648576cb", "sourcePath": "apps/api/docs/openapi.json", - "sourceSha256": "79543bf719017598c3e2497004d761056e919b3200abdaae1560893542816cc7", + "sourceSha256": "11346736cdb19b4124d34b193a5a563d4f6ad1800d07785b5fb0aae9f0923f43", "schemas": { "TestEventFixtureList": { "type": "object", @@ -21,8 +21,8 @@ "call.received", "call.missed", "call.ended", - "session.status", - "session.restriction_updated", + "connection.status", + "connection.restriction_updated", "template.status" ] }, @@ -45,12 +45,6 @@ "TriggerTestEventRequest": { "type": "object", "properties": { - "session": { - "type": "string", - "minLength": 1, - "maxLength": 128, - "description": "Test number session name in the project." - }, "event": { "type": "string", "enum": [ @@ -60,8 +54,8 @@ "call.received", "call.missed", "call.ended", - "session.status", - "session.restriction_updated", + "connection.status", + "connection.restriction_updated", "template.status" ], "description": "Fixture name. Each name is the event type it produces." @@ -69,14 +63,14 @@ "overrides": { "$ref": "#/schemas/TestEventOverrides" }, - "fromSession": { + "fromConnection": { "type": "string", "minLength": 1, "maxLength": 128, - "description": "message.received only. Send a simulated text message from this other connected Test number in the same project instead of generating an event." + "description": "message.received only. Send a simulated text message from this other connected Test connection in the same project instead of generating an event." } }, - "required": ["session", "event"], + "required": ["event"], "additionalProperties": false }, "TriggerTestEventResponse": { @@ -91,12 +85,12 @@ "call.received", "call.missed", "call.ended", - "session.status", - "session.restriction_updated", + "connection.status", + "connection.restriction_updated", "template.status" ] }, - "session": { + "connection": { "type": "string" }, "delivery": { @@ -113,7 +107,7 @@ "enum": ["test", "runtime"] } }, - "required": ["event", "session", "delivery", "eventId", "source"] + "required": ["event", "connection", "delivery", "eventId", "source"] }, "TestEventOverrides": { "type": "object", @@ -153,7 +147,7 @@ "type": "string", "enum": [ "invalid_recipient", - "session_not_connected", + "connection_not_connected", "ack_timeout", "send_failed", "blocked_by_safety" @@ -213,5 +207,6 @@ }, "additionalProperties": false } - } + }, + "published": false } diff --git a/examples/calls-example/client-rules.test.mjs b/examples/calls-example/client-rules.test.mjs index 119444e8f..2f1965263 100644 --- a/examples/calls-example/client-rules.test.mjs +++ b/examples/calls-example/client-rules.test.mjs @@ -12,7 +12,7 @@ const rules = { }; function fakeMessaging({ - sessionError, + connectionError, rulesError, updateError, configuredRules = rules, @@ -20,10 +20,10 @@ function fakeMessaging({ const calls = []; return { calls, - sessions: { + connections: { retrieve: async () => { - calls.push("retrieve-session"); - if (sessionError) throw sessionError; + calls.push("retrieve-connection"); + if (connectionError) throw connectionError; }, }, clientTokens: { @@ -36,7 +36,7 @@ function fakeMessaging({ calls.push(["mint", input]); return { data: { data: { token: "pmfa_ct_ZXhhbXBsZQ" } } }; }, - updateRules: async (_session, input) => { + updateRules: async (_connection, input) => { calls.push(["update-rules", input]); if (updateError) throw updateError; }, @@ -50,19 +50,19 @@ test("mint helper identifies missing rules after a visible Number and never mint mintCallsExampleToken(messaging, "support", "local-1"), /No client rules are configured/, ); - assert.deepEqual(messaging.calls, ["retrieve-rules", "retrieve-session"]); + assert.deepEqual(messaging.calls, ["retrieve-rules", "retrieve-connection"]); }); -test("mint helper reports a generic rules 404 when sessions:read is unavailable", async () => { +test("mint helper reports a generic rules 404 when connections:read is unavailable", async () => { const messaging = fakeMessaging({ - sessionError: forbidden, + connectionError: forbidden, rulesError: missing, }); await assert.rejects( mintCallsExampleToken(messaging, "support", "local-1"), /Check the Number ID, project-token project, and whether client rules are configured/, ); - assert.deepEqual(messaging.calls, ["retrieve-rules", "retrieve-session"]); + assert.deepEqual(messaging.calls, ["retrieve-rules", "retrieve-connection"]); }); test("mint helper rejects missing Calls actions before minting", async () => { @@ -76,13 +76,13 @@ test("mint helper rejects missing Calls actions before minting", async () => { assert.deepEqual(messaging.calls, ["retrieve-rules"]); }); -test("mint helper uses existing rules without requiring sessions:read", async () => { - const messaging = fakeMessaging({ sessionError: forbidden }); +test("mint helper uses existing rules without requiring connections:read", async () => { + const messaging = fakeMessaging({ connectionError: forbidden }); const token = await mintCallsExampleToken(messaging, "support", "local-1"); assert.equal(token, "pmfa_ct_ZXhhbXBsZQ"); assert.deepEqual(messaging.calls, [ "retrieve-rules", - ["mint", { session: "support", ephemeralId: "local-1", ttlSeconds: 900 }], + ["mint", { connection: "support", ephemeralId: "local-1", ttlSeconds: 900 }], ]); }); @@ -98,12 +98,12 @@ test("configure helper refuses to replace existing rules", async () => { test("configure helper uses bounded Calls-only rules when GET returns 404", async () => { const messaging = fakeMessaging({ rulesError: missing, - sessionError: forbidden, + connectionError: forbidden, }); await configureCallsExampleRules(messaging, "support", "+12025550123"); assert.deepEqual(messaging.calls.slice(0, 2), [ "retrieve-rules", - "retrieve-session", + "retrieve-connection", ]); const write = messaging.calls[2]; assert.equal(write[0], "update-rules"); @@ -129,12 +129,12 @@ test("configure helper validates the callee and project before writing", async ( ); assert.deepEqual(invalid.calls, []); - const hidden = fakeMessaging({ rulesError: missing, sessionError: missing }); + const hidden = fakeMessaging({ rulesError: missing, connectionError: missing }); await assert.rejects( configureCallsExampleRules(hidden, "support", "+12025550123"), /Number unavailable/, ); - assert.deepEqual(hidden.calls, ["retrieve-rules", "retrieve-session"]); + assert.deepEqual(hidden.calls, ["retrieve-rules", "retrieve-connection"]); }); test("configure helper accepts a seven-digit E.164 test callee", async () => { diff --git a/examples/calls-example/configure-client-rules-core.mjs b/examples/calls-example/configure-client-rules-core.mjs index d88da1cda..5044f3a09 100644 --- a/examples/calls-example/configure-client-rules-core.mjs +++ b/examples/calls-example/configure-client-rules-core.mjs @@ -6,7 +6,7 @@ const E164 = /^\+[1-9]\d{6,14}$/; /** Install narrow Calls rules only when this Number has no rules yet. */ export async function configureCallsExampleRules( messaging, - session, + connection, testCallee, ) { if (!E164.test(testCallee)) @@ -16,7 +16,7 @@ export async function configureCallsExampleRules( let existing = false; try { - await messaging.clientTokens.retrieveRules(session); + await messaging.clientTokens.retrieveRules(connection); existing = true; } catch (cause) { if (cause?.status !== 404) throw cause; @@ -31,9 +31,9 @@ export async function configureCallsExampleRules( // The public 404 does not say whether rules are absent or the Number is // outside this credential's project. A readable Number resolves it; when - // sessions:read is missing, the PUT still checks the project on the server. + // connections:read is missing, the PUT still checks the project on the server. try { - await messaging.sessions.retrieve(session); + await messaging.connections.retrieve(connection); } catch (cause) { if (cause?.status === 404) throw new CallsExampleSetupError( @@ -43,7 +43,7 @@ export async function configureCallsExampleRules( } try { - await messaging.clientTokens.updateRules(session, { + await messaging.clientTokens.updateRules(connection, { recipientMode: "none", allowedActions: "voip_place,voip_answer,voip_signal", // Per token per minute: signaling, candidates and diagnostics share it. diff --git a/examples/calls-example/configure-client-rules.mjs b/examples/calls-example/configure-client-rules.mjs index dc48fc44b..f52793c98 100644 --- a/examples/calls-example/configure-client-rules.mjs +++ b/examples/calls-example/configure-client-rules.mjs @@ -4,13 +4,13 @@ import { CallsExampleSetupError } from "./mint-client-token-core.mjs"; import { configureCallsExampleRules } from "./configure-client-rules-core.mjs"; const key = process.env.POLYMORFA_SERVER_KEY; -const session = process.env.POLYMORFA_SESSION; +const connection = process.env.POLYMORFA_CONNECTION; const testCallee = process.env.POLYMORFA_TEST_CALLEE; const credentialType = serverCredentialType(key); -if (!key || !session || !testCallee) { +if (!key || !connection || !testCallee) { process.stderr.write( - "Set POLYMORFA_SERVER_KEY, POLYMORFA_SESSION and POLYMORFA_TEST_CALLEE.\n", + "Set POLYMORFA_SERVER_KEY, POLYMORFA_CONNECTION and POLYMORFA_TEST_CALLEE.\n", ); process.exitCode = 1; } else if (!credentialType) { @@ -22,7 +22,7 @@ if (!key || !session || !testCallee) { credential: { type: credentialType, value: key }, baseUrl: "https://api.polymorfastaging.com", }); - await configureCallsExampleRules(messaging, session, testCallee); + await configureCallsExampleRules(messaging, connection, testCallee); process.stdout.write( "Configured bounded Calls client rules for this Number.\n", ); diff --git a/examples/calls-example/mint-client-token-core.mjs b/examples/calls-example/mint-client-token-core.mjs index bb23c8a22..053864640 100644 --- a/examples/calls-example/mint-client-token-core.mjs +++ b/examples/calls-example/mint-client-token-core.mjs @@ -2,31 +2,31 @@ export class CallsExampleSetupError extends Error {} /** Check the Number and its client rules before minting the browser token. */ -export async function mintCallsExampleToken(messaging, session, ephemeralId) { +export async function mintCallsExampleToken(messaging, connection, ephemeralId) { let rules; try { - rules = (await messaging.clientTokens.retrieveRules(session)).data.data; + rules = (await messaging.clientTokens.retrieveRules(connection)).data.data; } catch (cause) { if (cause?.status !== 404) throw cause; // Public 404s conceal whether rules are absent or the Number is outside // this credential's project. Check Number visibility only on that path. try { - await messaging.sessions.retrieve(session); + await messaging.connections.retrieve(connection); throw new CallsExampleSetupError( "No client rules are configured for this Number. Configure the Calls actions before minting.", ); - } catch (sessionCause) { - if (sessionCause instanceof CallsExampleSetupError) throw sessionCause; - if (sessionCause?.status === 404) + } catch (connectionCause) { + if (connectionCause instanceof CallsExampleSetupError) throw connectionCause; + if (connectionCause?.status === 404) throw new CallsExampleSetupError( "Number unavailable to this credential. Check the Number ID and project-token project.", ); - // Reading a Number needs sessions:read; minting only needs sessions:manage. - if (sessionCause?.status === 403) + // Reading a Number needs connections:read; minting only needs connections:manage. + if (connectionCause?.status === 403) throw new CallsExampleSetupError( "Client rules are unavailable. Check the Number ID, project-token project, and whether client rules are configured.", ); - throw sessionCause; + throw connectionCause; } } @@ -50,7 +50,7 @@ export async function mintCallsExampleToken(messaging, session, ephemeralId) { ); const result = await messaging.clientTokens.mint({ - session, + connection, ephemeralId, ttlSeconds: 900, }); diff --git a/examples/calls-example/mint-client-token.mjs b/examples/calls-example/mint-client-token.mjs index 6c8b6aa60..d776d153f 100644 --- a/examples/calls-example/mint-client-token.mjs +++ b/examples/calls-example/mint-client-token.mjs @@ -6,12 +6,12 @@ import { } from "./mint-client-token-core.mjs"; const key = process.env.POLYMORFA_SERVER_KEY; -const session = process.env.POLYMORFA_SESSION; +const connection = process.env.POLYMORFA_CONNECTION; const ephemeralId = process.env.POLYMORFA_EPHEMERAL_ID; const credentialType = serverCredentialType(key); -if (!key || !session || !ephemeralId) { +if (!key || !connection || !ephemeralId) { process.stderr.write( - "Set POLYMORFA_SERVER_KEY, POLYMORFA_SESSION and POLYMORFA_EPHEMERAL_ID.\n", + "Set POLYMORFA_SERVER_KEY, POLYMORFA_CONNECTION and POLYMORFA_EPHEMERAL_ID.\n", ); process.exitCode = 1; } else if (!credentialType) { @@ -23,7 +23,7 @@ if (!key || !session || !ephemeralId) { credential: { type: credentialType, value: key }, baseUrl: "https://api.polymorfastaging.com", }); - const token = await mintCallsExampleToken(messaging, session, ephemeralId); + const token = await mintCallsExampleToken(messaging, connection, ephemeralId); process.stdout.write(`${token}\n`); } catch (cause) { const detail = @@ -31,7 +31,7 @@ if (!key || !session || !ephemeralId) { ? cause.message : "Token mint failed."; process.stderr.write( - `${detail}\nCheck the staging API, key scopes, session and client rules.\n`, + `${detail}\nCheck the staging API, key scopes, connection and client rules.\n`, ); process.exitCode = 1; } diff --git a/examples/calls-example/src/numbers.ts b/examples/calls-example/src/connections.ts similarity index 62% rename from examples/calls-example/src/numbers.ts rename to examples/calls-example/src/connections.ts index 2f4dff00c..c8fa8d491 100644 --- a/examples/calls-example/src/numbers.ts +++ b/examples/calls-example/src/connections.ts @@ -4,44 +4,44 @@ import { type BrowserCallsOptions, } from "@polymorfa/ui-kit"; -export interface NumberConnection { +export interface CallingConnection { readonly id: string; readonly label: string; readonly calls: BrowserCalls; dispose(): Promise; } -/** The example accepts only a token already authorized for this exact Number. */ -export function createNumberConnection( +/** The example accepts only a token already authorized for this exact Connection. */ +export function createCallingConnection( input: { - readonly session: string; + readonly connection: string; readonly label: string; readonly token: string; readonly baseUrl: string; }, callbacks: Pick = {}, create = createBrowserCalls, -): NumberConnection { - const session = input.session.trim(); - if (!session || !input.token.trim().startsWith("pmfa_ct_")) +): CallingConnection { + const connection = input.connection.trim(); + if (!connection || !input.token.trim().startsWith("pmfa_ct_")) throw new Error( - "Enter a Number's session and its pmfa_ct_ browser client token.", + "Enter a Connection ID and its pmfa_ct_ browser client token.", ); let token = input.token.trim(); let disposed = false; const calls = create({ ...callbacks, - session, + connection, baseUrl: input.baseUrl, - // Each closure belongs to one Number. Selection never changes its token. + // Each closure belongs to one Connection. Selection never changes its token. getClientToken: () => disposed - ? Promise.reject(new Error("Number disconnected.")) + ? Promise.reject(new Error("Connection disconnected.")) : Promise.resolve(token), }); return { - id: session, - label: input.label.trim() || session, + id: connection, + label: input.label.trim() || connection, calls, dispose: () => { disposed = true; @@ -51,8 +51,8 @@ export function createNumberConnection( }; } -export function hasActiveCall(numbers: readonly NumberConnection[]): boolean { - return numbers.some(({ calls }) => { +export function hasActiveCall(connections: readonly CallingConnection[]): boolean { + return connections.some(({ calls }) => { const snapshot = calls.controller.getSnapshot(); return ( snapshot.placing === true || diff --git a/examples/calls-example/src/main.tsx b/examples/calls-example/src/main.tsx index afeb954e8..58ff3f02c 100644 --- a/examples/calls-example/src/main.tsx +++ b/examples/calls-example/src/main.tsx @@ -1,16 +1,16 @@ import { useEffect, useRef, useState } from "react"; import { createRoot } from "react-dom/client"; import { - CallNumberPicker, + CallConnectionPicker, CallSurface, DialPad, PolymorfaProvider, } from "@polymorfa/ui-kit/react"; import { - createNumberConnection, + createCallingConnection, hasActiveCall, - type NumberConnection, -} from "./numbers.js"; + type CallingConnection, +} from "./connections.js"; import "./style.css"; const apiBaseUrl = "https://api.polymorfastaging.com"; @@ -20,15 +20,15 @@ interface Feedback { } function App() { - const [session, setSession] = useState(""); + const [connection, setConnection] = useState(""); const [label, setLabel] = useState(""); const [token, setToken] = useState(""); - const [numbers, setNumbers] = useState([]); + const [connections, setConnections] = useState([]); const [selectedId, setSelectedId] = useState(""); const [error, setError] = useState(""); const [feedback, setFeedback] = useState>({}); const [, redraw] = useState(0); - const numbersRef = useRef([]); + const connectionsRef = useRef([]); const subscriptions = useRef(new Map void>()); useEffect(() => { @@ -37,30 +37,30 @@ function App() { window.clearInterval(timer); for (const stop of subscriptions.current.values()) stop(); subscriptions.current.clear(); - for (const number of numbersRef.current) void number.dispose(); - numbersRef.current = []; + for (const connection of connectionsRef.current) void connection.dispose(); + connectionsRef.current = []; }; }, []); - async function addNumber() { - const id = session.trim(); - if (numbersRef.current.some((number) => number.id === id)) { + async function addConnection() { + const id = connection.trim(); + if (connectionsRef.current.some((connection) => connection.id === id)) { setError( - "This Number is already connected. Disconnect it before replacing its token.", + "This Connection is already connected. Disconnect it before replacing its token.", ); return; } - let number: NumberConnection; + let configured: CallingConnection; const update = (next: Feedback) => { - if (!numbersRef.current.includes(number)) return; + if (!connectionsRef.current.includes(configured)) return; setFeedback((previous) => ({ ...previous, [id]: { ...previous[id], ...next }, })); }; try { - number = createNumberConnection( - { session: id, label, token, baseUrl: apiBaseUrl }, + configured = createCallingConnection( + { connection: id, label, token, baseUrl: apiBaseUrl }, { onError: ({ code, message }) => update({ error: `${code}: ${message}` }), @@ -78,24 +78,24 @@ function App() { ); } catch (cause) { setError( - cause instanceof Error ? cause.message : "Could not add Number.", + cause instanceof Error ? cause.message : "Could not add Connection.", ); return; } setError(""); setToken(""); - setSession(""); + setConnection(""); setLabel(""); - const next = [...numbersRef.current, number]; - numbersRef.current = next; - setNumbers(next); - setSelectedId((current) => current || number.id); + const next = [...connectionsRef.current, configured]; + connectionsRef.current = next; + setConnections(next); + setSelectedId((current) => current || configured.id); subscriptions.current.set( - number.id, - number.calls.controller.subscribe(() => redraw((value) => value + 1)), + configured.id, + configured.calls.controller.subscribe(() => redraw((value) => value + 1)), ); try { - await number.calls.connect(); + await configured.calls.connect(); } catch (cause) { update({ error: @@ -106,53 +106,53 @@ function App() { } } - async function disconnect(number: NumberConnection) { - if (hasActiveCall(numbersRef.current)) return; - subscriptions.current.get(number.id)?.(); - subscriptions.current.delete(number.id); - const next = numbersRef.current.filter((entry) => entry !== number); - numbersRef.current = next; - setNumbers(next); + async function disconnect(connection: CallingConnection) { + if (hasActiveCall(connectionsRef.current)) return; + subscriptions.current.get(connection.id)?.(); + subscriptions.current.delete(connection.id); + const next = connectionsRef.current.filter((entry) => entry !== connection); + connectionsRef.current = next; + setConnections(next); setSelectedId((current) => - current === number.id ? (next[0]?.id ?? "") : current, + current === connection.id ? (next[0]?.id ?? "") : current, ); setFeedback((current) => { const next = { ...current }; - delete next[number.id]; + delete next[connection.id]; return next; }); - await number.dispose(); + await connection.dispose(); } - const selected = numbers.find((number) => number.id === selectedId); - const busy = hasActiveCall(numbers); + const selected = connections.find((connection) => connection.id === selectedId); + const busy = hasActiveCall(connections); return (

Polymorfa SDK

Calls example

-

Choose an authorized staging Number for outgoing calls.

+

Choose an authorized staging Connection for outgoing calls.

API: {apiBaseUrl}

-
+
{ event.preventDefault(); - void addNumber(); + void addConnection(); }} > - + setSession(event.target.value)} + id="connection" + value={connection} + onChange={(event) => setConnection(event.target.value)} placeholder="support" autoComplete="off" required /> - + - +
- +
{error && ( @@ -180,17 +180,17 @@ function App() {

)}
- {numbers.length > 0 && ( + {connections.length > 0 && (
- ({ - id: number.id, - label: number.label, - controller: number.calls.controller, + ({ + id: connection.id, + label: connection.label, + controller: connection.calls.controller, }))} value={selectedId} onChange={(id) => { - if (!hasActiveCall(numbersRef.current)) setSelectedId(id); + if (!hasActiveCall(connectionsRef.current)) setSelectedId(id); }} /> {selected !== undefined && ( @@ -198,7 +198,7 @@ function App() {

Call from {selected.label}

{busy ? (

- Finish the active call before choosing another Number or + Finish the active call before choosing another Connection or dialing.

) : selected.calls.connected ? ( @@ -208,39 +208,39 @@ function App() { allowVideo={false} /> ) : ( -

Waiting for this Number's call connection.

+

Waiting for this Connection's call connection.

)} )}
)} - {numbers.map((number) => { - const failure = number.calls.controller.getSnapshot().error; + {connections.map((connection) => { + const failure = connection.calls.controller.getSnapshot().error; return (
-

Calls on {number.label}

-

Session: {number.id}

+

Calls on {connection.label}

+

Connection: {connection.id}

- {number.calls.connected + {connection.calls.connected ? "Ready for calls" : "Reconnecting to call events"}
- {feedback[number.id]?.error && ( + {feedback[connection.id]?.error && (

- {feedback[number.id]!.error} + {feedback[connection.id]!.error}

)} {failure && ( @@ -248,12 +248,12 @@ function App() { {failure.code}: {failure.message}

)} - {feedback[number.id]?.requestFailure && ( + {feedback[connection.id]?.requestFailure && (

- Last failed request: {feedback[number.id]!.requestFailure} + Last failed request: {feedback[connection.id]!.requestFailure}

)} - +
); })} diff --git a/examples/five-minute-inbox/app/api/polymorfa/[...route]/route.ts b/examples/five-minute-inbox/app/api/polymorfa/[...route]/route.ts index b68c9a31c..07cec0f78 100644 --- a/examples/five-minute-inbox/app/api/polymorfa/[...route]/route.ts +++ b/examples/five-minute-inbox/app/api/polymorfa/[...route]/route.ts @@ -15,7 +15,7 @@ export const { GET, POST } = createPolymorfaHandler({ authenticate: currentUser, // The only place permissions are chosen: the smallest set this user needs. mint: () => ({ - session: process.env.POLYMORFA_SESSION!, + connection: process.env.POLYMORFA_CONNECTION!, conversations: "all", allow: ["read_messages", "subscribe_events", "send_message"], ttlSeconds: 600, diff --git a/examples/full-platform/app/api/admin/bansafe/route.ts b/examples/full-platform/app/api/admin/bansafe/route.ts index cef065a9d..ed0e7e8b1 100644 --- a/examples/full-platform/app/api/admin/bansafe/route.ts +++ b/examples/full-platform/app/api/admin/bansafe/route.ts @@ -1,4 +1,4 @@ -import type { BanSafeNumber } from "@polymorfa/sdk"; +import type { BanSafeConnection } from "@polymorfa/sdk"; import { team } from "../../../../lib/polymorfa.js"; import { env } from "../../../../lib/env.js"; @@ -15,7 +15,7 @@ import { export const GET = route("admin", async () => { const banSafe = team().banSafe; const projectId = env.projectId(); - const numbers: BanSafeNumber[] = []; + const numbers: BanSafeConnection[] = []; let cursor: string | undefined; // At most 20 pages (2,000 numbers); stop if the cursor does not advance. for (let pages = 0; pages < 20; pages += 1) { @@ -63,12 +63,12 @@ export const POST = route("admin", async ({ body, request }) => { const banSafe = team().banSafe; switch (action(body)) { case "number": { - const session = text(body, "session"); + const connection = text(body, "connection"); const [health, history, telemetry, telemetryHistory] = await Promise.all([ - banSafe.getHealth(session), - banSafe.listHealthHistory(session, { limit: 30 }), - banSafe.getTelemetry(session), - banSafe.listTelemetryHistory(session, { limit: 24 }), + banSafe.getHealth(connection), + banSafe.listHealthHistory(connection, { limit: 30 }), + banSafe.getTelemetry(connection), + banSafe.listTelemetryHistory(connection, { limit: 24 }), ]); return { health: health.data.data, @@ -81,7 +81,7 @@ export const POST = route("admin", async ({ body, request }) => { const note = optionalText(body, "note"); return banSafe.createIncident( { - session: text(body, "session"), + connection: text(body, "connection"), ...(note === undefined ? {} : { note }), }, { idempotencyKey: idempotencyKey(request) }, diff --git a/examples/full-platform/app/api/admin/sessions/route.ts b/examples/full-platform/app/api/admin/connections/route.ts similarity index 55% rename from examples/full-platform/app/api/admin/sessions/route.ts rename to examples/full-platform/app/api/admin/connections/route.ts index 381f2f1b5..bfa9cf060 100644 --- a/examples/full-platform/app/api/admin/sessions/route.ts +++ b/examples/full-platform/app/api/admin/connections/route.ts @@ -11,59 +11,59 @@ import { } from "../../../../lib/route.js"; export const GET = route("admin", () => - team().sessions.list({ projectId: env.projectId() }), + team().connections.list({ projectId: env.projectId() }), ); export const POST = route("admin", async ({ body, request }) => { - const sessions = team().sessions; + const connections = team().connections; const projectId = env.projectId(); const name = action(body); switch (name) { case "stopMany": - return sessions.stopMany({ projectId, sessionIds: texts(body, "ids") }); + return connections.stopMany({ projectId, connectionIds: texts(body, "ids") }); case "deleteMany": - return sessions.deleteMany({ projectId, sessionIds: texts(body, "ids") }); + return connections.deleteMany({ projectId, connectionIds: texts(body, "ids") }); } - const sessionId = text(body, "sessionId"); + const connectionId = text(body, "connectionId"); switch (name) { case "retrieve": - return sessions.retrieve(sessionId); + return connections.retrieve(connectionId); case "start": - return sessions.start(sessionId, { projectId }); + return connections.start(connectionId, { projectId }); case "stop": - return sessions.stop(sessionId, { projectId }); + return connections.stop(connectionId, { projectId }); case "delete": - return sessions.delete(sessionId); + return connections.delete(connectionId); case "resetConfiguration": { - const current = await sessions.retrieve(sessionId); - const revision = current.data.data.configuration?.revisions.session ?? 0; - return sessions.update(sessionId, { + const current = await connections.retrieve(connectionId); + const revision = current.data.data.configuration?.revisions.connection ?? 0; + return connections.update(connectionId, { configuration: { reset: ["observation", "historySync"] }, revision, }); } case "quoteTier": // Review the quote with the customer, then confirm it with applyTier. - return sessions.quoteTierChange(sessionId, { + return connections.quoteTierChange(connectionId, { projectId, tierOverride: oneOf(body, "tier", ["free", "standard", "pro"]), }); case "tierQuote": - return sessions.retrieveTierChange(sessionId, text(body, "quoteId")); + return connections.retrieveTierChange(connectionId, text(body, "quoteId")); case "applyTier": - return sessions.setTierOverride( - sessionId, + return connections.setTierOverride( + connectionId, { projectId, quoteId: text(body, "quoteId") }, { idempotencyKey: idempotencyKey(request) }, ); case "capabilities": // Beta: returns 403 until the team enrolls in number capabilities. - return sessions.getCapabilities(sessionId); + return connections.getCapabilities(connectionId); case "safeMode": - return sessions.getSafeMode(sessionId); + return connections.getSafeMode(connectionId); case "updateSafeMode": - return sessions.updateSafeMode(sessionId, { pacing: "jittered" }); + return connections.updateSafeMode(connectionId, { pacing: "jittered" }); default: return unknownAction(name); } diff --git a/examples/full-platform/app/api/admin/customers/route.ts b/examples/full-platform/app/api/admin/customers/route.ts index 723758fa7..1a73271ed 100644 --- a/examples/full-platform/app/api/admin/customers/route.ts +++ b/examples/full-platform/app/api/admin/customers/route.ts @@ -82,7 +82,7 @@ export const POST = route("admin", async ({ body, request }) => { { idempotencyKey: idempotencyKey(request) }, ); case "numbers": - return customers.listNumbers(customerId, projectId); + return customers.listConnections(customerId, projectId); case "events": return customers.listEvents(customerId, { projectId, limit: 50 }); case "createPairingLink": { @@ -108,10 +108,10 @@ export const POST = route("admin", async ({ body, request }) => { text(body, "pairingLinkId"), projectId, ); - case "transferNumber": - return customers.transferNumber( + case "transferConnection": + return customers.transferConnection( customerId, - text(body, "sessionId"), + text(body, "connectionId"), { projectId, sourceCustomerId: text(body, "sourceCustomerId"), diff --git a/examples/full-platform/app/api/admin/projects/route.ts b/examples/full-platform/app/api/admin/projects/route.ts index f9453e3e3..a1706868a 100644 --- a/examples/full-platform/app/api/admin/projects/route.ts +++ b/examples/full-platform/app/api/admin/projects/route.ts @@ -54,7 +54,7 @@ export const POST = route("admin", async ({ body, request }) => { version: current.version, enabled: false, threshold: current.threshold, - sessionAction: current.sessionAction, + connectionAction: current.connectionAction, slowDownMps: current.slowDownMps, emailNotification: current.emailNotification, webhookNotification: current.webhookNotification, diff --git a/examples/full-platform/app/api/admin/security/route.ts b/examples/full-platform/app/api/admin/security/route.ts index a3cc0a577..998d0e232 100644 --- a/examples/full-platform/app/api/admin/security/route.ts +++ b/examples/full-platform/app/api/admin/security/route.ts @@ -1,7 +1,7 @@ import { team } from "../../../../lib/polymorfa.js"; import { action, route, text, unknownAction } from "../../../../lib/route.js"; -// Audit trail, leaked-credential incidents and session bans. +// Audit trail, leaked-credential incidents and connection bans. export const GET = route("admin", async ({ url }) => { const client = team(); const auditAction = url.searchParams.get("action") ?? undefined; @@ -11,14 +11,14 @@ export const GET = route("admin", async ({ url }) => { ...(auditAction === undefined ? {} : { action: auditAction }), }), client.securityIncidents.list(), - client.sessionBans.list(), - client.sessionBans.listActive(), + client.connectionBans.list(), + client.connectionBans.listActive(), ]); return { auditLogs: auditLogs.data.data, securityIncidents: incidents.data.data, - sessionBans: bans.data.data, - activeSessionBans: activeBans.data.data, + connectionBans: bans.data.data, + activeConnectionBans: activeBans.data.data, }; }); diff --git a/examples/full-platform/app/api/admin/settings/route.ts b/examples/full-platform/app/api/admin/settings/route.ts index 5ebb0441a..27cf20a69 100644 --- a/examples/full-platform/app/api/admin/settings/route.ts +++ b/examples/full-platform/app/api/admin/settings/route.ts @@ -7,18 +7,18 @@ import { unknownAction, } from "../../../../lib/route.js"; -// Session configuration defaults and saved QuickLink branding, for the team +// Connection configuration defaults and saved QuickLink branding, for the team // (team view) and for this project (project view). export const GET = route("admin", async () => { const [teamConfig, projectConfig, teamLinks, projectLinks] = await Promise.all([ - team().sessionConfiguration.retrieve(), - project().sessionConfiguration.retrieve(), + team().connectionConfiguration.retrieve(), + project().connectionConfiguration.retrieve(), team().quickLinkSettings.retrieve(), project().quickLinkSettings.retrieve(), ]); return { - sessionConfiguration: { + connectionConfiguration: { team: teamConfig.data, project: projectConfig.data, }, @@ -30,7 +30,7 @@ export const POST = route("admin", async ({ body }) => { switch (action(body)) { case "projectObservation": // `revision` must match the value last read, or the API rejects the write. - return project().sessionConfiguration.update({ + return project().connectionConfiguration.update({ configuration: { set: { observation: { presenceMode: "cache", typingMode: "events" }, diff --git a/examples/full-platform/app/api/desk/connections/route.ts b/examples/full-platform/app/api/desk/connections/route.ts index e19be6372..ce44b7db5 100644 --- a/examples/full-platform/app/api/desk/connections/route.ts +++ b/examples/full-platform/app/api/desk/connections/route.ts @@ -26,7 +26,7 @@ export const GET = route( { demo: "handler" }, ); -// Session controls are admin-only. +// Connection controls are admin-only. export const POST = route( "admin", async ({ body, request }) => { @@ -35,7 +35,7 @@ export const POST = route( case "quickLink": // QuickLink is hosted by Polymorfa: return the URL, embed nothing. return data.createQuickLink(idempotencyKey(request)); - case "session": + case "connection": return data.connectionAction( text(body, "connectionId"), oneOf(body, "operation", ACTIONS), diff --git a/examples/full-platform/app/api/desk/media/route.ts b/examples/full-platform/app/api/desk/media/route.ts index 976c4dce7..d3176731b 100644 --- a/examples/full-platform/app/api/desk/media/route.ts +++ b/examples/full-platform/app/api/desk/media/route.ts @@ -67,7 +67,7 @@ const authenticatedGet = route( { demo: "handler" }, ); -// Signed links let Polymorfa fetch an upload without a session cookie. +// Signed links let Polymorfa fetch an upload without a connection cookie. export async function GET(request: Request): Promise { const url = new URL(request.url); if (url.searchParams.has("sig")) { diff --git a/examples/full-platform/app/api/desk/tickets/route.ts b/examples/full-platform/app/api/desk/tickets/route.ts index 221f9612f..3db55f4d5 100644 --- a/examples/full-platform/app/api/desk/tickets/route.ts +++ b/examples/full-platform/app/api/desk/tickets/route.ts @@ -43,17 +43,17 @@ export const GET = route( export const POST = route( "agent", - async ({ body, operator, sessionOf }) => { + async ({ body, operator, connectionOf }) => { const data = await desk(); const name = action(body); if (name === "create") { const requested = optionalText(body, "connectionId"); - // Live sessions go through the same allow-list as every other route; + // Live connections go through the same allow-list as every other route; // demo connections are fixtures. const connectionId = requested === undefined || isDemoMode() ? requested - : sessionOf({ session: requested }); + : connectionOf({ connection: requested }); return data.createTicket( { phone: text(body, "phone").replace(/[\s()-]/g, ""), diff --git a/examples/full-platform/app/api/messaging/bansafe/route.ts b/examples/full-platform/app/api/messaging/bansafe/route.ts index 24c9484be..b9a8f177e 100644 --- a/examples/full-platform/app/api/messaging/bansafe/route.ts +++ b/examples/full-platform/app/api/messaging/bansafe/route.ts @@ -3,26 +3,26 @@ import { env } from "../../../../lib/env.js"; import { action, flag, route, unknownAction } from "../../../../lib/route.js"; // BanSafe settings through the Messaging API. -export const GET = route("admin", async ({ body, sessionOf }) => { +export const GET = route("admin", async ({ body, connectionOf }) => { const banSafe = messaging().banSafe; const projectId = env.projectId(); - const [safeMode, warmup, insurance, health, session] = await Promise.all([ + const [safeMode, warmup, insurance, health, connection] = await Promise.all([ banSafe.getProjectSafeMode(projectId), banSafe.getProjectWarmupPlan(projectId), banSafe.getProjectInsuranceEvidence(projectId), banSafe.getProjectHealthPolicy(projectId), - banSafe.getSessionSafeMode(sessionOf(body)), + banSafe.getConnectionSafeMode(connectionOf(body)), ]); return { safeMode: safeMode.data.data, warmup: warmup.data.data, insurance: insurance.data.data, health: health.data.data, - session: session.data.data, + connection: connection.data.data, }; }); -export const POST = route("admin", async ({ body, sessionOf }) => { +export const POST = route("admin", async ({ body, connectionOf }) => { const banSafe = messaging().banSafe; const projectId = env.projectId(); switch (action(body)) { @@ -51,14 +51,14 @@ export const POST = route("admin", async ({ body, sessionOf }) => { version: policy.version, enabled: true, threshold: 40, - sessionAction: "slow_down", + connectionAction: "slow_down", slowDownMps: 1, emailNotification: policy.integrations.emailConfigured, webhookNotification: policy.integrations.webhookConfigured, }); } - case "sessionSafeMode": - return banSafe.updateSessionSafeMode(sessionOf(body), { + case "connectionSafeMode": + return banSafe.updateConnectionSafeMode(connectionOf(body), { presence: "inherit", typing: "inherit", reads: "all_inbound", diff --git a/examples/full-platform/app/api/messaging/business/route.ts b/examples/full-platform/app/api/messaging/business/route.ts index b18823aa6..cef547d6b 100644 --- a/examples/full-platform/app/api/messaging/business/route.ts +++ b/examples/full-platform/app/api/messaging/business/route.ts @@ -12,15 +12,15 @@ import { } from "../../../../lib/route.js"; // Business App profile and commerce. Most reads take the business user id. -export const POST = route("admin", async ({ body, sessionOf }) => { +export const POST = route("admin", async ({ body, connectionOf }) => { const business = messaging().business; - const session = sessionOf(body); + const connection = connectionOf(body); const name = action(body); switch (name) { case "profile": - return business.getProfile(session); + return business.getProfile(connection); case "updateProfile": - return business.updateProfile(session, { + return business.updateProfile(connection, { description: text(body, "description"), websites: ["https://acme.test"], hours: { @@ -37,67 +37,67 @@ export const POST = route("admin", async ({ body, sessionOf }) => { }, }); case "setCoverPhoto": - return business.setCoverPhoto(session, { url: text(body, "url") }); + return business.setCoverPhoto(connection, { url: text(body, "url") }); case "deleteCoverPhoto": - return business.deleteCoverPhoto(session, text(body, "coverPhotoId")); + return business.deleteCoverPhoto(connection, text(body, "coverPhotoId")); case "catalog": { const after = optionalText(body, "after"); - return business.getCatalog(session, { + return business.getCatalog(connection, { id: text(body, "businessId"), limit: optionalInteger(body, "limit") ?? 20, ...(after === undefined ? {} : { after }), }); } case "createCatalog": - return business.createCatalog(session); + return business.createCatalog(connection); case "setCartEnabled": - return business.setCartEnabled(session, { + return business.setCartEnabled(connection, { enabled: flag(body, "enabled"), }); case "product": - return business.getProduct(session, text(body, "productId"), { + return business.getProduct(connection, text(body, "productId"), { id: text(body, "businessId"), }); case "createProduct": - return business.createProduct(session, product(body)); + return business.createProduct(connection, product(body)); case "updateProduct": return business.updateProduct( - session, + connection, text(body, "productId"), product(body), ); case "deleteProduct": - return business.deleteProduct(session, text(body, "productId")); + return business.deleteProduct(connection, text(body, "productId")); case "setProductVisibility": - return business.setProductVisibility(session, text(body, "productId"), { + return business.setProductVisibility(connection, text(body, "productId"), { hidden: flag(body, "hidden"), }); case "appealProduct": - return business.appealProduct(session, text(body, "productId"), { + return business.appealProduct(connection, text(body, "productId"), { reason: text(body, "reason"), }); case "collections": - return business.listCollections(session, { + return business.listCollections(connection, { id: text(body, "businessId"), collectionLimit: 10, }); case "collection": - return business.getCollection(session, text(body, "collectionId"), { + return business.getCollection(connection, text(body, "collectionId"), { id: text(body, "businessId"), }); case "createCollection": - return business.createCollection(session, { + return business.createCollection(connection, { name: text(body, "name"), productIds: texts(body, "productIds"), }); case "updateCollection": - return business.updateCollection(session, text(body, "collectionId"), { + return business.updateCollection(connection, text(body, "collectionId"), { name: text(body, "name"), }); case "deleteCollection": - return business.deleteCollection(session, text(body, "collectionId")); + return business.deleteCollection(connection, text(body, "collectionId")); case "reorderCollections": - return business.reorderCollections(session, { + return business.reorderCollections(connection, { moves: [ { collectionId: text(body, "collectionId"), @@ -107,22 +107,22 @@ export const POST = route("admin", async ({ body, sessionOf }) => { ], }); case "appealCollection": - return business.appealCollection(session, text(body, "collectionId"), { + return business.appealCollection(connection, text(body, "collectionId"), { reason: text(body, "reason"), }); case "order": - return business.getOrder(session, text(body, "orderId"), { + return business.getOrder(connection, text(body, "orderId"), { token: text(body, "token"), }); case "merchantCompliance": - return business.getMerchantCompliance(session); + return business.getMerchantCompliance(connection); case "setMerchantCompliance": { const contact = { email: "care@acme.test", landlineNumber: "+15550100", mobileNumber: "+15550101", }; - return business.setMerchantCompliance(session, { + return business.setMerchantCompliance(connection, { entityName: "Acme Inc.", entityType: "PRIVATE_COMPANY", isRegistered: true, @@ -132,9 +132,9 @@ export const POST = route("admin", async ({ body, sessionOf }) => { }); } case "linkedAccounts": - return business.getLinkedAccounts(session); + return business.getLinkedAccounts(connection); case "eligibility": - return business.getEligibility(session); + return business.getEligibility(connection); default: return unknownAction(name); } diff --git a/examples/full-platform/app/api/messaging/calls/token/route.ts b/examples/full-platform/app/api/messaging/calls/token/route.ts index 9380e8bca..225e46530 100644 --- a/examples/full-platform/app/api/messaging/calls/token/route.ts +++ b/examples/full-platform/app/api/messaging/calls/token/route.ts @@ -8,7 +8,7 @@ import { env, isDemoMode } from "../../../../../lib/env.js"; import { messaging } from "../../../../../lib/polymorfa.js"; // Calls token minted with `clientTokens.mint` (POST /platform/client-tokens). -// The session's client rules must grant voip_place, voip_answer and +// The connection's client rules must grant voip_place, voip_answer and // voip_signal. export const POST = createClientTokenRoute({ authorize: async (request) => { @@ -21,7 +21,7 @@ export const POST = createClientTokenRoute({ createMessagingClientTokenMint({ clientTokens: messaging().clientTokens, resolve: () => ({ - session: env.session(), + connection: env.connection(), ephemeralId: subject.userId, ttlSeconds: 600, }), diff --git a/examples/full-platform/app/api/messaging/channels/route.ts b/examples/full-platform/app/api/messaging/channels/route.ts index c75dfe6e2..df862897f 100644 --- a/examples/full-platform/app/api/messaging/channels/route.ts +++ b/examples/full-platform/app/api/messaging/channels/route.ts @@ -8,17 +8,17 @@ import { unknownAction, } from "../../../../lib/route.js"; -export const GET = route("agent", ({ body, sessionOf }) => - messaging().channels.list(sessionOf(body)), +export const GET = route("agent", ({ body, connectionOf }) => + messaging().channels.list(connectionOf(body)), ); -export const POST = route("admin", async ({ body, sessionOf }) => { +export const POST = route("admin", async ({ body, connectionOf }) => { const channels = messaging().channels; - const session = sessionOf(body); + const connection = connectionOf(body); const name = action(body); if (name === "create") { const description = optionalText(body, "description"); - return channels.create(session, { + return channels.create(connection, { name: text(body, "name"), ...(description === undefined ? {} : { description }), }); @@ -26,47 +26,47 @@ export const POST = route("admin", async ({ body, sessionOf }) => { const channelId = text(body, "channelId"); switch (name) { case "retrieve": - return channels.retrieve(session, channelId); + return channels.retrieve(connection, channelId); case "delete": - return channels.delete(session, channelId); + return channels.delete(connection, channelId); case "messages": { // Page older history with the smallest `position` you have seen. const before = optionalInteger(body, "before"); - return channels.listMessages(session, channelId, { + return channels.listMessages(connection, channelId, { count: 50, ...(before === undefined ? {} : { before }), }); } case "updates": { const since = optionalInteger(body, "since"); - return channels.listMessageUpdates(session, channelId, { + return channels.listMessageUpdates(connection, channelId, { count: 50, ...(since === undefined ? {} : { since }), }); } case "markViewed": return channels.markMessageViewed( - session, + connection, channelId, text(body, "messageId"), ); case "react": return channels.reactToMessage( - session, + connection, channelId, text(body, "messageId"), { reaction: typeof body.reaction === "string" ? body.reaction : "" }, ); case "liveUpdates": - return channels.subscribeToLiveUpdates(session, channelId); + return channels.subscribeToLiveUpdates(connection, channelId); case "follow": - return channels.follow(session, channelId); + return channels.follow(connection, channelId); case "unfollow": - return channels.unfollow(session, channelId); + return channels.unfollow(connection, channelId); case "mute": - return channels.mute(session, channelId); + return channels.mute(connection, channelId); case "unmute": - return channels.unmute(session, channelId); + return channels.unmute(connection, channelId); default: return unknownAction(name); } diff --git a/examples/full-platform/app/api/messaging/chats/route.ts b/examples/full-platform/app/api/messaging/chats/route.ts index c5bb36bc8..3b42e4149 100644 --- a/examples/full-platform/app/api/messaging/chats/route.ts +++ b/examples/full-platform/app/api/messaging/chats/route.ts @@ -9,24 +9,24 @@ import { const TIMERS = { off: 0, "24h": 86400, "7d": 604800, "90d": 7776000 } as const; -export const POST = route("agent", async ({ body, sessionOf }) => { +export const POST = route("agent", async ({ body, connectionOf }) => { const chats = messaging().chats; - const session = sessionOf(body); + const connection = connectionOf(body); const chatId = text(body, "chatId"); switch (action(body)) { case "editMessage": - return chats.editMessage(session, chatId, text(body, "messageId"), { + return chats.editMessage(connection, chatId, text(body, "messageId"), { text: text(body, "text"), }); case "deleteMessage": - return chats.deleteMessage(session, chatId, text(body, "messageId")); + return chats.deleteMessage(connection, chatId, text(body, "messageId")); case "archive": - return chats.archive(session, chatId); + return chats.archive(connection, chatId); case "unarchive": - return chats.unarchive(session, chatId); + return chats.unarchive(connection, chatId); case "disappearing": { const timer = oneOf(body, "timer", ["off", "24h", "7d", "90d"]); - return chats.setDisappearingTimer(session, chatId, { + return chats.setDisappearingTimer(connection, chatId, { durationSeconds: TIMERS[timer], }); } diff --git a/examples/full-platform/app/api/messaging/client-rules/route.ts b/examples/full-platform/app/api/messaging/client-rules/route.ts index d88ec5426..4d4c05263 100644 --- a/examples/full-platform/app/api/messaging/client-rules/route.ts +++ b/examples/full-platform/app/api/messaging/client-rules/route.ts @@ -2,18 +2,18 @@ import { messaging } from "../../../../lib/polymorfa.js"; import { env } from "../../../../lib/env.js"; import { action, route, unknownAction } from "../../../../lib/route.js"; -export const GET = route("admin", ({ body, sessionOf }) => - messaging().clientTokens.retrieveRules(sessionOf(body)), +export const GET = route("admin", ({ body, connectionOf }) => + messaging().clientTokens.retrieveRules(connectionOf(body)), ); -export const POST = route("admin", async ({ body, sessionOf }) => { +export const POST = route("admin", async ({ body, connectionOf }) => { const clientTokens = messaging().clientTokens; - const session = sessionOf(body); + const connection = connectionOf(body); switch (action(body)) { case "apply": - // What browser tokens for this session may do: chat in existing + // What browser tokens for this connection may do: chat in existing // conversations and handle calls from this origin only. - return clientTokens.updateRules(session, { + return clientTokens.updateRules(connection, { enabled: true, recipientMode: "conversation", allowedActions: [ @@ -32,7 +32,7 @@ export const POST = route("admin", async ({ body, sessionOf }) => { maxConcurrency: 1, }); case "delete": - return clientTokens.deleteRules(session); + return clientTokens.deleteRules(connection); default: return unknownAction(action(body)); } diff --git a/examples/full-platform/app/api/messaging/sessions/route.ts b/examples/full-platform/app/api/messaging/connections/route.ts similarity index 53% rename from examples/full-platform/app/api/messaging/sessions/route.ts rename to examples/full-platform/app/api/messaging/connections/route.ts index 1e32935b6..1cad89fc2 100644 --- a/examples/full-platform/app/api/messaging/sessions/route.ts +++ b/examples/full-platform/app/api/messaging/connections/route.ts @@ -9,33 +9,33 @@ import { unknownAction, } from "../../../../lib/route.js"; -// Sessions are created by QuickLink (see ../quicklinks). These routes list, -// inspect and operate existing sessions. -export const GET = route("agent", () => messaging().sessions.list()); +// Connections are created by QuickLink (see ../quicklinks). These routes list, +// inspect and operate existing connections. +export const GET = route("agent", () => messaging().connections.list()); -export const POST = route("admin", async ({ body, sessionOf }) => { - const sessions = messaging().sessions; - const session = sessionOf(body); +export const POST = route("admin", async ({ body, connectionOf }) => { + const connections = messaging().connections; + const connection = connectionOf(body); switch (action(body)) { case "retrieve": - return sessions.retrieve(session); + return connections.retrieve(connection); case "status": { - const response = await sessions.retrieve(session); + const response = await connections.retrieve(connection); const { status, statusReason } = response.data.data; - return { session, status, statusReason }; + return { connection, status, statusReason }; } case "account": - return sessions.account(session); + return connections.account(connection); case "start": - return sessions.start(session); + return connections.start(connection); case "stop": - return sessions.stop(session); + return connections.stop(connection); case "restart": - return sessions.restart(session); + return connections.restart(connection); case "logout": - return sessions.logout(session); + return connections.logout(connection); case "delete": - return sessions.delete(session); + return connections.delete(connection); case "configure": { // Optimistic concurrency: pass the revision you last read. const history = object(body, "historySync"); @@ -43,16 +43,16 @@ export const POST = route("admin", async ({ body, sessionOf }) => { if (mode !== "metadata_only" && mode !== "deliver") { throw new InputError("historySync.mode is invalid."); } - return sessions.update(session, { + return connections.update(connection, { configuration: { set: { historySync: { mode } } }, revision: integer(body, "revision"), }); } // Direct pairing is entitlement-gated; QuickLink is the standard flow. case "qr": - return sessions.qr(session); + return connections.qr(connection); case "pairingCode": - return sessions.requestPairingCode(session, { + return connections.requestPairingCode(connection, { phone: text(body, "phone"), }); default: diff --git a/examples/full-platform/app/api/messaging/contacts/route.ts b/examples/full-platform/app/api/messaging/contacts/route.ts index 8ec7432ff..fceb2b348 100644 --- a/examples/full-platform/app/api/messaging/contacts/route.ts +++ b/examples/full-platform/app/api/messaging/contacts/route.ts @@ -7,34 +7,34 @@ import { unknownAction, } from "../../../../lib/route.js"; -export const GET = route("agent", ({ body, sessionOf }) => - messaging().contacts.list(sessionOf(body)), +export const GET = route("agent", ({ body, connectionOf }) => + messaging().contacts.list(connectionOf(body)), ); -export const POST = route("agent", async ({ body, sessionOf }) => { +export const POST = route("agent", async ({ body, connectionOf }) => { const contacts = messaging().contacts; - const session = sessionOf(body); + const connection = connectionOf(body); const name = action(body); if (name === "check") { - return contacts.check(session, texts(body, "phones")); + return contacts.check(connection, texts(body, "phones")); } - if (name === "blocklist") return contacts.blocklist(session); + if (name === "blocklist") return contacts.blocklist(connection); const contactId = text(body, "contactId"); switch (name) { case "retrieve": - return contacts.retrieve(session, contactId); + return contacts.retrieve(connection, contactId); case "picture": - return contacts.picture(session, contactId); + return contacts.picture(connection, contactId); case "info": - return contacts.info(session, contactId); + return contacts.info(connection, contactId); case "devices": - return contacts.devices(session, contactId); + return contacts.devices(connection, contactId); case "businessProfile": - return contacts.businessProfile(session, contactId); + return contacts.businessProfile(connection, contactId); case "block": - return contacts.block(session, contactId); + return contacts.block(connection, contactId); case "unblock": - return contacts.unblock(session, contactId); + return contacts.unblock(connection, contactId); default: return unknownAction(name); } diff --git a/examples/full-platform/app/api/messaging/groups/route.ts b/examples/full-platform/app/api/messaging/groups/route.ts index 22bdb842a..1d76e75b9 100644 --- a/examples/full-platform/app/api/messaging/groups/route.ts +++ b/examples/full-platform/app/api/messaging/groups/route.ts @@ -9,73 +9,73 @@ import { unknownAction, } from "../../../../lib/route.js"; -export const GET = route("agent", ({ body, sessionOf }) => - messaging().groups.list(sessionOf(body)), +export const GET = route("agent", ({ body, connectionOf }) => + messaging().groups.list(connectionOf(body)), ); -export const POST = route("agent", async ({ body, sessionOf }) => { +export const POST = route("agent", async ({ body, connectionOf }) => { const groups = messaging().groups; - const session = sessionOf(body); + const connection = connectionOf(body); const name = action(body); switch (name) { case "create": - return groups.create(session, { + return groups.create(connection, { name: text(body, "name"), participants: texts(body, "participants"), }); case "joinInfo": - return groups.getJoinInfo(session, text(body, "code")); + return groups.getJoinInfo(connection, text(body, "code")); case "join": - return groups.join(session, { code: text(body, "code") }); + return groups.join(connection, { code: text(body, "code") }); } const groupId = text(body, "groupId"); const participants = () => ({ participants: texts(body, "participants") }); switch (name) { case "retrieve": - return groups.retrieve(session, groupId); + return groups.retrieve(connection, groupId); case "delete": - return groups.delete(session, groupId); + return groups.delete(connection, groupId); case "leave": - return groups.leave(session, groupId); + return groups.leave(connection, groupId); case "setSubject": - return groups.setSubject(session, groupId, { + return groups.setSubject(connection, groupId, { value: text(body, "value"), }); case "setDescription": - return groups.setDescription(session, groupId, { + return groups.setDescription(connection, groupId, { value: text(body, "value"), }); case "inviteCode": - return groups.getInviteCode(session, groupId); + return groups.getInviteCode(connection, groupId); case "revokeInviteCode": - return groups.revokeInviteCode(session, groupId); + return groups.revokeInviteCode(connection, groupId); case "participants": - return groups.listParticipants(session, groupId); + return groups.listParticipants(connection, groupId); case "addParticipants": - return groups.addParticipants(session, groupId, participants()); + return groups.addParticipants(connection, groupId, participants()); case "removeParticipants": - return groups.removeParticipants(session, groupId, participants()); + return groups.removeParticipants(connection, groupId, participants()); case "promoteParticipants": - return groups.promoteParticipants(session, groupId, participants()); + return groups.promoteParticipants(connection, groupId, participants()); case "demoteParticipants": - return groups.demoteParticipants(session, groupId, participants()); + return groups.demoteParticipants(connection, groupId, participants()); case "setPicture": - return groups.setPicture(session, groupId, { url: text(body, "url") }); + return groups.setPicture(connection, groupId, { url: text(body, "url") }); case "setInfoEditing": - return groups.setInfoEditing(session, groupId, { + return groups.setInfoEditing(connection, groupId, { adminsOnly: flag(body, "adminsOnly"), }); case "setMessaging": - return groups.setMessaging(session, groupId, { + return groups.setMessaging(connection, groupId, { adminsOnly: flag(body, "adminsOnly"), }); case "setMemberAddMode": - return groups.setMemberAddMode(session, groupId, { + return groups.setMemberAddMode(connection, groupId, { mode: oneOf(body, "mode", ["admin_add", "all_member_add"]), }); case "setJoinApproval": - return groups.setJoinApproval(session, groupId, { + return groups.setJoinApproval(connection, groupId, { required: flag(body, "required"), }); default: diff --git a/examples/full-platform/app/api/messaging/identities/route.ts b/examples/full-platform/app/api/messaging/identities/route.ts index 083e51ed3..9c0799d9e 100644 --- a/examples/full-platform/app/api/messaging/identities/route.ts +++ b/examples/full-platform/app/api/messaging/identities/route.ts @@ -11,14 +11,14 @@ import { type Body, } from "../../../../lib/route.js"; -export const POST = route("agent", async ({ body, sessionOf }) => { - const session = sessionOf(body); +export const POST = route("agent", async ({ body, connectionOf }) => { + const connection = connectionOf(body); switch (action(body)) { case "resolve": - return messaging().identities.resolve(session, identity(body)); + return messaging().identities.resolve(connection, identity(body)); case "securityCode": // Display-only verification code for a stable user id. - return messaging().users.getSecurityCode(session, text(body, "userId")); + return messaging().users.getSecurityCode(connection, text(body, "userId")); default: return unknownAction(action(body)); } diff --git a/examples/full-platform/app/api/messaging/inbox/route.ts b/examples/full-platform/app/api/messaging/inbox/route.ts index 923bfe49f..ce4512db6 100644 --- a/examples/full-platform/app/api/messaging/inbox/route.ts +++ b/examples/full-platform/app/api/messaging/inbox/route.ts @@ -24,7 +24,7 @@ export const POST = route("agent", async ({ body, request }) => { const clientId = text(body, "clientId"); const replyTo = optionalText(body, "replyTo"); const response = await messaging().messages.send( - env.session(), + env.connection(), { conversation: { phoneNumber: chat }, content: { text: content }, @@ -41,6 +41,6 @@ export const POST = route("agent", async ({ body, request }) => { direction: "outbound" as const, status: "sent" as const, }; - emit("inbox.message", env.session(), { chat, message }); + emit("inbox.message", env.connection(), { chat, message }); return message; }); diff --git a/examples/full-platform/app/api/messaging/labels/route.ts b/examples/full-platform/app/api/messaging/labels/route.ts index 0a39f4596..e14059662 100644 --- a/examples/full-platform/app/api/messaging/labels/route.ts +++ b/examples/full-platform/app/api/messaging/labels/route.ts @@ -10,19 +10,19 @@ import { unknownAction, } from "../../../../lib/route.js"; -export const GET = route("agent", ({ body, sessionOf, url }) => - messaging().labels.list(sessionOf(body), { +export const GET = route("agent", ({ body, connectionOf, url }) => + messaging().labels.list(connectionOf(body), { includeObservation: url.searchParams.get("observation") === "true", }), ); -export const POST = route("agent", async ({ body, sessionOf }) => { +export const POST = route("agent", async ({ body, connectionOf }) => { const labels = messaging().labels; - const session = sessionOf(body); + const connection = connectionOf(body); switch (action(body)) { case "create": { const color = optionalInteger(body, "color"); - return labels.create(session, { + return labels.create(connection, { name: text(body, "name"), ...(color === undefined ? {} : { color }), }); @@ -32,23 +32,23 @@ export const POST = route("agent", async ({ body, sessionOf }) => { const color = optionalInteger(body, "color"); const labelId = text(body, "labelId"); if (name !== undefined) { - return labels.update(session, labelId, { + return labels.update(connection, labelId, { name, ...(color === undefined ? {} : { color }), }); } if (color !== undefined) { - return labels.update(session, labelId, { color }); + return labels.update(connection, labelId, { color }); } throw new InputError("Provide a name or color."); } case "delete": - return labels.delete(session, text(body, "labelId")); + return labels.delete(connection, text(body, "labelId")); case "forChat": - return labels.listForChat(session, text(body, "chatId")); + return labels.listForChat(connection, text(body, "chatId")); case "replaceForChat": // Replaces the chat's complete label set. - return labels.replaceForChat(session, text(body, "chatId"), { + return labels.replaceForChat(connection, text(body, "chatId"), { labels: texts(body, "labels"), }); default: diff --git a/examples/full-platform/app/api/messaging/messages/route.ts b/examples/full-platform/app/api/messaging/messages/route.ts index 63b27c7ea..9f51a5f31 100644 --- a/examples/full-platform/app/api/messaging/messages/route.ts +++ b/examples/full-platform/app/api/messaging/messages/route.ts @@ -18,25 +18,25 @@ import { type Body, } from "../../../../lib/route.js"; -export const POST = route("agent", async ({ body, sessionOf, request }) => { +export const POST = route("agent", async ({ body, connectionOf, request }) => { const messages = messaging().messages; - const session = sessionOf(body); + const connection = connectionOf(body); const conversation = conversationOf(body); switch (action(body)) { case "send": - return messages.send(session, buildMessage(body, { conversation }), { + return messages.send(connection, buildMessage(body, { conversation }), { idempotencyKey: idempotencyKey(request), }); case "seen": - return messages.markSeen(session, { conversation, id: text(body, "id") }); + return messages.markSeen(connection, { conversation, id: text(body, "id") }); case "typing": - return messages.setTyping(session, { + return messages.setTyping(connection, { conversation, state: oneOf(body, "state", ["typing", "recording", "paused"]), }); case "react": return messages.react( - session, + connection, { conversation, id: text(body, "id"), @@ -46,7 +46,7 @@ export const POST = route("agent", async ({ body, sessionOf, request }) => { { idempotencyKey: idempotencyKey(request) }, ); case "star": - return messages.star(session, { + return messages.star(connection, { conversation, id: text(body, "id"), star: flag(body, "star"), diff --git a/examples/full-platform/app/api/messaging/observation-policies/route.ts b/examples/full-platform/app/api/messaging/observation-policies/route.ts index 864e044de..c53f47230 100644 --- a/examples/full-platform/app/api/messaging/observation-policies/route.ts +++ b/examples/full-platform/app/api/messaging/observation-policies/route.ts @@ -2,14 +2,14 @@ import { messaging } from "../../../../lib/polymorfa.js"; import { env } from "../../../../lib/env.js"; import { route } from "../../../../lib/route.js"; -// Effective presence, typing and label observation for the project and session. +// Effective presence, typing and label observation for the project and connection. export const GET = route("admin", async ({ url }) => { const policies = messaging().observationPolicies; - const [projectPolicy, sessionPolicy] = await Promise.all([ + const [projectPolicy, connectionPolicy] = await Promise.all([ policies.retrieveForProject(env.projectId()), - policies.retrieveForSession( - url.searchParams.get("session") ?? env.session(), + policies.retrieveForConnection( + url.searchParams.get("connection") ?? env.connection(), ), ]); - return { project: projectPolicy.data.data, session: sessionPolicy.data.data }; + return { project: projectPolicy.data.data, connection: connectionPolicy.data.data }; }); diff --git a/examples/full-platform/app/api/messaging/onboarding/route.ts b/examples/full-platform/app/api/messaging/onboarding/route.ts index c0a5f18c2..69fe3afca 100644 --- a/examples/full-platform/app/api/messaging/onboarding/route.ts +++ b/examples/full-platform/app/api/messaging/onboarding/route.ts @@ -26,7 +26,7 @@ export const POST = route("admin", async ({ body }) => { }); } case "historyFixture": - // Simulated history for testing sessions. Never use real content. + // Simulated history for testing connections. Never use real content. return messaging().testing.createHistoryFixture(env.projectId(), { messages: [ { @@ -46,7 +46,7 @@ export const POST = route("admin", async ({ body }) => { ], }); case "testingQuickLink": { - // A QuickLink that opens a simulated testing session. + // A QuickLink that opens a simulated testing connection. const response = await messaging().quickLinks.create({ configuration: { testing: { diff --git a/examples/full-platform/app/api/messaging/presence/route.ts b/examples/full-platform/app/api/messaging/presence/route.ts index b9cd58b60..b6c7063b4 100644 --- a/examples/full-platform/app/api/messaging/presence/route.ts +++ b/examples/full-platform/app/api/messaging/presence/route.ts @@ -7,23 +7,23 @@ import { unknownAction, } from "../../../../lib/route.js"; -export const GET = route("agent", ({ body, sessionOf }) => - messaging().presence.get(sessionOf(body)), +export const GET = route("agent", ({ body, connectionOf }) => + messaging().presence.get(connectionOf(body)), ); -export const POST = route("agent", async ({ body, sessionOf }) => { +export const POST = route("agent", async ({ body, connectionOf }) => { const presence = messaging().presence; - const session = sessionOf(body); + const connection = connectionOf(body); switch (action(body)) { case "set": - return presence.set(session, { + return presence.set(connection, { presence: oneOf(body, "presence", ["available", "unavailable"]), }); case "forChat": // Retained observations governed by the observation policy. - return presence.getForChat(session, text(body, "chatId")); + return presence.getForChat(connection, text(body, "chatId")); case "subscribe": - return presence.subscribe(session, text(body, "chatId")); + return presence.subscribe(connection, text(body, "chatId")); default: return unknownAction(action(body)); } diff --git a/examples/full-platform/app/api/messaging/privacy/route.ts b/examples/full-platform/app/api/messaging/privacy/route.ts index 9c81a30fe..59132d3b3 100644 --- a/examples/full-platform/app/api/messaging/privacy/route.ts +++ b/examples/full-platform/app/api/messaging/privacy/route.ts @@ -16,18 +16,18 @@ import { const TIMERS = { off: 0, "24h": 86400, "7d": 604800, "90d": 7776000 } as const; -export const GET = route("admin", ({ body, sessionOf }) => - messaging().privacy.get(sessionOf(body)), +export const GET = route("admin", ({ body, connectionOf }) => + messaging().privacy.get(connectionOf(body)), ); -export const POST = route("admin", async ({ body, sessionOf }) => { +export const POST = route("admin", async ({ body, connectionOf }) => { const privacy = messaging().privacy; - const session = sessionOf(body); + const connection = connectionOf(body); switch (action(body)) { case "set": - return privacy.set(session, mutation(body.setting, text(body, "value"))); + return privacy.set(connection, mutation(body.setting, text(body, "value"))); case "defaultTimer": - return privacy.setDefaultDisappearingTimer(session, { + return privacy.setDefaultDisappearingTimer(connection, { durationSeconds: TIMERS[oneOf(body, "timer", ["off", "24h", "7d", "90d"])], }); diff --git a/examples/full-platform/app/api/messaging/profile/route.ts b/examples/full-platform/app/api/messaging/profile/route.ts index a85b64927..9ff369dfa 100644 --- a/examples/full-platform/app/api/messaging/profile/route.ts +++ b/examples/full-platform/app/api/messaging/profile/route.ts @@ -1,22 +1,22 @@ import { messaging } from "../../../../lib/polymorfa.js"; import { action, route, text, unknownAction } from "../../../../lib/route.js"; -export const GET = route("agent", ({ body, sessionOf }) => - messaging().profile.get(sessionOf(body)), +export const GET = route("agent", ({ body, connectionOf }) => + messaging().profile.get(connectionOf(body)), ); -export const POST = route("admin", async ({ body, sessionOf }) => { +export const POST = route("admin", async ({ body, connectionOf }) => { const profile = messaging().profile; - const session = sessionOf(body); + const connection = connectionOf(body); switch (action(body)) { case "setName": - return profile.setName(session, { name: text(body, "name") }); + return profile.setName(connection, { name: text(body, "name") }); case "setStatus": - return profile.setStatus(session, { status: text(body, "status") }); + return profile.setStatus(connection, { status: text(body, "status") }); case "setPicture": - return profile.setPicture(session, { url: text(body, "url") }); + return profile.setPicture(connection, { url: text(body, "url") }); case "deletePicture": - return profile.deletePicture(session); + return profile.deletePicture(connection); default: return unknownAction(action(body)); } diff --git a/examples/full-platform/app/api/messaging/quick-replies/route.ts b/examples/full-platform/app/api/messaging/quick-replies/route.ts index a0f9f3428..5848e6523 100644 --- a/examples/full-platform/app/api/messaging/quick-replies/route.ts +++ b/examples/full-platform/app/api/messaging/quick-replies/route.ts @@ -7,24 +7,24 @@ import { type Body, } from "../../../../lib/route.js"; -export const GET = route("agent", ({ body, sessionOf }) => - messaging().quickReplies.list(sessionOf(body)), +export const GET = route("agent", ({ body, connectionOf }) => + messaging().quickReplies.list(connectionOf(body)), ); -export const POST = route("agent", async ({ body, sessionOf }) => { +export const POST = route("agent", async ({ body, connectionOf }) => { const quickReplies = messaging().quickReplies; - const session = sessionOf(body); + const connection = connectionOf(body); switch (action(body)) { case "create": - return quickReplies.create(session, reply(body)); + return quickReplies.create(connection, reply(body)); case "replace": return quickReplies.replace( - session, + connection, text(body, "quickReplyId"), reply(body), ); case "delete": - return quickReplies.delete(session, text(body, "quickReplyId")); + return quickReplies.delete(connection, text(body, "quickReplyId")); default: return unknownAction(action(body)); } diff --git a/examples/full-platform/app/api/messaging/quicklinks/route.ts b/examples/full-platform/app/api/messaging/quicklinks/route.ts index 8e423a688..428a00f93 100644 --- a/examples/full-platform/app/api/messaging/quicklinks/route.ts +++ b/examples/full-platform/app/api/messaging/quicklinks/route.ts @@ -28,8 +28,8 @@ export const POST = route("admin", async ({ body, request }) => { }, { idempotencyKey: idempotencyKey(request) }, ); - const { id, url, session, expiresAt } = response.data.data; - return { id, url, session, expiresAt }; + const { id, url, connection, expiresAt } = response.data.data; + return { id, url, connection, expiresAt }; } case "retrieve": return quickLinks.retrieve(text(body, "id")); diff --git a/examples/full-platform/app/api/messaging/templates/route.ts b/examples/full-platform/app/api/messaging/templates/route.ts index 8431e34e4..092b3f4a0 100644 --- a/examples/full-platform/app/api/messaging/templates/route.ts +++ b/examples/full-platform/app/api/messaging/templates/route.ts @@ -24,7 +24,7 @@ export const POST = route("admin", async ({ body }) => { }); case "submit": return templates.submit(slug, templateId, { - session: env.templateSession(), + connection: env.templateConnection(), }); case "delete": return templates.delete(slug, templateId); diff --git a/examples/full-platform/app/api/polymorfa/templates/route.ts b/examples/full-platform/app/api/polymorfa/templates/route.ts index 780bf98cc..3ab9e36c8 100644 --- a/examples/full-platform/app/api/polymorfa/templates/route.ts +++ b/examples/full-platform/app/api/polymorfa/templates/route.ts @@ -21,7 +21,7 @@ export function POST(request: Request): Promise { return operator?.role === "admin" ? { userId: operator.userId } : null; }, resolveProjectSlug: () => (demo ? "demo" : env.projectSlug()), - resolveSubmissionSession: () => (demo ? "demo" : env.templateSession()), + resolveSubmissionConnection: () => (demo ? "demo" : env.templateConnection()), }); } catch (error) { return Promise.resolve(errorResponse(error)); diff --git a/examples/full-platform/app/api/polymorfa/token/route.ts b/examples/full-platform/app/api/polymorfa/token/route.ts index a359a66a5..b3db9df6e 100644 --- a/examples/full-platform/app/api/polymorfa/token/route.ts +++ b/examples/full-platform/app/api/polymorfa/token/route.ts @@ -7,7 +7,7 @@ import { authenticate } from "../../../../lib/auth.js"; import { env, isDemoMode } from "../../../../lib/env.js"; import { messaging } from "../../../../lib/polymorfa.js"; -// Browser messaging token. The session's client rules decide what it can do +// Browser messaging token. The connection's client rules decide what it can do // (see /api/messaging/client-rules). export const POST = createClientTokenRoute({ authorize: async (request) => { @@ -20,7 +20,7 @@ export const POST = createClientTokenRoute({ createMessagingClientTokenMint({ clientTokens: messaging().clientTokens, resolve: () => ({ - session: env.session(), + connection: env.connection(), // One ephemeral id per operator keeps rate limits per person. ephemeralId: subject.userId, ttlSeconds: 300, diff --git a/examples/full-platform/lib/desk/data.ts b/examples/full-platform/lib/desk/data.ts index 158572cf8..7777fe22c 100644 --- a/examples/full-platform/lib/desk/data.ts +++ b/examples/full-platform/lib/desk/data.ts @@ -31,7 +31,7 @@ import type { MessagePage } from "./history.js"; export interface InboundMessage { readonly id: string; - readonly session: string; + readonly connection: string; readonly phone: string; readonly name?: string; readonly text: string; diff --git a/examples/full-platform/lib/desk/demo-fixtures.ts b/examples/full-platform/lib/desk/demo-fixtures.ts index 9f71d4db6..04c0dec8e 100644 --- a/examples/full-platform/lib/desk/demo-fixtures.ts +++ b/examples/full-platform/lib/desk/demo-fixtures.ts @@ -90,7 +90,7 @@ const FIXTURES: Readonly> = { slug: "acme-support", defaultTier: "standard", environment: "production", - sessionCount: 3, + connectionCount: 3, createdAt: iso(300 * DAY), }, { @@ -99,7 +99,7 @@ const FIXTURES: Readonly> = { slug: "sandbox", defaultTier: "free", environment: "sandbox", - sessionCount: 1, + connectionCount: 1, createdAt: iso(20 * DAY), }, ], @@ -113,7 +113,7 @@ const FIXTURES: Readonly> = { usage: { periodStart: iso(16 * DAY), messages: 25_564, - sessions: 3, + connections: 3, amount: "96.20", }, transactions: [ @@ -150,19 +150,19 @@ const FIXTURES: Readonly> = { { tier: "free", region: "global", - perSessionDay: "0.00", + perConnectionDay: "0.00", perMessage: "0.000", }, { tier: "standard", region: "north_america", - perSessionDay: "0.40", + perConnectionDay: "0.40", perMessage: "0.002", }, { tier: "pro", region: "north_america", - perSessionDay: "0.90", + perConnectionDay: "0.90", perMessage: "0.001", }, ], @@ -192,7 +192,7 @@ const FIXTURES: Readonly> = { }, { id: "aud_4", - action: "session.restarted", + action: "connection.restarted", actor: "priya@acme.test", target: "sales-us", createdAt: iso(0.2 * DAY), @@ -207,33 +207,33 @@ const FIXTURES: Readonly> = { detectedAt: iso(30 * DAY), }, ], - sessionBans: [ + connectionBans: [ { id: "ban_1", - session: "old-promo", + connection: "old-promo", reason: "spam_reports", status: "lifted", createdAt: iso(70 * DAY), }, ], - activeSessionBans: [], + activeConnectionBans: [], }, - "/api/admin/sessions": [ + "/api/admin/connections": [ { id: "ses_1", - sessionId: "support-main", + connectionId: "support-main", status: "connected", tierOverride: null, }, { id: "ses_2", - sessionId: "sales-us", + connectionId: "sales-us", status: "connected", tierOverride: "pro", }, { id: "ses_3", - sessionId: "billing-eu", + connectionId: "billing-eu", status: "disconnected", tierOverride: null, }, @@ -241,21 +241,21 @@ const FIXTURES: Readonly> = { "/api/admin/bansafe": { numbers: [ { - session: "support-main", + connection: "support-main", phoneNumber: "+14155550100", health: 94, band: "good", mostLikelyHealthState: "healthy", }, { - session: "sales-us", + connection: "sales-us", phoneNumber: "+14155550142", health: 71, band: "fair", mostLikelyHealthState: "healthy", }, { - session: "billing-eu", + connection: "billing-eu", phoneNumber: "+442071838750", health: 48, band: "poor", @@ -265,7 +265,7 @@ const FIXTURES: Readonly> = { findings: [ { id: "fnd_1", - session: "billing-eu", + connection: "billing-eu", severity: "critical", code: "block_rate_high", status: "open", @@ -285,7 +285,7 @@ const FIXTURES: Readonly> = { name: "Northwind Traders", externalCustomerId: "nw-001", status: "active", - numberCount: 2, + connectionCount: 2, createdAt: iso(100 * DAY), }, { @@ -293,7 +293,7 @@ const FIXTURES: Readonly> = { name: "Globex", externalCustomerId: "gx-17", status: "active", - numberCount: 1, + connectionCount: 1, createdAt: iso(45 * DAY), }, ], @@ -302,31 +302,31 @@ const FIXTURES: Readonly> = { { id: "evt_1", type: "message.received", - session: "support-main", + connection: "support-main", createdAt: iso(60 * 1000), }, { id: "evt_2", type: "message.ack", - session: "support-main", + connection: "support-main", createdAt: iso(90 * 1000), }, { id: "evt_3", - type: "session.status", - session: "billing-eu", + type: "connection.status", + connection: "billing-eu", createdAt: iso(26 * 60 * 60 * 1000), }, { id: "evt_4", type: "template.status", - session: null, + connection: null, createdAt: iso(5 * 60 * 60 * 1000), }, { id: "evt_5", type: "call.missed", - session: "support-main", + connection: "support-main", createdAt: iso(190 * 60 * 1000), }, ], @@ -342,7 +342,7 @@ const FIXTURES: Readonly> = { "message.received", "message.ack", "call.received", - "session.status", + "connection.status", ], createdAt: iso(40 * DAY), }, @@ -368,7 +368,7 @@ const FIXTURES: Readonly> = { ], }, "/api/admin/settings": { - sessionConfiguration: { + connectionConfiguration: { team: { observation: { presenceMode: "cache", typingMode: "events" }, historySync: { mode: "metadata_only" }, @@ -411,7 +411,7 @@ const FIXTURES: Readonly> = { { phone: "+14155550999", reason: "STOP keyword", createdAt: iso(5 * DAY) }, ], "/api/admin/campaigns": [], - "/api/messaging/sessions": [], + "/api/messaging/connections": [], "/api/messaging/inbox": { messages: [ { diff --git a/examples/full-platform/lib/desk/live.ts b/examples/full-platform/lib/desk/live.ts index ff71457bd..f6814517f 100644 --- a/examples/full-platform/lib/desk/live.ts +++ b/examples/full-platform/lib/desk/live.ts @@ -1,6 +1,6 @@ import type { MessageAttachment } from "@polymorfa/ui-kit"; import type { - PlatformSession, + PlatformConnection, ProjectTemplate, SendMessageRequest, } from "@polymorfa/sdk"; @@ -44,7 +44,7 @@ import { const COLORS = ["#10b981", "#6366f1", "#f59e0b", "#ec4899", "#0ea5e9"]; /** - * Data layer backed by the Polymorfa SDK. WhatsApp resources (sessions, + * Data layer backed by the Polymorfa SDK. WhatsApp resources (connections, * labels, quick replies, contacts, templates, campaigns, presence, sends) go * to the Messaging API. Tickets are this app's own records: they live in a * process-local store fed by webhooks and sends, standing in for your database. @@ -64,8 +64,8 @@ export class PolymorfaDesk implements DeskData { } } - get #session(): string { - return env.session(); + get #connection(): string { + return env.connection(); } async bootstrap(operator: Operator): Promise { @@ -89,7 +89,7 @@ export class PolymorfaDesk implements DeskData { /** Records an inbound WhatsApp message (called from the webhook handler). */ ingestInbound(input: InboundMessage): void { const contact = this.#store.ensureContact(input.phone, input.name); - const ticket = this.#store.openTicket(contact, input.session); + const ticket = this.#store.openTicket(contact, input.connection); this.#store.upsert({ id: input.id, ticketId: ticket.id, @@ -121,15 +121,15 @@ export class PolymorfaDesk implements DeskData { "Enter the number in E.164 format, like +14155550123.", ); } - const session = input.connectionId ?? this.#session; + const connection = input.connectionId ?? this.#connection; // Confirm the number is on WhatsApp before opening a ticket. - const checked = await messaging().contacts.check(session, input.phone); + const checked = await messaging().contacts.check(connection, input.phone); if (!checked.data.data.some((result) => result.exists)) { throw new InputError("This number is not on WhatsApp."); } const contact = this.#store.ensureContact(input.phone); const agent = this.#store.agentFor(operator); - return this.#store.openTicket(contact, session, { assigneeId: agent.id }); + return this.#store.openTicket(contact, connection, { assigneeId: agent.id }); } async updateTicket( @@ -263,7 +263,7 @@ export class PolymorfaDesk implements DeskData { } async listContacts(search?: string): Promise { - const response = await messaging().contacts.list(this.#session); + const response = await messaging().contacts.list(this.#connection); for (const contact of response.data.data) { if (contact.phoneNumber === undefined) continue; const known = this.#store.ensureContact( @@ -288,13 +288,13 @@ export class PolymorfaDesk implements DeskData { if (patch.blocked !== undefined && patch.blocked !== contact.blocked) { await (patch.blocked ? contacts.block : contacts.unblock).call( contacts, - this.#session, + this.#connection, contact.phone, ); } if (patch.tags !== undefined) { // Labels are WhatsApp Business chat labels; replace the chat's full set. - await messaging().labels.replaceForChat(this.#session, contact.phone, { + await messaging().labels.replaceForChat(this.#connection, contact.phone, { labels: patch.tags, }); } @@ -305,7 +305,7 @@ export class PolymorfaDesk implements DeskData { const valid = rows.filter((row) => isE164(row.phone)); if (valid.length === 0) return { imported: 0, skipped: rows.length }; const checked = await messaging().contacts.check( - this.#session, + this.#connection, valid.map((row) => row.phone), ); const onWhatsApp = new Set( @@ -330,7 +330,7 @@ export class PolymorfaDesk implements DeskData { } async listQuickReplies(): Promise { - const response = await messaging().quickReplies.list(this.#session); + const response = await messaging().quickReplies.list(this.#connection); return response.data.data.quickReplies.map(({ id, shortcut, message }) => ({ id, shortcut, @@ -347,18 +347,18 @@ export class PolymorfaDesk implements DeskData { const quickReplies = messaging().quickReplies; const response = input.id === undefined - ? await quickReplies.create(this.#session, body) - : await quickReplies.replace(this.#session, input.id, body); + ? await quickReplies.create(this.#connection, body) + : await quickReplies.replace(this.#connection, input.id, body); const { id, shortcut, message } = response.data.data; return { id, shortcut, message }; } async deleteQuickReply(id: string) { - await messaging().quickReplies.delete(this.#session, id); + await messaging().quickReplies.delete(this.#connection, id); } async listTags(): Promise { - const response = await messaging().labels.list(this.#session); + const response = await messaging().labels.list(this.#connection); const data = response.data.data; const labels = "labels" in data ? data.labels : data; return labels.map((label) => ({ @@ -372,13 +372,13 @@ export class PolymorfaDesk implements DeskData { async saveTag(input: { id?: string; name: string; color: number }) { const labels = messaging().labels; if (input.id === undefined) { - const created = await labels.create(this.#session, { + const created = await labels.create(this.#connection, { name: input.name, color: input.color, }); return { ...created.data.data, chatCount: 0 }; } - await labels.update(this.#session, input.id, { + await labels.update(this.#connection, input.id, { name: input.name, color: input.color, }); @@ -386,15 +386,15 @@ export class PolymorfaDesk implements DeskData { } async deleteTag(id: string) { - await messaging().labels.delete(this.#session, id); + await messaging().labels.delete(this.#connection, id); } async listConnections(): Promise { - const response = await messaging().sessions.list(); - const sessions = response.data.data; + const response = await messaging().connections.list(); + const connections = response.data.data; const health = await this.#health(); - return sessions.map((session, index) => - toConnection(session, index, health.get(session.name)), + return connections.map((connection, index) => + toConnection(connection, index, health.get(connection.name)), ); } @@ -408,7 +408,7 @@ export class PolymorfaDesk implements DeskData { limit: 100, }); for (const number of page.data.data) - scores.set(number.session, number.health); + scores.set(number.connection, number.health); } catch (error) { console.warn("BanSafe health unavailable", error); } @@ -420,26 +420,26 @@ export class PolymorfaDesk implements DeskData { action: ConnectionAction, phone?: string, ): Promise>> { - const sessions = messaging().sessions; + const connections = messaging().connections; switch (action) { case "restart": - return { ...(await sessions.restart(connectionId)).data }; + return { ...(await connections.restart(connectionId)).data }; case "logout": - return { ...(await sessions.logout(connectionId)).data }; + return { ...(await connections.logout(connectionId)).data }; case "delete": - return { ...(await sessions.delete(connectionId)).data }; + return { ...(await connections.delete(connectionId)).data }; case "start": - return { ...(await sessions.start(connectionId)).data }; + return { ...(await connections.start(connectionId)).data }; case "stop": - return { ...(await sessions.stop(connectionId)).data }; + return { ...(await connections.stop(connectionId)).data }; case "qr": - return { ...(await sessions.qr(connectionId)).data.data }; + return { ...(await connections.qr(connectionId)).data.data }; case "pairingCode": if (phone === undefined || !isE164(phone)) { throw new InputError("Enter the phone number in E.164 format."); } return { - ...(await sessions.requestPairingCode(connectionId, { phone })).data + ...(await connections.requestPairingCode(connectionId, { phone })).data .data, }; } @@ -691,23 +691,23 @@ function toSendRequest( } function toConnection( - session: PlatformSession, + connection: PlatformConnection, index: number, health: number | null | undefined, ): Connection { - const score = health ?? (session.status === "connected" ? 90 : 50); + const score = health ?? (connection.status === "connected" ? 90 : 50); const level: HealthLevel = score >= 80 ? "healthy" : score >= 60 ? "watch" : "at_risk"; return { - id: session.name, - name: session.name, - phone: session.phone, - platform: session.platform, - isBusiness: session.isBusiness, - status: session.status, + id: connection.name, + name: connection.name, + phone: connection.phone, + platform: connection.platform, + isBusiness: connection.isBusiness, + status: connection.status, color: COLORS[index % COLORS.length] ?? "#10b981", - messageCount: session.messageCount, - lastActiveAt: session.lastActiveAt, + messageCount: connection.messageCount, + lastActiveAt: connection.lastActiveAt, health: { score, level }, }; } diff --git a/examples/full-platform/lib/desk/mock.ts b/examples/full-platform/lib/desk/mock.ts index f17aecf36..b7c24c890 100644 --- a/examples/full-platform/lib/desk/mock.ts +++ b/examples/full-platform/lib/desk/mock.ts @@ -301,7 +301,7 @@ export class MockDesk implements DeskData { ...current, status: "connected", }); - emitWebhook("session.status", connectionId, { status: "connected" }); + emitWebhook("connection.status", connectionId, { status: "connected" }); }, 2000); return { status: "connecting" }; } diff --git a/examples/full-platform/lib/desk/types.ts b/examples/full-platform/lib/desk/types.ts index 7b395f871..f6eddb109 100644 --- a/examples/full-platform/lib/desk/types.ts +++ b/examples/full-platform/lib/desk/types.ts @@ -35,7 +35,7 @@ export interface Tag { export type HealthLevel = "healthy" | "watch" | "at_risk"; export interface Connection { - /** Session name used in Messaging API paths. */ + /** Connection name used in Messaging API paths. */ readonly id: string; readonly name: string; readonly phone: string | null; diff --git a/examples/full-platform/lib/env.ts b/examples/full-platform/lib/env.ts index 75608434b..c203b3718 100644 --- a/examples/full-platform/lib/env.ts +++ b/examples/full-platform/lib/env.ts @@ -18,14 +18,14 @@ export const env = { teamApiKey: () => requiredEnv("POLYMORFA_TEAM_API_KEY"), projectId: () => requiredEnv("POLYMORFA_PROJECT_ID"), projectSlug: () => requiredEnv("POLYMORFA_PROJECT_SLUG"), - session: () => requiredEnv("POLYMORFA_SESSION"), - templateSession: () => requiredEnv("POLYMORFA_TEMPLATE_SESSION"), + connection: () => requiredEnv("POLYMORFA_CONNECTION"), + templateConnection: () => requiredEnv("POLYMORFA_TEMPLATE_CONNECTION"), webhookSecret: () => requiredEnv("POLYMORFA_WEBHOOK_SECRET"), messagingWebhookSecret: () => requiredEnv("POLYMORFA_MESSAGING_WEBHOOK_SECRET"), - /** Extra sessions agents may address; the default session is always allowed. */ - agentSessions: () => - (optionalEnv("POLYMORFA_AGENT_SESSIONS") ?? "") + /** Extra connections agents may address; the default connection is always allowed. */ + agentConnections: () => + (optionalEnv("POLYMORFA_AGENT_CONNECTIONS") ?? "") .split(",") .map((name) => name.trim()) .filter((name) => name.length > 0), diff --git a/examples/full-platform/lib/polymorfa.ts b/examples/full-platform/lib/polymorfa.ts index 7a3801c49..3093e2b96 100644 --- a/examples/full-platform/lib/polymorfa.ts +++ b/examples/full-platform/lib/polymorfa.ts @@ -24,7 +24,7 @@ function shared(): SharedClientOptions { }; } -/** Project-scoped Messaging API client (sessions, messages, templates, calls, ...). */ +/** Project-scoped Messaging API client (connections, messages, templates, calls, ...). */ export function messaging(): MessagingClient { assertServerRuntime(); messagingClient ??= new MessagingClient({ diff --git a/examples/full-platform/lib/realtime.ts b/examples/full-platform/lib/realtime.ts index 92aba6ed8..e08876153 100644 --- a/examples/full-platform/lib/realtime.ts +++ b/examples/full-platform/lib/realtime.ts @@ -64,12 +64,12 @@ export function publish(event: RealtimeEvent): void { /** Builds and publishes an app event in the webhook envelope. */ export function emit( event: K, - session: string, + connection: string, payload: AppEventPayloads[K], ): void { publish({ id: `evt_${crypto.randomUUID()}`, - session, + connection, timestamp: new Date().toISOString(), event, payload, @@ -79,12 +79,12 @@ export function emit( /** Publishes a webhook-shaped event that the app synthesizes, e.g. in demo mode. */ export function emitWebhook( event: K, - session: string, + connection: string, payload: WebhookPayloadMap[K], ): void { publish({ id: `evt_${crypto.randomUUID()}`, - session, + connection, timestamp: new Date().toISOString(), event, payload, diff --git a/examples/full-platform/lib/route.ts b/examples/full-platform/lib/route.ts index 39e91634d..fbca6bfee 100644 --- a/examples/full-platform/lib/route.ts +++ b/examples/full-platform/lib/route.ts @@ -30,10 +30,10 @@ export interface RouteContext { readonly body: Body; readonly url: URL; /** - * The session this operator may address: the body's `session` field (the - * `?session=` query for GET), or the default session. + * The connection this operator may address: the body's `connection` field (the + * `?connection=` query for GET), or the default connection. */ - readonly sessionOf: (body: Body) => string; + readonly connectionOf: (body: Body) => string; } const privateHeaders = { "Cache-Control": "no-store, private" }; @@ -54,8 +54,8 @@ export function route( if (role === "admin" && operator.role !== "admin") { return problem(403, "forbidden"); } - // GET reads take the session from `?session=`, checked by `sessionOf` - // exactly like a mutation's `session` field. + // GET reads take the connection from `?connection=`, checked by `connectionOf` + // exactly like a mutation's `connection` field. const body = request.method === "GET" ? queryBody(request) : await readBody(request); // Without credentials, SDK routes answer with sample data so the UI @@ -77,7 +77,7 @@ export function route( operator, body, url: new URL(request.url), - sessionOf: (input) => sessionOf(input, operator.role), + connectionOf: (input) => connectionOf(input, operator.role), }); if (result instanceof Response) return result; return Response.json(unwrap(result), { headers: privateHeaders }); @@ -121,8 +121,8 @@ function isApiResponse(value: unknown): value is ApiResponse { } function queryBody(request: Request): Body { - const session = new URL(request.url).searchParams.get("session"); - return session === null ? {} : { session }; + const connection = new URL(request.url).searchParams.get("connection"); + return connection === null ? {} : { connection }; } async function readBody(request: Request): Promise { @@ -281,17 +281,17 @@ export function idempotencyKey(request: Request): string { } /** - * Agents may only address the default session or one listed in - * POLYMORFA_AGENT_SESSIONS; admins may address any session. + * Agents may only address the default connection or one listed in + * POLYMORFA_AGENT_CONNECTIONS; admins may address any connection. */ -function sessionOf(body: Body, role: Role): string { - const requested = optionalText(body, "session"); - const fallback = env.session(); +function connectionOf(body: Body, role: Role): string { + const requested = optionalText(body, "connection"); + const fallback = env.connection(); if (requested === undefined || requested === fallback) return fallback; - if (role === "admin" || env.agentSessions().includes(requested)) { + if (role === "admin" || env.agentConnections().includes(requested)) { return requested; } - throw new InputError("session is not available to this operator."); + throw new InputError("connection is not available to this operator."); } /** Accepts `{ chat: { phoneNumber } }`, `{ chat: { id } }` or `{ chat: { bsuid } }`. */ diff --git a/examples/full-platform/lib/webhooks.ts b/examples/full-platform/lib/webhooks.ts index 0b4e67c7c..88fb88c6a 100644 --- a/examples/full-platform/lib/webhooks.ts +++ b/examples/full-platform/lib/webhooks.ts @@ -20,9 +20,9 @@ export const WEBHOOK_EVENTS = [ "call.received", "call.ended", "call.missed", - "session.status", - "session.connected", - "session.logged_out", + "connection.status", + "connection.connected", + "connection.logged_out", "template.status", "campaign.completed", "bansafe.incident", @@ -78,24 +78,24 @@ function handle(event: WebhookEvent): void { // Browsers get the verified event unchanged, in the same envelope. publish(event); if (isEvent(event, "message.received")) { - receiveMessage(event.payload, event.session); + receiveMessage(event.payload, event.connection); } else if (isEvent(event, "message.ack")) { for (const message of event.payload.messages) { console.info("ack", message.id); } - } else if (isEvent(event, "session.connected")) { - console.info("connected", event.session, event.payload.accountType); - } else if (isEvent(event, "session.logged_out")) { - console.warn("logged out", event.session, event.payload.reason); + } else if (isEvent(event, "connection.connected")) { + console.info("connected", event.connection, event.payload.accountType); + } else if (isEvent(event, "connection.logged_out")) { + console.warn("logged out", event.connection, event.payload.reason); } else if (isEvent(event, "campaign.completed")) { console.info("campaign completed", event.payload.campaignId); } else if (isEvent(event, "bansafe.incident")) { - console.warn("BanSafe incident", event.session, event.payload.kind); + console.warn("BanSafe incident", event.connection, event.payload.kind); } else if ( !isEvent(event, "call.received") && !isEvent(event, "call.ended") && !isEvent(event, "call.missed") && - !isEvent(event, "session.status") && + !isEvent(event, "connection.status") && !isEvent(event, "template.status") && !isEvent(event, "customer.created") ) { @@ -106,7 +106,7 @@ function handle(event: WebhookEvent): void { function receiveMessage( payload: MessageReceivedPayload, - session: string | undefined, + connection: string | undefined, ): void { const chat = payload.conversation.phoneNumber ?? payload.conversation.id; const linked = isLinkedDevice(payload) ? payload : undefined; @@ -115,12 +115,12 @@ function receiveMessage( const createdAt = toMilliseconds(payload.timestamp); const phone = payload.conversation.phoneNumber; // Customer messages open or update a help-desk ticket. - if (linked?.fromMe !== true && phone !== undefined && session !== undefined) { + if (linked?.fromMe !== true && phone !== undefined && connection !== undefined) { void desk() .then((data) => { data.ingestInbound?.({ id: payload.id, - session, + connection, phone, text: body ?? "", kind: kindOf(payload.type), @@ -129,12 +129,12 @@ function receiveMessage( }) .catch((error: unknown) => console.error("ticket ingest failed", error)); } - // The inbox reads and replies through POLYMORFA_SESSION, so only that - // session's messages go there; tickets above keep their own session. - if (session === undefined || session !== optionalEnv("POLYMORFA_SESSION")) { + // The inbox reads and replies through POLYMORFA_CONNECTION, so only that + // connection's messages go there; tickets above keep their own connection. + if (connection === undefined || connection !== optionalEnv("POLYMORFA_CONNECTION")) { return; } - emit("inbox.message", session, { + emit("inbox.message", connection, { chat, message: { id: payload.id, diff --git a/examples/full-platform/ui/app.tsx b/examples/full-platform/ui/app.tsx index fb88a9522..2cfdd8328 100644 --- a/examples/full-platform/ui/app.tsx +++ b/examples/full-platform/ui/app.tsx @@ -32,20 +32,20 @@ import { TicketsPage } from "./tickets/tickets-page.js"; function CallsProvider({ children }: { readonly children: ReactNode }) { const { bootstrap } = useDesk(); const [calls, setCalls] = useState(null); - const session = bootstrap.connections[0]?.id ?? ""; + const connection = bootstrap.connections[0]?.id ?? ""; useEffect(() => { // Calls need browser media APIs, so create them after mount. - if (!bootstrap.me.demo && session === "") { + if (!bootstrap.me.demo && connection === "") { setCalls(null); return; } - const created = createDeskCalls({ demo: bootstrap.me.demo, session }); + const created = createDeskCalls({ demo: bootstrap.me.demo, connection }); setCalls(created); return () => { setCalls((current) => (current === created ? null : current)); created.dispose(); }; - }, [bootstrap.me.demo, session]); + }, [bootstrap.me.demo, connection]); const names = useMemo( () => diff --git a/examples/full-platform/ui/calls.ts b/examples/full-platform/ui/calls.ts index 11d67040f..f9076cad7 100644 --- a/examples/full-platform/ui/calls.ts +++ b/examples/full-platform/ui/calls.ts @@ -25,9 +25,9 @@ export interface DeskCalls { * Real calling. The client token from /api/messaging/calls/token is the only * credential; the lifecycle stream delivers incoming calls and their answers. */ -function createLiveCalls(session: string): DeskCalls { +function createLiveCalls(connection: string): DeskCalls { const calls = createBrowserCalls({ - session, + connection, getClientToken: createClientTokenProvider({ path: "/api/messaging/calls/token", }), @@ -50,7 +50,7 @@ function createLiveCalls(session: string): DeskCalls { /** * Demo calling: a backend that rings, connects and hangs up on timers, and - * media sessions with empty streams, so the call UI runs without a network. + * media connections with empty streams, so the call UI runs without a network. */ function createDemoCalls(): DeskCalls { const listeners = new Set<(event: CallLifecycleEvent) => void>(); @@ -140,7 +140,7 @@ function createDemoCalls(): DeskCalls { export function createDeskCalls(options: { readonly demo: boolean; - readonly session: string; + readonly connection: string; }): DeskCalls { - return options.demo ? createDemoCalls() : createLiveCalls(options.session); + return options.demo ? createDemoCalls() : createLiveCalls(options.connection); } diff --git a/examples/full-platform/ui/pages/admin.tsx b/examples/full-platform/ui/pages/admin.tsx index d1bd9380b..807bf8f0c 100644 --- a/examples/full-platform/ui/pages/admin.tsx +++ b/examples/full-platform/ui/pages/admin.tsx @@ -150,7 +150,7 @@ function Table({ caption={caption} rows={rows} rowKey={(row) => - String(row.id ?? row.session ?? row.phone ?? JSON.stringify(row)) + String(row.id ?? row.connection ?? row.phone ?? JSON.stringify(row)) } empty="Nothing to show." columns={[ @@ -278,7 +278,7 @@ const TABS: readonly { id: string; label: string; icon: IconName }[] = [ { id: "bansafe", label: "BanSafe", icon: "alert" }, { id: "customers", label: "Customers", icon: "contacts" }, { id: "audiences", label: "Audiences", icon: "campaigns" }, - { id: "settings", label: "Session settings", icon: "settings" }, + { id: "settings", label: "Connection settings", icon: "settings" }, { id: "platform", label: "Platform", icon: "globe" }, { id: "messaging", label: "Messaging API", icon: "code" }, ]; @@ -419,7 +419,7 @@ function Panel({ tab }: { readonly tab: string }) { @@ -465,11 +465,11 @@ function Panel({ tab }: { readonly tab: string }) { } /> - +
@@ -605,7 +605,7 @@ function Panel({ tab }: { readonly tab: string }) {
)} @@ -621,7 +621,7 @@ function Panel({ tab }: { readonly tab: string }) { caption="Number health" rows={rowsOf(field(data, "numbers"))} keys={[ - "session", + "connection", "phoneNumber", "health", "band", @@ -633,7 +633,7 @@ function Panel({ tab }: { readonly tab: string }) {
@@ -652,7 +652,7 @@ function Panel({ tab }: { readonly tab: string }) { "name", "externalCustomerId", "status", - "numberCount", + "connectionCount", "createdAt", ]} /> @@ -691,12 +691,12 @@ function Panel({ tab }: { readonly tab: string }) { return (
{(data, reload) => { - const config = field(data, "sessionConfiguration") as + const config = field(data, "connectionConfiguration") as Row | undefined; const quick = field(data, "quickLinkSettings") as Row | undefined; return (
- +
Team
@@ -803,7 +803,7 @@ function Panel({ tab }: { readonly tab: string }) { } >

- Browser tokens can only do what the session's client rules + Browser tokens can only do what the connection's client rules allow: sending messages and placing, answering and signaling calls from this app's origin.

diff --git a/examples/full-platform/ui/pages/connections.tsx b/examples/full-platform/ui/pages/connections.tsx index 4cd575f44..c8a7f13ea 100644 --- a/examples/full-platform/ui/pages/connections.tsx +++ b/examples/full-platform/ui/pages/connections.tsx @@ -80,7 +80,7 @@ function PairModal({ const result = await callApi>>( "/api/desk/connections", { - action: "session", + action: "connection", connectionId: connection.id, operation, ...(operation === "pairingCode" @@ -106,7 +106,7 @@ function PairModal({ return ( @@ -199,10 +199,10 @@ export function ConnectionsPage() { const { reload, setData } = connections; useLiveEvents({ - "session.status": (event) => + "connection.status": (event) => setData((current) => current?.map((connection) => - connection.id === event.session && "status" in event.payload + connection.id === event.connection && "status" in event.payload ? { ...connection, status: event.payload.status } : connection, ), @@ -226,7 +226,7 @@ export function ConnectionsPage() { setBusy(`${connection.id}:${operation}`); try { await callApi("/api/desk/connections", { - action: "session", + action: "connection", connectionId: connection.id, operation, }); diff --git a/examples/full-platform/ui/pages/login.tsx b/examples/full-platform/ui/pages/login.tsx index 2fb59d5a8..140adb3a6 100644 --- a/examples/full-platform/ui/pages/login.tsx +++ b/examples/full-platform/ui/pages/login.tsx @@ -42,7 +42,7 @@ export function LoginPage({ error }: { readonly error?: string }) { Admin - Everything, including sessions and billing + Everything, including connections and billing
diff --git a/examples/full-platform/ui/pages/settings.tsx b/examples/full-platform/ui/pages/settings.tsx index 9d717bff9..44b99af97 100644 --- a/examples/full-platform/ui/pages/settings.tsx +++ b/examples/full-platform/ui/pages/settings.tsx @@ -46,7 +46,8 @@ function ConnectionSettings() { ); const [busy, setBusy] = useState(false); const project = (( - settings.data?.connectionConfiguration as Record | undefined + settings.data?.connectionConfiguration as + Record | undefined )?.project ?? {}) as { revision?: number; data?: { revision?: number } }; const revision = project.revision ?? project.data?.revision ?? 0; @@ -76,8 +77,8 @@ function ConnectionSettings() {

- Controls what WhatsApp history the connection shares with this app when a - phone links. + Controls what WhatsApp history the connection shares with this app + when a phone links.

- Applies to {bootstrap.connections[0]?.name ?? "the default connection"}{" "} - · revision {revision} + Applies to{" "} + {bootstrap.connections[0]?.name ?? "the default connection"} · + revision {revision}