cancel
Showing results for 
Search instead for 
Did you mean: 

How to move a contact between different contact lists (groups)

New Member

How to move a contact between different contact lists (groups)

We have a requirment of placing same contacts in different contact lists(groups) but only single entry per each contact list and some of the groups may not contain the same contact. Here, my problem is that I am not able to move a specific contact between different contact lists. If I remove it from the target contact list group then it is moved to "no mail group" which I don't wish. Please, provide any possible solution to this problem. Thank you.

srk

11 REPLIES 11
CTCT Employee

When removing a contact from

When removing a contact from a list using the API you are not required to move them to the 'do not mail' list, what I believe you are referring to as 'no mail group'. Instead, you can update a contact and simply choose to omit any lists from their details. By not belonging to any lists, the contact will simply be in 'Removed' status. They can then be updated an placed on any number of lists.


 


Please keep in mind that you do not need to even place a contact in 'Removed' status in order to add them to other lists as you may have been trying. When moving contacts between lists or adding contacts to additional lists, you need only modify the contact and specify what lists you would like then to be on from that point forward.


 


In summary, do not use the DELETE option to temporarily remove a contact from a list. Instead, leave the <ContactLists> node empty. If looking to modify the lists that a contact belongs to, simply specify those desired lists in the <ContactLists> node.

Dan H

Support Engineer, Constant Contact

New Member

Not able to copy or Move a contact through any API

Now, I have another problem that I am not able to copy or move a contact to different contact lists(groups) through any given APIs which is my prime requirement. Tha API throws an error saying that the contact already exists. My requirement is that I need to maintain different groups apart from All users group which may have duplicate sets of contacts. This we are able to do manually through the Constant contact interface but not through any of the available API. Please help us so that we can go ahead with subscribing to a decent Constant Contact plan. Thank you.

srk

Moderator

It sounds like the problem

It sounds like the problem you are facing is that you are trying to "Create" the contact when you should be "Updating" the contact.  There is a difference in how you send a request that says that one is a "Create" and one is an "Update.  For Create requests, the HTTP method should be POST.  For Update requests, the HTTP method should be PUT. 


 


You can find more documentation for updating contacts here: http://developer.constantcontact.com/doc/manageContacts#update_contact_info

Dave Berard
Senior Product Manager, Constant Contact
Occasional Participant

Re: It sounds like the problem

Hi Dave,

 

I am having the same problem. I'm using PHP Wrapper api and I need to move contacts from one list to another in certain situations.

 

My logic flow is this

 

1) check if a contact exists in any of the existing lists using searchbyemail function

2) if yes,move him to the newly specified list

3) If not, add him to the given list.

 

I guess the solution is updating an existing contact to point to a new list, But iam not sure which Contact object attribute I must update in order to move a contact from one list to another.  When i search for an existing contact with their email, I get the following object response.

 

"

object(Contact)[8]
  public 'link' => string '/ws/customers/myaccountusername/contacts/7' (length=53)
  public 'id' => string 'http://api.constantcontact.com/ws/customers/myaccountusername/contacts/7' (length=83)
  public 'updated' => string '2012-10-18T12:25:52.782Z' (length=24)
  public 'status' => string 'Active' (length=6)
  public 'emailAddress' => string 'jet@lee.com' (length=11)
  public 'emailType' => string 'HTML' (length=4)
  public 'firstName' => string '' (length=0)
  public 'middleName' => string '' (length=0)
  public 'lastName' => string '' (length=0)
  public 'fullName' => string '' (length=0)
  public 'jobTitle' => string '' (length=0)
  public 'companyName' => string '' (length=0)
  public 'homePhone' => string '' (length=0)
  public 'workPhone' => string '' (length=0)
  public 'addr1' => string '' (length=0)
  public 'addr2' => string '' (length=0)
  public 'addr3' => string '' (length=0)
  public 'city' => string '' (length=0)
  public 'stateCode' => string '' (length=0)
  public 'stateName' => string '' (length=0)
  public 'countryCode' => string '' (length=0)
  public 'countryName' => string '' (length=0)
  public 'postalCode' => string '' (length=0)
  public 'subPostalCode' => string '' (length=0)
  public 'notes' => string '' (length=0)
  public 'customField1' => string '' (length=0)
  public 'customField2' => string '' (length=0)
  public 'customField3' => string '' (length=0)
  public 'customField4' => string '' (length=0)
  public 'customField5' => string '' (length=0)
  public 'customField6' => string '' (length=0)
  public 'customField7' => string '' (length=0)
  public 'customField8' => string '' (length=0)
  public 'customField9' => string '' (length=0)
  public 'customField10' => string '' (length=0)
  public 'customField11' => string '' (length=0)
  public 'customField12' => string '' (length=0)
  public 'customField13' => string '' (length=0)
  public 'customField14' => string '' (length=0)
  public 'customField15' => string '' (length=0)
  public 'contactLists' => string '' (length=0)
  public 'confirmed' => string '' (length=0)
  public 'optInSource' => string 'ACTION_BY_CUSTOMER' (length=18)
  public 'lists' => 
    array
      empty

 

