NAME

SMS::Send::KR::CoolSMS - An SMS::Send driver for the coolsms.co.kr service

VERSION

version 1.003

SYNOPSIS

use SMS::Send;

# create the sender object
my $sender = SMS::Send->new('KR::CoolSMS',
    _api_key    => 'XXXXXXXXXXXXXXXX',
    _api_secret => 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
    _from       => '01025116893',
);

# send a message
my $sent = $sender->send_sms(
    text  => 'You message may use up to 88 chars and must be utf8',
    to    => '01012345678',
);

unless ( $sent->{success} ) {
    warn "failed to send sms: $sent->{reason}\n";

    # if you want to know detail more, check $sent->{detail}
    use Data::Dumper;
    warn Dumper $sent->{detail};
}

# Of course you can send LMS
my $sender = SMS::Send->new('KR::CoolSMS',
    _api_key    => 'XXXXXXXXXXXXXXXX',
    _api_secret => 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
    _type       => 'lms',
    _from       => '01025116893',
);

# You can override _from or _type

# send a message
my $sent = $sender->send_sms(
    text     => 'You LMS message may use up to 2000 chars and must be utf8',
    to       => '01025116893',
    _from    => '02114',             # you can override $self->_from
    _type    => 'LMS',               # you can override $self->_type
    _subject => 'This is a subject', # subject is optional & up to 40 chars
);

# check the balance
my $balance = $sender->balance;
if ( $balance->{success} ) {
    printf "cash: \n", $banalce->{detail}{cash};
    printf "point: \n", $banalce->{detail}{point};
}

DESCRIPTION

SMS::Send driver for sending SMS messages with the coolsms SMS service. You'll need IO::Socket::SSL at least 1.84 version to use SSL support for HTTPS.

ATTRIBUTES

_url

DO NOT change this value except for testing purpose. Default is "api.coolsms.co.kr/1/send".

_agent

The agent value is sent as the "User-Agent" header in the HTTP requests. Default is "SMS-Send-KR-CoolSMS/#.###".

_timeout

HTTP request timeout seconds. Default is 3.

_api_key

Required. coolsms API key for REST API.

_api_secret

Required. coolsms API secret for REST API.

_from

Required. Source number to send sms.

_type

Type of sms. Currently SMS and LMS are supported. Default is "SMS".

_country

Country code to route the sms. This is for destination number. Default is "KR".

_delay

Delay second between sending sms. Default is 0.

METHODS

new

This constructor should not be called directly. See SMS::Send for details.

send_sms

This constructor should not be called directly. See SMS::Send for details.

Available parameters are:

  • text

  • to

  • _from

  • _country

  • _type

  • _delay

  • _subject

  • _epoch

balance

This method checks the balance.

SEE ALSO

AUTHOR

Keedi Kim - 김도형 <keedi@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Keedi Kim.

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