---
title: Decorators
description: Wrap any channel transport with retry, fallback, preview, or idempotency.
icon: Layers
source: "src/transports/retry.ts"
---

Decorators wrap another transport. The channel sender still calls `send` the same way — only the transport path changes.
Retry, fallback, and weighted fallback work for email, SMS, WhatsApp, and push.
Preview and idempotency remain email-oriented.

<Callout title="The one rule">Pass the outermost decorator to the matching channel sender (`createMailer`, `createSmsSender`, …).</Callout>

## Available decorators

| Decorator | Import | Channels |
| --- | --- | --- |
| [Preview](./preview) | `sently/transports/preview` | Email |
| [Retry](./retry) | `sently/transports/retry` | Email, SMS, WhatsApp, Push |
| [Fallback](./fallback) | `sently/transports/fallback` | Email, SMS, WhatsApp, Push |
| [Weighted fallback](./weighted-fallback) | `sently/transports/weighted-fallback` | Email, SMS, WhatsApp, Push |
| [Idempotency](./idempotency) | `sently/idempotency` | Email |

## Typical stack (email)

```ts
import { createMailer } from "sently/mailer";
import { ResendTransport } from "sently/transports/resend";
import { RetryTransport } from "sently/transports/retry";
import { FallbackTransport } from "sently/transports/fallback";

const transport = new FallbackTransport([
  new RetryTransport(new ResendTransport({ apiKey: process.env.RESEND_API_KEY! })),
  new ResendTransport({ apiKey: process.env.RESEND_BACKUP_KEY! }),
]);

const mailer = await createMailer({ transport });
```

## Typical stack (SMS)

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

const sms = createSmsSender({
  transport: new FallbackTransport([
    new TaqnyatSmsTransport({ bearerToken: process.env.TAQNYAT_TOKEN!, sender: "MyBrand" }),
    new UnifonicTransport({ appSid: process.env.UNIFONIC_APPSID!, senderId: "MyBrand" }),
  ]),
});
```

## Learn more

- [Failover recipe](../guides/failover) — retry inside a provider, then fail over
- [Transports](../transports)
- [Hooks](../channels/hooks)

## Next

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