Adding a new field for each recipient with custom data

Hey guys,

I am just starting to play around with the new API and I am having a few problems trying to accomplish something here. This is what I have to do:
I already have my contacts in a list, with a few custom fields, and now I must add 1 new custom field to the existing contacts, and populate that field with a different code for each recipient.

I would have to first add the custom field directly on the system.
I believe I know how to do this if I was adding a new contact, but how do I loop though all my existing contacts and add new data for a custom field?

Thanks in advance.

jamesd jamesd, 6 years ago

Hey Bruno,

The simplest (but not necessarily the quickest) way of doing this would be to:

1. Get the list of active subscribers you need to update using:

2. Iterate through all the subscribers and update their details using: (ensuring that you include the new custom field in the CustomFields input)

The other approach you could take would be to export the list of subscribers and then use to bulk re-import them, including the new custom field in the input.

bc173, 6 years ago

Hey Bruno, I had the same problem a few weeks ago and from my experience importing a .csv file manually is the fastest solution (a matter of seconds).

The problem with updating through the API (the older version) is that my PHP script got a time-out for every 2,000 updates (I was updating around 10,000 subscribers).

brunom, 6 years ago

Thanks guys!

If I just export my current contacts to a CSV file, and add the new column with the unique code to it, when I reupload that file back into CampaignMonitor, will it just upload my current contacts (i.e. just add that new field to each) or will it overwrite all my contacts?

Since I already sent a few campaigns to this list I would like to keep the historical data for each contact.


jamesd jamesd, 6 years ago

Any existing contacts which you re-import will be updated. See the import help topic:

brunom, 6 years ago

Great! I just noticed that.
Perfect. For this one time I believe the suggestion of bc173 will be faster.

Thanks guys.

200,000 companies around the world can't be wrong.

From Australia to Zimbabwe, and everywhere in between, companies count on 
Campaign Monitor for email campaigns that drive real business results.

Get started for free