No release in over 3 years
A Rails gem that automatically captures application errors and sends instant notifications to Slack, Discord, Email, or WhatsApp (via Twilio).
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

Runtime

>= 6.6, < 8.0
 Project Readme

🚨 Rails Error Notifier – Ruby Gem for Error Monitoring in Rails

Gem Version Build Status License: MIT

Rails Error Notifier is an open-source Ruby gem for Rails 6+ applications that automatically captures unhandled exceptions and sends instant notifications. It integrates with Slack, Discord, Email, and WhatsApp (Twilio) so your team is immediately alerted to production errors.

πŸ‘‰ RubyGems page | πŸ‘‰ Source code on GitHub


✨ Features

  • πŸ”₯ Automatic error capturing in Rails via Rack middleware.
  • πŸ“© Send error notifications to:
    • Slack
    • Discord
    • Email
    • WhatsApp (via Twilio API)
  • βš™οΈ Easy setup with Rails generator.
  • πŸ“ Add custom context (current user, request path, environment).
  • πŸ›‘οΈ Safe failover (won’t crash if webhooks or configs are missing).
  • 🧩 Works seamlessly with Rails 6, Rails 7, and above, and supports Ruby 2.0+.

πŸ“¦ Installation

Add this line to your Gemfile:

gem 'rails_error_notifier'

Install the gem:

bundle install

Or install manually:

gem install rails_error_notifier

βš™οΈ Configuration

Generate initializer:

bin/rails generate rails_error_notifier:install

This creates config/initializers/rails_error_notifier.rb:

RailsErrorNotifier.configure do |config|
  # Slack + Discord
  config.slack_webhook   = ENV["SLACK_WEBHOOK_URL"] # "https://hooks.slack.com/services/T000/B000/XXXX"
  config.discord_webhook = ENV["DISCORD_WEBHOOK_URL"] # "https://discord.com/api/webhooks/1234567890/abcXYZ"

  # Email
  config.error_email_to   = ENV["ERROR_EMAIL_TO"]   # e.g. "dev-team@example.com"
  config.error_email_from = ENV["ERROR_EMAIL_FROM"] # e.g. "notifier@example.com"

  # WhatsApp (via Twilio)
  config.twilio_sid   = ENV["TWILIO_SID"] #"AC1234567890abcdef1234567890abcd"
  config.twilio_token = ENV["TWILIO_TOKEN"] #"your_auth_token_here"
  config.twilio_from  = ENV["TWILIO_FROM"] #"+14155552671"
  config.twilio_to    = ENV["TWILIO_TO"] # "whatsapp:+919876543210"

  # Enable in production only
  config.enabled = !Rails.env.development? && !Rails.env.test?
end

πŸš€ Usage

Automatic Error Notifications

Rails middleware will automatically send alerts for any unhandled exception.

Manual Error Notifications

begin
  risky_operation
rescue => e
  RailsErrorNotifier.notify(e, context: { user_id: current_user.id, path: request.path })
end

πŸ”” Example Notifications

Slack

🚨 Rails Error Notifier
Message: undefined method `foo' for nil:NilClass
Context: {:user_id=>42, :path=>"/dashboard"}

Discord

⚑ Rails Error Notifier
Error: PG::ConnectionBad
Message: could not connect to server: Connection refused
Context: {:host=>"db.example.com", :env=>"production"}

πŸ§ͺ Development & Testing

Clone and setup:

git clone https://github.com/mrmalvi/rails_error_notifier.git
cd rails_error_notifier
bundle install

Run specs:

bundle exec rspec

Build gem locally:

bundle exec rake install

Release a version:

bundle exec rake release

🀝 Contributing

Contributions, bug reports, and pull requests are welcome! See issues.


πŸ“œ License

Released under the MIT License.


πŸ“ˆ SEO Keywords

Rails error notifier gem, Ruby gem for error logging, Slack error notification Rails, Discord error notification Rails, Rails exception tracker, Rails monitoring gem, Ruby on Rails error reporting.