RailsDrips

RailsDrips is a Rails engine for versioned, auditable email drip campaigns. It stores campaign definitions, enrolls any Active Record model as a recipient, schedules steps through Active Job, and delivers mail through the host application's Action Mailer classes.

RailsDrips owns the workflow. Your application owns the product decisions and email content.

RailsDrips provides Your application provides
Campaigns, immutable versions, and ordered steps Action Mailer classes and templates
Enrollment, scheduling, retries, and cancellation The business event that enrolls or removes a recipient
Active Job delivery orchestration A production Active Job adapter and worker process
Delivery snapshots and an append-only event history Optional eligibility, preference, and transport hooks
YAML definitions and import tooling Admin authentication and authorization if the UI is mounted

RailsDrips supports Rails 7.0 through Rails 8.x. Its public API is still pre-release.

Quick start

Add the gem, install its files, and migrate:

# Gemfile
gem "railsdrip-engine"
bundle install
bin/rails generate rails_drips:install
bin/rails db:migrate

Register a host mailer in config/initializers/rails_drips.rb:

RailsDrips.configure do |config|
  config.delivery_queue_name = :mailers

  config.mailers.register "welcome", label: "Welcome" do |delivery|
    OnboardingMailer.welcome(delivery)
  end
end

Define OnboardingMailer#welcome, edit the generated campaign YAML, import and activate it, then enroll a recipient:

bin/rails rails_drips:validate DEFINITION=config/rails_drips/onboarding.yml
bin/rails rails_drips:import DEFINITION=config/rails_drips/onboarding.yml APPLY=true
bin/rails rails_drips:activate CAMPAIGN=onboarding VERSION=1
RailsDrips.enroll(
  campaign: "onboarding",
  recipient: ,
  source: "account_created"
)

That call creates the enrollment, event history, and scheduled deliveries in one transaction. Delivery jobs are enqueued only after the transaction commits.

Documentation

The current admin pages are an operational prototype, not the finished UI. The admin UI and dummy-app TODO defines the next design and demonstration iteration.

Development

bundle install
bundle exec rspec
bundle exec rake build

Extraction research and implementation plans live under docs/research/extracting-drip-engine/ and plans/.