Optional opts: { Optional fetchOverride the global fetch (inject a mock in tests).
Optional init: RequestInitOptional init: RequestInitOptional retryConnection retry tuning (see BaseChannelAdapter).
Optional nonceHow long the nonce of an accepted callback is remembered, in milliseconds. Default: 24 hours.
Optional maxHow many nonces are remembered at once; past it the oldest is forgotten first. Default: 10,000.
Initialize the adapter with auth credentials. If already connected this will shut down the existing connection first (idempotent).
Get the current connection status and metadata.
Send a message to a conversation on the external platform.
Platform-native conversation/chat ID.
Message content to send.
The platform-assigned message ID.
Register an event handler. Returns an unsubscribe function.
Optional eventTypes: ChannelEventType[]Protected emitEmit an event to all matching subscribers. Subclasses call this when the platform SDK receives an inbound event.
Protected emitConvenience helper: emit a connection_change event with the current
status. Called automatically by setStatus.
Protected hasCheck whether this adapter declares a specific capability.
Protected setTransition to a new connection status and emit an event.
Optional error: stringProtected doEstablish the platform connection using the supplied credentials.
Called by initialize after state has been set to connecting.
Must throw on failure — the base class handles retry and state changes.
Protected doDeliver a message to the external platform.
Called by sendMessage only when the adapter is connected.
Protected doRelease platform resources (close WebSocket, stop polling, etc.).
Called by shutdown before the state transitions to disconnected.
Handle an inbound Plivo SMS webhook. The host forwards Plivo's request here.
When signature verification is enabled (the default), the request must carry a valid Plivo signature over the URL Plivo requested, and each callback is accepted once: a request whose nonce was already accepted is dropped. Anything else is dropped as well (fail closed).
What a valid signature proves depends on its family:
From,
Text and MessageUUID are the ones Plivo sent.From, Text or MessageUUID: whoever holds one callback's signature
and nonce can send them again over a different body. Plivo's messaging
documentation describes V2 for message callbacks.The nonce memory narrows that replay; it does not end it. It holds the
callbacks this process accepted, for nonceTtlMs (24 hours by default)
and maxNonces of them at most, and a restart empties it. Plivo's
signatures carry no timestamp, so a callback sent again after its nonce is
forgotten, or one this process never accepted, is accepted. Do not let an
inbound message authorize an action by its sender number alone.
Parsed form body of Plivo's inbound-message POST. For a GET
callback the params are read from the query string of meta.url, whose
values win over body.
Optional meta: { Request metadata needed to verify the signature.
Optional method?: stringOptional url?: stringThe exact externally-visible URL Plivo requested (must byte-match); for a GET callback, with its query string.
Optional headers?: Record<string, undefined | string | string[]>Protected statusProtected connectedProtected errorProtected platformProtected authStored auth config so reconnect() can re-use it.
Protected Readonly retryReadonly platformPlatform this adapter serves.
Readonly displayHuman-readable display name (e.g., "WhatsApp Business").
Readonly capabilitiesDeclared capabilities of this adapter.
Channel adapter for SMS backed by Plivo.
Capabilities: text. (MMS media is out of scope for this adapter.)