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.

Can same email address used repetitively?

Highlighted
Occasional Contributor

Can same email address used repetitively?

I have updated contact with test@gmail.com. Can I add another contact with test@gmail.com with different details. if so can I know which HTTP request method I need to use? Thank you!!

 

Can anyone reply me urgently?

16 REPLIES 16
Highlighted
Moderator

Re: Can same email address used repetitively?

Currently, our contact system is based off email addresses, so two contacts cannot exist with the same email address.

 

Nick Galbraith
Support Engineer
Highlighted
Occasional Participant

Re: Can same email address used repetitively?

Thank you for clarification!!

Highlighted
Trusted Contributor

Re: Can same email address used repetitively?

I'd like to add to what Nick has stated. I've  provided a description of our contact data model that explains this more thoroughly here.  Essentially, contacts are unique at the account level in our system, and list are "interest" attributes of the contact record.

Mark Coleman
Support Engineer
Highlighted
Occasional Contributor

Re: Can same email address used repetitively?

 There is an emergency issue with this to my clients. Contacts are not getting updated once contact is register. is there a way that I could reach you guys?  Please help us out.

Highlighted
Occasional Contributor

Re: Can same email address used repetitively?

Seems like issue is with post. Once the contact is created then how can I get the right contact using GET when I have list number and email address? Please hlep me soon. Thanks!

Highlighted
Employee

Re: Can same email address used repetitively?

Hi,

 

If you want to update existing contacts as well as add new contacts, you have to build in logic to do a search by email address, then PUT the contact if it already exists or POST the contact if it is new.  Here is my script that uses our PHP wrapper, for example.

 

<?php

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

$ConstantContact = new ConstantContact("oauth2", $apikey, $username, $accessToken);  //OR
//$ConstantContact = new ConstantContact("basic", $apikey, $username, $password);
//Supply your credentials--API Key and other details--in config.php

// 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
$emailAddress = "test_12132012@example.com";

// Search for our new Email address
$search = $ConstantContact->searchContactsByEmail($emailAddress);

// 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'][1]->id);
	// Set the email address
	$contactObj->emailAddress = $emailAddress;
	//Set the opt in source
	$contactObj->optInSource = "ACTION_BY_CONTACT";
	// Create the Contact and DONE
	$Contact = $ConstantContact->addContact($contactObj);
	echo ("Contact added.");

} // Otherwise we update our existing contact
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'][1]->id );
	 
	 //Set the opt in value
	 $contactObj->optInSource = "ACTION_BY_CONTACT";
	 $contactObj->firstName = 'firstname';
  	 $contactObj->lastName = 'CTCTlastname';
	// Update the contact and DONE
	$UpdateContact = $ConstantContact->updateContact($contactObj);
	
	echo ("Contact updated.");
}	

?>

 

 

Best Regards,

Shannon W.

API Support Specialist

Highlighted
Occasional Contributor

Re: Can same email address used repetitively?

Is there any Java code examples for the same issuer?

Highlighted
Occasional Contributor

Re: Can same email address used repetitively?

Actually my case is, I can't directly update existing contact and I should when it's not there in any lists but already registered and create a new one if not registered. And another thing is we don't have many list but just one so I knew list number.

 

 Thanks!

Highlighted
Employee

Re: Can same email address used repetitively?

Hi.

 

That is what the script I posted above does.  If the contact is new, it adds them.  If the contact exists already, it updates them to make sure they are added to a list in the account.

 

Sorry, but I don't have any Java examples of this.

 

Best Regards,

Shannon W.

API Support Specialist

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