{"id":22763068,"url":"https://github.com/b67-engineering/devise_slack_notifiable","last_synced_at":"2025-04-14T21:53:20.571Z","repository":{"id":43361178,"uuid":"273894479","full_name":"b67-engineering/devise_slack_notifiable","owner":"b67-engineering","description":"Devise slack notifications gem","archived":false,"fork":false,"pushed_at":"2022-03-05T16:16:39.000Z","size":82,"stargazers_count":12,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-14T21:53:09.510Z","etag":null,"topics":["devise","notifications","slack"],"latest_commit_sha":null,"homepage":"","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/b67-engineering.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-06-21T11:54:02.000Z","updated_at":"2022-10-14T05:02:00.000Z","dependencies_parsed_at":"2022-07-26T00:32:12.066Z","dependency_job_id":null,"html_url":"https://github.com/b67-engineering/devise_slack_notifiable","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b67-engineering%2Fdevise_slack_notifiable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b67-engineering%2Fdevise_slack_notifiable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b67-engineering%2Fdevise_slack_notifiable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b67-engineering%2Fdevise_slack_notifiable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/b67-engineering","download_url":"https://codeload.github.com/b67-engineering/devise_slack_notifiable/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248968754,"owners_count":21191158,"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":["devise","notifications","slack"],"created_at":"2024-12-11T11:06:38.108Z","updated_at":"2025-04-14T21:53:20.547Z","avatar_url":"https://github.com/b67-engineering.png","language":"Ruby","readme":"# DeviseSlackNotifiable\n\nDevise slack notifications gem. It posts message after registration and confirmation (if Devise confirmations strategy is enabled).\n\n[![Gem Version](https://badge.fury.io/rb/devise_slack_notifiable.svg)](https://badge.fury.io/rb/devise_slack_notifiable)\n[![codecov](https://codecov.io/gh/b67-engineering/devise_slack_notifiable/branch/master/graph/badge.svg)](https://codecov.io/gh/invoicity/devise_slack_notifiable)\n[![ruby](https://github.com/b67-engineering/devise_slack_notifiable/workflows/Ruby/badge.svg)](https://github.com/invoicity/devise_slack_notifiable/actions)\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'devise_slack_notifiable'\n```\n\nAnd then execute:\n\n    $ bundle install\n\nOr install it yourself as:\n\n    $ gem install devise_slack_notifiable\n\n## Usage\n\n### 1. Slack\nPrepare Slack Webhook - it should look like `https://hooks.slack.com/services/XXX/XXX/XXX`.\n\nNot sure how to do that? Check out [slack documentation](https://api.slack.com/messaging/webhooks#getting_started).\n\n### 2. Application\nAfter preparing Slack Webhook create initializer - `config/initializers/devise_slack_notifiable.rb`:\n```ruby\nDeviseSlackNotifiable.configure do |config|\n  # Enabled state\n  #   By default integration is disabled. You need to enable it manually on desired environments.\n  #   For example production only:\n  #     config.enabled = Rails.env.production?\n  #   Default: false\n  config.enabled = true\n\n  # Slack Webhook URL\n  #   Required when integration enabled.\n  #   It's recommended to use rails credentials instead of raw url (https://edgeguides.rubyonrails.org/security.html#custom-credentials)\n  # Default: nil\n  config.slack_webhook = 'YOUR_SLACK_WEBHOOK_URL'\n\n  # Confirmation message state\n  #   If You want You can disable sending confirmation message:\n  #     config.confirmation_message_enabled\n  #   Default: true\n\n  # Context fields\n  #   To all messages sent there is context attached that adds entity fields.\n  #   If You want to customize fields:\n  #     config.context_fields = [:id, :email, :first_name, :last_name]\n  #   Default: [:id, :email]\nend\n```\n\nAfter creating initializer add `:slack_notifiable` to the devise call in your model (we’re assuming here you already have a User model with some Devise modules):\n```ruby\nclass User \u003c ActiveRecord::Base\n  devise :database_authenticatable, :confirmable, :slack_notifiable\nend\n```\n\nAnd you are ready to go!\n\n## Messages\nMessages overview:\n\n![Registration notification](./docs/registration-notification.png)\n![Confirmation notification](./docs/confirmation-notification.png)\n\n### Customization\n\n#### Context\nIf You want to add more fields to context check out configuration in initializer - it's based on `context_fields`.\n\nExample with context extended by first and last name (as on screenshots):\n```ruby\nconfig.context_fields = [:id, :email, :first_name, :last_name]\n```\n\n#### Sending own messages\nYou can send own messages with this context for anywhere You want inside rails application:\n```ruby\n# Let's assume that customer with id 1 asked for sales contact\nuser = User.find(1)\nformatter = -\u003e(entity) { \"Customer #{entity.id} asked for sales contact!\" }\n\nnotifier = DeviseSlackNotifiable::Notifier.new\nnotifier.send_message(user, formatter)\n```\n\n#### Message formatting\nYou can customize messages by initializer:\n```ruby\nconfig.registration_message_formatter = lambda { |entity|\n                                          \"Yeah 🎉! Looks like we have new #{entity.model_name.human}! 😊\"\n                                        }\n```\n\n```ruby\nconfig.confirmation_message_formatter = lambda { |entity|\n                                          \"#{entity.model_name.human} have just confirmed his account 🥂\"\n                                        }\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/b67-engineering/devise_slack_notifiable. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/invoicity/devise_slack_notifiable/blob/master/CODE_OF_CONDUCT.md).\n\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n## Code of Conduct\n\nEveryone interacting in the DeviseSlackNotifiable project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/devise_slack_notifiable/blob/master/CODE_OF_CONDUCT.md).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fb67-engineering%2Fdevise_slack_notifiable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fb67-engineering%2Fdevise_slack_notifiable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fb67-engineering%2Fdevise_slack_notifiable/lists"}