The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

SMS::Send::WebSMS - SMS::Send driver for the WebSMS service

VERSION

version 0.001

SYNOPSIS

use SMS::Send;
my $sender = SMS::Send->new('WebSMS',
    _login    => 'foo',
    _password => 'bar',
);

my $sent = $sender->send_sms(
    'to'             => '+43123123456789',
    'text'           => 'This is a test message',
    '_senderAddress' => '43321987654321',
);

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

DESCRIPTION

This module currently uses the REST API with JSON.

METHODS

send_sms

Is called by "send_sms" in SMS::Send and passes all arguments starting with an underscore to the request having the first underscore removed as shown in the SYNOPSIS above. The list of supported parameters can be found on the WebSMS REST API website.

Returns true if the message was successfully sent.

Returns false if an error occurred and $@ is set to a hashref of the following info:

{
    clientMessageId => "...",
    transferId      => "...",
    statusMessage   => "...",
    statusCode      => "...",
}

Throws an exception if a fatal error like a http timeout in the underlying connection occurred.

AUTHOR

Alexander Hartmaier <abraxxa@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2015 by Alexander Hartmaier.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.