Create a new list using the API?

SOLVED
Highlighted
Occasional Advisor

Create a new list using the API?

I've successfully create campaigns and add to existing contact lists via the API - I don't see any code samples or options to create a new list.  Is this possible using the API?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Honored Contributor

Re: Create a new list using the API?

Hello,

 

Here's a very simple snippet of code showing the minimum requirements to create a list with the API. 

$cc = new ConstantContact(APIKEY);
$newList = $cc->listService->addList(ACCESS_TOKEN,ContactList::create(Array(
	"name" => "List Name",
	"status" => "ACTIVE"
)));

Please let me know if you have questions!

 

Sincerely,

Elijah G.
API Support Engineer

View solution in original post

10 REPLIES 10
Highlighted
Honored Contributor

Re: Create a new list using the API?

Hello,

 

It is possible to create lists with the API! You can find the documentation for that action here: http://developer.constantcontact.com/docs/contact-list-api/contactlist-collection.html?method=POST

 

Additionally, if you are using one of our SDKs and let me know which one, I can provide some guidance on how to accomplish this task with that SDK.

 

If you have any follow-up questions, please let me know!

 

Sincerely,

Elijah G.
API Support Engineer
Highlighted
Occasional Advisor

Re: Create a new list using the API?

Thanks alot - I'm using the php SDK from https://github.com/constantcontact/php-sdk

Highlighted
Honored Contributor

Re: Create a new list using the API?

Hello,

 

Here's a very simple snippet of code showing the minimum requirements to create a list with the API. 

$cc = new ConstantContact(APIKEY);
$newList = $cc->listService->addList(ACCESS_TOKEN,ContactList::create(Array(
	"name" => "List Name",
	"status" => "ACTIVE"
)));

Please let me know if you have questions!

 

Sincerely,

Elijah G.
API Support Engineer

View solution in original post

Highlighted
Occasional Advisor

Re: Create a new list using the API?

Thanks - that's exactly what I needed

Highlighted
Member

Re: Create a new list using the API?

Hi,

 

Can we allocate specific contacts(new contacts) to a campaign(a new campaign) that I schedule for?

Cheers

 

Highlighted
Honored Contributor

Re: Create a new list using the API?

Hello,

 

If you are working with a new campaign, then the only way to specifically send it to only new contacts would be to place those new contacts into a separate list. However, if you have a specific email campaign that you'd like to send to any new contacts over a period of time, you might be able to use our Autoresponder feature.

 

Autoresponder allows you to create a series of campaigns with a specified time delay. You can then assign lists of contacts to that series and any contacts who are added to those lists will be sent those email with the specified delay from the time they were added to the list. If you're interested in this, you can find more information about autoresponder here: https://knowledgebase.constantcontact.com/articles/KnowledgeBase/5521-about-autoresponder

 

Sincerely,

Elijah G.
API Support Engineer
Highlighted
Occasional Advisor

Re: Create a new list using the API?

Thanks alot for your help!  I'd like to give a user the option of creating a campaign and creating a new list at the same time.  Is it possible to retrieve the list ID right after creating it, or would I have to perform 'getLists', find the newly created list, then add it to the campaign that way?

Highlighted
Honored Contributor

Re: Create a new list using the API?

Hello,

 

I apologize for having missed this and not responding sooner!

 

When you first create a new contact list, the API response includes the new list ID. With the code sample I provided before, $newlist would contain an id that could be assigned to an email campaign. If you have any difficulty with this, please let me know!

 

Sincerely,

Elijah G.
API Support Engineer
Highlighted
Occasional Advisor

Re: Create a new list using the API?

Thanks so much - I was able to get the new list ID, as well as create, schedule, update and delete campaigns via the API with your help!

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