PHP code example of irnoti / laravel-sms-panel-api

1. Go to this page and download the library: Download irnoti/laravel-sms-panel-api library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

irnoti / laravel-sms-panel-api example snippets


Irnoti::sms()->send(lineId: 1, to: '09121234567', text: 'Your order has shipped!');

use Irnoti\SmsPanelApi\Facades\Irnoti;
use Irnoti\SmsPanelApi\Exceptions\IrnotiApiException;

try {
    $line = Irnoti::lines()->list()[0]['id'];

    $sent = Irnoti::sms()->send(
        lineId: $line,
        to: '09121234567',
        text: 'Your verification code is 48213.',
        idempotencyKey: 'otp-9921',
    );
    // ['batchId' => '918', 'count' => 1, 'totalPrice' => '980', 'replayed' => false]
} catch (IrnotiApiException $e) {
    report($e);
}

// One or many recipients and/or phonebook groups (max 10,000 numbers; Persian digits and +98 are fine).
Irnoti::sms()->send(lineId: 1, text: 'Flash sale!', to: ['09121234567', '09351234567'], groupIds: [12]);

// Cost without sending or charging.
Irnoti::sms()->quote(lineId: 1, text: 'Flash sale!', to: '09121234567');   // count, parts, totalPrice

// Later: 1 minute – 60 days ahead. The cost is reserved immediately.
Irnoti::sms()->send(lineId: 1, text: 'Reminder', to: '09121234567', scheduledAt: now()->addDay());

// Gradual: release 500 messages every 10 minutes (combinable with scheduledAt).
Irnoti::sms()->send(lineId: 1, text: 'Hi', groupIds: [12], gradual: ['chunkSize' => 500, 'intervalMinutes' => 10]);

// Approved template (pattern) — OTP / transactional.
Irnoti::sms()->pattern(code: 'k3f9a2', to: '09121234567', params: ['code' => '4821']);

// Critical alerts over the platform's own routes with automatic provider failover (≤ 200 recipients).
Irnoti::sms()->sos(to: ['09121234567'], text: 'Service down');

Irnoti::messages()->list(take: 50);              // newest first; page with before: <last id>
Irnoti::messages()->get(5521);                   // status: queued | sent | delivered | failed
Irnoti::messages()->check(5521);                 // ask the operator now (30/min)

Irnoti::batches()->scheduled();
Irnoti::batches()->cancel(918);                  // refunds what has not been released
Irnoti::batches()->pause(918);
Irnoti::batches()->resume(918);

Irnoti::lines()->list();                         // ids to use as lineId

Irnoti::wallet()->balance();        // ['balance' => '1840000', 'currency' => 'IRR']
Irnoti::wallet()->transactions();

$group = Irnoti::phonebook()->createGroup('VIP');                     // 409 if the name exists
Irnoti::phonebook()->addContacts($group['id'], [['mobile' => '09121234567', 'name' => 'Ali']]);
Irnoti::phonebook()->importCsv($group['id'], file_get_contents('contacts.csv'));
Irnoti::phonebook()->contacts($group['id'], take: 100, q: 'Ali');
Irnoti::phonebook()->updateContact(7, ['company' => 'Acme', 'optedOut' => false]);
Irnoti::phonebook()->deleteContact(7);
Irnoti::phonebook()->groups();
Irnoti::phonebook()->deleteGroup($group['id']);

Irnoti::services()->prices();

$body = ['province' => 'tehran', 'count' => 5000, 'text' => 'Sale today'];
Irnoti::services()->quote('regional', $body);
$order = Irnoti::services()->regional($body);

Irnoti::services()->targeted(['gender' => 'female', 'ageFrom' => 20, 'ageTo' => 35, 'count' => 1000, 'text' => '…']);
Irnoti::services()->peyamap(['operator' => 'mci', 'areas' => [['name' => 'Valiasr', 'count' => 500]], 'text' => '…']);
Irnoti::services()->smart(['09121234567'], 'Hello');
Irnoti::services()->messenger('bale', ['09121234567'], 'Hello');   // bale | eitaa | whatsapp
Irnoti::services()->voice(['09121234567'], 'Your order is ready');
Irnoti::services()->international(['+4915112345678'], 'Hello');

Irnoti::services()->get('regional', $order['id']);
Irnoti::services()->refresh('regional', $order['id']);
Irnoti::services()->cancel('regional', $order['id']);              // only before the provider starts

Irnoti::linkTracker()->send(
    lineId: 1, text: 'Sale: {link}', url: 'https://shop.example/sale',
    to: ['09121234567'], variants: ['Big sale: {link}'], holdoutPercent: 20,
);
Irnoti::linkTracker()->campaigns();
Irnoti::linkTracker()->campaign($batchId);   // clicks per link
Irnoti::linkTracker()->holdouts();
Irnoti::linkTracker()->sendNow($holdoutId);

Irnoti::numberBanks()->list();
Irnoti::numberBanks()->facets(2);
Irnoti::numberBanks()->quote(bankId: 2, count: 1000, lineId: 1, text: 'Promo', filters: ['operator' => 'mci']);
Irnoti::numberBanks()->send(bankId: 2, count: 1000, lineId: 1, text: 'Promo', filters: ['operator' => 'mci'], idempotencyKey: 'promo-1');

$s = Irnoti::verify()->create(to: '09121234567', options: ['length' => 6, 'ttlSec' => 300, 'callbackUrl' => 'https://app.example/verified']);
Irnoti::verify()->get($s['id']);
Irnoti::verify()->cancel($s['id']);
Irnoti::verify()->list(); Irnoti::verify()->stats(); Irnoti::verify()->info();

Irnoti::bots()->list();
Irnoti::bots()->send($botId, to: [...], message: [...], idempotencyKey: 'msg-1');   // 202, queued
Irnoti::bots()->otp($botId, to: [...], length: 6);
Irnoti::bots()->subscribers($botId); Irnoti::bots()->messages($botId); Irnoti::bots()->stats($botId);
Irnoti::bots()->shopOrders($botId, status: 'new');

Irnoti::voip()->price();
Irnoti::voip()->call(from: '09121234567', to: '09351234567');
Irnoti::voip()->calls();

use Irnoti\SmsPanelApi\Support\Webhook;

$event = Webhook::parse($request->getContent(), $request->header('X-Irnoti-Signature'), config('services.irnoti.webhook_secret'));
// ['id' => '4821', 'event' => 'message.delivered', 'createdAt' => '…', 'data' => ['messageId' => '5521', 'status' => 'delivered', …]]

try {
    Irnoti::sms()->send(lineId: 1, to: '0912', text: 'hi');
} catch (IrnotiApiException $e) {
    $e->statusCode();   // 400
    $e->errorCode();    // "invalid_recipients" ('' for plain 401/403/404)
    $e->details();      // ['0912']  — invalid numbers / missing template params / field errors
    $e->getMessage();
}

use Irnoti\SmsPanelApi\Facades\Irnoti;

$client = Irnoti::withApiKey($customer->irnoti_api_key);

$client->sms()->send(to: $customer->mobile, message: 'Welcome aboard!');