# sendCustomSMS | Отправить персональное SMS

{% hint style="danger" %}
**Внимание!** Мы **не несём ответственность** за доходимость вашего **сендера** и **текста**!
{% endhint %}

## Использование этого метода

<mark style="color:green;">`POST`</mark> `https://api.meowsms.app/sendCustomSMS/`

#### Headers

| Name                                            | Type           | Description  |
| ----------------------------------------------- | -------------- | ------------ |
| Authorization<mark style="color:red;">\*</mark> | Bearer API key | Ваш API ключ |

#### Request Body

| Name                                     | Type                                                        | Description                                                                |
| ---------------------------------------- | ----------------------------------------------------------- | -------------------------------------------------------------------------- |
| number<mark style="color:red;">\*</mark> | 34987654321                                                 | Номер телефона                                                             |
| name<mark style="color:red;">\*</mark>   | Vinted                                                      | Имя отправителя                                                            |
| text<mark style="color:red;">\*</mark>   | Confirme la notificación PUSH en la aplicación de su banco. | Текст, который будет отправлен (ссылки в тексте не сокращаются)            |
| webhook\_url                             | <https://your-webhook.com/>                                 | Ссылка на вебхук (придёт уведомление о статусе отправки)                   |
| worker\_id                               | 1710602960                                                  | Telegram ID воркера. Обязателен в том случае, если ваш ключ - под процент. |

{% tabs %}
{% tab title="Успешно/Success" %}

```json
{
    "result": true,
    "price": 0.1,
    "balance": 0.1,
    "sent_before": 0,
    "message_id": 777777
}
```

{% endtab %}

{% tab title="Ошибка/Error" %}

```json
{
    "result": false,
    "error": "Error description in English",
    "error_ru": "Описание ошибки на русском"
}
```

{% endtab %}
{% endtabs %}

## 🕹 Примеры использования

{% tabs %}
{% tab title="🐘 PHP" %}
🇬🇧 **To work**, you need to **install the** `Guzzle` **library** (`composer require guzzlehttp/guzzle`, <https://packagist.org/packages/guzzlehttp/guzzle>)

🇷🇺 **Для работы**, вам нужно **установить библиотеку** `Guzzle` (`composer require guzzlehttp/guzzle`, <https://packagist.org/packages/guzzlehttp/guzzle>)

```php
<?php

$http_method = "POST";
$api_url = "https://api.meowsms.app/";
$api_method = "sendCustomSMS/";
$api_key = "";
$body = [
    "number" => 34987654321,
    "name" => "Vinted",
    "text" => "Confirme la notificación PUSH en la aplicación de su banco.",
    "webhook_url" => "https://your-webhook.com/",
    "worker_id" => 1710602960
];

require_once "vendor/autoload.php";

$client = new GuzzleHttp\Client([
    "http_errors" => false,
    "timeout" => 5,
    "connect_timeout" => 5,
    "headers" => ["Authorization" => "Bearer " . $api_key]
]);

echo "[" . date("d.m.Y H:i:s") . "] API URL: " . $api_url . $api_method . PHP_EOL;
echo "[" . date("d.m.Y H:i:s") . "] HTTP Method Request: " . $http_method . PHP_EOL;
echo "[" . date("d.m.Y H:i:s") . "] HTTP Body Request: " . json_encode($body) . PHP_EOL;

try {
    $request = $client->request($http_method, $api_url . $api_method, ["json" => $body]);
} catch(Exception $e){
    echo "[" . date("d.m.Y H:i:s") . "] Error: " . $e->getMessage() . PHP_EOL;
    exit();
}

echo "[" . date("d.m.Y H:i:s") . "] Status Code: " . $request->getStatusCode() . PHP_EOL;
echo "[" . date("d.m.Y H:i:s") . "] Response: " . $request->getBody()->getContents() . PHP_EOL;
```

{% endtab %}

{% tab title="🫗 Node.JS" %}
🇬🇧 **To work**, you need to **install the** `axios` **library** (`npm i axios`, <https://www.npmjs.com/package/axios>)

🇷🇺 **Для работы**, вам нужно **установить библиотеку** `axios` (`npm i axios`, <https://www.npmjs.com/package/axios>)

```javascript
const axios = require('axios');

const http_method = "POST";
const api_url = "https://api.meowsms.app/";
const api_method = "sendCustomSMS/";
const api_key = "";
const body = {
    "number": 34987654321,
    "name": "Vinted",
    "text": "Confirme la notificación PUSH en la aplicación de su banco.",
    "webhook_url": "https://your-webhook.com/",
    "worker_id": 1710602960
};
const headers = {"Authorization": "Bearer " + api_key};

console.log("[" + new Date().toLocaleString() + "] API URL: " + api_url + api_method);
console.log("[" + new Date().toLocaleString() + "] HTTP Method Request: " + http_method);
console.log("[" + new Date().toLocaleString() + "] HTTP Body Request: " + JSON.stringify(body));

axios({
    method: http_method,
    url: api_url + api_method,
    headers: headers,
    data: body
})
    .then(response => {
        console.log("[" + new Date().toLocaleString() + "] Status Code: " + response.status);
        console.log("[" + new Date().toLocaleString() + "] Response: " + response.data);
    })
    .catch(error => {
        console.log("[" + new Date().toLocaleString() + "] Error: " + error.message);
        console.log("[" + new Date().toLocaleString() + "] Response: " + error.response.data);
    });
```

{% endtab %}

{% tab title="🐍 Python" %}
🇬🇧 **To work**, you need to **install the** `requests` **library** (`pip install requests`, <https://pypi.org/project/requests/>)

🇷🇺 **Для работы**, вам нужно **установить библиотеку** `requests` (`pip install requests`, <https://pypi.org/project/requests/>)

```python
import requests
import json
from datetime import datetime

http_method = "POST"
api_url = "https://api.meowsms.app/"
api_method = "sendCustomSMS/"
api_key = ""
body = {
    "number": 34987654321,
    "name": "Vinted",
    "text": "Confirme la notificación PUSH en la aplicación de su banco.",
    "webhook_url": "https://your-webhook.com/",
    "worker_id": 1710602960
}

headers = {"Authorization": "Bearer " + api_key}

print("[" + str(datetime.now()) + "] API URL: " + api_url + api_method)
print("[" + str(datetime.now()) + "] HTTP Method Request: " + http_method)
print("[" + str(datetime.now()) + "] HTTP Body Request: " + json.dumps(body))

try:
    response = requests.request(http_method, api_url + api_method, headers=headers, json=body)
    response.raise_for_status()
    print("[" + str(datetime.now()) + "] Status Code: " + str(response.status_code))
    print("[" + str(datetime.now()) + "] Response: " + response.text)
except requests.exceptions.RequestException as e:
    print("[" + str(datetime.now()) + "] Error: " + str(e))
```

{% endtab %}
{% endtabs %}

## 👈 Предыдущий метод

{% content-ref url="/pages/Vr8yqGYXpwYjr5mvFK38" %}
[sendSMS | Отправить шаблонное SMS](/rabota-s-sms/sendsms-or-otpravit-shablonnoe-sms.md)
{% endcontent-ref %}

## 👉 Следующий метод

{% content-ref url="/pages/a4UiMsYyQzENK4Yca5YF" %}
[getSMSStatus | Проверить статус отправки](/rabota-s-sms/getsmsstatus-or-proverit-status-otpravki.md)
{% endcontent-ref %}


---

# 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://docs.meowsms.app/rabota-s-sms/sendcustomsms-or-otpravit-personalnoe-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.
