# Sending An SMS

{% hint style="danger" %}
**Requires&#x20;*****`SEND_SMS`*****&#x20;permission.**
{% endhint %}

Add the following permission in your `AndroidManifest.xml`

```markup
<uses-permission android:name="android.permission.SEND_SMS"/>
```

## sendSms()

#### Returns Future\<void>

|   Parameters   | Type                                                                | Description                                                                                                                                                  | Optional | Default Value |
| :------------: | ------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | :------: | :-----------: |
|       to       | `String`                                                            | Number to send SMS to                                                                                                                                        |     ❌    |      `-`      |
|     message    | `String`                                                            | Message to send                                                                                                                                              |     ❌    |      `-`      |
|   isMultipart  | `bool`                                                              | If the body of the message is longer than the standard SMS length limit of `160 characters`, you can send a multipart SMS by setting the `isMultipart` flag. |    ✔️    |    `false`    |
| statusListener | [`SmsSendStatusListener`](/sending-an-sms.md#smssendstatuslistener) | Receives SMS sent and delivered events                                                                                                                       |    ✔️    |     `null`    |

```dart
Telephony telephony = Telephony.instance;

await telephony.sendSms(
    to: "1234567890",
    message: "May the force be with you!"
    );
```

If you want to listen to the status of the message being sent, provide[`SmsSendStatusListener`](/sending-an-sms.md#smssendstatuslistener) to the `sendSms` function.

```dart
final SmsSendStatusListener listener = (SendStatus status) {
    // Handle the status
    };

await telephony.sendSms(
    to: "1234567890",
    message: "May the force be with you!",
    statusListener: listener
    );
```

{% hint style="info" %}
**TIP:** \
If you want to send an sms to multiple numbers, you may pass multiple numbers separated by a `;`&#x20;

```dart
await telephony.sendSms(
    to: "1234567890;5724352435;24653456345",
    message: "May the force be with you!"
    );
```

Keep in mind that this method may not work on all devices.
{% endhint %}

## sendSmsByDefaultApp()

#### Returns Future\<void>

| Parameters | Type     | Description           | Optional |
| :--------: | -------- | --------------------- | :------: |
|     to     | `String` | Number to send SMS to |     ❌    |
|   message  | `String` | Message to send       |     ❌    |

Opens the default SMS app with the number and the message passed to the function.

```dart
await telephony.sendSmsByDefaultApp(
    to: "1234567890",
    message: "May the force be with you!"
    );
```

## SmsSendStatusListener

Receives `SendStatus` when SMS is `sent` and `delivered`.

```dart
SmsSendStatusListener listener = (SendStatus status) {
    // Handle the status
    };
```

## SendStatus

| Type | Values                  |
| ---- | ----------------------- |
| Enum | **`SENT`, `DELIVERED`** |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://telephony.shounakmulay.dev/sending-an-sms.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
