Socket
Book a DemoInstallSign in
Socket

rails_discord_notifier

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rails_discord_notifier

0.1.1
bundlerRubygems
Version published
Maintainers
1
Created
Source

RailsDiscordNotifier

Send Rails exceptions to Discord via an incoming webhook

RailsDiscordNotifier is a lightweight gem that captures unhandled exceptions in your Rails application and delivers detailed error reports directly to a Discord channel via a configurable webhook. You own the codebase and can customize the format, embed fields, and delivery settings to suit your needs.

Features

  • Middleware-based interception of all uncaught exceptions
  • Rich embed messages with exception class, message, backtrace, request method & URL, and timestamp
  • Configurable via environment variables and initializer
  • Safe error handling: notification failures are logged but don’t interrupt your app

Installation

Add the gem directly from RubyGems.org by including it in your Gemfile:

gem "rails_discord_notifier", "~> 0.1.0"

Then install:

bundle install

Or use Bundler:

bundle add rails_discord_notifier

Usage

Generate the default initializer in your Rails app:

rails generate rails_discord_notifier:install

In config/initializers/rails_discord_notifier.rb, configure your webhook and options:

RailsDiscordNotifier.configure do |config|
  # Discord webhook URL (required)
  config.webhook_url = ENV.fetch("DISCORD_WEBHOOK_URL")

  # Bot username (optional, defaults to ENV["ERROR_BOT_NAME"] or "Error Bot")
  config.username    = ENV.fetch("ERROR_BOT_NAME", "Error Bot")

  # Bot avatar URL (optional)
  # config.avatar_url = ENV.fetch("ERROR_BOT_AVATAR_URL", nil)
end

Ensure the middleware is loaded (added automatically by the Railtie).

Any uncaught exception in your controllers or middleware stack will now send an embed to Discord before re-raising.

Configuration Options

OptionTypeDefaultDescription
webhook_urlStringRequiredDiscord incoming webhook URL
usernameStringfetched from ENV ERROR_BOT_NAME (defaults to "Error Bot")Bot display name
avatar_urlStringfetched from ENV ERROR_BOT_AVATAR_URL (defaults to nil)URL of the bot avatar image

Development

  • Checkout the repo
  • Run bin/setup to install dependencies
  • Run bundle exec rspec to execute the test suite
  • Build and install locally:
    gem build rails_discord_notifier.gemspec
    gem install ./rails_discord_notifier-#{RailsDiscordNotifier::VERSION}.gem
    
  • To release (public gem) update lib/rails_discord_notifier/version.rb and run:
    bundle exec rake release
    

Contributing

Bug reports and pull requests are welcome on GitHub: https://github.com/gettinDrikkieWithIt/rails_discord_notifier

Please follow the project’s Code of Conduct.

License

This gem is available as open source under the terms of the MIT License.
See LICENSE.txt for details.

FAQs

Package last updated on 28 May 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.