05-31-2012 12:12 PM
I have the documentation for scheduling a campaign but not sure I see what I need.
My use case is as follows:
1. User signs up ro receive campaigns on my web site.
2. I add them to a contact list.
3. Send that one email address (contact entry) the latest campaign. Note, the latest campaign has already been sent to other contacts.
05-31-2012 03:56 PM
If you use a scheduling request to schedule an email that was already sent to a list of contacts, our system will send the email only to new contacts that have been added since the last time the email was sent.
You have a couple of options that I think will accomplish what you're trying to do.
1) You could schedule the most recently sent email each time a new contact signs up, or
2) Use a cron job to simply reschedule your most recently sent email at some time interval.
Both of the above should accomplish your goal, so long as the most recent campaign was sent within the last 90 days, and in the case of rescheduling with each signup, you would want to request status of the email before scheduling to avoid 409 errors if the email is already in a scheduled status.
I hope this helps you out. Let us know if you have any additional questions.
05-31-2012 04:27 PM
I'm esseentially doing a ber of #1 and it's working great! I'll add code to check if it's already scheduled.
Curious, in the Campaign class I noticed a Type variable, how is this set? I don't see a UI option to have campaign types.
05-31-2012 05:15 PM
If you're referring to the CampaignType, that refers to whether the email is based on our template (value = "STOCK"), or an html/xhtml email (value = "CUSTOM"). Emails created through the API will be "CUSTOM." Let me know if this wasn't what you were referring to, and I'll do my best to provide a better answer.
05-31-2012 05:39 PM
Thanks! My use case is a bit different. We use Constant Contact for more than newletters so when I send the newsletter for a new sign-up I need to know what is the latest real newsletter to send. Other than coming up with a naming scheme, 'Latest', I don't see any other way.
Let me know if I'm missing something.
05-31-2012 07:24 PM
Your approach is reasonable, I think. There are other options to retrieve a list of all emails with status SENT, and then test for most recent using some logic, but the problem there is that if the most recent email is currently scheduled when another contact signs up, they may then get the next most recent email instead! But you could also get scheduled emails to see if there is a newsletter scheduled, and if so, do nothig, knowing that your contact added to the list at that point should then recieve the scheduled newsletter when it sends, which spresumably would be the most recent unless it's common for you to resend emails manually or at other times.
Just some thoughts. You'll know best if they could work in your case.
06-01-2012 09:40 AM
The best way I can think, since Mark makes good points on the limitations of the querying and searching in the API, would be to use a naming convention that includes the date the email was sent in the name. This way, you can pull all of the campaigns and see the latest by the date in the name of the campaign and choose that campaign to send. Since you want this script to dynamically always choose the "most recently sent" email, there is no way to do this without some sort of convention you've established to decide what that means.
Senior Product Manager, Constant Contact