> For the complete documentation index, see [llms.txt](https://codemash.gitbook.io/codemash/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://codemash.gitbook.io/codemash/cloud/sms/templates/test-send.md).

# Send a test SMS

Send one test SMS of a template to a phone number, with the tokens filled in.

**Where:** SMS → Templates → a template → **Test** · `/projects/<project>/sms/templates/<id>/edit`

## Before you start

* The template is saved, has no unsaved changes, and has a text for every project language — see [Create or edit a template](/codemash/cloud/sms/templates/editor.md).
* An enabled integration that can send — [Twilio](/codemash/cloud/sms/integrations/providers/twilio.md) or the [Fake SMS (Test Me)](/codemash/cloud/sms/integrations/providers/fake-sms.md). Without one the panel says **No SMS integrations found** and has no **Send** button.
* You need `sms:create` on SMS campaigns: a test SMS is a real one-number campaign.

## Steps

1. Open the template, for example `Login code`, and press **Test**. The panel **Send Test SMS** opens (*Send a test SMS to a phone number for this template*).

   <figure><img src="https://712692422-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHy372bqsaex2cqS3ikhL%2Fuploads%2Fgit-blob-39fc05b1135c230f89156da884d126fa960d5c44%2Ftemplates-test-send-1.png?alt=media" alt="The Send Test SMS panel with Select language, SMS Provider Test Me (Fake) (Default), the Test Tokens Panel with the empty tokens FirstName and Code, and the Message preview"><figcaption><p>The Test panel before the tokens are filled.</p></figcaption></figure>
2. Fill in the panel:

   | Field             | Required  | What it does                                                                                                                                           | Example                                |
   | ----------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------- |
   | Select language   | yes       | Which translation is shown and sent. Must be a project language.                                                                                       | `en`                                   |
   | SMS Provider:     | yes       | The integration that sends the test; its sender is what the phone shows. The project default is picked for you.                                        | `Test Me (Fake) (Default)`             |
   | Trigger Type      | no        | Leave **Not a trigger** for a plain test; the other choices offer the tokens of a Database, Membership, File or Payment trigger.                       | `Not a trigger`                        |
   | Template Tokens   | yes, each | A value for every token of the template. While one is empty the panel says *Pick a value for every token before sending. Still missing:* and names it. | `FirstName` = `Ada`, `Code` = `482913` |
   | Send test SMS to: | yes       | The phone that gets the test, in E.164 format. An empty box shows *Type the phone number that gets the test SMS.*                                      | `+37060000001`                         |

   **Message preview** shows the finished text and the character counter.

   <figure><img src="https://712692422-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHy372bqsaex2cqS3ikhL%2Fuploads%2Fgit-blob-a09cb3c5ce69be7b003a95617200fb281919fd9c%2Ftemplates-test-send-2.png?alt=media" alt="The Test panel with FirstName Ada and Code 482913, the Message preview Hi Ada, your Acme code is 482913. It expires in 10 minutes., 59 / 160 characters, Send test SMS to +37060000001 and the Send button"><figcaption><p>The tokens are filled and Send is on.</p></figcaption></figure>
3. Press **Send**. It turns on only when every token has a value.

## Result

The toast says *Test SMS sent. See SMS campaigns for the delivery result.* A new campaign to that one number appears in the [campaigns list](/codemash/cloud/sms/campaigns.md); its [message log](/codemash/cloud/sms/campaigns/log.md) shows the sent text. Through Twilio the SMS arrives on the phone (a paid SMS); through the Fake it is recorded as sent and nothing arrives.

<figure><img src="https://712692422-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHy372bqsaex2cqS3ikhL%2Fuploads%2Fgit-blob-11199dd5cf659b8af6313012f540e1a2f8cd0857%2Ftemplates-test-send-3.png?alt=media" alt="The Test panel with the green toast Success! Test SMS sent. See SMS campaigns for the delivery result."><figcaption><p>The test SMS was sent.</p></figcaption></figure>

## Change or remove it later

* The panel closes only with its **X** or **Cancel**, so the values you typed are not lost by a stray click. They are not saved.
* The test campaign is an ordinary campaign: read or delete it on its [details page](/codemash/cloud/sms/campaigns/details.md).

## Do it from code

There is no separate test call: create a campaign to one phone number and force the language.

```ts
const { id } = await norbix.hub.notifications.createSmsCampaign({
  templateId: 'tmpl_2BHRvMydBbybNH5ThRV7fB', // Login code
  integrationId: 'int_6owP11oF9ZZAt9szkqy99S', // Test Me (Fake)
  deliveryType: 'PhoneNumbers',
  language: 'en',
  phoneNumbers: {
    recipientsSourceType: 'PhoneNumbers',
    phoneNumbers: ['+37060000001'],
    mappedTokens: [
      { key: 'FirstName', value: 'Ada', resolver: 'Custom' },
      { key: 'Code', value: '482913', resolver: 'Custom' },
    ],
  },
});
console.log(id); // cmp_…
```

```sh
norbix hub notifications sms campaign create --templateId tmpl_2BHRvMydBbybNH5ThRV7fB --integrationId int_6owP11oF9ZZAt9szkqy99S --deliveryType PhoneNumbers --language en --phoneNumbers '{"recipientsSourceType":"PhoneNumbers","phoneNumbers":["+37060000001"],"mappedTokens":[{"key":"FirstName","value":"Ada","resolver":"Custom"},{"key":"Code","value":"482913","resolver":"Custom"}]}'
```

The client setup is on the [SMS page](/codemash/cloud/sms.md#use-it-from-code). API: [Create Sms Campaign](/codemash/api-reference/notifications/sms/create-sms-campaign.md) · [Render Sms](/codemash/api-reference/notifications/sms/render-sms.md) (the preview)
