The Community is hosting an End of Summer sweepstakes! Participants must complete tasks to earn tickets that will enter them with a chance to win a free year of Constant Contact and other great prizes!*
*No Purchase Necessary. For Official Rules, visit here. Constant Contact’s End of Summer 2020 Sweepstakes ends on October, 20, 2020 at 11:50 PM EST.

BULK Adding/Editing contact information

Highlighted
Occasional Participant

BULK Adding/Editing contact information

 Hi, just signed up for CC and working on porting all our users to the CC platform. We intend on making several "lists" and then adding all the emails in our system to these "lists".


We have around 40k contacts we'd like to bulk add to CC and on a nightly basis sync that data with CC. I downloaded the sample php code (http://developer.constantcontact.com/sites/default/files/PHP_Sample_Signup_Forms.zip) but it seems a bit in-efficient to bulk upload 40k users one request at a time. Is there a better way of doing this?

9 REPLIES 9
Highlighted
Frequent Participant

Hi, You need to be using the

Hi,


You need to be using the bulk activitities resource described here:


http://developer.constantcontact.com/doc/activities

James Benson, PHP Developer.


Constant Contact Services: http://integrationservic.es/

Highlighted
Occasional Participant

 Hey James, Thanks. I am

 Hey James,


Thanks. I am trying to use the activities api method but I'm running into a "400" error. Here is my code:


 


   $call = https://api.constantcontact.com/ws/customers/USERNAME/activities;


   $parameters = "activityType=SV_ADD";


    $parameters .= "&data=";


    $csvContacts = "Email Address, First Name, Last Name,";


    $csvContacts .= "xxx1@example.com, First1, Last1,";


    $csvContacts .= "xxx2@example.com, First2, Last2";


    $parameters .= urlencode($csvContacts);


    $parameters .= "&lists=".urlencode( 'http://api.constantcontact.com/ws/customers/USERNAME/lists/1');



   $ch = curl_init();

    curl_setopt ($ch, CURLOPT_URL, $call);

    curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");

    curl_setopt ($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);

    curl_setopt ($ch, CURLOPT_USERPWD, APIKEY%USERNAME:PASSWORD);

    curl_setopt ($ch, CURLOPT_HEADER, 0);

    curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);

    curl_setopt ($ch, CURLOPT_FAILONERROR, 1);

    curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);

    curl_setopt ($ch, CURLOPT_POST, 1);

    curl_setopt ($ch, CURLOPT_POSTFIELDS , $parameters);

    curl_setopt ($ch, CURLOPT_HTTPHEADER, Array("Content-Type: application/x-www-form-urlencoded"));

   $emessage = curl_exec ($ch);


 

Highlighted
Occasional Participant

 Hey James, I found my own

 Hey James,


I found my own mistake. My csv variable had comma's instead of line breaks.


Thanks again.


Sammy


 

Highlighted
Occasional Participant

 Hey James/Anyone, Now that I

 Hey James/Anyone,


Now that I can creat the 40k contacts, is there a way I can edit their account details in bulk. Say for instance 1,000 people add their name to the do-no-solicit list in our system?


Sammy

Highlighted
Frequent Participant

Hi Sammy, There is no way to

Hi Sammy,


There is no way to edit in bulk I'm afraid, this would be a useful option to have though so may want to suggest this to CC in the specific forum topic dedicated to enhancement requests.

James Benson, PHP Developer.


Constant Contact Services: http://integrationservic.es/

Highlighted
Moderator

The Bulk API does allow

The Bulk API does allow editing/updating in bulk to a certain point.  One of the options we do not currently offer but are looking to add in the future is moving large volumes to the Removed list or Do Not Mail list.  You can update contact information in bulk though using any of the fields we offer.  I've provided this feature request to our Product Management on your behalf.

Dave Berard
Senior Product Manager, Constant Contact
Highlighted
Frequent Participant

To delete or edit users in

To delete or edit users in bulk you will first need to get the users URI by querying the contacts by email address, once found you can use that URI to update or delete a user:


http://developer.constantcontact.com/doc/contactsCollection


If this is to be done for 1000 users you will want to separate it into smaller chunks, maybe run a script every few minutes using cron.


Deleting users in bulk is a must have really, would be more useful than wiping an entire contact list of all contacts - IMO.


Regards

James Benson, PHP Developer.


Constant Contact Services: http://integrationservic.es/

Highlighted
Occasional Participant

 Hey Dave, Thanks for

 Hey Dave,


Thanks for submitting the request. We'll find a work around using the manual file uploader to move users to the DNS for now. I think thats our only option.


Thanks again, look forward to seeing the API expand.


Sammy

Highlighted
New Member

Since it appears your

Since it appears your updating Constant Contact from your own database, can you just clear the existing list and then reload the list without your DNS contacts?  Just do that everytime it changes.


I think that is what I'm going to be doing because everytime my users send an email, it will be to a different list/segment of contacts that they generate from my system so I'll just be dumping temporary lists into contant contact and then removing that list.

Developer Portal

View API documentation, code samples, get your API key.

Visit Page

Constant Contact 2020 End of Summer Community Sweepstakes!

The Constant Contact User Community is hosting a sweepstakes. The more you participate, the more chances you have to win! Read on to learn more...

Read More
Featured