SMS::Send::UK::GovUkNotify
Version 0.0.1
# 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' );
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
You need a Gov.Uk Notify account in order to use this driver
# Instantiate a sender object my $sender = SMS::Send->new( 'UK::GovUkNotify', _key => 'key' );
The new constructor accepts one parameter, which is required
new
The return value is a SMS::Send::UK::GovUkNotify object.
The parameter identifying the driver name
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
_key
The _template_id parameter as supplied by Gov.Uk Notify https://docs.notifications.service.gov.uk/rest-api.html#template-id-required
_template_id
# 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:
clean_to
The return value is the number in international format
A string containing the number to be cleaned
# 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.
send_sms
The return value is a 0 or 1 representing false or true, indicating whether the send was successful.
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'
A numeric string representing the phone number of the recipient, in a valid international format (i.e. country code followed by the number)
Andrew Isherwood <andrew.isherwood at ptfs-europe.com>
<andrew.isherwood at ptfs-europe.com>
Please report any bugs or features to andrew.isherwood at ptfs-europe.com
andrew.isherwood at ptfs-europe.com
You can find documentation for this module with the perldoc command.
perldoc SMS::Send::UK::GovUkNotify
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.
Many thanks to the authors of the following modules that served as inspiration for this one:
To install SMS::Send::UK::GovUkNotify, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SMS::Send::UK::GovUkNotify
CPAN shell
perl -MCPAN -e shell install SMS::Send::UK::GovUkNotify
For more information on module installation, please visit the detailed CPAN module installation guide.