Email::ConstantContact - Perl interface to the ConstantContact API


Email-ConstantContact documentation  | view source Contained in the Email-ConstantContact distribution.

Index


NAME

Top

Email::ConstantContact - Perl interface to the ConstantContact API

VERSION

Top

Version 0.05

SYNOPSIS

Top

This module allows you to interact with the ConstantContact mass email marketing service from perl, such as creating and mainting contacts and contact lists.

Before using this module, you must register your application with the ConstantContact company, agree to their terms & conditions, and apply for an API access key. You will use this key, in combination with a ConstantContact username and password to interact with the service.

    use Email::ConstantContact;

    my $apikey = 'ABCDEFG1234567';
    my $username = 'mycompany';
    my $password = 'topsecret';

    my $cc = new Email::ConstantContact($apikey, $username, $password);

    # How to enumerate existing Contact Lists:
    my @all_lists = $cc->lists();
    foreach my $list (@all_lists) {
        print "Found list: ", $list->{Name}, "\n";
    }

    # How to create a new Contact List:
    my $new_list = $cc->newList('JAPH Newsletter', {
        SortOrder		=> '70',
        DisplayOnSignup		=> 'false',
        OptInDefault		=> 'false',
    });

    # How to add a new contact:
    my $new_contact = $cc->newContact('jdoe@example.com', {
        FirstName	=> 'John',
        LastName	=> 'Doe',
        CompanyName	=> 'JD Industries',
        ContactLists	=> [ $new_list ],
    });

    # How to modify existing contact:
    my $old_contact = $cc->getContact('yogi@example.com');
    print "Yogi no longer works for ", $old_contact->{CompanyName}, "\n";
    $old_contact->{CompanyName} = 'Acme Corp';

    # Enumerate List Membership
    print "Member of Lists: \n";
    foreach my $listid (@{ $old_contact->{ContactLists} }) {
        my $listobj = $cc->getList($listid);
        print $listobj->{Name}, "\n";
    }

    # Manage List Membership
    $old_contact->removeFromList($some_list_id);
    $old_contact->clearAllLists();
    $old_contact->addToList($new_list);
    $old_contact->save();

    # Opt-Out of all future emails
    $old_contact->optOut();
    $old_contact->save();

    # Display recent activities
    my @recent_activities = $cc->activities();

    foreach my $activity (@recent_activities) {
        print "Found recent activity, Type= ", $activity->{Type}, 
            "Status= ", $activity->{Status}, "\n";
    }

	# Obtain bounced email addresses.
	foreach my $camp ($cc->campaigns('SENT')) {
		foreach my $event ($camp->events('bounces')) {
			if ($event->{Code} eq 'B') {
				print "Bounced: ", $event->{Contact}->{EmailAddress}, "\n";
			}
		}
	}




TODO

Top

* Implement method for enumerating members of a specified list.
* Implement method for enumerating contacts
* Implement method for enumerating campaign events per contact
* Implement method for enumerating campaign contacts per event
* Implement methods for bulk operations (import/export)

AUTHOR

Top

Adam Rich, <arich at cpan.org>

BUGS

Top

Please report any bugs or feature requests to bug-email-constantcontact at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Email-ConstantContact. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

Top

You can find documentation for this module with the perldoc command.

    perldoc Email::ConstantContact




You can also look for information at:

* RT: CPAN's request tracker

http://rt.cpan.org/NoAuth/Bugs.html?Dist=Email-ConstantContact

* AnnoCPAN: Annotated CPAN documentation

http://annocpan.org/dist/Email-ConstantContact

* CPAN Ratings

http://cpanratings.perl.org/d/Email-ConstantContact

* Search CPAN

http://search.cpan.org/dist/Email-ConstantContact/

COPYRIGHT & LICENSE

Top


Email-ConstantContact documentation  | view source Contained in the Email-ConstantContact distribution.