Custom Campaign For Each Subscriber

Hello,

I am integrating the Campaign Monitor API into my custom CMS.  There are 900+ members that each get a daily newsletter, which I am using Campaign Monitor.

Each newsletter has custom article HTML inside a standard template.  Which means I have to:

1.) loop through the subscribers for a list (the following is done inside the loop)
-----
2.) do a cms lookup for the companies the member wishes to view articles from, and then lookup the articles for those companies, and then get the HTML to put into the template.
3.) create a list with the subscriber in the loop
4.) create a campaign, create the Html Url with the custom article HTML in it
5.) run the send function for that campaign to the list with the subscriber in it
6.) delete the campaign with the campaign function, delete the list... because I do not want to store 900+ campaigns/list each time the newsletters get sent
7.) log the results
-----

My question is:  Can I loop through all of the subscribers in a list, create a list, put the subscriber into that list, create a campaign, send the campaign, and then delete the campaign and list... in each iteration of the loop??

The concern is that I will only know which articles to put into a campaign once I do a cms lookup for that member.  Members can change their article settings whenever they want...

tobyb tobyb, 5 years ago

Hi gdubs,

Your right that you can perform all those actions in each iteration of the loop, however this approach will no doubt be quite slow as there would be around 10 API calls per subscriber.

Another option you have is to define a custom field for each company a member may be interested in. When you need to send an email out you would have to update the value for these fields for all of your subscribers to keep your list in sync with your CMS. You could then use these fields to control which content is used for each subscriber.

Say you have a 'Company A', you would define a text custom field [CompanyA] and in your email have the content for Company A as the fallback term for that field, e.g

[CompanyA, fallback=<div>Company A just released...</div>]

Members who wish to view articles from Company A would have the CompanyA field set to null, or an empty string and the system would use the fallback value. Members not wishing to view Company A information would have the CompanyA field set to '&nbsp;' or similarly blank content.

Whilst this approach may seem more complex it would drastically reduce the work your code would have to perform (using the import method ~10 api calls for 900 subscribers), not to mention you'd be able to get reporting for the entire list.

gdubs, 5 years ago

Hey Toby! That's great news... I was wondering about the custom fields.  I could populate one custom field pr subscriber prior to using the api to sending the campaign. 

One thing I would want to make sure of is that ... Can I put html into the custom field? Also I would want to know what is the max amount of HTML I can have in a custom field...

Carissa Carissa, 5 years ago

Hi gdubs,

Yes! You can put HTML into a custom field. The max amount of characters you can have in a custom field is 250. Hope that's enough for you!


Carissa
Campaign Monitor
gdubs, 5 years ago

That's a shame...

I would need to create a custom field called 'articles_html' for each subscriber.  That field would need to have a fiarly large amount of html in it.

Is there any custom field that would allow a TEXT field link in mysql? Which I could have 2000 or so chars?

Also, Can you point me to some sample code for creating and populating a custom field for subscribers?  I do not see in the samples/subscriber folder in the php wrapper download anything for subscriber custom fields.

Thanks!

Stig Stig, 5 years ago

Unfortunately all fields have the 250 character limit. But as a workaround, you could spread the HTML across several fields, and add the personalization tag back to back.

The maximum number of fields is 20, so 2,000 characters would fit fine.


The Campaign Monitor Blog – HTML email smarts to go with your good looks.
tobyb tobyb, 5 years ago

Hi gdubs,

While the character limit on a custom field is 250 characters there is no limit on the fallback value. In my proposal above you will see that the only content you would have in custom fields would be '&nbsp;' or some other equivalent, all well within the character limit. The custom content for each company would instead be included as the fallback value (which as noted has no limit). 

As for the API samples, you create a custom field on a list (see here) and populate the custom field using the subscribe or import (examples here and here)

gdubs, 5 years ago

Hey, thanks for all the support.  I got what I needed accomplished in my CMS.  Once I finish the Mailer System, I'll post my code.

I used the fallback for the default article html.  And when a cms staff clicks start mailer, i delete the campaigns custom field that hold the fallback, and then create it with the new fallback (since each mailer has a different fallback).  I then use the import function to loop through the members and updating up to 19 custom fields with limited char html. 

And then use only one spi send command.

Join 200,000 companies around the world that use Campaign Monitor to run email marketing campaigns that deliver results for their business.

Get started for free
1-888-533-8098