Channels
Channels
Send through a stable channel API while transports handle providers.
Choose a channel sender for the kind of message your application sends. Each sender accepts a provider transport, so delivery providers can change without rewriting send calls.
The one rule
Application code calls a sently channel sender; provider-specific code stays in its transport.
| Channel | Sender | Send shape |
|---|---|---|
createMailer or createSMTPMailer | Sender, recipient, subject, and body. | |
| SMS | createSmsSender | Recipient number and body. |
createWhatsAppSender | Template or text message. | |
| Push | createPushSender | Web Push subscription or FCM token, plus title and body. |
import { createSmsSender } from "sently/sms";
import { TwilioSmsTransport } from "sently/transports/twilio-sms";
const sms = createSmsSender({
transport: new TwilioSmsTransport({
accountSid: process.env.TWILIO_ACCOUNT_SID!,
authToken: process.env.TWILIO_AUTH_TOKEN!,
}),
});
await sms.send({
to: "+15551234567",
body: "Your order is on its way.",
from: "+15557654321",
});Channel factories
| Factory | Async | When to use it |
|---|---|---|
createMailer | Yes | Email with an explicit transport. |
createSMTPMailer | Yes | Email configured with SMTP host, port, and authentication. |
createSmsSender | No | SMS with an SmsTransport. |
createWhatsAppSender | No | WhatsApp with a WhatsAppTransport. |
createPushSender | No | Web Push or FCM with a PushTransport. |
Troubleshooting
Use the matching sently sender for normal delivery. Provider-only features belong on the concrete transport rather than the shared channel contract.
Keep the sender call and create it with a different transport for the same channel.