{"id":13680946,"url":"https://github.com/simukappu/activity_notification","last_synced_at":"2025-04-30T02:33:39.679Z","repository":{"id":9670256,"uuid":"62952924","full_name":"simukappu/activity_notification","owner":"simukappu","description":"Integrated user activity notifications for Ruby on Rails","archived":false,"fork":false,"pushed_at":"2024-09-23T06:35:27.000Z","size":5072,"stargazers_count":496,"open_issues_count":11,"forks_count":79,"subscribers_count":14,"default_branch":"master","last_synced_at":"2024-10-12T23:51:15.915Z","etag":null,"topics":["activity-notification","email-notification","notification","notification-api","rails","rails-gem"],"latest_commit_sha":null,"homepage":"https://rubygems.org/gems/activity_notification","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/simukappu.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"docs/CONTRIBUTING.md","funding":null,"license":"MIT-LICENSE","code_of_conduct":"docs/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-07-09T14:21:59.000Z","updated_at":"2024-09-23T06:34:26.000Z","dependencies_parsed_at":"2024-04-10T13:54:00.677Z","dependency_job_id":"86ef4dbb-1a87-485f-9fed-f512fa119d4c","html_url":"https://github.com/simukappu/activity_notification","commit_stats":{"total_commits":579,"total_committers":22,"mean_commits":"26.318181818181817","dds":0.09326424870466321,"last_synced_commit":"a58b4650844d8f04d62fd83c611513d4f89e6c4b"},"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simukappu%2Factivity_notification","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simukappu%2Factivity_notification/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simukappu%2Factivity_notification/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simukappu%2Factivity_notification/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simukappu","download_url":"https://codeload.github.com/simukappu/activity_notification/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224196518,"owners_count":17271850,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["activity-notification","email-notification","notification","notification-api","rails","rails-gem"],"created_at":"2024-08-02T13:01:24.149Z","updated_at":"2024-11-12T00:30:21.520Z","avatar_url":"https://github.com/simukappu.png","language":"Ruby","funding_links":[],"categories":["Ruby","Gems"],"sub_categories":["Articles"],"readme":"# ActivityNotification\n\n[![Build Status](https://github.com/simukappu/activity_notification/actions/workflows/build.yml/badge.svg)](https://github.com/simukappu/activity_notification/actions/workflows/build.yml)\n[![Coverage Status](https://coveralls.io/repos/github/simukappu/activity_notification/badge.svg?branch=master)](https://coveralls.io/github/simukappu/activity_notification?branch=master)\n[![Dependency](https://img.shields.io/depfu/simukappu/activity_notification.svg)](https://depfu.com/repos/simukappu/activity_notification)\n[![Inline docs](http://inch-ci.org/github/simukappu/activity_notification.svg?branch=master)](http://inch-ci.org/github/simukappu/activity_notification)\n[![Gem Version](https://badge.fury.io/rb/activity_notification.svg)](https://rubygems.org/gems/activity_notification)\n[![Gem Downloads](https://img.shields.io/gem/dt/activity_notification.svg)](https://rubygems.org/gems/activity_notification)\n[![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](MIT-LICENSE)\n\n*activity_notification* provides integrated user activity notifications for [Ruby on Rails](https://rubyonrails.org). You can easily use it to configure multiple notification targets and make activity notifications with notifiable models, like adding comments, responding etc.\n\n*activity_notification* supports Rails 5.0+ with [ActiveRecord](https://guides.rubyonrails.org/active_record_basics.html), [Mongoid](https://mongoid.org) and [Dynamoid](https://github.com/Dynamoid/dynamoid) ORM. It is tested for [MySQL](https://www.mysql.com), [PostgreSQL](https://www.postgresql.org), [SQLite3](https://www.sqlite.org) with ActiveRecord, [MongoDB](https://www.mongodb.com) with Mongoid and [Amazon DynamoDB](https://aws.amazon.com/dynamodb) with Dynamoid. If you are using Rails 4.2, use [v2.1.4](https://rubygems.org/gems/activity_notification/versions/2.1.4) or older version of *activity_notification*.\n\n\n## About\n\n*activity_notification* provides following functions:\n* Notification API for your Rails application (creating and managing notifications, query for notifications)\n* Notification models (stored with ActiveRecord, Mongoid or Dynamoid ORM)\n* Notification controllers (managing open/unopen of notifications, providing link to notifiable activity page)\n* Notification views (presentation of notifications)\n* Automatic tracked notifications (generating notifications along with the lifecycle of notifiable models)\n* Grouping notifications (grouping like *\"Kevin and 7 other users posted comments to this article\"*)\n* Email notification\n* Batch email notification (event driven or periodical email notification, daily or weekly etc)\n* Push notification with [Action Cable](https://guides.rubyonrails.org/action_cable_overview.html)\n* Subscription management (subscribing and unsubscribing for each target and notification type)\n* REST API backend and [OpenAPI Specification](https://github.com/OAI/OpenAPI-Specification)\n* Integration with [Devise](https://github.com/plataformatec/devise) authentication\n* Activity notifications stream integrated into cloud computing using [Amazon DynamoDB Streams](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Streams.html)\n* Optional notification targets (Configurable optional notification targets like [Amazon SNS](https://aws.amazon.com/sns), [Slack](https://slack.com), SMS and so on)\n\n### Online Demo\n\nYou can see an actual application using this gem here:\n* **https://activity-notification-example.herokuapp.com/**\n\nLogin as the following test users to experience user activity notifications:\n\n| Email | Password | Admin? |\n|:---:|:---:|:---:|\n| ichiro@example.com  | changeit | Yes |\n| stephen@example.com | changeit |     |\n| klay@example.com    | changeit |     |\n| kevin@example.com   | changeit |     |\n\nThe deployed demo application is included in this gem's source code as a test application here: *[/spec/rails_app](/spec/rails_app/)*\n\n### Notification index and plugin notifications\n\n\u003ckbd\u003e![plugin-notifications-image](https://raw.githubusercontent.com/simukappu/activity_notification/images/activity_notification_plugin_focus_with_subscription.png)\u003c/kbd\u003e\n\n*activity_notification* deeply uses [PublicActivity](https://github.com/pokonski/public_activity) as reference in presentation layer.\n\n### Subscription management of notifications\n\n\u003ckbd\u003e![subscription-management-image](https://raw.githubusercontent.com/simukappu/activity_notification/images/activity_notification_subscription_management_with_optional_targets.png)\u003c/kbd\u003e\n\n### Amazon SNS as optional notification target\n\n\u003ckbd\u003e![optional-target-amazon-sns-email-image](https://raw.githubusercontent.com/simukappu/activity_notification/images/activity_notification_optional_target_amazon_sns.png)\u003c/kbd\u003e\n\n### Slack as optional notification target\n\n\u003ckbd\u003e![optional-target-slack-image](https://raw.githubusercontent.com/simukappu/activity_notification/images/activity_notification_optional_target_slack.png)\u003c/kbd\u003e\n\n### Public REST API reference as OpenAPI Specification\n\nREST API reference as OpenAPI Specification is published in SwaggerHub here:\n* **https://app.swaggerhub.com/apis-docs/simukappu/activity-notification/**\n\nYou can see sample single page application using [Vue.js](https://vuejs.org) as a part of example Rails application here:\n* **https://activity-notification-example.herokuapp.com/spa/**\n\nThis sample application works with *activity_notification* REST API backend.\n\n\n## Table of Contents\n\n- [About](#about)\n  - [Online Demo](#online-demo)\n  - [Public REST API reference as OpenAPI Specification](#public-rest-apu-reference-as-openapi-specification)\n- [Getting Started](#getting-started)\n- [Setup](/docs/Setup.md#Setup)\n  - [Gem installation](/docs/Setup.md#gem-installation)\n  - [Database setup](/docs/Setup.md#database-setup)\n    - [Using ActiveRecord ORM](/docs/Setup.md#using-activerecord-orm)\n    - [Using Mongoid ORM](/docs/Setup.md#using-mongoid-orm)\n    - [Using Dynamoid ORM](/docs/Setup.md#using-dynamoid-orm)\n      - [Integration with DynamoDB Streams](/docs/Setup.md#integration-with-dynamodb-streams)\n  - [Configuring models](/docs/Setup.md#configuring-models)\n    - [Configuring target models](/docs/Setup.md#configuring-target-models)\n    - [Configuring notifiable models](/docs/Setup.md#configuring-notifiable-models)\n      - [Advanced notifiable path](/docs/Setup.md#advanced-notifiable-path)\n  - [Configuring views](/docs/Setup.md#configuring-views)\n  - [Configuring routes](/docs/Setup.md#configuring-routes)\n    - [Routes with scope](/docs/Setup.md#routes-with-scope)\n    - [Routes as REST API backend](/docs/Setup.md#routes-as-rest-api-backend)\n  - [Creating notifications](/docs/Setup.md#creating-notifications)\n    - [Notification API](/docs/Setup.md#notification-api)\n    - [Asynchronous notification API with ActiveJob](/docs/Setup.md#asynchronous-notification-api-with-activejob)\n    - [Automatic tracked notifications](/docs/Setup.md#automatic-tracked-notifications)\n  - [Displaying notifications](/docs/Setup.md#displaying-notifications)\n    - [Preparing target notifications](/docs/Setup.md#preparing-target-notifications)\n    - [Rendering notifications](/docs/Setup.md#rendering-notifications)\n    - [Notification views](/docs/Setup.md#notification-views)\n    - [i18n for notifications](/docs/Setup.md#i18n-for-notifications)\n  - [Customizing controllers (optional)](/docs/Setup.md#customizing-controllers-optional)\n- [Functions](/docs/Functions.md#Functions)\n  - [Email notification](/docs/Functions.md#email-notification)\n    - [Mailer setup](/docs/Functions.md#mailer-setup)\n    - [Sender configuration](/docs/Functions.md#sender-configuration)\n    - [Email templates](/docs/Functions.md#email-templates)\n    - [Email subject](/docs/Functions.md#email-subject)\n    - [Other header fields](/docs/Functions.md#other-header-fields)\n    - [i18n for email](/docs/Functions.md#i18n-for-email)\n  - [Batch email notification](/docs/Functions.md#batch-email-notification)\n    - [Batch mailer setup](/docs/Functions.md#batch-mailer-setup)\n    - [Batch sender configuration](/docs/Functions.md#batch-sender-configuration)\n    - [Batch email templates](/docs/Functions.md#batch-email-templates)\n    - [Batch email subject](/docs/Functions.md#batch-email-subject)\n    - [i18n for batch email](/docs/Functions.md#i18n-for-batch-email)\n  - [Grouping notifications](/docs/Functions.md#grouping-notifications)\n  - [Subscription management](/docs/Functions.md#subscription-management)\n    - [Configuring subscriptions](/docs/Functions.md#configuring-subscriptions)\n    - [Managing subscriptions](/docs/Functions.md#managing-subscriptions)\n    - [Customizing subscriptions](/docs/Functions.md#customizing-subscriptions)\n  - [REST API backend](/docs/Functions.md#rest-api-backend)\n    - [Configuring REST API backend](/docs/Functions.md#configuring-rest-api-backend)\n    - [API reference as OpenAPI Specification](/docs/Functions.md#api-reference-as-openapi-specification)\n  - [Integration with Devise](/docs/Functions.md#integration-with-devise)\n    - [Configuring integration with Devise authentication](/docs/Functions.md#configuring-integration-with-devise-authentication)\n    - [Using different model as target](/docs/Functions.md#using-different-model-as-target)\n    - [Configuring simple default routes](/docs/Functions.md#configuring-simple-default-routes)\n    - [REST API backend with Devise Token Auth](/docs/Functions.md#rest-api-backend-with-devise-token-auth)\n  - [Push notification with Action Cable](/docs/Functions.md#push-notification-with-action-cable)\n    - [Enabling broadcasting notifications to channels](/docs/Functions.md#enabling-broadcasting-notifications-to-channels)\n    - [Subscribing notifications from channels](/docs/Functions.md#subscribing-notifications-from-channels)\n    - [Subscribing notifications with Devise authentication](/docs/Functions.md#subscribing-notifications-with-devise-authentication)\n    - [Subscribing notifications API with Devise Token Auth](/docs/Functions.md#subscribing-notifications-api-with-devise-token-auth)\n    - [Subscription management of Action Cable channels](/docs/Functions.md#subscription-management-of-action-cable-channels)\n  - [Optional notification targets](/docs/Functions.md#optional-notification-targets)\n    - [Configuring optional targets](/docs/Functions.md#configuring-optional-targets)\n    - [Customizing message format](/docs/Functions.md#customizing-message-format)\n    - [Action Cable channels as optional target](/docs/Functions.md#action-cable-channels-as-optional-target)\n    - [Amazon SNS as optional target](/docs/Functions.md#amazon-sns-as-optional-target)\n    - [Slack as optional target](/docs/Functions.md#slack-as-optional-target)\n    - [Developing custom optional targets](/docs/Functions.md#developing-custom-optional-targets)\n    - [Subscription management of optional targets](/docs/Functions.md#subscription-management-of-optional-targets)\n- [Testing](/docs/Testing.md#Testing)\n  - [Testing your application](/docs/Testing.md#testing-your-application)\n  - [Testing gem alone](/docs/Testing.md#testing-gem-alone)\n- [Documentation](#documentation)\n- [Common Examples](#common-examples)\n- [Contributing](#contributing)\n- [License](#license)\n\n\n## Getting Started\n\nThis getting started shows easy setup description of *activity_notification*. See [Setup](/docs/Setup.md#Setup) for more details.\n\n### Gem installation\n\nYou can install *activity_notification* as you would any other gem:\n\n```console\n$ gem install activity_notification\n```\nor in your Gemfile:\n\n```ruby\ngem 'activity_notification'\n```\n\nAfter you install *activity_notification* and add it to your Gemfile, you need to run the generator:\n\n```console\n$ bin/rails generate activity_notification:install\n```\n\nThe generator will install an initializer which describes all configuration options of *activity_notification*.\n\n### Database setup\n\nWhen you use *activity_notification* with ActiveRecord ORM as default configuration,\ncreate migration for notifications and migrate the database in your Rails project:\n\n```console\n$ bin/rails generate activity_notification:migration\n$ bin/rake db:migrate\n```\n\nSee [Database setup](/docs/Setup.md#database-setup) for other ORMs.\n\n### Configuring models\n\nConfigure your target model (e.g. *app/models/user.rb*).\nAdd **acts_as_target** configuration to your target model to get notifications.\n\n```ruby\nclass User \u003c ActiveRecord::Base\n  acts_as_target\nend\n```\n\nThen, configure your notifiable model (e.g. *app/models/comment.rb*).\nAdd **acts_as_notifiable** configuration to your notifiable model representing activity to notify for each of your target model.\nYou have to define notification targets for all notifications from this notifiable model by *:targets* option. Other configurations are optional. *:notifiable_path* option is a path to move when the notification is opened by the target user.\n\n```ruby\nclass Article \u003c ActiveRecord::Base\n  belongs_to :user\n  has_many :comments, dependent: :destroy\n  has_many :commented_users, through: :comments, source: :user\nend\n\nclass Comment \u003c ActiveRecord::Base\n  belongs_to :article\n  belongs_to :user\n\n  acts_as_notifiable :users,\n    targets: -\u003e(comment, key) {\n      ([comment.article.user] + comment.article.reload.commented_users.to_a - [comment.user]).uniq\n    },\n    notifiable_path: :article_notifiable_path\n\n  def article_notifiable_path\n    article_path(article)\n  end\nend\n```\n\nSee [Configuring models](/docs/Setup.md#configuring-models) for more details.\n\n### Configuring views\n\n*activity_notification* provides view templates to customize your notification views.\nSee [Configuring views](/docs/Setup.md#configuring-views) for more details.\n\n### Configuring routes\n\n*activity_notification* also provides routing helper for notifications. Add **notify_to** method to *config/routes.rb* for the target (e.g. *:users*):\n\n```ruby\nRails.application.routes.draw do\n  notify_to :users\nend\n```\n\nSee [Configuring routes](/docs/Setup.md#configuring-routes) for more details.\n\nYou can also configure *activity_notification* routes as REST API backend with *api_mode* option like this:\n\n```ruby\nRails.application.routes.draw do\n  scope :api do\n    scope :\"v2\" do\n      notify_to :users, api_mode: true\n    end\n  end\nend\n```\n\nSee [Routes as REST API backend](/docs/Setup.md#configuring-routes) and [REST API backend](/docs/Functions.md#rest-api-backend) for more details.\n\n### Creating notifications\n\nYou can trigger notifications by setting all your required parameters and triggering **notify** on the notifiable model, like this:\n\n```ruby\n@comment.notify :users, key: \"comment.reply\"\n```\n\nThe first argument is the plural symbol name of your target model, which is configured in notifiable model by *acts_as_notifiable*.\nThe new instances of **ActivityNotification::Notification** model will be generated for the specified targets.\n\nSee [Creating notifications](/docs/Setup.md#creating-notifications) for more details.\n\n### Displaying notifications\n\n*activity_notification* also provides notification views. You can prepare target notifications, render them in your controller, and show them provided or custom notification views.\n\nSee [Displaying notifications](/docs/Setup.md#displaying-notifications) for more details.\n\n### Run example Rails application\n\nTest module includes example Rails application in *[spec/rails_app](/spec/rails_app)*.\nPull git repository and you can run the example application as common Rails application.\n\n```console\n$ git pull https://github.com/simukappu/activity_notification.git\n$ cd activity_notification\n$ bundle install —path vendor/bundle\n$ cd spec/rails_app\n$ bin/rake db:migrate\n$ bin/rake db:seed\n$ bin/rails server\n```\nThen, you can access \u003chttp://localhost:3000\u003e for the example application.\n\n\n## Setup\n\nSee [Setup](/docs/Setup.md#Setup).\n\n\n## Functions\n\nSee [Functions](/docs/Functions.md#Functions).\n\n\n## Testing\n\nSee [Testing](/docs/Testing.md#Testing).\n\n\n## Documentation\n\nSee [API Reference](http://www.rubydoc.info/github/simukappu/activity_notification/index) for more details.\n\nRubyDoc.info does not support parsing methods in *included* and *class_methods* of *ActiveSupport::Concern* currently.\nTo read complete documents, please generate YARD documents on your local environment:\n```console\n$ git pull https://github.com/simukappu/activity_notification.git\n$ cd activity_notification\n$ bundle install —path vendor/bundle\n$ bundle exec yard doc\n$ bundle exec yard server\n```\nThen you can see the documents at \u003chttp://localhost:8808/docs/index\u003e.\n\n\n## Common Examples\n\nSee example Rails application in *[/spec/rails_app](/spec/rails_app)*.\n\nYou can also try this example Rails application as Online Demo here:\n* **https://activity-notification-example.herokuapp.com/**\n\nYou can login as test users to experience user activity notifications. For more details, see [Online Demo](#online-demo).\n\n\n## Contributing\n\nWe encourage you to contribute to *activity_notification*!\nPlease check out the [Contributing to *activity_notification* guide](/docs/CONTRIBUTING.md#how-to-contribute-to-activity_notification) for guidelines about how to proceed.\n\nEveryone interacting in *activity_notification* codebases, issue trackers, and pull requests is expected to follow the *activity_notification* [Code of Conduct](/docs/CODE_OF_CONDUCT.md#contributor-covenant-code-of-conduct).\n\nWe appreciate any of your contribution!\n\n\n## License\n\n*activity_notification* project rocks and uses [MIT License](MIT-LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimukappu%2Factivity_notification","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimukappu%2Factivity_notification","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimukappu%2Factivity_notification/lists"}