# How SMS work

> What an SMS is in Releva, who receives it, how merge tags, link shortening, length and encoding work, what the daily limit does, how test messages and statistics work, and which providers Releva sends through.

An **SMS** (the admin calls it a **Text Message**) is a saved piece of text that Releva sends to the phone numbers of your profiles through the SMS provider set up for your shop. The SMS itself holds only the text and a daily-limit rule. Who gets it and when is decided by the workflow that uses it. SMS live under **Marketing Channels › SMS / Text Messages**.

## Three parts: provider, message, workflow

| Part         | Where                                           | What it does                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| ------------ | ----------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Provider** | **Settings › Messaging**, tab **Text Messages** | The gateway Releva sends through, chosen in **Message Sender**. **Mobica**, **Routee**, **Infobip** and **Link Mobility** are SMS providers you have your own account with; you enter that account’s credentials. **Releva** is not a separate provider: Releva sends your SMS through Amazon Web Services (AWS) on Releva’s own AWS account, so the form asks for no credentials. Until a sender and its credentials are saved, **New Text Message** is disabled and the list shows *Please fill in your Text Message credentials because we cannot send messages without them!* |
| **Message**  | **Marketing Channels › SMS / Text Messages**    | The text, with merge tags, plus **If max text messages per day is reached** and **Max Reschedules**. See [Create an SMS](https://releva.ai/documentation/guides/sms/create-an-sms/).                                                                                                                                                                                                                                                                                                                                                                                                               |
| **Workflow** | **Workflows**, or **Send** on the SMS           | Picks the audience and the moment. An SMS can only be sent from a workflow (one-off, continuous or triggered). See [Send an SMS with a workflow](https://releva.ai/documentation/guides/sms/send-an-sms-with-a-workflow/).                                                                                                                                                                                                                                                                                                                                                                         |

Saving an SMS makes no call to the provider. Only a launched workflow and **Test Message** send.

## Who receives an SMS

When a workflow step runs, Releva loads the profiles that match the workflow’s audience and keeps only those that:

* have a phone number;
* are subscribed (see [How consent works in Releva](https://releva.ai/documentation/learn/consent/how-consent-works-in-releva/)), unless the step runs in the transactional scope;
* have no SMS bounce recorded (a hard bounce excludes the profile for good; a soft bounce excludes it for a while);
* are not over the daily limit, unless the SMS is set to **Send anyway** (see below);
* did not receive this SMS from this workflow step already (the same phone number is never sent twice in one run).

Profiles that fail these checks are left out before anything is sent, so they do not count as **Sent**.

The whole send is also skipped when the click-tracking host of your sender domain does not answer (**Settings › Messaging**, tab **General**, section **Click Tracking**): every link in the SMS is routed through it, so Releva refuses to send rather than deliver dead links. The workflow editor shows a red warning, *Campaign sending is disabled until the click-tracking DNS record is in place for your sender domain*, while that is the case.

## Merge tags

The message is a [Handlebars](https://handlebarsjs.com/) template. **Merge Tags** on the form lists every tag you can use, with its **Pattern** and **Label**: profile fields such as `{{firstName}}`, `{{lastName}}`, `{{email}}`, `{{phoneNumber}}`, `{{profileId}}`; links such as `{{unsubscribeLink}}`, `{{subscriptionManagementLink}}` and `{{loyaltyLink}}`; your custom profile fields; dynamic coupon lists as `{{dynamicCoupons.<name>}}` (see [How dynamic coupons work](https://releva.ai/documentation/learn/dynamic-coupons/how-dynamic-coupons-work/)); survey links; and, in triggered workflows, the trigger event’s fields as `{{triggerEvent.…}}`.

Rules:

* The form checks the template as you type. A broken tag shows *Invalid merge tag: …* under the message and disables **Save** and **Test Message**. The server rejects the same text with *Message body is not a valid Handlebars template: …*.
* Only Releva’s built-in helpers are allowed. Tags are rendered once per recipient at send time.
* If rendering fails for one recipient (for example a missing dynamic coupon), that recipient is marked as failed and the others are still sent.
* A message with a dynamic coupon tag claims one code per recipient; recipients who get no code are skipped.

## Links, tracking and shortening

Every `http://` or `https://` link in the text is rewritten at send time, per recipient, in two steps. First the link becomes a click-tracking link on your sender domain’s click-tracking host (**Settings › Messaging**, tab **General**, section **Click Tracking**), which records the click for the profile, the SMS and the workflow step and then redirects to your page. Then that link is replaced by a short link on Releva’s short domain (or your shop’s custom short domain, if one is set up), so it fits in an SMS. `mailto:` links are left alone. The **Preview** on the form shows the shortened text, which is why the preview is fetched from the server rather than built in the browser.

Keep the short links in mind when you count characters: the preview length, not the text you typed, is what gets sent.

## Length and encoding

**Length** on the form shows `n / 160`. The number comes from the server and is the SMS length of the previewed text, which is not always the character count:

| Message contains                                                | Encoding                                            | Characters per SMS | Per part when split |
| --------------------------------------------------------------- | --------------------------------------------------- | ------------------ | ------------------- |
| Only GSM characters (Latin letters, digits, common punctuation) | GSM 7-bit                                           | 160                | 153                 |
| Also `^ { } \ [ ~ ] \| €`                                       | GSM 7-bit with extension; each of these counts as 2 | 160                | 153                 |
| Any other character (Cyrillic, emoji, curly quotes…)            | Unicode (UCS-2)                                     | 70                 | 67                  |

The form always prints “/ 160”, even for a Unicode message. Merge tags also change the final length per recipient: `{{firstName}}` is 13 characters in the editor but “Maria” is 5 when sent. Messages over the limit are sent as a long (multi-part) SMS, which phones show as one message; the provider bills each part.

## The daily limit

Each shop has a maximum number of text messages one profile may receive per day (3 by default, 1 to 10, set under **Settings › Messaging**, tab **Text Messages**). The SMS decides what happens to a profile that already reached it:

| Setting                  | What happens                                                                                                                                                                                                                     |
| ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Reschedule** (default) | The profile is left out of this run and the step is queued again 24 hours later for the profiles that were over the limit. **Max Reschedules** (1 to 10, default 3) is the number of retries; after that the profile is dropped. |
| **Send anyway**          | The limit is ignored for this SMS.                                                                                                                                                                                               |
| **Skip sending**         | The profile is left out; no retry.                                                                                                                                                                                               |

The check applies to one-off and continuous sends. Triggered workflows do not check the limit; the form says the setting applies in continuous campaigns or workflows. Rescheduled and skipped profiles are recorded as events (`textMessageReschedule`, `textMessageSkip`) on the profile.

## Test messages

**Test Message** on the form sends the SMS for real, through your provider, to one or more numbers. Each number must be in international format with the country code (`+359…`), and the field is prefilled with your own number. You can pick a **Profile to impersonate** (by email, phone number or profile id) so the merge tags render with that profile’s data, and, for triggered workflows, a **Trigger event**. The button is disabled while the message is empty or invalid.

If the provider rejects the message, the form shows *Message could not be sent:* followed by the provider’s response. A test send goes straight to the provider and records no send event, so it does not show up in the SMS statistics.

## Statistics

Each card on the list shows, for the selected period (30 days by default): **Sent**, **Delivered** (% of sent), **Clicks** (% of delivered), **Conversions** (% of clicks), **Purchases** (% of conversions), **Revenue**, **Unsubscribes** (% of sent) and **Bounces**. The people icon next to a number opens a new segment of the profiles behind it. **Statistics** on the card opens a daily chart for one SMS (7 days by default), and **Export** on the list creates a report of all SMS.

Delivered and Bounces come from your provider’s delivery reports, which the provider posts to a Releva endpoint (Mobica, Routee, Infobip and Link Mobility each have one). Without delivery reports an SMS is counted as sent but never as delivered or bounced. Ask support to set them up with your provider.

## Deleting and copying

**Make a copy** on a saved SMS opens a new form with the same text, named **Copy of \<name>**. **Delete** asks you to confirm and warns: *Please verify that this Text Message is not part of any workflows or campaigns before proceeding with deletion.* Releva does not check this for you; a workflow step that points to a deleted SMS has nothing to send.

## Next steps

* [Create an SMS](https://releva.ai/documentation/guides/sms/create-an-sms/): Write and save your first SMS with merge tags.
* [Send an SMS with a workflow](https://releva.ai/documentation/guides/sms/send-an-sms-with-a-workflow/): Start a workflow with your SMS already connected.
* [How consent works in Releva](https://releva.ai/documentation/learn/consent/how-consent-works-in-releva/): Learn which customers can receive marketing SMS.
* [How dynamic coupons work](https://releva.ai/documentation/learn/dynamic-coupons/how-dynamic-coupons-work/): Give each recipient a different coupon code.