NAME
SMS::Send::UK::GovUkNotify
VERSION
Version 0.0.1
SYNOPSIS
# Instantiate a sender object
my $sender = SMS::Send->new(
'UK::GovUkNotify',
_template_id => 'template_id',
_key => 'key'
);
# Send a message
my $sent = $sender->send_sms(
to => '0000000000' # In the format: +447312345679,
text => 'Dummy text'
);
DESCRIPTION
SMS::Send::UK::GovUkNotify is a SMS::Send driver that provides SMS message sending via the Gov.Uk Notify service.
Usage of this module requires the definition of a template with a single placeholder ((text)) - the content of the text message sent will be substituted in place of the placeholder
CAVEATS
You need a Gov.Uk Notify account in order to use this driver
METHODS
new
# Instantiate a sender object
my $sender = SMS::Send->new(
'UK::GovUkNotify',
_key => 'key'
);
The new
constructor accepts one parameter, which is required
The return value is a SMS::Send::UK::GovUkNotify
object.
- 'UK::GovUkNotify'
-
The parameter identifying the driver name
- _key
-
The
_key
parameter is the full API key, as supplied by Gov.Uk Notify https://docs.notifications.service.gov.uk/rest-api.html#api-keys - _template_id
-
The
_template_id
parameter as supplied by Gov.Uk Notify https://docs.notifications.service.gov.uk/rest-api.html#template-id-required
clean_to
# Examine a passed phone number and attempt to return the number
# in a format supported by the API,
# croak if a conversion is not possible
my $intl_number = clean_to($source_number);
The clean_to
method accepts a single required parameter:
The return value is the number in international format
- source_number
-
A string containing the number to be cleaned
send_sms
# Send a message
my $sent = $sender->send_sms(
text => 'dummy_text'
to => '0000000000' # In the format: +447312345679
);
The send_sms
method accepts two parameters, both of which are required.
The return value is a 0 or 1 representing false or true, indicating whether the send was successful.
- text
-
Although this is a required parameter by Send::SMS, we don't actually use it. The Gov.Uk Notify service uses a template ID (which is passed in our constructor) and placeholder values. So we just silently ignore what was passed in 'text'
- to
-
A numeric string representing the phone number of the recipient, in a valid international format (i.e. country code followed by the number)
AUTHOR
Andrew Isherwood <andrew.isherwood at ptfs-europe.com>
BUGS
Please report any bugs or features to andrew.isherwood at ptfs-europe.com
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc SMS::Send::UK::GovUkNotify
COPYRIGHT & LICENSE
Copyright (C) 2020 PTFS Europe https://www.ptfs-europe.com/
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself
Additionally, you are again reminded that this software comes with no warranty of any kind, including but not limited to the implied warranty of merchantability.
ANY use may result in charges on your Gov.Uk Notify bill, and you should use this software with care. The author takes no responsibility for any such charges accrued.
ACKNOWLEDGEMENTS
Many thanks to the authors of the following modules that served as inspiration for this one: