Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
A

activity_notification

> 后端框架
Open source

Integrated user activity notifications for Ruby on Rails

520 stars0 likes2 views
WebsiteGitHub

About

Integrated user activity notifications for Ruby on Rails

ActivityNotification

activity_notification provides integrated user activity notifications for Ruby on Rails. You can easily use it to configure multiple notification targets and make activity notifications with notifiable models, like adding comments, responding etc.

activity_notification supports Rails 7.0+ with ActiveRecord, Mongoid and Dynamoid ORM. It is tested for MySQL, PostgreSQL, SQLite3 with ActiveRecord, MongoDB with Mongoid and Amazon DynamoDB with Dynamoid v3.11.0+. If you are using Rails 5 or Rails 6, use v2.3.3 or older version of activity_notification.

About

activity_notification provides following functions:

  • Notification API for your Rails application (creating and managing notifications, query for notifications)
  • Notification models (stored with ActiveRecord, Mongoid or Dynamoid ORM)
  • Notification controllers (managing open/unopen of notifications, providing link to notifiable activity page)
  • Notification views (presentation of notifications)
  • Automatic tracked notifications (generating notifications along with the lifecycle of notifiable models)
  • Grouping notifications (grouping like "Kevin and 7 other users posted comments to this article")
  • Email notification
  • Email attachments (configurable at global, target, and notifiable levels)
  • Batch email notification (event driven or periodical email notification, daily or weekly etc)
  • Cascading notifications (progressive notification escalation through multiple channels with time delays)
  • Push notification with Action Cable
  • Subscription management (subscribing and unsubscribing for each target and notification type)
  • Instance-level subscriptions (subscribing to notifications from a specific notifiable instance)
  • REST API backend and OpenAPI Specification
  • Integration with Devise authentication
  • Activity notifications stream integrated into cloud computing using Amazon DynamoDB Streams
  • Optional notification targets (Configurable optional notification targets like Amazon SNS, Slack, SMS and so on)

Notification index and plugin notifications

activity_notification deeply uses PublicActivity as reference in presentation layer.

Subscription management of notifications

Amazon SNS as optional notification target

Slack as optional notification target

Public REST API reference as OpenAPI Specification

REST API reference as OpenAPI Specification is published in SwaggerHub here:

  • https://app.swaggerhub.com/apis-docs/simukappu/activity-notification/

You can see sample single page application using Vue.js as a part of example Rails application in /spec/rails_app. This sample application works with activity_notification REST API backend.

Table of Contents

  • About
    • Public REST API reference as OpenAPI Specification
  • Getting Started
  • Setup
    • Gem installation
    • Database setup
      • Using ActiveRecord ORM
      • Using Mongoid ORM
      • Using Dynamoid ORM
        • Integration with DynamoDB Streams
    • Configuring models
      • Configuring target models
      • Configuring notifiable models
        • Advanced notifiable path
    • Configuring views
    • Configuring routes
      • Routes with scope
      • Routes as REST API backend
    • Creating notifications
      • Notification API
      • Asynchronous notification API with ActiveJob
      • Automatic tracked notifications
    • Displaying notifications
      • Preparing target notifications
      • Rendering notifications
      • Notification views
      • i18n for notifications
      • Managing notifications
    • Managing notifications
    • Customizing controllers (optional)
  • Functions
    • Email notification
      • Mailer setup
      • Sender configuration
      • Email templates
      • Email subject
      • Other header fields
      • i18n for email
    • Batch email notification
      • Batch mailer setup
      • Batch sender configuration
      • Batch email templates
      • Batch email subject
      • i18n for batch email
    • Grouping notifications
    • Cascading notifications
    • Subscription management
      • Configuring subscriptions
      • Managing subscriptions
      • Customizing subscriptions
    • REST API backend
      • Configuring REST API backend
      • API reference as OpenAPI Specification
    • Integration with Devise
      • Configuring integration with Devise authentication
      • Using different model as target
      • Configuring simple default routes
      • REST API backend with Devise Token Auth
    • Push notification with Action Cable
      • Enabling broadcasting notifications to channels
      • Subscribing notifications from channels
      • Subscribing notifications with Devise authentication
      • Subscribing notifications API with Devise Token Auth
      • Subscription management of Action Cable channels
    • Optional notification targets
      • Configuring optional targets
      • Customizing message format
      • Action Cable channels as optional target
      • Amazon SNS as optional target
      • Slack as optional target
      • Developing custom optional targets
      • Subscription management of optional targets
  • Testing
    • Testing your application
    • Testing gem alone
  • Documentation
  • Common Examples
    • Example Rails application
  • Contributing
  • License

Getting Started

This getting started shows easy setup description of activity_notification. See Setup for more details.

Gem installation

You can install activity_notification as you would any other gem:

bash
$ gem install activity_notification

or in your Gemfile:

ruby
gem 'activity_notification'

After you install activity_notification and add it to your Gemfile, you need to run the generator:

bash
$ bin/rails generate activity_notification:install

The generator will install an initializer which describes all configuration options of activity_notification.

ORM Dependencies

By default, activity_notification uses ActiveRecord as the ORM and no additional ORM gems are required.

If you intend to use Mongoid support, you need to add the mongoid gem separately to your Gemfile:

ruby
gem 'activity_notification'
gem 'mongoid', '>= 4.0.0', '= 3.11.0', '(comment, key) {
      ([comment.article.user] + comment.article.reload.commented_users.to_a - [comment.user]).uniq
    },
    notifiable_path: :article_notifiable_path

  def article_notifiable_path
    article_path(article)
  end
end

See Configuring models for more details.

Configuring views

activity_notification provides view templates to customize your notification views. See Configuring views for more details.

Configuring routes

activity_notification also provides routing helper for notifications. Add notify_to method to config/routes.rb for the target (e.g. :users):

ruby
Rails.application.routes.draw do
  notify_to :users
end

See Configuring routes for more details.

You can also configure activity_notification routes as REST API backend with api_mode option like this:

ruby
Rails.application.routes.draw do
  scope :api do
    scope :"v2" do
      notify_to :users, api_mode: true
    end
  end
end

See Routes as REST API backend and REST API backend for more details.

Creating notifications

You can trigger notifications by setting all your required parameters and triggering notify on the notifiable model, like this:

ruby
@comment.notify :users, key: "comment.reply"

The first argument is the plural symbol name of your target model, which is configured in notifiable model by *acts_as_not

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Rubyactivity-notificationemail-notificationnotificationnotification-api

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category后端框架
PricingOpen source

> Related tools

N
Node.js
基于 V8 的 JavaScript 运行时
D
Django
Python 高级 Web 框架
S
Spring Boot
Java 生态主流微服务框架