> For the complete documentation index, see [llms.txt](https://docs.sendwithses.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sendwithses.com/features/sms.md).

# SMS

**Send With SES** integrates with your AWS SNS account to send SMS (Text Messages). You can send SMS manually or via the API. There are three types of SMS you can send and each type has a predefined template.

| Type of SMS              | How to send         |
| ------------------------ | ------------------- |
| Transactional            | Manually or via API |
| Marketing                | Manually or via API |
| One Time Passwords (OTP) | ONLY via API        |

<figure><img src="/files/qFshOgdcXZUVSc24Tqjn" alt=""><figcaption></figcaption></figure>

***

### **Manual SMS - (Transactional OR Marketing):**&#x20;

To send an SMS manually, select one or more contacts or filter contacts using the options in the left panel and click "Send Button" at top. You will be shown a popup where you can compose your SMS.

<figure><img src="/files/jIAIYBFaOA8CD0f1ANiE" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
**NOTEs:**&#x20;

* Sender ID is optional. Enter only if you have one.&#x20;
* Origination number is required only if you are sending to USA mobile numbers.
  {% endhint %}

***

### **API SMS - (Transactional OR Marketing):** &#x20;

See the request/response details below.

{% tabs %}
{% tab title="API Request" %}

<pre><code><strong>URL: https://api.sendwithses.com/send-sms
</strong></code></pre>

{% code lineNumbers="true" %}

```
{
      "method": "POST",
      "url": "https://api.sendwithses.com/send-sms",
      "headers": {"template-key": "**************************4lVm"},
      "body": {
          "sender_id": "ABCDEF",
          "origination_number": "+449876543212",
          "mobile": "+449876543210",
          "message": "Hello John."
       }
}
```

{% endcode %}

**IMPORTANT:**

* All API calls MUST include the **Template Key**. Template Key is unique to Transactional SMS and Marketing SMS.
* 'Origination Number' is required only when sending to USA mobile numbers.&#x20;
* All mobile numbers MUST be in E.164 format.&#x20;
  {% endtab %}

{% tab title="API Response" %}
Success Response:

{% code lineNumbers="true" %}

```
{
      "success": true,
      "message": "SMS Sent"
}
```

{% endcode %}

Failed Response:

{% code lineNumbers="true" %}

```
{
      "success": false,
      "message": "message details",
      "error": "error details"
}
```

{% endcode %}
{% endtab %}
{% endtabs %}

***

### **OTP SMS - (Can be sent via API ONLY):** &#x20;

OTP SMS is used to send one time codes intended for Two-Factor Authentication (2FA) or other high value transactions within your website or mobile app. OTP SMS has a template that allows you to customize fields like App Name, OTP Size, and OTP Expiry Time.

<figure><img src="/files/tK5EOyEYnFrrGpbpnecW" alt=""><figcaption></figcaption></figure>

The OTP SMS includes two parts, ***Send API*** and ***Verify API***.

{% tabs %}
{% tab title="Send API" %}
Send API is used to trigger the SMS containing one time code to the end user.

```
URL: https://api.sendwithses.com/send-otp
```

**Request:**

{% code lineNumbers="true" %}

```
{
      "method": "POST",
      "url": "https://api.sendwithses.com/send-otp",
      "headers": {"template-key": "****************************elA2"},
      "body": {
          "sender_id": "ABCDEF"
          "origination_number": "+449876543212"
          "mobile": "+449876543210",
       }
}
```

{% endcode %}

**Success Response:**

```
{
      "success": true,
      "message": "OTP Sent"
}
```

**Failed Response:**

{% code lineNumbers="true" %}

```
{
      "success": false,
      "message": "message details",
      "error": "error details"
}
```

{% endcode %}

**IMPORTANT:**

* All API calls MUST include the **Template Key**. Template Key is unique to OTP SMS.
* 'Origination Number' is required only when sending to USA mobile numbers.&#x20;
* All mobile numbers MUST STRICTLY be in E.164 format.
  {% endtab %}

{% tab title="Verify API" %}
Verify API is used to match the one time code received from end user with the code generated during the Send API call.&#x20;

```
URL: https://api.sendwithses.com/verify-otp
```

**Request:**

{% code lineNumbers="true" %}

```
{
      "method": "POST",
      "url": "https://api.sendwithses.com/verify-otp",
      "headers": {"template-key": "***********************elA2"},
      "body": {
          "mobile": "+449876543210"
          "otp": "123456",
       }
}
```

{% endcode %}

**Success Response:**

{% code lineNumbers="true" %}

```
{
      "success": true,
      "message": "OTP Verified"
}
```

{% endcode %}

**Failed Response:**

{% code lineNumbers="true" %}

```
{
      "success": false,
      "message": "message details",
      "error": "error details"
}
```

{% endcode %}

**IMPORTANT:**

* All API calls MUST include the **Template Key**. Template Key is unique to OTP SMS.
* 'Origination Number' is required only when sending to USA mobile numbers.&#x20;
* All mobile numbers MUST STRICTLY be in E.164 format.
  {% endtab %}
  {% endtabs %}