The above contact belongs to list id 1 in my account.  There is no way to identify which list id he belongs to - from the above data.  Now tell me in the above contact object which field must i update remove him from list id 1 and put him in list id 2.

 

Thank you for your help.

 

Regards,

Pradeep

"

CTCT Employee

Re: It sounds like the problem

Hi Pradeep,

 

When you search for a contact by email address, the lists they belong to is not returned.  If you search for a contact by their unique contact ID (7 in your example), then the lists they belong to is returned, and you can change their lists from there.

 

Best Regards,

Shannon W.

API Support Specialist

Occasional Participant

Re: It sounds like the problem

Hello Shannon,

 

Thank you very much for your prompt reply. 

 

Could you also let me know which functions i can use to

 

1. get the contact id using the email address.

2. get the list id using the contact id

3) update the list id

 

Thanks a lot for your help!

 

Regards,

Pradeep

CTCT Employee

Re: It sounds like the problem

Hey Pradeep,

 

With the PHP lib you are using you would do this:

 

$ConstantContact = new ConstantContact($authType, $apiKey, $un, $pw);

//Returns an array of Contacts
$myContact = $ConstantContact->searchContactsByEmail('emailAddress');

//Get details of specific Contact
$myContactDetails = $ConstantContact->getContactDetails($myContact[0]);

 

Do a print_r on $myContactDetails and you will see a "lists" node which includes an array of list URIs.  Hope this helps.

 

Please confirm.

 

Thanks,

 

 

Andrew Weber
Associate Product Manager for EventSpot
Occasional Participant

Re: It sounds like the problem

Hi Andrew

 

Thanks for the information. I hope I can achieve my requirement with that.

 

I would also like to know how i can add one contact already added to list A to List B.  My requirement is if a person purchases product A, I'l add him to list A and if he purchases Product B i'l add him to list B to send them promotions relevant to the product. So suppose if a person buys both my products A and B I would want to add him to both lists A and B through the PHP Wrapper Api class. Let me know how this can be done, since if i try to add user once again to List B, it throws me xml error, contact already exists!

 

Thanks,

Pradeep

CTCT Employee

Re: It sounds like the problem

Hey Pradeep,

 

This of course can be done.  It sounds like you are trying to add a new contact with Product A and then add that same contact again but with Product B.  Because this is a RESTFul API, if the contact already exists in the account, you must PUT not POST.  

 

Adding a new contact uses POST.

Updating a current contact uses PUT.

 

The PHP wrapper equivalents are:

 

addContact which is used to create a new contact.

updateContact() which is used to update an existing contact.

 

You can do one of two things:

 

Add the contact with both lists in the XML.

Add the contact with one list and then update that contact with the second list.

 

I personally would go with the first option; it is easier and logically flows better.  

 

If you are still running into issues, please post your code for us to review.  

 

Thanks,

 

 

 

Andrew Weber
Associate Product Manager for EventSpot