SlackSender
Reliable Slack messaging for Ruby — with automatic retries, rate-limit handling, and sandbox safety.
SlackSender handles the plumbing so you can focus on your application: background dispatch, retry logic, multi-workspace support, and development environment redirects are all built in.
Installation
Add to your Gemfile:
gem 'slack_sender'Then run:
bundle installRequirements:
- Ruby >= 3.2.1
- A Slack Bot User OAuth Token with
chat:writescope (see Configuration for full scope list) - For async delivery: Sidekiq or ActiveJob (auto-detected)
Quick Start - Minimal
SlackSender.register(token: ENV['SLACK_BOT_TOKEN'])SlackSender.call!(channel: "some_channel_name", text: "Hi there")Quick Start - Realistic
1. Register a Profile
SlackSender.register(
token: ENV['SLACK_BOT_TOKEN'],
channels: {
ops_alerts: 'C1111111111',
deployments: 'C2222222222',
},
sandbox: {
channel: { replace_with: 'C_DEV_CHANNEL' } # Redirects in non-production
}
)2. Send Messages
# Async (recommended) — background job with automatic retries
SlackSender.call(channel: :ops_alerts, text: ":rotating_light: High error rate detected")
# Sync — when you need the thread timestamp
thread_ts = SlackSender.call!(channel: :deployments, text: ":rocket: Deploy started")
SlackSender.call(channel: :deployments, text: "Deploy complete!", thread_ts:)That's it. SlackSender handles rate limits, retries, and sandbox redirection (if configured, all messages sent from non-production environments will be delivered to your replace_with channel) automatically.
Documentation
| Guide | Description |
|---|---|
| Usage Guide | Messages, files, threading, multi-channel delivery |
| Configuration | Profiles, sandbox mode, global settings |
| Axn Integration |
use :slack strategy and SlackSender::Notifier
|
| Troubleshooting | Common errors and FAQ |
Features
- Background dispatch with automatic rate-limit retries via Sidekiq or ActiveJob
- Multi-channel delivery — broadcast to multiple channels efficiently
- Sandbox mode — redirect or suppress messages in non-production environments
- File uploads — sync and async, with automatic size handling
- Multiple profiles — manage multiple Slack workspaces
-
Axn integration —
use :slackstrategy and dedicatedNotifierbase class
Development
bin/setup # Install dependencies
bundle exec rspec # Run testsContributing
Bug reports and pull requests are welcome on GitHub at https://github.com/teamshares/slack_sender.
License
The gem is available as open source under the terms of the MIT License.