Dennis Kaarsemaker > Net-SMS-WorldText-1.3 > Net::SMS::WorldText

Download:
Net-SMS-WorldText-1.3.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 1.3   Source  

NAME ^

Net::SMS::WorldText - Send SMS messages via the World-Text HTTP API

SYNOPSIS ^

    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",
    );

DESCRIPTION ^

Perl module to send sms'es and manage bulk-sending groups via World-Text's HTTP api on sms.world-text.com.

METHODS ^

All methods below will confess upon any failure.

new

    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:

    $wt->{ua}->proxy(['http','https'], 'http://my.proxy.host:3128');

ping

    $wt->ping;

Checks whether you can connect.

send

    $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.

credits

    my $credits = $wt->credits;

Returns your SMS credit balance.

query

    my $result = $wt->query($msgid);

Returns the current status of your message.

group

    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.

create_group

    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.

GROUP METHODS ^

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.

add

    $group->add("+15550123456", "Dennis Kaarsemaker");

Adds a member to the group. The name should not be longer than 20 characters and will be truncated.

del

    $group->del("+15550123456");

Removes a member, only phonenumbers can be passed to this call.

delall

    $group->delall;

Removes all members from the group.

list

    $group->list;

Returns all phonenumbers in the group.

details

    $group->details;

Like list, but returns a has mapping names to numbers.

send

    $group->send("Hello, group!" [, srcaddr => "SMSAlert"] [, multipart => 1]);

Sends a message to all members of the group. Returns the amount of sms'es sent.

remove

    $group->remove;

Deletes the group from the World-Text system.

SEE ALSO ^

World-Text http api documentation

Github source: http://github.com/seveas/Net-SMS-WorldText

AUTHOR ^

Dennis Kaarsemaker, <dennis@kaarsemaker.net>

COPYRIGHT AND LICENSE ^

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.

syntax highlighting: