# Отправка SMS

Если клиент указал при подписке телефон, то есть возможность реализации своей логики оптравки СМС черех хук

При наличии модуля [«Короткие ссылки»](https://www.hostcms.ru/documentation/modules/shortlink/), будет формироваться удобная короткая ссылка для смс, иначе обычная ссылка на товар

{% code lineNumbers="true" %}

```php
class My_ASMP_Subscription
{
	/**
	 * $object - ASMP_Subscription_Model
	 * $args - $phone, $shortlink
	*/
	static public function sendSms($object, $args)
	{
		$link = $args[0];

		$oShop_Item = $object->Shop_Item;
		$phone = $object->phone;

		$message = sprintf("%s %s %s", ($object->type ? "Снизилась цена" : "Поступил товар"), $oShop_Item->name, $link);

		// Ваш фунционал отправки смс
	}
}

Core_Event::attach('ASMP_Subscription.sendSms', array('My_ASMP_Subscription', 'sendSms'));
```

{% endcode %}

{% hint style="warning" %}
**Внимание сам модуль не осуществляет отправку смс**
{% endhint %}


---

# 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://support.morozovpimnev.ru/subscription/otpravka-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.
