Simple Ruby REST wrapper for the Active Campaign API


This is a very simple wrapper around the REST ActiveCampaign API. You will still need to provide the path and the payload for each request. Eventually I will grow this out to be more convenient, if needed. Right now, this just provides some conveniences and an easy way to configure the API and not much more... hence the name active-campaign-simple :)

Use the public API as a guide for paths (urls) and payload info:


gem install active-campaign-simple


  1. add gem 'active-campaign-simple' to your Gemfile
  2. Get your API URL and Key from within your application (Settings > Developer)
  3. Then create an initializer in config\initializers called active_campaign.rb and the following
# Added to your config\initializers file
ActiveCampaign.configure do |config|
  config.api_url = 'YOUR_API_URL'
  config.api_key = 'YOUR_API_KEY'
  config.api_logger ="#{Rails.root}/log/active_campaign_api.log") # optional logger file


# Get a list of contacts

# Get a contact
ActiveCampaign.get('/contacts/' + id)

# Create (post) a new contact
#'/contacts', payload: {
  contact: {
    email: '',
    firstName: 'Nate',
    lastName: 'Test',
    phone: '1231231234'
  fieldValues: [
      field: '1',
      value: 'The Value for First Field'

# Update (put) a contact
ActiveCampaign.put('/contacts/' + id, payload: {
  contact: {
    email: ''

# Delete a contact
ActiveCampaign.delete('/contacts/' + id)

# Search for a contact
ActiveCampaign.get('/contacts', query: { email: '' })

# Event Tracking
# See:
# NOTE - The tracking API is different from all other calls as it changes the arguments a little to simplify.
ActiveCampaign.track_event('event-key', 'actid', 'event-name', 'email')

# or with optional eventdata
ActiveCampaign.track_event('event-key', 'actid', 'event-name', 'email', 'eventdata')


In the spirit of free software, everyone is encouraged to help improve this project.

See MIT LICENSE for details.