Sample Code

Looking for applications already written in your favorite language or just a place to get started with the API? The applications below have been approved by Constant Contact and are yours to download, study, or modify. We encourage you to contribute to the developer community by submitting any apps you want to share.

Email Sign up Form - C#

This code sample creates an email sign up form that adds individual contacts to the user's contact collection; written in C#.

Go to GitHub

Create and Send Email - C#

This code sample creates and sends an email campaign message.

Go to GitHub

Email Sign up Form - iOS

This code sample creates an email sign up form that adds individual contacts to the user's contact collection; written in Objective-C for iOS.

Go to GitHub

Create and Send Email - iOS

This code sample creates and sends an email campaign message.

Go to GitHub

Create and Send Email - PHP

This code sample creates and sends an email campaign message.

Go to GitHub

OAuth 2.0 Server Flow - PHP

Implements the OAuth 2.0 server flow, obtaining an access token for a Constant Contact user.

Go to GitHub

Email Sign up Form - PHP

This code sample creates an email sign up form that adds individual contacts to the user's contact collection; written in PHP.

Go to GitHub

Create and Send Email - Ruby

This code sample creates and sends an email campaign message.

Go to GitHub

Bulk Activity - Import Contacts from a file - Ruby

The sample Ruby app (requires Sinatra) imports contacts from a properly formatted file to the user's contact collection, adding them to a specified contact list, all using the bulk activity import contacts endpoint.

Go to GitHub

Add a MyLibrary File (Multipart form) - Ruby

The example uploads a file (.jpg, .jpeg, .gif, .png, .pdf) to a MyLibrary folder in the user's Constant Contact account.

Go to GitHub

Email Sign up Form - Ruby

This Ruby code sample creates an email sign up form that adds contacts to the user's contact collection.

Go to GitHub