The Community is hosting an End of Summer sweepstakes! Participants must complete tasks to earn tickets that will enter them with a chance to win a free year of Constant Contact and other great prizes!*
*No Purchase Necessary. For Official Rules, visit here. Constant Contact’s End of Summer 2020 Sweepstakes ends on October, 20, 2020 at 11:50 PM EST.

Pull data from database as content for newsletter

Highlighted
Occasional Participant

Pull data from database as content for newsletter

Would someone please point me in the right direction. Using Constant Contact, I'd like to create a newsletter that pulls data from a database I created on my server. Is this possible? Thanks.


BTW, love Drupal!

5 REPLIES 5
Highlighted
Employee

Database Content

Constant Contact will allow you to upload a number of different details about a contact, as well as 15 custom fields where you can store any data that is not covered by one of our other fields.  If you visit our Contacts Collection page, this will give you more information about this, as well as a list of each field that you can use to store contact details.


 


While we cannot directly pull information from your database, you could write a script that would pull information from your database and use our API to store that information using the fields mentioned in the Contacts Collection page, which is linked above . Once you have that information uploaded, you can pull this information into your emails by using 1 of two methods, depending on which type of email you are using.

 

1) If you are using an XHTML email, you can dynamically pull this information for each contact into the email by using that particular property. For example, for displaying the 'Job Title' field, you would use <Property name="Subscriber.JobTitle"/> directly in your XHTML. You can find a full list of the properties for use in an XHTML email in this FAQ.

 

2) If you are using a new wizard email, you can insert contact details right from our editor. This FAQ discusses inserting contact details into new wizard emails in more detail.

 

I hope this information helps. Please let us know if you have any other questions.

David J

Highlighted
Occasional Participant

Database Content

In what form do I need to pull the data from the DB? Should I write it to a file on my server? Should I output it to a web page with URL?


Does the API access the data using the GET protocol? How does the API "store that information using the fields mentioned in the Contacts Collection page" ? 


I haven't worlked with XML at all so I don't understand this mechanism very well. Is there an overview that explains the mechanics of the CC API?


Thanks for your help.

Highlighted
Employee

Re: Database Content

You would need to write the file mentioned on your own server. This file would pull information out from your database and upload it to Constant Contact in 1 of 2 ways.


 


1.       Bulk Operations – this is for use of 25 contacts or more. Managing smaller sets of contacts should be done through the Contacts Collection. Violation of this would be against our API terms and conditions. This method does not involve using XML at all to create contacts in our system.

2.       Contacts Collection – This is for creating a single contact at a time, and would be recommended if you needed to create fewer than 25 contacts. This involves doing an http POST where the request body contains XML representing the contact details.

 

Once you have used either of these methods to create your contacts, we do have that information stored on our servers and you will be able to insert those details dynamically into your emails.

 

For an overview of our API and some How-To guides, please take a look at our REST API Reference page.

 

For sample forms in C#, PHP, and ColdFusion, please take a look at our Sample Codes page, which can help get you started using our API.

 

David J

Highlighted
Occasional Participant

Database Content

I think I'm trying to accomplish something different than this. I am not importing email contacts. I would like to import realestate property listings from my DB into the Constant Contact newsletter.



I think what I need to do is write a script that will generate the HTML code (for each property listing) that can then be cut-and-pasted (how archaic) into the newsletter template.



Wish there were a more elegant solution. Any ideas?

Highlighted
Employee

Dynamically generated emails

 


I think you are correct in that we had some miscommunication going on. What you are suggesting is possible, but would involve pulling that information from your database and inserting it into the HTML code for your emails as you had suggested.

 

Depending on how you have your information stored in your database for each of these property listings, you could generate a script to pull out certain fields and insert them into some default HTML of your email that you have designed. You would loop through your database doing this for each listing that you want to create an email for, thus generating slightly different HTML for each particular listing. You could also build in the logic to create the actual email in Constant Contact by using our API, which would prevent you having to copy/paste the HTML into each individual email. For information on doing this, I would recommend taking a look at Creating a Campaign, which will show you the XML necessary for creating an email campaign in Constant Contact using our API.

 

This would involve a fair bit of programming, but it is certainly possible. Once you have your script generated to create the HTML necessary for your emails, if you are running into difficulties creating the actual email in Constant Contact, please let us know and we would be more than happy to assist you with this.

David J

Developer Portal

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

Visit Page

Constant Contact 2020 End of Summer Community Sweepstakes!

The Constant Contact User Community is hosting a sweepstakes. The more you participate, the more chances you have to win! Read on to learn more...

Read More
Featured