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.

AddRemoveContactsFromListsActivity() usage?

SOLVED
Go to solution
Highlighted
Occasional Contributor

AddRemoveContactsFromListsActivity() usage?

Attempting to delete emails from a contact list(s).  having no success when executing the following via the .NET wrapper APIs:

 

Dim actSrvc As New CTCT.Services.ActivityService

Dim actSrvcRsp As New CTCT.Components.Activities.Activity

 

actSrvcRsp =  actSrvc.AddRemoveContactsFromListsActivity(

  accessToken:=myAccessToken

, apiKey:=myAPIKey

, emailAddresses:=myEmailsList

, lists:=myListsList    )

 

myEmailsList has 23 items. 

myListsList has 1 item.

 

This seems to execute ok. But i have seen no contacts removed from the list of contact lists i submit.  and when i check results later using GetActivty( idOfTheActivity ), it always showsErrorCount = 1 And Errors(0):   emailAddress = "";    lineNumber = 0;     message = "sameEmailEverytime@junk.com"

 

Can you see what i am doing wrong, or neglecting to do?   Thanks in advance for any feedback:)

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Moderator

Re: AddRemoveContactsFromListsActivity() usage?

Thanks for sending that over.  Looked at your account and confirmed our suspicions.  You are on our new Contact management system, which is an upgrade we're rolling out to our customer base over the next few months and which started about 3 months ago to migrate everyone.  This new system allows for a lot more flexibility and features when editing contacts.

 

Unfortunately, we ran into an issue where Contacts are not being removed correctly with bulk activity requests from lists.  We are investigating this issue, however it is a very complicated problem.  We are continuing to work on it and will update once we have a solution.  As of this time, we don't have any workarounds to share.

Dave Berard
Senior Product Manager, Constant Contact

View solution in original post

5 REPLIES 5
Highlighted
Moderator

Re: AddRemoveContactsFromListsActivity() usage?

Can you provide your username for us to look into this closer?  You can either PM it to me or send it to our support staff via webservices@constantcontact.com

Dave Berard
Senior Product Manager, Constant Contact
Highlighted
Occasional Contributor

Re: AddRemoveContactsFromListsActivity() usage?

PM sent.  Thank you.

Highlighted
Moderator

Re: AddRemoveContactsFromListsActivity() usage?

Thanks for sending that over.  Looked at your account and confirmed our suspicions.  You are on our new Contact management system, which is an upgrade we're rolling out to our customer base over the next few months and which started about 3 months ago to migrate everyone.  This new system allows for a lot more flexibility and features when editing contacts.

 

Unfortunately, we ran into an issue where Contacts are not being removed correctly with bulk activity requests from lists.  We are investigating this issue, however it is a very complicated problem.  We are continuing to work on it and will update once we have a solution.  As of this time, we don't have any workarounds to share.

Dave Berard
Senior Product Manager, Constant Contact

View solution in original post

Highlighted
Occasional Contributor

Re: AddRemoveContactsFromListsActivity() usage?

Has there been any better resolution on this issue?  I seem to be hitting this as well.

Highlighted
Occasional Contributor

Re: AddRemoveContactsFromListsActivity() usage?

It turns out that the JSON data is not formed correctly.  I did figure this out finally.  I modified the AddRemoveContactsFromListsActivity() method in the ActivityService.cs file as below. (see //TG marks)

 

 

/// <summary>

/// Create a Remove Contacts From Lists Activity.

/// </summary>

/// <param name="accessToken">Constant Contact OAuth2 access token.</param>

/// <param name="apiKey">The API key for the application</param>

/// <param name="emailAddresses">List of email addresses.</param>

/// <param name="lists">List of id's.</param>

/// <returns>Returns an Activity object.</returns>

public Activity AddRemoveContactsFromListsActivity(string accessToken, string apiKey, IList<string> emailAddresses, IList<string> lists)

{

    Activity activity = null;

    string url = String.Concat(Config.Endpoints.BaseUrl, Config.Endpoints.RemoveFromListsActivity);

 

    //TG

    IList<ImportEmailAddress> importData = new List<ImportEmailAddress>();

    foreach (string emailAddress in emailAddresses)

    {

        importData.Add(new ImportEmailAddress() { EmailAddresses = new List<string> { emailAddress } });

    }

    //TG

 

    RemoveContact removeContact = new RemoveContact()

    {

        //ImportData = new List<ImportEmailAddress>() { new ImportEmailAddress() { EmailAddresses = emailAddresses } },

        ImportData = importData, //TG

        Lists = lists

    };

 

    string json = removeContact.ToJSON();

    CUrlResponse response = RestClient.Post(url, accessToken, apiKey, json);

 

    if (response.IsError)

    {

        throw new CtctException(response.GetErrorMessage());

    }

 

    if (response.HasData)

    {

        activity = response.Get<Activity>();

    }

 

    return activity;

}

 

 

Thanks,

Tony

Tags (2)
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