Convertkit Ruby Client
A Ruby toolkit for Convertkit API.
Add this line to your application's Gemfile:
gem 'convertkit-ruby', require: 'convertkit'
And then execute:
Or install it yourself as:
$ gem install convertkit-ruby
For private integrations, use your personal
API_SECRET found in your account settings.
require "dotenv" Dotenv.load(".env.local") Convertkit.configure do |config| config.api_secret = ENV["API_SECRET"] config.api_key = ENV["API_KEY"] end client = Convertkit::Client.new
Calls for Convertkit API v3 are relative to the url http://api.convertkit.com/v3.
API actions are available as methods on the client object. Currently, the Convertkit client has the following methods:
|Get account information||
|Fetch a subscriber||
|Update a subscriber||
|Add subscriber to sequence||
|Add subscriber to tag||
|Create a tag||
|Create multiple tags||
|Add subscriber to form||
Note: We do not have complete API coverage yet. If we are missing an API method that you need to use in your application, please file an issue and/or open a pull request. See the official API documentation for a complete API reference.
Here are some common use cases for the Convertkit v3 API client.
First configure the
convertkit-ruby gem with your
API_SECRET, and initialize a new client. After that, you can fetch data from your account.
List all subscribers added to your account on or after a specific date.
response = client.subscribers(from: "2016-03-01") # => <Faraday::Response ...> response.status # => 200
Fetching subscriber data
Subscribers can be looked up by their
response = client.subscriber("17682009") # => <Faraday::Response ...> response.status # => 200
After checking out the repo, run
bin/setup to install dependencies. Then, copy
.env.local and substitute your own real values from your account. Finally, run
rake spec 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/hookengine/convertkit-ruby. 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.
- Fork it ( https://github.com/hookengine/convertkit-ruby/fork )
- Create your feature branch (
git checkout -b my-new-feature)
- Commit your changes (
git commit -am 'Add some feature')
- Push to the branch (
git push origin my-new-feature)
- Create a new Pull Request
The gem is available as open source under the terms of the MIT License.