Between 8:00 - 9:00 am ET on 10/25 we need to take our site down to make updates. We recommend logging out before 8:00am ET and not using your account during this time. Thank you for your patience while we make these important updates.

contacts removed while adding them via API

SOLVED
Go to solution
Member

contacts removed while adding them via API

Hello there,

 

I have a question regarding some email address not making to constant contact when i add them via API. I had a list of 414 contacts that were supposed to be in constant and contact but only 380 made it. I know the duplicates are removed on the fly, but there are 9 unique contacts that were not added to constant and contact. I have this SSIS package that runs weekly, uses the constant and contact API to add the contacts to the list. Could you tell me what other criteria you look at besides duplicates and what would prevent adding these 9 contacts? My client is worried whether there are some other contacts that didn't go through. I just want to explain what could have caused this issue.

 

Thanks!

1 ACCEPTED SOLUTION

While you can request the status of Bulk activities, that will return the number of unique records in the activity and the number and details for errors (invalid email addresses, not added due to previoius opt-out). It does not, however, provide details for duplicate records that will be usful for your purposes, so I believe your best bet is going to be to identify duplicates on your end, to correct the statistics reported to your clients.

 

If the primary goal  is to reflect the number of unique contacts to which the email was sent, would the number sent for a given campaign that is obtainable through a GET request to the Campaign Resource API be of use? Although I probably don't have a full understanding of your integration, I understand that you may prefer to have information to indicate duplicates from your bulk Activities for other reasons, but in the absence of that capability, I'm trying to offer some other ideas for obtaining accurate data for number sent per campaign, at least.

Mark Coleman
Support Engineer

View solution in original post

6 REPLIES 6
Member

Hello,

 

It sounds as though you are using a bulk upload activity to upload the list of contacts. Other than duplicates, contacts that would not be added through a bulk upload include any who had previously opted out, or those without valid email addresses. If the file or string is not structured properly, or there are certain unsupported special characters in them, this can also cause some contacts not to be added through a bulk upload.

 

Let me know if this is helpful.  If the above do not seem to apply in this case, you can PM me the full content of the bulk upload request being made, and/or any file that is being submitted with it, and will try to determine what specifically is at issue with this upload.

 

Cheers,

Mark Coleman
Support Engineer

Thanks for the explanation. I tried testing this by adding two duplicate emails to constant contact via API. As i was debugging through this code:

request.ContentLength = byteArray.Length;
                        string XMLResponse = "Bytes to send: " + byteArray.Length;
                        Stream streamRequest = request.GetRequestStream();
                        streamRequest.Write(byteArray, 0, byteArray.Length);
                        streamRequest.Close();
                        HttpWebResponse Response = (HttpWebResponse)request.GetResponse();
                        StreamReader Reader = new StreamReader(Response.GetResponseStream());
                        XMLResponse += Response.StatusCode + Response.StatusDescription + Reader.ReadToEnd();
                        Reader.Close();
                        Response.Close();

 ..found out that the Response.StatusCode and response.StatusDescritpion was set to created for both of the duplicate contacts. When i looked into constant contact list, only one was created. Would i be able to capture somewhere here in the code that tells me anything about the contact whether it was duplicate or bad email or not added, so I could update that contact in my db? It would be very helpful if I can get anything out of constant contact that would be more specific about that contact. Let me know if I did not make myself clear.

If you are using the bulk API, your contacts will be updated with the new information submitted in your request, and you won't have a per-contact response to tell you whether the contact was present alredy present.  You could request list members or active contacts before your request to add/update via the bulk activities API and cross-reference locally, however.  

 

If you are syncing or adding small numbers of contacts in a given event, no more than 25 contacts per sync as per our API Terms of Service to preserve quality of service, using a POST request to add the contacts would create contacts if they are not already on a list in the account, or return a 409 Conflict if the email address in a request is already present in the account.  In this case, the contact will not be udpated with the new information.  If you use PUT method for the same request  instead, the contact would simply be updated.

Mark Coleman
Support Engineer

Hi Mark,

 

Its great that duplicates are not added to constant and contact and we like it that way. We do weekly mailings via ctct. I have a list that i use all the time for sending these mails out weekly. Prior to I do the export, I clear out the list. Using the sql data reader, I start adding contacts one by one to ctct. When they are added, i then mark a flag in my database with a datetime stamp indicating that this contact was mailed out. What happens inside ctct, we get that report later once they get mailed. But for our reporting, we tell the client that so and so number of records were mailed out. For my own data validity, if  I have 300 contacts to send to ctct, what happens right now is even i have any duplicates, the response from the api comes back saying created. Say there are 5 contacts with the same email address on my list to export, when i check in ctct after my routine has run, only 1 show up and the remaining 4 are not there which is perfect. But in my database, the flag is already datetimestamped, so client sees 5 being mailed, in reality only one goes out. 

 

I need to track these 4 via ctct api that they were not added. If there is anything that ctct tells me that these 4 records were ignored, were dupes, not added any sort of status, then i could tweak my routine to not date stamp these records. That way the results are accurate to clients and they see only 1 email being sent out. I know these dupes could be taken care of when i create the list but if there are some bad emails, emails that ctct didn't import, they could fall into this as well. Let me know if I am asking for too much. If there is not a way to capture the status during the bulk upload, then thats not a problem. There are so many feature via API that we can do after the list is uploaded..i was checking to make sure i am not missing anything in the bulk upload.

 

Thanks!!

While you can request the status of Bulk activities, that will return the number of unique records in the activity and the number and details for errors (invalid email addresses, not added due to previoius opt-out). It does not, however, provide details for duplicate records that will be usful for your purposes, so I believe your best bet is going to be to identify duplicates on your end, to correct the statistics reported to your clients.

 

If the primary goal  is to reflect the number of unique contacts to which the email was sent, would the number sent for a given campaign that is obtainable through a GET request to the Campaign Resource API be of use? Although I probably don't have a full understanding of your integration, I understand that you may prefer to have information to indicate duplicates from your bulk Activities for other reasons, but in the absence of that capability, I'm trying to offer some other ideas for obtaining accurate data for number sent per campaign, at least.

Mark Coleman
Support Engineer

View solution in original post

Thanks Mark. What i will do is to upload contacts to ctct, then have a next step to grab those contacts and update my database. Thay way, if 350 contacts gets added to ctct, then 350 contacts will be updated in my database thus making the statistics better.

 

I have some questions on getting the members from a contact list but I will create a new post for that as its a different topic.

 

Thanks for your help on this. It was great to learn more about the process.

Developer Portal

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

Visit Page