# Set up failover from RCS to SMS

Sometimes, when you send Rich communication services (RCS) messages to end users, the message might not be delivered for various reasons. Example: The end user's device or network does not support RCS, the end user does not have an active internet connection, or there are network issues.

In such cases, to ensure that the end user receives the message, use another channel as the failover. SMS is the most reliable channel because it does not require an internet connection and is compatible with all types of mobile devices. This is why SMS is often used as the failover channel to guarantee message delivery.

This tutorial shows how to set up failover from RCS to SMS. Customize the example to meet your specific use case and requirements.

## Products and channels [#products-channels]

- [RCS](https://www.infobip.com/docs/rcs)
- [SMS](https://www.infobip.com/docs/sms)
- [Broadcast](https://www.infobip.com/docs/broadcast)

## Prerequisites [#prerequisites]

- **Infobip account** with the following enabled:

    - RCS
    - SMS

    If you do not have an account, [create a free trial account](https://www.infobip.com/docs/essentials/getting-started/create-an-account) and select **RCS** and **SMS** channels on the welcome screen.
- **Infobip API key** with the following scopes:

    - ```rcs:message:send```
    - ```sms:message:send```
    
     For information about creating an API key with the required scope, refer to [API authorization](https://www.infobip.com/docs/essentials/api-essentials/api-authorization).
- **HTTP client**: This tutorial uses curl. Alternatively, you can choose the official [Infobip SDK](https://www.infobip.com/docs/sdk) for the required programming language.
- **RCS agent or sender**: If you want to configure a custom RCS sender, contact your Infobip account manager.
- **SMS sender**: If you are in the free trial period, you can use Infobip's test sender, **ServiceSMS**.

    If you want to configure a custom SMS sender, request either a new number or an alphanumeric sender through either your [Infobip account](https://portal.infobip.com/channels-and-numbers/channels/sms/overview) or the [Infobip Numbers](https://www.infobip.com/docs/api/platform/numbers) API.
- **Destination**: A phone number to which RCS and SMS messages are sent.

    If the RCS agent is not launched, you can only send to safelisted phone numbers.

## Implementation over the Infobip web interface [#implementation-over-web-interface]

1. On the [Infobip web interface](https://portal.infobip.com/login), go to **Moments** > **Broadcasts**.
2. Select [**Create new broadcast**](https://www.infobip.com/docs/broadcast/create#new-broadcast).
3. Select **RCS** as the channel.
4. Choose the **Recipients** and select a **Sender**.
5. In the **Content** section, create a **Text** message that includes a URL.

    Example: *For news about CPaaS in Infobip, go to https:<span>//</span>www<span>.</span>infobip.com/news/infobip-is-one-of-the-top-cpaas-providers-in-metrigys-cpaas-metrirank-report.*

1. Enable **Failover to SMS**.
2. Select a **Sender**.
3. In the **Message** section, copy the message from the RCS **Content** section.

5. (Optional) Configure other fields as required.
6. Name your broadcast.
7. Select **Continue to preview**.
8. Verify the content in the preview page.
9. Select **Launch**.

## Implementation over API [#implementation-over-api]

1. [Create an API request](https://www.infobip.com/docs/api/channels/rcs/send-rcs-messages) to send RCS messages.

    ```curl showLineNumbers copy filename="curl"
    curl -X POST https://api.infobip.com/rcs/2/messages \
    -H 'Authorization: App {YOUR_API_KEY}' \
    -H 'Content-Type: application/json' \
    {
      "messages": [
        {
          "sender": "{YOUR_RCS_SENDER}",
          "destinations": [
            {
              "to": "{YOUR_DESTINATION}"
            }
          ],
          "content": {
            "text": "For news about CPaaS in Infobip, go to https://www.infobip.com/news/infobip-is-one-of-the-top-cpaas-providers-in-metrigys-cpaas-metrirank-report",
            "suggestions": [
              {
                "text": "Find more",
                "postbackData": "more",
                "type": "REPLY"
              }
            ],
            "type": "TEXT"
          }
        }
      ]
    }
    ```

2. In the API request, configure the SMS failover.

    ```curl showLineNumbers copy filename="curl"
    curl -X POST https://api.infobip.com//rcs/2/messages \
    -H 'Authorization: App {YOUR_API_KEY}' \
    -H 'Content-Type: application/json' \
    {
      "messages": [
        {
          "sender": "{YOUR_RCS_SENDER}",
          "destinations": [
            {
              "to": "{YOUR_DESTINATION}"
            }
          ],
          "options": {
            "validityPeriod": {
              "amount": 5,
              "timeUnit": "SECONDS"
            },
            "deliveryTimeWindow": {
              "days": [
                "MONDAY",
                "TUESDAY",
                "WEDNESDAY",
                "THURSDAY",
                "FRIDAY",
                "SATURDAY",
                "SUNDAY"
              ],
              "from": {
                "hour": 2,
                "minute": 0
              },
              "to": {
                "hour": 23,
                "minute": 59
              }
            },
            "campaignReferenceId": "Example campaign id",
            "smsFailover": {
              "sender": "{YOUR_SMS_SENDER}",
              "text": "For news about CPaaS in Infobip, go to https://www.infobip.com/news/infobip-is-one-of-the-top-cpaas-providers-in-metrigys-cpaas-metrirank-report",
              "validityPeriod": {
                "amount": 48,
                "timeUnit": "HOURS"
              }
            }
          }
        }
      ]
    }
    ```

## Additional resources [#additional-resources]

- <apidocslink href="channels/rcs/send-rcs-messages">RCS API reference</apidocslink> documentation.
- [RCS](https://www.infobip.com/docs/rcs) documentation.
- [SMS](https://www.infobip.com/docs/sms) documentation.
- [Broadcast](https://www.infobip.com/docs/broadcast) documentation.
- [Response status and error codes](https://www.infobip.com/docs/essentials/api-essentials/response-status-and-error-codes) documentation.
- <portallink href="broadcast">Broadcast</portallink> on the Infobip web interface.
- [Infobip SDK](https://www.infobip.com/docs/sdk) documentation.