SMS::MessageBird - SMS sending module that uses the MessageBird gateway.
This module is a Perl interface for interacting with the MessageBird SMS Gateway API.
my $messagebird = SMS::MessageBird->new(
api_key => 'test_abcdefghijklmnopqrstuvwxyz',
originator => 'Me!', # Specify here, or use the originator() method.
# Optional. This can be updated at any time, but only needs to be set once.
my $result = $messagebird->sms->send(
recipients => qw( 07123456789 ),
message => 'This is my SMS text', # synonym for 'body'
This module provides a simple Perl interface to the MessageBird JSON API. It deals with the JSON stuff allowing you to get back useful Perl data.
To use this module you'll need an account with MessageBird. Once you have that, you can create an API key on your account and feed it to this module which will authenticate with their API using that key.
The methods implmented acceept the paramteres as named in the MessageBird API documentation which can be found at the MessageBird Developer Documentation. If you're using this distribution you should be familiar with the API documentation.
This distribution provides several modules which are used by the SMS::MessageBird object. Each module implements a section of the api.
Use of the functionality of a given module, is done via the accessor for that module, thus:
my $result = $messagebird->sms->send(...);
my $balance = $messagebird->balance->get();
This is the accessor for the SMS::MessageBird::API::SMS module. Used for sending/receiving SMS messages.
This is the accessor for the SMS::MessageBird::API::Voice module. Used for sending/receiving Text-to-Voice messages.
This is the accessor for the SMS::MessageBird::API::Verify module. Used to implement the MessageBird number verification API.
This is the accessor for the SMS::MessageBird::API::HLR module. Used to send Network Queries to mobile numbers.
This is the accessor for the SMS::MessageBird::API::Balance module. Used to retrieve your MessageBird account balance.
This is the accessor for the SMS::MessageBird::API::Lookup module. Used to validate phone numbers, and provide optional formats for that number.
In: %params - Various parameters for the API interface.
Creates a new instance of SMS::MessageBird.
Parmeters are passed to the contructor as a hash. Required / acceptable keys are as follows:
Required. The MessageBird account API key used for authentication with MessageBird's API.
As per the MessageBird documentation, all sending functionality requires an originator. This can be set once on the SMS::MessageBird object and passed to all the module methods. This can be set later using the originator() mutator.
If for some reason you need to use some form of local HTTP proxy / forwarder this parameter can be used to specifiy the alternate address. If it is omittied the default is MessageBird's URL https://rest.messagebird.com.
In: $originator (optional) - New originator to set.
Out: The currently set originator.
Mutator for the originator parameter. This parameter is the displayed "From" in the SMS. It can be a phone number (including country code) or an alphanumeric string of up to 11 characters.
This can be set for the lifetime of the object and used for all messages sent using the instance or passed individually to each call.
You can pass the originator param to the constructor rather than use this mutator, but it's here in case you want to send 2 batches of SMS from differing originiators using the same object.
In: $api_url (optional) - New api_url to set.
Out: The currently set api_url.
Mutator for the api_ul parameter. Should some form of network relay be required this can be used to override the default https://rest.messagebird.com.
James Ronan, <james at ronanweb.co.uk>
<james at ronanweb.co.uk>
Please report any bugs or feature requests to bug-sms-messagebird at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=SMS-MessageBird. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-sms-messagebird at rt.cpan.org
Alternatively you can raise an issue on the source code which is available on GitHub.
Copyright 2016 James Ronan.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install SMS::MessageBird, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell
For more information on module installation, please visit the detailed CPAN module installation guide.