SMS Mailing Integration (SMS.ru) with Website
SMS.ru is one of the popular SMS mailing services for Russian websites. Simple HTTP API, pay per message, and support for registering sender names.
Sending SMS via API
$response = Http::get('https://sms.ru/sms/send', [
'api_id' => env('SMSRU_API_KEY'),
'to' => $phone, // format: 79001234567
'msg' => "Your verification code: {$code}",
'json' => 1,
'from' => 'MyShop' // sender name (registration required)
]);
$result = $response->json();
// $result['sms'][$phone]['status'] === 'OK' → success
// $result['sms'][$phone]['status_code'] → error code on failure
Wrapper Class
class SmsRuService
{
public function send(string $phone, string $message): bool
{
$phone = preg_replace('/[^0-9]/', '', $phone);
if (str_starts_with($phone, '8')) {
$phone = '7' . substr($phone, 1);
}
$response = Http::get('https://sms.ru/sms/send', [
'api_id' => config('services.smsru.api_key'),
'to' => $phone,
'msg' => $message,
'json' => 1
]);
return $response->json("sms.{$phone}.status") === 'OK';
}
public function getBalance(): float
{
return Http::get('https://sms.ru/my/balance', [
'api_id' => config('services.smsru.api_key'),
'json' => 1
])->json('balance');
}
}
Typical Use Cases
- OTP codes for registration and login
- Order status notifications
- Appointment/booking reminders
- Request confirmation
Balance Check and Alerts
Zero balance = messages don't arrive = users don't receive OTP = can't log in. Balance monitoring with Telegram alerts when dropping below threshold is essential.
Integration timeframe: a few hours.







