SMS::API::CMTelecom - SMS API for cmtelecom.com
Version 0.01
use SMS::API::CMTelecom; my $sms = SMS::API::CMTelecom->new( product_token => '00000000-0000-0000-0000-000000000000', ); $sms->send( sender => '00480000111111111', message => 'please call me!', recipients => '00490000000000000', reference => 293854, ); # bulk send to many recipients: $sms->send( sender => '00480000111111111', message => 'please call me!', recipients => ['00490000000000000', '00480000000000', '004300021651202'], reference => 293854, ); my $number = '00480000111111111'; if ($sms->validate_number($number)) { print "$number is a valid phone number.\n" } else { print "$number is no valid phone number.\n" } my $number_details = $sms->number_details($number); print "$number was ported.\n" if $number_details->{ported};
Instantiate and initialise object with the following options:
product_token => $product_token
The product token is required to authenticate with the CM Telecom API.
sender => $sender
Optional. SMS sender number.
message => $message
Mandatory. Message text to send.
recipients => $recipients
Mandatory. May be a scalar containing one phone number or an array reference holding multiple scalars containing one phone number each.
Optional if already given as parameter to new. Can also be set globally when construction the object with new().
new
new()
If sending fails, undef is returned, otherwise a hashref with some status information:
undef
{ messages => [ { messageDetails => undef, parts => 1, reference => 51314, status => "Accepted", to => "0049123456784510", }, ], }
You can retrieve the error message via
my $msg = $sms->error_message();
Checks if the given phone number is valid and provides additional information, e.g. how the number should be formatted. Returns 1 if the number is valid, a false value otherwise.
Returns carrier, country, timezone and number type information about the given number.
Returns the last set error message.
Dominic Sonntag, <dominic at s5g.de>
<dominic at s5g.de>
Please report any bugs or feature requests on Github: https://github.com/sonntagd/SMS-API-CMTelecom/issues
Copyright 2017 Dominic Sonntag.
This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at:
http://www.perlfoundation.org/artistic_license_2_0
To install SMS::API::CMTelecom, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SMS::API::CMTelecom
CPAN shell
perl -MCPAN -e shell install SMS::API::CMTelecom
For more information on module installation, please visit the detailed CPAN module installation guide.