A Rails plugin for interfacing with the iContact email marketing api
Ruby
Switch branches/tags
Nothing to show
Permalink
Failed to load latest commit information.
lib
tasks
test
.gitignore
MIT-LICENSE
README
README.rdoc
Rakefile
init.rb
install.rb
uninstall.rb

README.rdoc

iContact

iContact is an email marketing service provider, and this is a Rails plugin to interface with their REST/XML api. The api is in beta and doesn't look to have a particularly large amount of development going on, but it is fairly complete and looks to cover most functionality.

For now I'm just producing a plugin, I'll move it over to a gem when it's more complete.

Updated to Include Limited POST Functionality

The new POST functionality only supports email and zip code at the moment. This could certainly be improved, but it works.

Put something like this in your site config:

Icontact::Application.api_key = "xxxxxxxxxxxxxxxxx"
Icontact::Application.shared_secret = "xxxxxxxxxxxxxxxxx"
ICONTACT_USER = 'xxxxxxxx'
ICONTACT_PASSWORD = 'xxxxxxxx'
ICONTACT_LIST_ID = <ID of the list you want to post to>

Then, in your controller, create a new iContact user and subscribe them to a mailing list:

api = Icontact::Application.login(ICONTACT_USER, ICONTACT_PASSWORD)
contact = Icontact::Contact.new(api.token, api.sequence)
contact.email = params[:user][:email]
contact.zip = params[:user][:postal_code]

if api.subscribe(api.create_contact(contact), ICONTACT_LIST_ID)
  flash[:notice] = 'Thank you for joining our mailing list.'
  redirect_to index_url
else
  flash[:notice] = "There was a problem when adding your email address. Please try again."
  redirect_to :action => 'email_signup'
end

Current Status

It's a while since I worked on this, but I seem to recall I'd implemented a lot of the get based stuff, and the rest would just largely be following the same pattern so shouldn't be too hard to complete.

Where I got stuck was on PUTs / POSTs which don't seem to work as documented and had many conflicting stories in the forums. After a lot of trial and error what previously worked no longer did so I think I'd had my key disabled due to being caught by some sort of a security measure.

Links

Homepage - www.icontact.com API docs - app.icontact.com/icp/pub/api/doc/api.html API forum - www.icontact.com/forums/forum-7.html API signup - www.icontact.com/icp/core/registerapp

Copyright © 2008 Jon Gilbraith / CompletelyNovel Ltd. Released under the MIT license