Changelog
Release history for @opencoredev/sms-sdk.
This page summarizes CHANGELOG.md in the repository, which is the canonical record.
Unreleased
sms.getMessage(providerId, { adapter?, signal? })looks a message up with the provider and returns its delivery, orundefinedwhen the provider has no such message. Failures throwMessageLookupError(retrySafe: false). Every built-in adapter implements the new optionalSmsAdapter.getMessage; Vonage reads the Reports API and needsreportsCredentialswith JWT auth.capabilities()reportsmessageLookup.parseSmsWebhooks()returns every event in a request: each element of a Bandwidth callback and each Sinchrecipient_delivery_reportentry.parseSmsWebhook()now throwsWebhookPayloadErrorfor a multi-event payload instead of returning only the first Sinch report. Bandwidth status callbacks include the recipient indedupeKey(bandwidth:{messageId}:{to}:{type}).fromByAdapteronsend()input sets a sender per adapter, for fallback chains.- Suppression lists:
SuppressionList,memorySuppressionList(),suppressionPolicy()forbeforeSend, andapplySuppressionEvent()for STOP and START webhooks. See STOP, HELP, and opt-outs. - Keyword events (
recipient.opted_out,recipient.opted_in,recipient.help) carrymediaUrls. createSmsClientrejectsidempotency.ttlSecandstaleReservationSecthat are not whole numbers of seconds of at least 1 (attlSecof 0 let a repeated key send twice),timeoutMsabove2147483647, malformedidempotency/retryobjects,retry.maxAttemptsoutside 1 to 10, and retry delays outside 0 to2147483647.send()throwsConfigurationErrorifidempotency.store.reserve()throws or returns a malformed record/result, andmemory(),memory().enqueue(), and the suppression helpers throwConfigurationErrorfor malformed inputs. Sinchexpire_atnow anchors tosendAtwhen bothsendAtandvalidityPeriodSecare set.validate()returns issues instead of throwing for malformed runtime input (a non-object message, a non-arraymediaUrls, a non-stringidempotencyKey), andsend()throwsInvalidMessageErrorfor it.createSmsClient, all adapter factories (twilio,telnyx,plivo,vonage,bandwidth,sinch),send(),getMessage(), and the webhook parsers and verify helpers throwConfigurationErrorfor missing or malformed options, malformed adapters (includingcapabilities.senderTypes,capabilities.validityPeriod, andproviderOptionsspecs), invalidfallback/hooks/beforeSend, invalid or non-http(s)baseUrl(including credentials, query, fragment, or Unicode whitespace/control characters) orpublicUrl(including credentials, bare?, fragment, or Unicode whitespace/control characters; non-empty query strings remain supported), invalid Vonageregion, non-functionfetchornow, spoofed or non-AbortSignalsignal, dot-segmentproviderId("."or".."), missing/malformed/locked webhookrequest, unsupported webhookprovider, empty Basic/HMAC/verify-helper secrets, invalid or non-http(s) URLs in Twilio/Plivo verify/compute helpers, unknown Sinch webhookcredentials.kind, non-Latin-1 Basic credentials, and invalidtoleranceSec(NaN, non-finite, negative, or non-number).MessageLookupError#toJSON(),WebhookSignatureError#toJSON(),WebhookPayloadError#toJSON(), andHandoffUnknownError#toJSON()includeproviderNameandreasonwhen present.SinchWebhookVerificationis exported from@opencoredev/sms-sdk/webhooks. Twilio error code30007maps tofiltered, SinchRejecteddelivery status maps toundeliveredunless the error code is40003(filtered), and each Sinchrecipient_delivery_reportevent takesoccurredAtfrom that report’sat.- Plivo
rejectedstatus maps toundeliveredin webhooks andgetMessage(), and placeholderErrorCode/error_code000is omitted. beforeSendfails closed withPolicyRejectedErroron malformed or unrecognized decisions without stranding idempotency reservations, and throwing insidebeforeSendnow emitsonFailure. An unexpected internal failure keeps the attempts already made.unsafeSkipVerificationthrowsConfigurationErrorwhenNODE_ENVisproduction.- Provider responses and inbound webhook request bodies are read up to 1 MiB; an oversized provider response is an unknown outcome, an oversized webhook body throws
WebhookPayloadError(reason: "body_too_large") before signature verification, and an aborted or unreadable webhook body stream throwsWebhookPayloadError(reason: "body_unreadable"). - Every subpath export has a
defaultcondition besideimport. The package stays ESM only. send(),validate(),createSmsClient(), adapter factories, and webhook parsers snapshot caller-supplied inputs and options upfront (preserving class-instancehooks,fromByAdapter, and factory/sender getters), deep-freeze exported capability constants andcapabilities()/defaultFromcopies, validateDateandRegExpbrand slots, require plain objects forproviderOptionsentries andextra, trim only HTTP OWS aroundtrustProxyheaders, and treat non-stringverifyTelnyxSignature/verifySinchSignatureinputs as invalid signatures.- Provider error details (
error.provider.code,error.provider.requestId) and serializedproviderNamefields keep compact structural tokens and opaque hex IDs while dropping free-form text, credential-shaped tokens, and phone-length digit runs (in-memoryerror.providerNamekeeps the registered adapter name, andSmsError#toJSON()clonesattemptsandprovider). - Concurrent same-key
send()calls coalesce synchronously with per-caller result andAbortSignalisolation;SendAbortedErrorandHandoffUnknownErrorpreserve each caller’ssignal.reasonascause. Retry-Afterheader parsing enforces strict RFC 9110 delta-seconds and calendar-exact HTTP-dates (IMF-fixdate, RFC 850 with the 50-year rule, and asctime), Sinch rejects overflowingsendAt + validityPeriodSectimestamps during validation, and overflowingRetry-Aftervalues stop retrying instead of falling back to backoff.
0.1.1
- The docs site is the package homepage, and the package README has the SMS SDK banner with its Contributing and Examples links pointing at GitHub.
- README: why Bandwidth and Sinch are partial, and which providers have signed webhook request builders.
0.1.0
First public version.
providerOptionsonsend()input: typed per-adapter provider parameters plus an unvalidatedextrapassthrough. Unknown keys, wrong types, and parameters the SDK sets throw before any request. Each entry applies only to its own adapter, is listed invalidate().providerOptionsFor, and is part of the idempotency fingerprint. Adapters declare options withSmsAdapter.providerOptionsand receive them asAdapterMessage.providerFields.createSmsClientwithsend(),validate(), andcapabilities().send()resolves only on provider acceptance. Rejections and unknown outcomes throw typed errors withcode,retrySafe, and redactedattempts.- Adapters: Twilio (supported), Telnyx (supported), Plivo (partial), Vonage Messages API with Basic or JWT auth (partial), Bandwidth (partial), and Sinch (partial).
- Opt-in fallback (
fallback: "on-known-rejection") forauth,rate_limited,sender, andaccountrejections only, never after an unknown outcome. - Rate-limit retries with exponential backoff, full jitter, and bounded
Retry-After. A 429 counts as a rate limit only with the provider’s documented rate-limit error. Any other 429 is an unknown outcome. - Per-request timeout and
AbortSignalsupport. - The
IdempotencyStorecontract with atomicreserveand owner-checkedfinalize, plusmemoryIdempotencyStore(). - GSM-7 and UCS-2 segment estimates, including extension characters and surrogate pairs at segment boundaries.
/webhooks: verified, normalized events for every provider, with dedupe keys and STOP/HELP detection./testing: thememory()adapter,mockFetch(), signed webhook request builders for Twilio, Telnyx, Plivo, and Vonage, andrunSmsAdapterContract().sms-sdk doctor: a dry-run configuration check with a gated--livesend.