Skip to content

Instantly share code, notes, and snippets.

Created September 19, 2017 21:27
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Minimalistic slack bot notifier approach for rails apps - useful for capistrano deploy scripts
#!/usr/bin/env ruby
# frozen_string_literal: true
require_relative '../config/boot'
require_relative '../config/environment'
require 'slack'
Slack.configure do |config|
config.token = Rails.application.secrets.slack_bot[:token]
slack_channel = Rails.application.secrets.slack_bot[:channel]
slack_bot =
channel: slack_channel,
text: 'deployed successfully',
as_user: true
# secrets.yml
:token: 'sample_token'
:channel: '#notifications'
1. add gem 'slack-ruby-client' to Gemfile and bundle install
2. copy this to bin/slack_notifier.rb
3. chmod +x bin/slack_notifier.rb
4. set up secrets
5. bin/slack_notifier.rb
6. see your message on the slack
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment