vis/esputnik_client_l5

1.1.2 2017-05-07 20:30 UTC

This package is not auto-updated.

Last update: 2024-11-10 02:49:25 UTC


README

eSputnik API library

Execute

    composer require "vis/esputnik_client_l5":"1.*"

Add eSputnikClientServiceProvider to ServiceProviders in config/app.php

   Vis\eSputnikClient\eSputnikClientServiceProvider::class,

Publish config and define your login\password in it

    php artisan vendor:publish --tag=esputnik-client-config --force

Usage

    use Vis\eSputnikClient\eSputnikClient;

Methods example

    $client = new eSputnikClient();

    $result  = $client->getVersion();

Send identical email to every recipient with prepared template as %TEMPLATE.variable_name%

    $letterTemplate = 'email_send';
    $recipient = ['email@email.com'];
    $params    = ['name' => 'k.glushchenko', 'message' => 'test_letter'];

    $result  = $client->sendPreparedMessage($letterTemplate, $recipient, $params);

Send identical sms to every recipient with prepared template Params in template are defined as %TEMPLATE.variable_name%

    $letterTemplate = 'sms_send';
    $recipient = ['+38(000)-000-00-00'];
    $params    = ['name' => 'k.glushchenko', 'message' => 'test_letter'];

    $result  = $client->sendPreparedMessage($letterTemplate, $recipient, $params, false);

Send parametrized email for every recipient with prepared template. Params in template are defined as $!data.get('variable_name')

    $letterTemplate = 'email_smartsend';
    $recipient = ['email1@email.com', 'email2@email.com'];
    $params    = [
        ['name' => 'name_for_email1', 'message' => 'message_for_email1'],
        ['name' => 'name_for_email2', 'message' => 'message_for_email2']
    ];

    $result  = $client->sendExtendedPreparedMessage($letterTemplate, $recipient, $params);

Send parametrized sms for every recipient with prepared template. Params in template are defined as $!data.get('variable_name')

    $letterTemplate = 'sms_smartsend';
    $recipient = ['+38(000)-000-000-00', '+38(000)-000-00-01'];
    $params    = [
        ['name' => 'name_for_00', 'message' => 'message_for_00'],
        ['name' => 'name_for_01', 'message' => 'message_for_01']
    ];

    $result  = $client->sendExtendedPreparedMessage($letterTemplate, $recipient, $params, false);

Check message status by message id

    $result = $client->getInstantMessageStatus($id);

Send instant email

    $from       = '"organization" <your@account.com>';
    $subject    = 'subject';
    $htmlText   = '<html><body><h1>test!</h1></body></html>';
    $emails     = ['email@email.com'];

    $result  = $client->sendEmail($from, $subject, $htmlText,$emails);

Check email status by message hash

    $result = $client->getInstantEmailStatus($hash);

Send instant email

     $from   = 'your_sms_sender';
     $text   = 'test';
     $phones = ["+38(000)-000-00-00"];

     $result  = $client->sendSMS($from, $text, $phones);

Check sms status by message hash

    $result = $client->getInstantSmsStatus($hash);