Net::SMS::WorldText - Send SMS messages via the World-Text HTTP API
use Net::SMS::WorldText; my $wt = Net::SMS::WorldText->new(user => "testuser", pass => "123456"); $wt->send( message => "A thing of beauty is a joy forever", dest => "+15550123456", );
Perl module to send sms'es and manage bulk-sending groups via World-Text's HTTP api on sms.world-text.com.
All methods below will confess upon any failure.
my $wt = Net::SMS::WorldText->new(user => "username", pass => "password" [, proxyapi => 1]);
Creates an object for you to use. Specify proxy => 1 if you cannot connect to port 1082 on sms.world-text.com, it will then use the proxy api ont he standard https port of www.world-text.com.
If you need to use a proxy to access the world-text service, you can set it in the underlying LWP::Useragent object as follows:
Checks whether you can connect.
$wt->send(message => "Hello, world", dest => "+15550123456" [, srcaddr => "SMSAlert"] [, multipart => 1] [, callback => "url"]);
Send a message to one or more recipients. To send the message to more than one recipient, pass an arrayref as dest. srcaddr can be any source address assigned to your account. Messages that are too long will be split, multipart specifies the maximum number of parts. The callback url will be called when the message status changes. It will receive three POST parameters: error (en arror code), msgid (of this message) and state (DELIVRD, EXPIRED, UNDELIV, ACCEPTD, REJECTD).
This method returns an reference to an array of arrayrefs. Each of those refs points to a 2-element array (msgid, balance) of the message sent and the credit balance left after sending it.
my $credits = $wt->credits;
Returns your SMS credit balance.
my $result = $wt->query($msgid);
Returns the current status of your message.
my $group = $wt->group(1042);
Returns a Net::SMS::WorldText::Group object that represents a group with that group id. You can find these id's in the World-Text web interface.
my $group = create_group(name => "Testgroup", srcaddr => "SMSAlert", pin => "1234");
Creates a new bulk send group and returns it. Name should not be longer than 20 characters and may not contain spaces, srcaddr can be any of the source addresses available to your account.
Bulk groups make it easy to send messages to the same set of people frequently. These groups can be managed and addressed with the following methods.
$group->add("+15550123456", "Dennis Kaarsemaker");
Adds a member to the group. The name should not be longer than 20 characters and will be truncated.
Removes a member, only phonenumbers can be passed to this call.
Removes all members from the group.
Returns all phonenumbers in the group.
Like list, but returns a has mapping names to numbers.
$group->send("Hello, group!" [, srcaddr => "SMSAlert"] [, multipart => 1]);
Sends a message to all members of the group. Returns the amount of sms'es sent.
Deletes the group from the World-Text system.
Github source: http://github.com/seveas/Net-SMS-WorldText
Dennis Kaarsemaker, <email@example.com>
Copyright (C) 2012 by Dennis Kaarsemaker
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.