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.

Easier way to add existing contacts to a Contact List?

SOLVED
Go to solution
Highlighted
Occasional Participant

Easier way to add existing contacts to a Contact List?

We are currently managing our contacts inside our own internal application. When we add contacts to a contact list using the bulk activity method we have to break out post request down to 50 contacts per post. (Limitations on data types on our end) This will keep our post request under 32 kb. Yesterday we needed to add 10k contacts to a new list (I'm guessing 99% of these contacts already existed in out CC account). It created about 200 post requests. This only took a couple mins. However the process time on the CC servers took about 8 hours to process this information.

 

Currently I'm batching all the contact information we have and adding it to the request body. However all I really need to do is add these contacts to a list, nothing else. If they don't have a constant contact id then add all the data via the post I'm doing now to include contact information.

 

Is there an easier way to add existing contacts to a list and then non existing contacts could be added this way?

 

POST

https://api.constantcontact.com/v2/activities/addcontacts

  

{
  "import_data": [
    {
      "email_addresses": [
        "info@gfs.com"
      ],
      "company_name": "SGF",
      "first_name": "J",
      "last_name": "G",
      "addresses": [
        {
          "line1": "P.O. Box 1787",
          "city": "",
          "state_code": "",
          "postal_code": ""
        }
      ],
      "custom_fields": [
        {
          "name": "Custom Field 1",
          "value": "199"
        },
        {
          "name": "Custom Field 2",
          "value": "14715"
        },
        {
          "name": "Custom Field 3",
          "value": "Garfield Heights"
        },
        {
          "name": "Custom Field 4",
          "value": ""
        },
        {
          "name": "Custom Field 5",
          "value": ""
        },
        {
          "name": "Custom Field 6",
          "value": "2168836300"
        }
      ]
    }
  ],
  "lists": [
    "2140778226"
  ],
  "column_names": [
    "EMAIL",
    "COMPANY NAME",
    "FIRST NAME",
    "LAST NAME",
    "ADDRESS LINE 1",
    "CITY",
    "STATE",
    "ZIP/POSTAL CODE",
    "CUSTOM FIELD 1",
    "CUSTOM FIELD 2",
    "CUSTOM FIELD 3",
    "CUSTOM FIELD 4",
    "CUSTOM FIELD 5",
    "CUSTOM FIELD 6"
  ]
}

 

I'm looking at an easier way to include just contact id or email address into the import data. and list id in the list section. This way if the contact already exist we can batch more data into each post and if they don't exist fall back to this method to add them.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Moderator

Re: Easier way to add existing contacts to a Contact List?

The reason that the processing time is so long is the architecture of our bulk import services.  In order to prevent a single customer from causing other customers to be unable to upload contacts, only a single request can be processed at a time per customer.  We pull a batch of jobs to process at a time, put them in a queue for processing and when that queue is empty, pull another set of jobs to process.  Since each customer can only have one job when we fill up that queue, it can take a while to process a large number of small jobs.  It may seem a little backwards, but it would be faster to process a small number of large jobs the way we manage imports today.

 

Regarding the imports themselves, if you are limited to 32kb per payload there is a bit of a challenge if you use the JSON version.  It could be easier for you to do one of the following:

 

1. Use a multipart message with a CSV or XLS file: http://developer.constantcontact.com/docs/bulk_activities_api/bulk-activities-addcontact-multipart.h...

2. When adding contacts to a list, don't import the optional demographic data, only use email addresses.  This will allow you to have more contacts per request with the 32kb limit.  Demographic fields which are left out of the request are ignored so you won't overwrite data.

Dave Berard
Senior Product Manager, Constant Contact

View solution in original post

5 REPLIES 5
Highlighted
Occasional Advisor

Re: Easier way to add existing contacts to a Contact List?

In version 1 of the API,  there's Utitliy.bulkUrlEncoded where you could slurp up a csv file with about 2,000 contacts in it and import that.  We do that, and sleep for a few seconds and then do it over and over again.  We routinely import 100k+ contacts into hundredes of lists and it only takes about 15-30 mins this way to both send the job to CC and for them to process it.

 

There isn't really an equivalent in API v2 that is quick and efficient like this to my knowledge but hopefully the CC folks chime in.

 

 

public static string bulkUrlEncoded(AuthenticationData authdata, string data, IList<string> listIds);
Highlighted
Occasional Participant

Re: Easier way to add existing contacts to a Contact List?

Thanks however, I had to write a wrapper from scratch as the programming language that I am using doesn't have any wrappers or support utilities. I'm basically writing our the post get put and delete requests and processing them accordingly. 

 

I could look at using some other methods of datatypes to process this data accordingly to not limit me to the 32kb limit. However It just seems that this method is redundant and could be much more effecient in adding existing contacts to a contact list.

 

If you don't mind me asking, how long did the server activity take to process 100k contacts? To me 8 hours for 10k contacts seems unreasonable and that I could be doing much more effienctly. 

Highlighted
Occasional Advisor

Re: Easier way to add existing contacts to a Contact List?

I use the .NET sdk for this.  It takes less than 30 minutes most days to push these contacts.  Some are new contacts, some are just updates.

Highlighted
Moderator

Re: Easier way to add existing contacts to a Contact List?

The reason that the processing time is so long is the architecture of our bulk import services.  In order to prevent a single customer from causing other customers to be unable to upload contacts, only a single request can be processed at a time per customer.  We pull a batch of jobs to process at a time, put them in a queue for processing and when that queue is empty, pull another set of jobs to process.  Since each customer can only have one job when we fill up that queue, it can take a while to process a large number of small jobs.  It may seem a little backwards, but it would be faster to process a small number of large jobs the way we manage imports today.

 

Regarding the imports themselves, if you are limited to 32kb per payload there is a bit of a challenge if you use the JSON version.  It could be easier for you to do one of the following:

 

1. Use a multipart message with a CSV or XLS file: http://developer.constantcontact.com/docs/bulk_activities_api/bulk-activities-addcontact-multipart.h...

2. When adding contacts to a list, don't import the optional demographic data, only use email addresses.  This will allow you to have more contacts per request with the 32kb limit.  Demographic fields which are left out of the request are ignored so you won't overwrite data.

Dave Berard
Senior Product Manager, Constant Contact

View solution in original post

Highlighted
Occasional Participant

Re: Easier way to add existing contacts to a Contact List?

Thanks.

 

I managed to re write the underlying code implementation of our post request to handle more than the 32kb limit. 

 

However, to just include the email addresses would have helped greatly and that alone solves my original question.

 

 

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