Highlighted
Occasional Contributor

Can't add contact

The following code using ctctwrapper is not working for me:

 

  $params = array();
  $params["email_address"] = $email;
  $params["first_name"] = $firstName;
  $params["last_name"] = "Doe";
  $params['status'] = "";
  $params['link'] = "";
  $params['id'] = "";
  $params['middle_name'] = "";
  $params['company_name'] = "";
  $params['job_title'] = "";
  $params['home_number'] = "";
  $params['work_number'] = "";
  $params['address_line_1'] = "";
  $params['address_line_2'] = "";
  $params['address_line_3'] = "";
  $params['city_name'] = "";
  $params['state_code'] = "";
  $params['state_name'] = "";
  $params['country_code'] = "";
  $params['zip_code'] = "";
  $params['sub_zip_code'] = "";
  $params['notes'] = "";
  $params['custom_field_1'] = "";
  $params['custom_field_2'] = "";
  $params['custom_field_3'] = "";
  $params['custom_field_4'] = "";
  $params['custom_field_5'] = "";
  $params['custom_field_6'] = "";
  $params['custom_field_7'] = "";
  $params['custom_field_8'] = "";
  $params['custom_field_9'] = "";
  $params['custom_field_10'] = "";
  $params['custom_field_11'] = "";
  $params['custom_field_12'] = "";
  $params['custom_field_13'] = "";
  $params['custom_field_14'] = "";
  $params['custom_field_15'] = "";
  $params['mail_type'] = "";
  $params['lists'] = 0;

  $contact = new Contact($params);
  $contactsCollection = new ContactsCollection();
  $contactsCollection->createContact($contact);

 

I'm getting no error or anything but when I check it's not added.

4 REPLIES 4
Highlighted
Occasional Contributor

Re: Can't add contact

I'm getting:

 

The requested URL returned error: 400

Highlighted
Occasional Contributor

Re: Can't add contact

I changed $params["lists"] = array("General Interest");

 

Still not working.

Highlighted
Employee

Re: Can't add contact

Hello,

 

In order to add contacts you do need a valid list.  In the ctctWrapper library, the list needs to be a valid list ID.  It will look like this:

 

http://api.constantcontact.com/ws/customers/USERNAME/lists/LISTID

 

Once y ou have a valid list and email address, it should work.

 

If you have any questions please let me know.

 

Regards,

Benjamin Soder
NOC Analyst
Constant Contact
Highlighted
Honored Contributor
Moved:

Re: Can't add contact

Developer Portal

View API documentation, code samples, get your API key.

Visit Page

Register for our "Making Sense of Online Marketing for Retail" Webinar

Join us on Thursday, August 13th at 2pm ET for a free webinar where we'll discuss how to incorporate online marketing into your retail store.

Read More
Featured