Skip to content

Drop-in plug-in for ActionMailer to send emails via Customer.io

License

Notifications You must be signed in to change notification settings

altertable-ai/customerio-rails

Repository files navigation

Customer.io Rails Gem

License Gem Version

The customerio-rails gem is a drop-in ActionMailer adapter to send emails via Customer.io. The gem has been created for fast implementation and targets Customer.io’s transactional email capabilities.

Usage

Requirements

You will need a Customer.io account set up to use it.

Supported Rails Versions

  • Rails 8.0
  • Rails 7.0

App API Key

Generate an App API Key (this is different than the pair Site ID / API Key) from your Workspace Settings > Your Workspace > Manage API Credentials > App API Keys.

Installation

Add customerio-rails to your Gemfile and run bundle install.

gem 'customerio-rails'

Set Customer.io as your preferred mail delivery method via config/application.rb:

config.action_mailer.delivery_method = :customerio
config.action_mailer.customerio_settings = { app_api_key: '<Your APP API Key>', region: Customerio::Regions::US }

Usage

Use it as you would usually:

class MyMailer < ApplicationMailer
  def whatever # whatever.{html,text}.erb will be used as body
    mail to: '[email protected]', subject: 'Hello from Rails!'
  end
end

Or rely on Customer.io's templated messages with:

class MyMailer < ApplicationMailer
  def whatever_with_template
    mail to: '[email protected]', subject: 'Hello from Rails!', transactional_message_id: 3, message_data: { myvar: 'a value', another_one: 42x }
  end
end

License

The Customer.io Rails gem is licensed under the MIT license. Refer to the LICENSE file for more information.

About

Drop-in plug-in for ActionMailer to send emails via Customer.io

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages