Decorators

Fallback

Fail over through an ordered list of channel transports.

Fail over through an ordered list of transports when the current one errors. Works with email, SMS, WhatsApp, and push.

The one rule

Wrap each entry in RetryTransport when you want in-provider retries before failover.

Quick start

import { FallbackTransport } from "sently/transports/fallback";
import { TaqnyatSmsTransport } from "sently/transports/taqnyat-sms";
import { UnifonicTransport } from "sently/transports/unifonic";

const transport = new FallbackTransport(
  [
    new TaqnyatSmsTransport({ bearerToken: process.env.TAQNYAT_TOKEN!, sender: "MyBrand" }),
    new UnifonicTransport({ appSid: process.env.UNIFONIC_APPSID!, senderId: "MyBrand" }),
  ],
  { cooldownMs: 300_000 },
);
import { createSmsSender } from "sently/sms";

const sms = createSmsSender({ transport });

Result fields

Successful sends include provider and providerIndex for the transport that handled the message.

Troubleshooting

Next

On this page