SMS::Send::Mocean - SMS::Send driver to send messages via Mocean, https://moceanapi.com/.
use SMS::Send;
my $gateway = SMS::Send->new(
'Mocean',
'_api_key' => 'foo',
'_api_secret' => 'bar'
);
$gateway->send_sms(
to => '+60123456789',
ext => 'Hello',
_from => 'foobar'
);
SMS::Send::Mocean is a driver for SMS::Send to send message via Mocean, https://moceanapi.com/.
Source repository at https://github.com/kianmeng/send-sms-mocean.
How to contribute? Follow through the CONTRIBUTING.md document to setup your development environment.
Construct a new SMS::Send instance.
my $gateway = SMS::Send->new(
'Mocean',
'_api_key' => 'foo',
'_api_secret' => 'bar'
);
Compulsory. The API access key used to make request through web service.
Compulsory. The API secret key.
Send the SMS text to a mobile user.
# Default parameters with XML response format if the '_resp_format' field
# is not defined.
$gateway->send_sms(
to => '+60123456789',
ext => 'Hello',
_from => 'foobar',
);
# With JSON response format.
$gateway->send_sms(
to => '+60123456789',
ext => 'Hello',
_from => 'foobar',
_resp_format => 'json',
);
Compulsory. The required field needed by SMS::Send. Only accept leading-plus number in the format of "+99 999 9999".
Compulsory. The required field needed by SMS::Send. The content of the SMS message. Depends on the language of the content, there is a limit of characters that can be sent.
Compulsory. The login username of the Mocean API portal.
Optional. Additional parameters that can be used when sending SMS. Check the Mocean API documentation on the available parameters. Due to the design constraints of SMS::Send::Driver, all parameters name must start with underscore. For example, '_resp_format'. This driver will convert the parameter name to equivalent format used by Mocean. In this case, '_foo_bar' will be formatted as 'mocean-resp-format'.
$gateway->send_sms(
to => '+60123456789',
ext => 'Hello',
_from => 'foobar',
_resp_format => 'json',
_charset => 'utf-8',
);
Kian Meng, Ang kianmeng@cpan.org
This software is Copyright (c) 2019 Kian Meng, Ang.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)