1.0.8 • Published 5 years ago

serwersms.pl v1.0.8

Weekly downloads
68
License
SerwerSMS.pl
Repository
-
Last release
5 years ago

Klient JS do komunikacji zdalnej z API v2 SerwerSMS.pl / Client JS for remote communication with the API v2 SerwerSMS.pl

Konsola/Console

    npm install serwersms.pl
    npm install request

Zalecane jest, aby komunikacja przez HTTPS API odbywała się z loginów utworzonych specjalnie do połączenia przez API. Konto użytkownika API można utworzyć w Panelu Klienta → Ustawienia interfejsów → HTTPS XML API → Użytkownicy.

It is recommended that communication via HTTPS API was done with logins created specifically to connect to the API. User Account API , you can create a Customer Panel → Settings → HTTPS interfaces XML API → Users.

Wysyłka SMS / SMS delivery

        var module = require('serwersms.pl');

        try{

            var object = module.serwerSMS('demo','demo');

            var messages = object.oMessages;

            // SMS FULL

            var params = new Object();
            
            params.phone  = ['500600700'];
            params.text   = 'test';
            params.sender = 'INFORMACJA'; 
            params.details = true;
            params.test = true;

            var callback = function(data){

                var obj = JSON.parse(data);
                console.log(obj);
            }
            messages.sendSms(params,callback);

            // SMS ECO

            var params = new Object();

            params.phone  = ['500600700'];
            params.text   = 'test';
            params.sender = null; 
            params.details = true;
            params.test = true;

            var callback = function(data){

                var obj = JSON.parse(data);
                console.log(obj);
            }
            messages.sendSms(params,callback);

            // VOICE from text

            var params = new Object();

            params.phone  = ['500600700'];
            params.text   = 'test voice';
            params.details = true;
            params.test = true;

            var callback = function(data){

                var obj = JSON.parse(data);
                console.log(obj);
            }
            messages.sendVoice(params,callback);

            // MMS
            var files = object.oFiles;

            var callback = function(data){

                var list = JSON.parse(data);
                var params = new Object();
                //console.log(list);
                params.phone   = ['500600700'];
                params.title    = 'MMS Title';
                params.file_id = list.items[0].id;
                params.details = true;
                params.test    = false;
                messages.sendMms(params,function(response){
                    console.log('Error: '+response);
                });

            }
            files.index('mms',callback);

        }catch(err) {
            console.log(err.message);
        }

Wysyłka spersonalizowanych SMS / Shipping personalized SMS

	var module = require('serwersms.pl');
        
        try{

            var object = module.serwerSMS('demo','demo');

            var messages = object.oMessages;

            var params = new Object();

            params.messages = 
            [
                { phone:'500600700',text:'pierwszy' },
                { phone:'500600700',text:'drugi' }
            ];

            params.sender = 'INFORMACJA'; 
            params.details = true;
            params.test = true;

            var callback = function(data){

                var obj = JSON.parse(data);
                console.log(obj);
            }
            messages.sendPersonalized(params,callback);

        }catch(err ) {
            console.log(err.message);
        }

Pobieranie raportów doręczeń / Downloading delivery reports

	var module = require('serwersms.pl');

        try{

            var object = module.serwerSMS('demo','demo');

            var messages = object.oMessages;

            var params = new Object();

            params = {id:['c7d505d346','4fbf1cd942']};
            var callback = function(data){

                var obj = JSON.parse(data);
                console.log(obj);
            }
            messages.reports(params,callback);

        }catch(err ) {
            console.log(err.message);
        }

Pobieranie wiadomości przychodzących / Downloading incoming messages

	var module = require('serwersms.pl');

        try{

            var object = module.serwerSMS('demo','demo');

            var messages = object.oMessages;

            var params = new Object();

            params.type = 'eco';
            var callback = function(data){

                var obj = JSON.parse(data);
                console.log(obj);
            }
            messages.recived(params,callback);

        }catch(err ) {
            console.log(err.message);
        }
1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago