Legacy Infusionsoft Api is an interface for accessing Infusionsoft's API.
It's based on the MYOB Api gem and the Infusionsoft API gem.
Add this line to your application's Gemfile:
gem 'legacy_infusionsoft_api'And then execute:
$ bundle
Or install it yourself as:
$ gem install legacy_infusionsoft_api
Create an api_client:
api_client = LegacyInfusionsoftApi::Client.new({
api_key: USERS_API_KEY,
app_name: USERS_APP_NAME,
})
The :api_key can be found in Infusionsoft under Admin -> Settings -> Application Setttings (Application). The :app_name is the subdomain of app_name.infusionsoft.com('app_name').
Return a list of all contacts
api_client.contact.all
You can get a count of all contacts
api_client.contact.count
You can execute a block of code while iterating contacts
api_client.contact.find_each({}, true, 50) do |contacts|
# contacts.length === 50
contacts.each do |contact|
puts contact['Id']
end
end
You can also pass a query hash
api_client.contact.all({
:FirstName => 'David',
})
You can create contacts too
client = api_client.contact.create({
:FirstName => 'David',
:LastName => 'Lumley',
:Email => 'david@davidlumley.com.au',
:Company => 'Client Heartbeat',
})
You can also delete contacts by passing an ID
api_client.contact.delete(16)
Or by passing a query
api_client.contact.delete({
:FirstName => 'Trevor',
})
Add a note to a contact
api_client.contact_action.create({
"ContactId" => 1234,
"CompletionDate" => Time.now.utc.strftime("%F\T%T"),
"ActionDescription" => "My Note Title",
"CreationNotes" => "My note body"
})
Return a list of all contact groups
api_client.contact_group_assign.all
You can also pass a hash query
api_client.contact_group_assign.all({
:GroupCategoryId => 12,
})
Return a list of all contact group assignments (i.e. contacts with a tag or group)
api_client.contact_group_assign.all
You can also pass a hash query
api_client.contact_group_assign.all({
:ContactGroup => 'New Customer',
})
Return a list of all contact group categories
api_client.contact_group_category.all
You can also pass a hash query
api_client.contact_group_category.all({
:CategoryName => 'Custom Tags',
})
After checking out the repo, run bin/setup to install dependencies. Then, run rake test to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://github.com/cavneb/legacy_infusionsoft_api. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the MIT License.
This project is proudly supported by the following code sponsors:
Everyone interacting in the LegacyInfusionsoftApi project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.



