NAME

Net::SMS::Cellsynt - Send SMS through Cellsynt SMS gateway

SYNOPSIS

 use Net::SMS::Cellsynt;

 $sms = Net::SMS::Cellsynt->new(
        origtype=>'alpha',
        orig=>'zibri',
 	username=>'foo',
	password=>'bar',
 );

 $sms->send_sms(
   to=>$recipient,
   text=>'this text is being sent to you bu Net::SMS::Cellsynt',
 );

DESCRIPTION

Net::SMS::Cellsynt provides a perl object oriented interface to the Cellsynt SMS HTTP API, which allows you to send SMS from within your script or application.

To use this module you must have a Cellsynt account.

CONSTRUCTOR

new( parameters )

MANDATORY PARAMETERS

username => $username

Your Cellsynt username.

password => $password

Your Cellsynt password.

origtype => $origtype

Type of originator. This can be either "alpha", where you supply a string in orig parameter that the recpient will see as sender (note that the recipient cannot answer this types of SMS); numeric, where you supply a telephone number in the orig parameter and shortcode where you supply a numerical short code for a operator network.

orig => $orig

This is the "sender" the recpient sees when recieving the SMS. Depending on the value of origtype this should be a string, a telephone number or a numerical shortcode. (See origtype)

OPTIONAL PARAMETERS

ttl

This value determines how long the SMS can be tried to be delivered, in seconds. If this value is above the operator's max value, the operator's value is used. Default is not set.

concat

Setting this to a value above 1 will allow for longer SMS:es to be sent. One SMS can use 153 bytes, and with this you can send up to 6 SMS:es (918 bytes).

simulate

If set to a value other than 0, the module will output the URI that would be used if this wasn't a simulation, and return, when callng the send_sms subroutine. Default is 0.

uri

Set an alternative URI to a service implementing the Cellsynt API. Default is "https://se-1.cellsynt.net/sms.php".

METHODS

send_sms(to=>$recipient, $text=>"msg")

Will send message "msg" as an SMS to $recipient, unless the object has set the simulate object; then the send_msg will output the URI that would be used to send the SMS.

$recipient is a telephone number in international format: The Swedish telephone number 0700123456 will translate into 0046700123456 --- it is the caller's responsibility to convert numbers into this format before calling send_sms.

The $text parameter is the SMS "body". This must be encoded using ISO-8859-1. It must not be longer than 160 characters.

The method will return a hashref containing a status key. If the status key is "ok", the key "id" is also present, containing the tracking ID supplied by the SMS gateway. If the status key matches /error-\w+/, the key "message" is also present. I.e.:

{ status => 'ok', id => 'abcdef123456' }
{ status => 'error-interal', message => 'example error message' }
{ status => 'error-gateway', message => 'example error message' }

The module differentiate between errors from the SMS gateway provider and internal errors. The message in error-gateway comes directly from the provider.

sender(origtype=>$origtype, orig=>$orig)

Update sender. You can set either or both values. See constructor documentation for valid values.

SEE ALSO

http://cellsynt.com/

AVAILABILITY

Latest stable version is available on CPAN. Current development version is available on https://github.com/olof/Net-SMS-Cellsynt.

COPYRIGHT

Copyright (c) 2009-2011, 2015, Olof 'zibri' Johansson <olof@cpan.org> All rights reserved.

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