Send an SMS Using Perl
The Textmagic API Perl wrapper can save you a lot of time, as it includes all the necessary API commands and tests. It only takes a few seconds to download it from GitHub and to install it into your own app or software. After installation, you’ll then be able to send text messages.
Get it now on GitHubInstallation Instructions
- Download the latest version of the wrapper from GitHub.
- Run the following commands:
- perl Makefile.pl
- make
- make install
- use Net::SMS::TextmagicRest in your code.
Requirements
The Perl wrapper for Textmagic API has the following requirements:
- Perl 5.6 or higher
- Rest::Client
- JSON
- Carp
- String::CamelCase
- Test::MockModule (for running tests only; however, you could use the wrapper without that dependency)
Sending an SMS using Perl (an example)
Below is an example of how to send a text message using Perl.
use Net::SMS:TextmagicRest my $tm = Net::SMS::TextmagicRest->new( username => "test", token => "my-api-key", ); print "Enter SMS text: "; chomp(my $sendingText = <STDIN>); print "\n\nEnter phone numbers, separated by [ENTER].\n"; my @sendingPhones = (); my $phone; do { $phone = readNumber('Phone'); push(@sendingPhones, $phone) } until (!$phone); pop(@sendingPhones); my $result = $tm->send( text => $sendingText, phones => \@sendingPhones, ); print "Message session $result->{id} successfully sent\n";
Support
If you need help with the wrapper, or if you have any suggestions for improvements and/or if you have any enquiries regarding the Perl SMS API, please contact us by emailing [email protected].