How do you create a list from PHP?

Regular Participant

How do you create a list from PHP?

our system uses sales tags that are like lists in constant contact.  What I want to let my users do is create new sales tags on my site and that will automattically add a list with the same name on constant contact.


I have the sales tag creation down I just need to know how to create a list on CC.





You can find information about creating a contact list here. This would involve making an http POST request to the lists collection uri ({username}/lists) using a Content-Type header with a value of 'application/atom+xml' and including a variation of the following XML in the request body.

We do have a PHP Library that has this capability already, and would just require the following code the create a list in your account, provided you've setup 'ctctWrapper.php' with your Constant Contact credentials.



$ListsCollection = new ListsCollection(); // Instantiate the ListsCollection class

// Setup list properties

$list = "Your list name"; // Name of List to create

$list = "99";       // Sort order of list

$list = false;   // Opt in default for 'Join My Mailing List' form

// Create the List Object

$myList = new ListObj($list);

// Add the new list to your Constant Contact account



I hope this helps. If you have any questions regarding this please let us know.

David J

Developer Portal

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

Visit Page