PrePAN

Sign in to PrePAN

SMS::Send::RedSMS SMS::Send driver to send messages via RedSMS.ru

Good

Synopsis

    use SMS::Send;
    my $api = SMS::Send->new('RedSMS',
        _login    => 'your login',
        _api => 'your api key',
        _sender => 'your approved sender name',
    );

    my $sent = $api->send_sms(
        'to'             => '+70001234567',
        'text'           => 'This is a test message'
    );

    # Did the send succeed.
    if ( $sent ) {
        print "Message sent ok\n";
    } else {
        print 'Failed to send message: ', $@, "\n";
    }

    # Get info about the last sent sms
    my $info = $api->{OBJECT}->{status};

    # Get sms-id of the last sent sms
    print $api->{OBJECT}->{status}->{id};

    # Show your balance
    print $api->balance();

    # Get sms delivery status
    $status = $api->status('sms-id 1', 'sms-id 2', ..., 'sms-id N');
    print $status->{'sms-id 1'};

    # Show error text of the last failed operation
    # Caution: in Russian (as RedSMS.ru is a Russian-oriented service)!
    print $@;

Description

SMS::Send driver for RedSMS - https://redsms.ru/

This is not intended to be used directly, but instead called by SMS::Send (see synopsis above for a basic illustration, and see SMS::Send's documentation for further information).

The driver uses the RedSMS HTTP API mechanism (lk.redsms.ru version) with JSON.

Be aware! The driver is intended only for lk.redsms.ru (not cp.redsms.ru) version of API.

Comments

Please sign up to post a review.