> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ruachnet.com/llms.txt
> Use this file to discover all available pages before exploring further.

# SMS Fallback

> Automatically resend failed WhatsApp messages to the same recipient as SMS

SMS fallback makes sure a message still reaches the customer when WhatsApp delivery fails. When a WhatsApp message fails, the platform calls an SMS API endpoint that you configure and sends the original message content to the same recipient as an SMS.

You set up fallback once in the dashboard. After that it applies to your WhatsApp traffic automatically, with no change to your WhatsApp API requests.

> [!WARNING]
>
> SMS fallback is not available for **Carousel** templates. If a Carousel template message fails, it is not sent as SMS, even when a fallback configuration exists.

## How it works

**1. You send a WhatsApp message**

You send a WhatsApp message through the API, a campaign, or the dashboard as usual.

**2. The WhatsApp message fails**

The platform matches the failure against the **Error Code** selected in your fallback configuration.

**3. The platform builds the SMS request**

The platform takes your configured body payload and replaces the system variables: `{{whatsapp_message}}` with the original WhatsApp message content and `{{recipient_id}}` with the recipient's phone number.

**4. The platform calls your SMS endpoint**

The request is sent to your **Endpoint URI** with the method, content type and custom headers you configured. The SMS provider then delivers the message to the recipient.

The endpoint can be the Ruach SMS API (recommended) or any other HTTP SMS API, as long as you can express its request in one of the supported content types.

## Set up SMS fallback

**1. Open Fallback Configuration**

Sign in to [app.notify.ng](https://app.notify.ng) and go to **WhatsApp → Fallback Configuration**.

**2. Create or edit a configuration**

Add a new configuration, or click **Edit** on an existing one to open **Manage configuration**.

**3. Fill in the fields**

Complete the fields described in [Configuration fields](#configuration-fields). Use the **Preview** panel to check the final request body.

**4. Save**

Click **Update** to save. Saved configurations are listed with their name, endpoint, method, content type and create date.

## Configuration fields

**Name** `string` *required*

A label for the configuration, for example `WA to SMS fallback`.

**Endpoint URI** `string` *required*

The SMS API endpoint the platform calls when a WhatsApp message fails. For the Ruach SMS API, use `https://app.notify.ng/api/v2/SendSMS`.

**Error Code** `select` *required*

The WhatsApp failure(s) that trigger fallback. `ALL` triggers SMS fallback for any failed WhatsApp message.

**Method** `select` *required*

The HTTP method used to call the endpoint: `GET` or `POST`.

**Content-Type** `select` *required*

The format of the request body: `application/json`, `application/x-www-form-urlencoded`, or `application/xml`.

**Body Payload** `string` *required*

The request body sent to the SMS endpoint, written in the format of the selected Content-Type. Include the system variables where the message text and recipient number belong.

**Custom-Header** `key-value`

Optional HTTP headers sent with the request, for example an `Authorization` header required by a third-party SMS provider. Enter each header as a key and value, then click **Add**.

## System variables

System variables are placeholders that the platform replaces with real values at the moment it calls your endpoint.

| Variable | Replaced with |
| - | - |
| `{{whatsapp_message}}` | The original WhatsApp message content |
| `{{recipient_id}}` | The recipient's phone number |

> [!TIP]
>
> Type `{{` in a header value field to see the list of available system variables.

Rules for variables:

* System variables must be enclosed in double curly braces, for example `{{whatsapp_message}}`.
* System variables are replaced automatically with their values (where available) during the API call.
* Custom variables must **not** use double curly braces.
* Custom headers must be entered as key-value pairs. Keys can be edited as needed.

## Example: fallback to the Ruach SMS API

This configuration resends failed WhatsApp messages through the Ruach SMS API.

| Field | Value |
| - | - |
| Name | `WA to SMS fallback` |
| Endpoint URI | `https://app.notify.ng/api/v2/SendSMS` |
| Error Code | `ALL` |
| Method | `POST` |
| Content-Type | `application/json` |

Body payload:

```json theme={null}
{
  "ApiKey": "YOUR_API_KEY",
  "ClientId": "YOUR_CLIENT_ID",
  "SenderId": "YOUR_SENDER_ID",
  "Message": "{{whatsapp_message}}",
  "MobileNumbers": "{{recipient_id}}",
  "Is_Unicode": false,
  "Is_Flash": false
}
```

| Parameter | Description |
| - | - |
| `ApiKey` | Your SMS API key |
| `ClientId` | Your SMS client ID |
| `SenderId` | An approved SMS sender ID on your account |
| `Message` | Set to `{{whatsapp_message}}` so the SMS carries the original WhatsApp content |
| `MobileNumbers` | Set to `{{recipient_id}}` so the SMS goes to the same recipient |
| `Is_Unicode` | Set to `true` if your messages contain non-GSM characters such as emoji or non-Latin scripts |
| `Is_Flash` | Set to `true` to send the fallback as a flash SMS |

> [!NOTE]
>
> Your fallback SMS uses your SMS sender ID, not your WhatsApp business name. Make sure the sender ID in the payload is approved on your SMS account.

## Best practices

* Keep your SMS API credentials in the payload up to date. If you rotate your API key, update the fallback configuration too, or fallback SMS will fail.
* Check the **Preview** panel before saving to confirm the body is valid for the selected Content-Type.
* Write WhatsApp content that still reads well as plain text, since the SMS carries the message content only.
* Use a standard template type rather than Carousel for messages that must reach the customer, because Carousel messages do not fall back to SMS.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.