How hanesauce/slack-tipbot works
Project type and purpose
• This is a single-service Slack bot written in Ruby (using Sinatra and slack-ruby-client) that lets teammates tip each other in bitcoin (via Coinbase).
• It’s deployed as one Heroku dyno, connects to Redis for state, interacts with the Coinbase API for wallet operations, and uses the Slack RealTime and Web APIs for messaging and slash commands.
Key parts of the file tree
• tipbot.rb / commands.rb – the core bot logic and command handlers
• web.rb / config.ru – the HTTP endpoints (Sinatra) that receive slash-command webhooks or health checks
• initializers/ – setup code for Money gem, Redis client, Slack client
• Procfile / app.json – Heroku deployment config
• images/ – static emoji assets for reaction-based tipping
• Gemfile – dependencies (sinatra, slack-ruby-client, redis, coinbase, money, etc.)
Main components
A. Slack Platform (external)
– RealTime API (websocket events)
– Web API (messages, slash command responses)
B. Heroku Dyno (single process)
1. Slack RealTime Client (slack-ruby-client)
2. HTTP Server (Sinatra in web.rb)
3. Bot Core / Command Dispatcher (tipbot.rb + commands.rb)
4. Initializers (configuration for Redis, Money, Slack client)
C. Data Layer
– Redis (Heroku Redis add-on) stores user balances, transaction history
D. External Service
– Coinbase API Client for on/off-chain wallet creation, transfers
E. Static Assets
– images/ custom emoji files
Relationships and data flows
• Redis is read or written by dispatcher when querying/updating balances.
• Coinbase API calls (create account, send coins) occur in command handlers via coinbase‐ruby.
Architectural patterns and principles
• Event-driven: reacts to Slack events (messages, reactions, slash commands)
• Single responsibility: separate modules for configuration (initializers), web endpoints (web.rb), real-time client (tipbot.rb), and business logic (commands.rb)
• Adapter layers for external APIs (Slack, Coinbase)
• Stateless HTTP endpoints; ephemeral Process state backed by Redis