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.

Problem with updating a Removed Contact.

Highlighted
Real Estate

Problem with updating a Removed Contact.

Scenario 1 (Works as expected):  Have a "Removed" contact.  I update the email address and Name.  The contact updates as expected and stays as "Removed" status.

 

Scenario 2 (Works as expected): Have a "Removed" contact.  I do not update the email but I do add them to a contact list.  This makes them active as expected.

 

Scenario 3 (Does not work as expected):  Have a "Removed" contact.  I modify the email address and also select a contact list.  I expect it to update the email on this contact and make it active.  However it creates a whole new contact with the new email address. 

 

This problem is consistent with the GUI and within the API using UpdateContactFullForm.

 

Please let me know if this is how it will always work so I have to account for it or is this a bug?

6 REPLIES 6
Highlighted
Employee

Re: Problem with updating a Removed Contact.

Hi,

 

I'm not able to replicate what you're seeing.  In the UI, I removed a contact from all lists, updated their email address, and then added the updated email address to lists.  I confirmed with the API that I am ending up with the unique contact ID for them that I started with (a new contact record isn't being created).  I did a GET for both the starting email address at the beginning of the process and for the updated email address after updating (confirming the unique contact ID was the same for both).  As you would expect, if I then do a GET for the original email address, the system does not find it.  

 

For the API, you are essentially doing the same thing--GETting the contact from us by searching for their email address or unique contact ID if you store that, then using the update function to change their email address, which PUTs back the contact with changes based on the unique contact ID.  Your code should be different to create a new contact than to update an existing one (creating uses the POST method, while updating uses the PUT function).  I use the following code to decide whether to create or update a contact.

 

<?php

session_start ();
require_once 'ConstantContact.php';
require_once 'config.php';

$ConstantContact = new ConstantContact("oauth2", $apiKey, $username, $accessToken);

// Get potential contact lists
$lists = $ConstantContact->getLists();
// Lists are returned in multidimentional arrays 0 being the list, and 1 being the next50

// Email address here is used for testing purposes
/* NOTE:  This email address will be added to your account if you execute this script, you should send this to do-not-mail after your testing */

$emailAddress = "testemail10312012@test.com";

// Search for our new Email address
$search = $ConstantContact->searchContactsByEmail($emailAddress);
echo $emailAddress . "<br>";
//echo $ContactsCollection->searchContactsByEmail($ext);

// If the search didnt return a contact object
if($search == false)
{
	// Create a new Contact Object to store data into
	$contactObj = new Contact();
	// Adding multiple lists to this new Contact Object
	$contactObj->lists = array($lists['lists'][0]->id, $lists['lists'][18]->id);
	// Set the email address
	$contactObj->emailAddress = $emailAddress;
	// Create the Contact and DONE
	$Contact = $ConstantContact->addContact($contactObj);
	echo ("Contact added.");

} // Otherwise we update our existing
else 
{
	// Gather data from our previous search and store it into a data type
	$contactObj = $ConstantContact->getContactDetails($search[0]);

	// We need to get the old list and add a new list to it as
	// this request requires a PUT and will remove the lists
	// as they are stored in an array
	 array_push($contactObj->lists, $lists['lists'][18]->id );
	
	// Update the contact and DONE
	$UpdateContact = $ConstantContact->updateContact($contactObj);
	echo ("Contact updated.");
}	

?>

 

 

This is a long answer to your question, but the answer is that I can't replicate scenario 3, but it should work as you would expect (updating an existing contact).

 

Best Regards,

Shannon W.

API Support Specialist

Highlighted
Real Estate

Re: Problem with updating a Removed Contact.

It still does as I specified.  Maybe I'm doing something wrong.

 

I have a contact with the following information:

 

Id: 20908

Email: test@test.com

FirstName: First

LastName: Last

Status: Removed (Not in any list)

 

Here is my update code:

 

Dim contact As New Contact()

contact = Utility.GetContactDetailsById(AuthenticationData, "20908")

 

contact.Status = ContactStatus.Active

contact.EmailAddress = "test1@test.com"

contact.FirstName = "First1"

contact.LastName = "Last1"

contact.OptInSource = ContactOptSource.ActionByCustomer

contact.ContactLists.Clear()

   

Dim contactOptInList As New ContactOptInList()

contactOptInList.ContactList = New ContactList("1")

contact.ContactLists.Add(contactOptInList)

   

Utility.UpdateContactFullForm(AuthenticationData, contact)

 

This does nothing to the 20908 record and creates a new record with the update information.

Highlighted
Employee

Re: Problem with updating a Removed Contact.

Hi,

 

I was able to reproduce the issue with the code that you provided; thank you.  I have made our engineering team aware of this so that they can look into it.  We don't have an estimated time this might be fixed, but in the meantime, the workaround would be to update the contact to active and update the lists, update contact full form, and then change the email address in a second step (then update full form again).  Sorry for the inconvenience, and thank you for bringing this our attention!

 

Best Regards,

Shannon W.

API Support Specialist

Highlighted
Occasional Participant

Re: Problem with updating a Removed Contact.

I'm having a similar problem.

 

Using the gui - I deleted a contact.  - action by owner

Using the api - I looked up the contact and there status is REMOVED with action by owner

 

Using the gui - I added the user - action by owner.

using the API - looked up the contact and their status still reads REMOVED.

 

I contacted support and they told me the status for the email is ACTIVE.

 

So why when using the API does that return status = REMOVED?

 

I do see in the json results the following:

"opt_in_date":"2014-01-10T17:04:07.000Z","opt_out_date":"2014-01-10T05:00:00.000Z"

 

Is there some sort of lag time between the GUI and the API?

 

thanks

 

 

 

 

 

Highlighted
Moderator

Re: Problem with updating a Removed Contact.

Hi Charles,

 

API returns the following status values:

 

Active - Contact is on one or more email lists, has not unsubscribed and has not been deleted through the web UI

Removed - Contact is not on any email lists, has not unsubscribed, may or may not have been deleted through the web UI

Unsubscribed - Contact has unsubscribed from all email marketing messages for this account, is no longer on any email lists, may or may not be deleted through the web UI

Awaiting Confirmation - Contact has not confirmed their email address through our Confirmed Opt In feature (off by default)

 

Hope this clears things up

Dave Berard
Senior Product Manager, Constant Contact
Highlighted
Occasional Participant

Re: Problem with updating a Removed Contact.

Kind of

 

The contact was listed in the GUI and could be sent email (GUI tech support said the contact was Active).

 

When looking the user up via the API, the contacts status read Removed.

 

After Posting an add request, the system said the User Already Exists.

 

I found that I could update the contact by issuing a PUT request, but then not really sure what to make of "REMOVED" status.

 

So it's a bit wonky, but did figure it out.  Thanks.

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