---
title: Fallback
description: Fail over through an ordered list of channel transports.
icon: GitBranch
source: "src/transports/fallback.ts"
---

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

<Callout title="The one rule">Wrap each entry in `RetryTransport` when you want in-provider retries before failover.</Callout>

## Quick start

<Steps>
  <Step title="Build a chain">

```ts
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 },
);
```

  </Step>
  <Step title="Use the matching sender">

```ts
import { createSmsSender } from "sently/sms";

const sms = createSmsSender({ transport });
```

  </Step>
</Steps>

## Result fields

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

## Troubleshooting

<Accordions>
  <Accordion title="Why did it not fail over on 400?">
    Permanent client errors (400 / 401 / 403) do not fail over by default — they usually fail on every provider.
  </Accordion>
</Accordions>

## Learn more

- [Failover guide](/docs/guides/failover) — retry-then-fallback recipes across channels

## Next

<Cards>
  <Card title="Failover guide" href="/docs/guides/failover" />
  <Card title="Weighted fallback" href="/docs/decorators/weighted-fallback" />
  <Card title="Retry" href="/docs/decorators/retry" />
</Cards>
