We all started somewhere! Share your experience on the Get Advice: Let's Get Started Sweepstakes thread and be entered to win a $100 credit on your Constant Contact account.

Can't add contact

DaveR50
Regular Participant

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
DaveR50
Regular Participant

I'm getting:

 

The requested URL returned error: 400

DaveR50
Regular Participant

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

 

Still not working.

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

Developer Portal

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

Visit Page