Net::Sendy::API - Perl SDK to sendy.co
use Net::Sendy::API; my $sendy = Net::Sendy::API->new( api_key => $api_key, url => 'http://www.example.com/sendy/' ); my $r = $sendy->subscribe(email => 'example@example.com', list => 'e'); unless ( $r->is_success ) { die "HTTP request failed" > $r->status_line; }
Perl extension to interact with a sendy.co instance.
This is an interface to http://www.sendy.co/api. As of this writing this is the complete implementation of the Sendy API.
All the arguments are required. api_key is what you receive in the email, after purchasing Sendy. url is the URL to the folder where sendy is installed.
api_key
url
Returns a class instance. It not expected to fail.
Subscribes an e-mail address to a list, where list is identified by its, what is called, an encrypted id. You can find this id next to each list name in the listing
list
an encrypted id
id
If your list has custom fields you can enter them by passing more key/value pairs to the method.
Returns an instance of HTTP::Response. Example
my $r = $sendy->subscribe(list => 'b', email => 'sherzodr@cpan.org', birth_day => "2013-09-12"); unless ( $r->is_success ) { die "HTTP request failed: " . $r->status_line; } my $message = $r->decoded_content;
$message, according to http://www.sendy.co/api, can be 1, Some fields are missing., Invalid email address., Invalid list ID., Already subscribed..
1
Some fields are missing.
Invalid email address.
Invalid list ID.
Already subscribed.
All the arguments are required. Unsubscribe an e-mail address from a list. See subscribe() for the definition of the arguments. Returns an instance of HTTP::Response. Example:
subscribe()
my $r = $sendy->unsubscribe(list => 'b', email => 'sherzodr@example.com'); unless ( $r->is_success ) { die "HTTP request failed: " . $r->status_line; } my $message = $r->decoded_content;
$message, according to http://www.sendy.co/api, can be 1, Some fields are missing., Invalid email address.
$message
Returns an instance of HTTP::Response. Body of the response can contain Subscribed, Unsubscribed, Unconfirmed, Bounced, Soft bounced, Complained, No data passed, API key not passed, Invalid API key, Email not passed, List ID not passed, Email does not exist in list.
Subscribed
Unsubscribed
Unconfirmed
Bounced
Soft bounced
Complained
No data passed
API key not passed
Invalid API key
Email not passed
List ID not passed
Email does not exist in list
For details on getting the body of the response see above.
Returns an instance of HTTP::Response. Body of the response should contain an integer if the call succeeds. If not, it may contains No data passed, API key not passed, Invalid API key, List ID not passed, List does not exist.
List does not exist
LWP::UserAgent, HTTP::Response, http://www.sendy.co/api.
Sherzod B. Ruzmetov <sherzodr@cpan.org>
Copyright (C) 2013 by Talibro LLC.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.14.2 or, at your option, any later version of Perl 5 you may have available.
To install Net::Sendy::API, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::Sendy::API
CPAN shell
perl -MCPAN -e shell install Net::Sendy::API
For more information on module installation, please visit the detailed CPAN module installation guide.