Reference
Channel send result
Map email, SMS, WhatsApp, and push results to a shared accepted shape.
Adapters that span channels can normalize every send into
{ messageId, provider, accepted } without inventing per-provider glue.
Use this after mailer.send, sms.send, whatsapp.send, or push.send.
The one rule
Keep channel-specific fields on the original result; use toChannelSendResult only for the shared slice.
Quick start
import { createSmsSender } from "sently/sms";
import { toChannelSendResult } from "sently/channel-result";
import { UnifonicTransport } from "sently/transports/unifonic";
const sms = createSmsSender({
transport: new UnifonicTransport({
appSid: process.env.UNIFONIC_APPSID!,
senderId: "MyBrand",
}),
});
const result = await sms.send({ to: "+15551234567", body: "Hi" });const shared = toChannelSendResult(result);
// { messageId, provider?, accepted }ChannelSendResult
| Field | Type | Meaning |
|---|---|---|
messageId | string | Provider or client message id |
provider | string? | Transport id when set |
accepted | boolean | Provider accepted the send (not end-user delivery) |
Mapping
| Channel result | accepted |
|---|---|
Email SendResult | accepted.length > 0 and rejected.length === 0 |
| SMS / WhatsApp / Push | status in accepted / queued / sending / sent / delivered / read / success (case-insensitive) |
Import from sently/channel-result or the main sently barrel.
Troubleshooting
Acceptance means the provider took the message. Use webhooks for delivered / failed outcomes.