---
title: "Examples"
description: "Runnable SMS SDK examples in the repository: a Twilio send, provider fallback, a webhook handler, and tests with the memory adapter."
---

The runnable examples live in [`packages/sms-sdk/examples`](https://github.com/opencoredev/sms-sdk/tree/main/packages/sms-sdk/examples), simplest first below. By default each one runs offline against a mocked provider API or the `memory()` adapter, so running them never sends a message. The test suite runs every example, which keeps them in step with the code.

| Example | Shows | Docs |
| --- | --- | --- |
| [`test-adapter`](https://github.com/opencoredev/sms-sdk/tree/main/packages/sms-sdk/examples/test-adapter) | App code tested with `memory()`, including a scripted compliance rejection. | [Local testing](/guides/local-testing) |
| [`twilio`](https://github.com/opencoredev/sms-sdk/tree/main/packages/sms-sdk/examples/twilio) | One send through Twilio. Mocked by default; opt into a live send with environment variables. | [Twilio](/providers/twilio) |
| [`failover`](https://github.com/opencoredev/sms-sdk/tree/main/packages/sms-sdk/examples/failover) | Twilio first, Telnyx after a known sender rejection, with handling for unknown outcomes. | [Retries and fallback](/sending/retries-and-fallback) |
| [`webhooks`](https://github.com/opencoredev/sms-sdk/tree/main/packages/sms-sdk/examples/webhooks) | A plain `fetch` handler for Twilio and Telnyx webhooks: verification, deduplication, and a rejected forgery. Works with `Bun.serve`, Hono, and Next.js route handlers. | [Receiving overview](/receiving/overview) |

## Run them

```bash
git clone https://github.com/opencoredev/sms-sdk.git
cd sms-sdk
bun install
cd packages/sms-sdk
bun examples/test-adapter/index.ts
bun examples/twilio/index.ts
bun examples/failover/index.ts
bun examples/webhooks/index.ts
```

Each prints what happened, such as `twilio accepted SM0123456789abcdef0123456789abcdef (handoff accepted, delivery queued)`.

## Send for real

Only the `twilio` example can send a real message, and only when you opt in. In `packages/sms-sdk`, copy `.env.example` to `.env`, fill in your Twilio credentials, and run:

```bash
SMS_EXAMPLE_LIVE=true SMS_EXAMPLE_TO=+14155550123 bun examples/twilio/index.ts
```

This sends one billable message to `SMS_EXAMPLE_TO` from `TWILIO_FROM`.
