Skip to content

Demo app - Receive exception notification in Slack Channel

Notifications You must be signed in to change notification settings

rutvij-pandya/slack_notification

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

slack_notification

Demo app - Receive Staging/Production exception notifications in Slack Channel

Required gems

Prerequisite

  • Create a channel named “exceptions” in your Slack account
  • Get Web Hook URL - click here

Integrate Slack Notification in your Rails app

  • Add required gems in Gemfile
gem ‘exception_notification’
gem ‘slack-notifier’
  • Install bundle
bundle install
  • Add below code in file /config/environments/staging.rb
config.middleware.use ExceptionNotification::Rack,  
  slack: {
    webhook_url: "https://YOUR-SLACK-WEB-HOOK-URL",
    channel: "#exceptions",
    username: "staging-exception", # ENV based username to distinguish Staging Exceptions in channel
    additional_parameters: { 
      icon_emoji: ":large_blue_circle:",  # BLUE CIRCLE icon to distinguish Staging Exceptions in channel
      mrkdwn: true 
    } 
  }
  • Add below code in file /config/environments/production.rb
config.middleware.use ExceptionNotification::Rack,  
  slack: {
    webhook_url: "https://YOUR-SLACK-WEB-HOOK-URL",
    channel: "#exceptions",
    username: "production-exception", # ENV based username to distinguish Production Exceptions in channel
    additional_parameters: { 
      icon_emoji: ":red_circle:",  # RED CIRCLE icon to distinguish Production Exceptions in channel
      mrkdwn: true 
    } 
  }

About

Demo app - Receive exception notification in Slack Channel

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages