SMS::MessageBird::API::SMS - Sub-module for the SMS::MessageBird distribution.
This is a sub-module which is part of the SMS::MessageBird distribution.
While this module can be used directly, it's designed to be used via SMS::MessageBird
This module provides the interface to the SMS sending methods of the MessageBird JSON API.
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.
Every method returns a standardised hashref containin the following keys:
Value of 0 or 1. Indicates if the request was completed successfully or not. This value is based on LWP::UserAgent's is_success() method.
This is the HTTP code returned by the API. In the event of ok => 0 - it's possible that the request was a 401 etc. So this is provided for sanity checking.
This is a Perl hashref data structure decoded from the API's response JSON as-is.
Please see the MessageBird Developer Documentation for more information on the expected structure.
In: %params - Hash of params accepted by the MessageBird API. Out: $response - Hashref of response data. See "Response Data" above.
This method implements the POST /messages route of the API.
Accepted parameters are listed in the MessageBird API documentation.
Require parameters are as follows:
The originator parameter is required but can be omitted if set when instantiating the SMS::MessageBird module.
The recipients parameter is required and can be either a scalar containing a single MSISDN (mobile number) or an arrayref containing many recipients.
The body parameter is required. Scalar containing the text of the message.
All other parameters are optional.
Please see the MessageBird API Documentation for more information.
In: $mesasge_id - Optional ID of the message to recieve. Out: $response - Hashref of response data. See "Response Data" above.
This method implements the GET /messages/{message_id} route of the API.
If supplied with a $message_id, that one message will be returned. If omitted, a complete list of messages will be returned.
Synonym for the receive() method.
In: %filters - Hashref of filter key / data pairs Out: $response - Hashref of reponse data. See "Response Data" above.
Search sent messages by criterion rather than getting a specifc message by id.
Please see the MessageBird API Documentation for message filtering for a complete list of filters.
Fair warning: MessageBird's API seems to ignore the documented "searchterm" paramter - which isn't an option via their portal, so perhaps doesn't work. It will, however, allow you to filter by status, recipient and originator. So it's of some use. Limit has a minimum of 10.
In: $message_id - The message_id to remove. Out: $response - Hashref of response data. See "Response Data" above.
This method implements the DELETE /messages/{message_id} route of the API.
Deletes the SMS with identifier $message_id.
Synonym for the remove() method.
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.
cpanm
cpanm SMS::MessageBird
CPAN shell
perl -MCPAN -e shell install SMS::MessageBird
For more information on module installation, please visit the detailed CPAN module installation guide.