---
title: Retry
description: Retry failed sends with configurable backoff on any channel transport.
icon: RotateCw
source: "src/transports/retry.ts"
---

Retry failed sends with configurable backoff.
Works with email, SMS, WhatsApp, and push transports.

<Callout title="The one rule">Authentication errors are not retried.</Callout>

## Configuration

`maxAttempts`, `backoff`, `baseDelay`, `retryOn`, and `onRetry` are optional.

## Quick start

<Steps>
  <Step title="Wrap a transport">

```ts
import { RetryTransport } from "sently/transports/retry";
import { TaqnyatSmsTransport } from "sently/transports/taqnyat-sms";

const transport = new RetryTransport(
  new TaqnyatSmsTransport({ bearerToken: "...", sender: "MyBrand" }),
  { maxAttempts: 3 },
);
```

  </Step>
  <Step title="Pass it to the channel sender">

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

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

  </Step>
</Steps>

## Troubleshooting

<Accordions>
  <Accordion title="Does this replace the inner provider?">
    No. It delegates sends to the wrapped transport.
  </Accordion>
</Accordions>

## Next

<Cards>
  <Card title="Fallback" href="/docs/decorators/fallback" />
  <Card title="Hooks" href="/docs/channels/hooks" />
</Cards>
