cancel
Showing results for 
Search instead for 
Did you mean: 

API question

Frequent Visitor

API question

My web developer worked to add code allowing customers visiting our site (http://www.mom4life.com) to sign up for our newsletter on the homepage and during checkout.

 

The code that he used is shown below:

CHeckout:

 

$data = array(

"EmailAddress" => $cart['user_data']['email'],

"OptInSource" => "ACTION_BY_CUSTOMER"

);

 

Homepage:

$data = array(

"EmailAddress" => $email_address,

"OptInSource" => "ACTION_BY_CUSTOMER"

);

Our understanding is that using this code would allow the customer to sign up though our website and that Constant Contact would view them as signing themselves up. However, all our recent subscribers are showing up as being added by the "site owner". Can you help us understand if we did something incorrectly in our code? We would like this to work in such as way that your system sees it as the customer signing themselves up so that they can get our welcome email automatically.

 

5 REPLIES 5
Trusted Contributor

Re: API question

Hello,

 

To display in the User Interface as added by "Contact", you should set the OptInSource to "ACTION_BY_CONTACT."

 

This not only changes the added-by fields, but also controls whether contacts will recieve an account welcome email when they are added to the list via your checkout/signup process. They should also be made aware during checkout, if possible that they will be receiving emails from you, and have the option not to be added at that time, if possible. That helps ensure that you won't inadvertently send someone emails they may not realize they'll be recieving.

 

I hope this helps. Let us know if you have additional questions.

Mark Coleman
Support Engineer
Frequent Visitor

Re: API question

Thank you for your fast reply, we will give that a try!!

Occasional Participant

Re: API question

Hi Mark,

 

I have the following code but all contacts are added as site owner.  Do you have any idea why this might be?

 

$postFields = array();
$postFields["emailAddress"] = $info["email"];
$postFields["firstName"] = $info["first_name"];
$postFields["lastName"] = $info["last_name"];
$postFields["OptInSource"] = "ACTION_BY_CONTACT";

$postFields["lists"] = array($list);

 

try {
$ConstantContact = new ConstantContact("oauth2", $apikey, $appusername, $apptoken);
$newContact = new Contact($postFields);
$result = $ConstantContact->addContact($newContact);
return true;
} catch (Exception $e) {
return false;
}

 

My understanding is that this should add subcribers not as a site owner - but this isn't the case.

 

Any help much appreciated.

Paul

CTCT Employee

Re: API question

Hi Paul,

 

The only modification I had to make for your code to add a contact by contact was to undercase the first letter of "OptInSource."  It should be "optInSource."  I hope that helps!

 

Best Regards,

Shannon W.

API Support Specialist

Occasional Participant

Re: API question

Thanks Shannon - much appreciated!