flow_chat 0.8.2 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/.cliff.toml +74 -0
  3. data/.github/workflows/ci.yml +2 -3
  4. data/.github/workflows/release.yml +56 -0
  5. data/.standard.yml +4 -0
  6. data/CHANGELOG.md +22 -0
  7. data/CLAUDE.md +327 -0
  8. data/CONTRIBUTING.md +134 -0
  9. data/Gemfile +1 -0
  10. data/README.md +290 -105
  11. data/Rakefile +5 -1
  12. data/SECURITY.md +42 -349
  13. data/docs/architecture.md +510 -0
  14. data/docs/async-background-processing.md +298 -0
  15. data/docs/configuration.md +556 -226
  16. data/docs/factory-pattern.md +355 -0
  17. data/docs/gateway-context-variables.md +171 -0
  18. data/docs/gateway-development.md +723 -0
  19. data/docs/getting-started.md +429 -0
  20. data/docs/instrumentation.md +264 -153
  21. data/docs/platforms/telegram.md +1013 -0
  22. data/docs/platforms/ussd.md +693 -0
  23. data/docs/platforms/whatsapp.md +1395 -0
  24. data/docs/testing.md +243 -365
  25. data/examples/custom_session_id_example.rb +119 -0
  26. data/examples/http_controller.rb +11 -11
  27. data/examples/intercom_configuration_example.rb +118 -0
  28. data/examples/intercom_controller.rb +194 -0
  29. data/examples/multi_tenant_whatsapp_controller.rb +4 -4
  30. data/examples/ussd_controller.rb +9 -9
  31. data/examples/whatsapp_controller.rb +2 -2
  32. data/flow_chat.gemspec +4 -0
  33. data/lib/flow_chat/{base_app.rb → app.rb} +16 -9
  34. data/lib/flow_chat/async_job.rb +176 -0
  35. data/lib/flow_chat/config.rb +10 -30
  36. data/lib/flow_chat/{base_executor.rb → executor.rb} +6 -11
  37. data/lib/flow_chat/factory.rb +94 -0
  38. data/lib/flow_chat/gateway_async_support.rb +106 -0
  39. data/lib/flow_chat/generic_async_job.rb +30 -0
  40. data/lib/flow_chat/http/gateway/simple.rb +81 -33
  41. data/lib/flow_chat/http/renderer.rb +3 -3
  42. data/lib/flow_chat/instrumentation/setup.rb +1 -1
  43. data/lib/flow_chat/instrumentation.rb +23 -0
  44. data/lib/flow_chat/intercom/client.rb +155 -0
  45. data/lib/flow_chat/intercom/configuration.rb +149 -0
  46. data/lib/flow_chat/intercom/gateway/intercom_api.rb +396 -0
  47. data/lib/flow_chat/intercom/renderer.rb +71 -0
  48. data/lib/flow_chat/phone_number_util.rb +37 -35
  49. data/lib/flow_chat/processor.rb +188 -0
  50. data/lib/flow_chat/renderers/markdown_support.rb +58 -0
  51. data/lib/flow_chat/session/middleware.rb +25 -9
  52. data/lib/flow_chat/telegram/client.rb +240 -0
  53. data/lib/flow_chat/telegram/configuration.rb +118 -0
  54. data/lib/flow_chat/telegram/gateway/bot_api.rb +300 -0
  55. data/lib/flow_chat/telegram/middleware/choice_mapper.rb +35 -0
  56. data/lib/flow_chat/telegram/renderer.rb +125 -0
  57. data/lib/flow_chat/telegram.rb +7 -0
  58. data/lib/flow_chat/ussd/gateway/nalo.rb +24 -4
  59. data/lib/flow_chat/ussd/middleware/pagination.rb +9 -5
  60. data/lib/flow_chat/ussd/renderer.rb +1 -1
  61. data/lib/flow_chat/version.rb +1 -1
  62. data/lib/flow_chat/whatsapp/client.rb +144 -13
  63. data/lib/flow_chat/whatsapp/configuration.rb +1 -1
  64. data/lib/flow_chat/whatsapp/gateway/cloud_api.rb +132 -96
  65. data/lib/flow_chat/whatsapp/id_generator.rb +124 -0
  66. data/lib/flow_chat/whatsapp/middleware/choice_mapper.rb +147 -0
  67. data/lib/flow_chat/whatsapp/renderer.rb +145 -11
  68. data/lib/flow_chat.rb +11 -1
  69. data/lib/tasks/release.rake +165 -0
  70. metadata +84 -25
  71. data/docs/flows.md +0 -320
  72. data/docs/http-gateway-protocol.md +0 -432
  73. data/docs/images/simulator.png +0 -0
  74. data/docs/media.md +0 -153
  75. data/docs/sessions.md +0 -433
  76. data/docs/ussd-setup.md +0 -322
  77. data/docs/whatsapp-setup.md +0 -162
  78. data/examples/whatsapp_message_job.rb +0 -113
  79. data/lib/flow_chat/base_processor.rb +0 -146
  80. data/lib/flow_chat/http/app.rb +0 -6
  81. data/lib/flow_chat/http/middleware/executor.rb +0 -24
  82. data/lib/flow_chat/http/processor.rb +0 -33
  83. data/lib/flow_chat/session/rails_session_store.rb +0 -68
  84. data/lib/flow_chat/ussd/app.rb +0 -6
  85. data/lib/flow_chat/ussd/gateway/nsano.rb +0 -96
  86. data/lib/flow_chat/ussd/middleware/executor.rb +0 -24
  87. data/lib/flow_chat/ussd/processor.rb +0 -39
  88. data/lib/flow_chat/whatsapp/app.rb +0 -29
  89. data/lib/flow_chat/whatsapp/middleware/executor.rb +0 -24
  90. data/lib/flow_chat/whatsapp/processor.rb +0 -32
  91. data/lib/flow_chat/whatsapp/send_job_support.rb +0 -79
data/README.md CHANGED
@@ -6,64 +6,80 @@
6
6
  [![Ruby](https://img.shields.io/badge/ruby-%3E%3D%202.3.0-red.svg)](https://www.ruby-lang.org/)
7
7
  [![Rails](https://img.shields.io/badge/rails-%3E%3D%206.0-red.svg)](https://rubyonrails.org/)
8
8
 
9
- FlowChat is a Rails framework for building sophisticated conversational workflows for USSD and WhatsApp messaging. Define multi-step conversations as Ruby classes with automatic session management, input validation, and cross-platform compatibility.
9
+ FlowChat is a powerful Rails framework for building sophisticated conversational interfaces across **multiple platforms** with a **pluggable gateway architecture**. Create interactive flows with menus, prompts, validation, media support, and session management using a unified, intuitive API that works across USSD, WhatsApp, Telegram, HTTP, and any custom platforms you build.
10
10
 
11
- ## Key Features
11
+ ## Key Features
12
12
 
13
- - 🎯 **Declarative Flow Definition** - Define conversations as Ruby classes
14
- - 🔄 **Automatic Session Management** - Persistent state across requests
15
- - **Input Validation & Transformation** - Built-in validation and data conversion
16
- - 📱 **USSD & WhatsApp Support** - Single codebase, multiple platforms
17
- - 💬 **Rich WhatsApp Features** - Interactive buttons, lists, media support
18
- - 🔧 **Standalone WhatsApp Client** - Send messages outside of flows
19
- - 📊 **Built-in Instrumentation** - Monitoring and metrics out of the box
20
- - 🧪 **Testing Tools** - Built-in simulator for development and testing
13
+ - **🔄 Unified API**: Single codebase that works across all platforms
14
+ - **🔌 Pluggable Gateways**: Extensible architecture supporting multiple backends per platform
15
+ - **📱 Multi-Platform**: Out of the box support for USSD, WhatsApp, Telegram, HTTP, and more, with simulator for testing
16
+ - **🎯 Screen-Based Navigation**: Intuitive screen() method for building conversational flows
17
+ - **💾 Advanced Session Management**: Flexible session boundaries and storage options
18
+ - **🔧 Middleware Architecture**: Extensible middleware system for custom processing
19
+ - **🎨 Rich Prompts**: Support for text, media, selections, yes/no prompts, validation, and transformations
20
+ - **📊 Built-in Instrumentation**: Comprehensive logging and metrics collection
21
+ - **🧪 Testing Support**: Built-in simulator for development and testing
22
+ - **🏢 Multi-Tenancy**: In-built support for custom configuration per tenant and URL-based isolation
23
+ - **🚀 Background Processing**: Job queue support for WhatsApp messaging
21
24
 
22
- ## Installation
25
+ ## 🚀 Quick Start
23
26
 
24
- Add to your Gemfile:
27
+ ### Installation
28
+
29
+ Add FlowChat to your Rails application:
25
30
 
26
31
  ```ruby
32
+ # Gemfile
27
33
  gem 'flow_chat'
28
34
  ```
29
35
 
30
- Then run:
31
-
32
36
  ```bash
33
37
  bundle install
34
38
  ```
35
39
 
36
- ## Quick Start
37
-
38
- ### USSD Example
39
-
40
- Create a flow in `app/flow_chat/welcome_flow.rb`:
40
+ ### Define your flow
41
41
 
42
42
  ```ruby
43
+ # app/flow_chat/welcome_flow.rb
44
+
43
45
  class WelcomeFlow < FlowChat::Flow
44
46
  def main_page
45
47
  name = app.screen(:name) do |prompt|
46
- prompt.ask "What's your name?",
48
+ prompt.ask "Welcome! What's your name?",
47
49
  transform: ->(input) { input.strip.titleize }
48
50
  end
49
51
 
50
- language = app.screen(:language) do |prompt|
51
- prompt.select "Choose language:", ["English", "French", "Spanish"]
52
+ choice = app.screen(:main_menu) do |prompt|
53
+ prompt.select "Hi #{name}! Choose:", {
54
+ "1" => "Account Info",
55
+ "2" => "Make Payment",
56
+ "3" => "Support"
57
+ }
52
58
  end
53
59
 
54
- app.say "Hello #{name}! Language set to #{language}."
60
+ case choice
61
+ when "1"
62
+ show_account_info
63
+ when "2"
64
+ make_payment
65
+ when "3"
66
+ app.say "Call us: 123-456-7890"
67
+ end
55
68
  end
69
+
70
+ # ... implement your flow methods
56
71
  end
57
72
  ```
58
73
 
59
- Create a controller:
74
+ ### Basic USSD Application
60
75
 
61
76
  ```ruby
77
+ # app/controllers/ussd_controller.rb
62
78
  class UssdController < ApplicationController
63
79
  skip_forgery_protection
64
80
 
65
81
  def process_request
66
- processor = FlowChat::Ussd::Processor.new(self) do |config|
82
+ processor = FlowChat::Processor.new(self) do |config|
67
83
  config.use_gateway FlowChat::Ussd::Gateway::Nalo
68
84
  config.use_session_store FlowChat::Session::CacheSessionStore
69
85
  end
@@ -73,33 +89,34 @@ class UssdController < ApplicationController
73
89
  end
74
90
  ```
75
91
 
76
- Add route in `config/routes.rb`:
92
+ ### Basic WhatsApp Application
77
93
 
78
94
  ```ruby
79
- post 'ussd' => 'ussd#process_request'
80
- ```
81
-
82
- ### WhatsApp Example
95
+ # app/controllers/whatsapp_controller.rb
96
+ class WhatsappController < ApplicationController
97
+ skip_forgery_protection
83
98
 
84
- Configure credentials in `config/credentials.yml.enc`:
99
+ def webhook
100
+ processor = FlowChat::Processor.new(self) do |config|
101
+ config.use_gateway FlowChat::Whatsapp::Gateway::CloudApi
102
+ config.use_session_store FlowChat::Session::CacheSessionStore
103
+ end
85
104
 
86
- ```yaml
87
- whatsapp:
88
- access_token: "your_access_token"
89
- phone_number_id: "your_phone_number_id"
90
- verify_token: "your_verify_token"
91
- app_secret: "your_app_secret"
105
+ processor.run WelcomeFlow, :main_page
106
+ end
107
+ end
92
108
  ```
93
109
 
94
- Create a controller:
110
+ ### Basic Telegram Application
95
111
 
96
112
  ```ruby
97
- class WhatsappController < ApplicationController
113
+ # app/controllers/telegram_controller.rb
114
+ class TelegramController < ApplicationController
98
115
  skip_forgery_protection
99
116
 
100
117
  def webhook
101
- processor = FlowChat::Whatsapp::Processor.new(self) do |config|
102
- config.use_gateway FlowChat::Whatsapp::Gateway::CloudApi
118
+ processor = FlowChat::Processor.new(self) do |config|
119
+ config.use_gateway FlowChat::Telegram::Gateway::BotApi
103
120
  config.use_session_store FlowChat::Session::CacheSessionStore
104
121
  end
105
122
 
@@ -108,102 +125,270 @@ class WhatsappController < ApplicationController
108
125
  end
109
126
  ```
110
127
 
111
- Add route:
128
+ ### Basic HTTP API Application
112
129
 
113
130
  ```ruby
114
- match '/whatsapp/webhook', to: 'whatsapp#webhook', via: [:get, :post]
131
+ # app/controllers/api_controller.rb
132
+ class ApiController < ApplicationController
133
+ def chat
134
+ processor = FlowChat::Processor.new(self) do |config|
135
+ config.use_gateway FlowChat::Http::Gateway::Simple
136
+ config.use_session_store FlowChat::Session::CacheSessionStore
137
+ end
138
+
139
+ processor.run WelcomeFlow, :main_page
140
+ end
141
+ end
115
142
  ```
143
+ > Same WelcomeFlow works across ALL platforms!
144
+
116
145
 
117
- ## Core Concepts
146
+ ## 🏗️ Architecture
147
+
148
+ FlowChat uses a **composition-based architecture** with these core components:
149
+
150
+ - **Processor**: Orchestrates request processing through middleware stack
151
+ - **Gateway**: Platform-specific request/response handling (Nalo, WhatsApp Cloud API)
152
+ - **App**: Unified application interface with screen-based navigation
153
+ - **Session**: Flexible session management with configurable boundaries
154
+ - **Middleware**: Extensible processing pipeline
155
+
156
+ ```
157
+ ┌─────────────┐ ┌──────────────┐ ┌─────────────┐
158
+ │ Gateway │ -> │ Session │ -> │ Custom │
159
+ │ │ │ Middleware │ │ Middleware │
160
+ └─────────────┘ └──────────────┘ └─────────────┘
161
+
162
+ v
163
+ ┌─────────────┐ ┌──────────────┐ ┌─────────────┐
164
+ │ Flow/Action │ <- │ Executor │ <- │ App │
165
+ │ │ │ │ │ │
166
+ └─────────────┘ └──────────────┘ └─────────────┘
167
+ ```
118
168
 
119
- ### Flows and Screens
169
+ ## 🔌 Pluggable Gateway Architecture
120
170
 
121
- **Flows** define conversation logic. **Screens** collect user input with automatic validation:
171
+ FlowChat's power comes from its pluggable gateway system. Each platform can have multiple gateway implementations:
122
172
 
123
173
  ```ruby
124
- class RegistrationFlow < FlowChat::Flow
125
- def main_page
126
- email = app.screen(:email) do |prompt|
127
- prompt.ask "Enter email:",
128
- validate: ->(input) { "Invalid email" unless input.include?("@") },
129
- transform: ->(input) { input.downcase.strip }
130
- end
174
+ # Create your own SMS gateway
175
+ class MyCompany::Sms::Gateway::Twilio
176
+ def initialize(app, config)
177
+ @app = app
178
+ @config = config
179
+ end
180
+
181
+ def call(context)
182
+ # Parse Twilio webhook, set context values
183
+ context["request.msisdn"] = params["From"]
184
+ context["request.platform"] = :sms
185
+ context.input = params["Body"]
186
+
187
+ # Process through middleware
188
+ type, prompt, choices, media = @app.call(context)
189
+
190
+ # Send response via Twilio API
191
+ send_sms_response(prompt, to: context["request.msisdn"])
192
+ end
131
193
 
132
- confirmed = app.screen(:confirm) do |prompt|
133
- prompt.yes? "Create account for #{email}?"
194
+ # Optional: Configure platform-specific middleware
195
+ def self.configure_middleware_stack(builder, custom_middleware)
196
+ builder.use MyCompany::Sms::MessageTransformMiddleware
197
+ builder.use custom_middleware
198
+ end
199
+ end
200
+
201
+ # Use your custom gateway
202
+ processor = FlowChat::Processor.new(self) do |config|
203
+ config.use_gateway MyCompany::Sms::Gateway::Twilio, sms_config
134
204
  end
205
+ ```
206
+
207
+ ## 📚 Documentation
135
208
 
136
- if confirmed
137
- create_account(email)
138
- app.say "Account created successfully!"
139
- else
140
- app.say "Registration cancelled."
209
+ ### Getting Started
210
+ - [**Getting Started Guide**](docs/getting-started.md) - Comprehensive setup and first app
211
+ - [**Architecture Overview**](docs/architecture.md) - Deep dive into FlowChat's design
212
+ - [**Configuration**](docs/configuration.md) - Complete configuration reference
213
+
214
+ ### Platform Guides
215
+ - [**USSD Development**](docs/platforms/ussd.md) - USSD-specific features and examples
216
+ - [**WhatsApp Development**](docs/platforms/whatsapp.md) - WhatsApp Business API integration
217
+ - [**Telegram Development**](docs/platforms/telegram.md) - Telegram Bot API integration
218
+ - [**HTTP Development**](docs/platforms/http.md) 🚧 - API endpoints and webhooks
219
+ - [**Multi-Platform Apps**](docs/platforms/multi-platform.md) 🚧 - Building unified experiences
220
+
221
+ ### Advanced Topics
222
+ - [**Gateway Development**](docs/gateway-development.md) - Creating custom gateways and platforms
223
+ - [**Session Management**](docs/session-management.md) 🚧 - Session boundaries and storage
224
+ - [**Middleware Development**](docs/middleware.md) 🚧 - Creating custom middleware
225
+ - [**Testing & Simulation**](docs/testing.md) - Testing strategies and simulator usage
226
+ - [**Background Jobs**](docs/background-jobs.md) 🚧 - Async processing for WhatsApp
227
+ - [**Instrumentation**](docs/instrumentation.md) - Monitoring, logging, and error tracking
228
+
229
+ ### API Reference
230
+ - [**Core API**](docs/api-reference/core.md) 🚧 - Processor, App, Flow classes
231
+ - [**Prompts & Validation**](docs/api-reference/prompts.md) 🚧 - Interactive prompts and validation
232
+ - [**Gateways**](docs/api-reference/gateways.md) 🚧 - Platform gateway interfaces
233
+ - [**Session Stores**](docs/api-reference/session-stores.md) 🚧 - Session storage options
234
+
235
+ ## 🎯 Core Concepts
236
+
237
+ ### Screen-Based Navigation
238
+
239
+ Build conversational flows using the intuitive `screen()` method:
240
+
241
+ ```ruby
242
+ def registration_flow
243
+ # Each screen automatically handles state and navigation
244
+ email = app.screen(:email) do |prompt|
245
+ prompt.ask "Enter your email:",
246
+ validate: ->(input) {
247
+ "Invalid email" unless input.include?("@")
248
+ }
249
+ end
250
+
251
+ name = app.screen(:name) do |prompt|
252
+ prompt.ask "Enter your full name:",
253
+ transform: ->(input) { input.strip.titleize }
254
+ end
255
+
256
+ # Confirmation screen with rich prompts
257
+ confirmed = app.screen(:confirm) do |prompt|
258
+ prompt.yes? "Confirm registration for #{name} (#{email})?"
259
+ end
260
+
261
+ if confirmed
262
+ create_user(name, email)
263
+ app.say "Welcome #{name}! Registration complete."
264
+ else
265
+ app.say "Registration cancelled."
266
+ end
267
+ end
268
+ ```
269
+
270
+ ### Multi-Platform Compatibility
271
+
272
+ Write once, run everywhere:
273
+
274
+ ```ruby
275
+ class MenuFlow < FlowChat::Flow
276
+ def main_menu
277
+ choice = app.screen(:menu) do |prompt|
278
+ prompt.select "Choose an option:", {
279
+ "info" => "📋 Information", # Rich for WhatsApp
280
+ "help" => "❓ Help", # Falls back to text for USSD
281
+ "exit" => "👋 Exit"
282
+ }
141
283
  end
284
+
285
+ # Same logic works on both platforms
286
+ handle_choice(choice)
142
287
  end
143
288
  end
144
289
  ```
145
290
 
146
- ### Input Methods
291
+ ### Flexible Session Management
147
292
 
148
- - **`prompt.ask()`** - Free-form input with optional validation
149
- - **`prompt.select()`** - Force selection from predefined options
150
- - **`prompt.yes?()`** - Simple yes/no questions
293
+ Configure sessions for your use case:
151
294
 
152
- ## WhatsApp Client
295
+ ```ruby
296
+ # Durable sessions across timeouts
297
+ processor = FlowChat::Processor.new(self) do |config|
298
+ config.use_durable_sessions # Uses user identifier (usually phone number) for session ID
299
+ end
300
+
301
+ # Cross-platform sessions
302
+ processor = FlowChat::Processor.new(self) do |config|
303
+ config.use_cross_platform_sessions # Share sessions between platforms (e.g. USSD & WhatsApp)
304
+ end
305
+
306
+ # URL-based multi-tenancy
307
+ processor = FlowChat::Processor.new(self) do |config|
308
+ config.use_url_isolation # tenant1.app.com vs tenant2.app.com
309
+ end
310
+ ```
311
+
312
+ ## 🛠️ Supported Platforms & Gateways
313
+
314
+ | Platform | Available Gateways | Features |
315
+ |----------|-------------------|----------|
316
+ | **USSD** | `Nalo` ✅, Custom | Pagination, choice mapping, session management |
317
+ | **WhatsApp** | `CloudApi` ✅, Custom | Rich media, buttons, lists, templates, background jobs |
318
+ | **Telegram** | `BotApi` ✅, Custom | Inline keyboards, rich media, callbacks, group chats |
319
+ | **HTTP** | `Simple` ✅, Custom | Testing, webhooks, API endpoints, JSON responses |
320
+ | **Simulator** | Built-in ✅ | Development testing, conversation replay, flow debugging |
321
+ | **Custom** | *Your Gateway* | Implement any platform by creating a gateway class |
322
+
323
+ *✅ = Included with FlowChat*
153
324
 
154
- Send messages outside of flows:
325
+ ### Gateway Examples
155
326
 
156
327
  ```ruby
157
- config = FlowChat::Whatsapp::Configuration.from_credentials
158
- client = FlowChat::Whatsapp::Client.new(config)
159
-
160
- # Send messages
161
- client.send_text("+1234567890", "Hello!")
162
- client.send_buttons("+1234567890", "Choose:", [
163
- { id: 'option1', title: 'Option 1' },
164
- { id: 'option2', title: 'Option 2' }
165
- ])
328
+ # Built-in gateways (included with FlowChat)
329
+ config.use_gateway FlowChat::Ussd::Gateway::Nalo
330
+ config.use_gateway FlowChat::Whatsapp::Gateway::CloudApi, whatsapp_config
331
+ config.use_gateway FlowChat::Telegram::Gateway::BotApi, telegram_config
332
+ config.use_gateway FlowChat::Http::Gateway::Simple
333
+
334
+ # Custom gateway examples (you would build these)
335
+ config.use_gateway MyCompany::Sms::Gateway::Twilio, twilio_config
336
+ config.use_gateway MyCompany::Slack::Gateway::BoltJS, slack_config
337
+ ```
338
+
339
+ ## 📦 Example Applications
340
+
341
+ - [**USSD Banking App**](docs/examples/ussd-banking.md) 🚧 - Complete banking flow with validation
342
+ - [**WhatsApp Customer Service**](docs/examples/whatsapp-support.md) 🚧 - Media support and templates
343
+ - [**HTTP API Chatbot**](docs/examples/http-api.md) 🚧 - JSON API for web/mobile integration
344
+ - [**Multi-Platform E-commerce**](docs/examples/multi-platform-shop.md) 🚧 - Unified shopping across USSD, WhatsApp, and HTTP
345
+ - [**Multi-Tenant SaaS**](docs/examples/multi-tenant.md) 🚧 - URL-based tenant isolation
346
+ - [**Custom Gateway Example**](docs/examples/custom-gateway.md) 🚧 - Building a Telegram gateway
347
+
348
+ ## 🧪 Testing & Development
349
+
350
+ FlowChat includes a built-in simulator interface for easy development and testing:
351
+
352
+ ```ruby
353
+ # Simulator is automatically enabled in development
354
+ processor = FlowChat::Processor.new(self) do |config|
355
+ config.use_gateway FlowChat::Ussd::Gateway::Nalo # or any gateway
356
+ end
357
+
358
+ # Explicitly control simulator mode if needed
359
+ processor = FlowChat::Processor.new(self, enable_simulator: false) do |config|
360
+ # Disable simulator even in development
361
+ end
166
362
  ```
167
363
 
168
- ## Testing Simulator
364
+ The simulator provides a web interface for testing your flows during development. It works the same regardless of which gateway you're using, allowing you to test your conversational logic before deploying to actual platforms.
169
365
 
170
- FlowChat includes a powerful built-in simulator with a modern web interface for testing both USSD and WhatsApp flows:
366
+ **Learn more**: [Testing & Simulation Guide](docs/testing.md)
171
367
 
172
- ![FlowChat Simulator](docs/images/simulator.png)
368
+ ## 🤝 Contributing
173
369
 
174
- Features:
175
- - 📱 **Visual Interface** - Phone-like display with real conversation flow
176
- - 🔄 **Environment Switching** - Toggle between USSD and WhatsApp modes
177
- - 📊 **Request Logging** - Real-time HTTP request/response monitoring
178
- - 🎯 **Interactive Testing** - Test flows with character counting and validation
179
- - 🛠️ **Developer Tools** - Session management and connection status
370
+ We welcome contributions!
180
371
 
181
- See the [Testing Guide](docs/testing.md) for complete setup instructions and testing strategies.
372
+ 1. Fork the repository
373
+ 2. Create your feature branch (`git checkout -b feature/amazing-feature`)
374
+ 3. Commit your changes (`git commit -m 'Add amazing feature'`)
375
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
376
+ 5. Open a Pull Request
182
377
 
378
+ ## 📄 License
183
379
 
184
- ## Documentation
380
+ FlowChat is released under the [MIT License](LICENSE.txt).
185
381
 
186
- - **[WhatsApp Setup](docs/whatsapp-setup.md)** - Comprehensive WhatsApp configuration
187
- - **[USSD Setup](docs/ussd-setup.md)** - USSD gateway configuration and examples
188
- - **[Flow Development](docs/flows.md)** - Advanced flow patterns and techniques
189
- - **[Session Management](docs/sessions.md)** - Session architecture and configuration
190
- - **[Media Support](docs/media.md)** - Rich media handling for WhatsApp
191
- - **[Testing Guide](docs/testing.md)** - Complete testing strategies
192
- - **[Configuration Reference](docs/configuration.md)** - All configuration options
193
- - **[Instrumentation](docs/instrumentation.md)** - Monitoring and metrics
194
- - **[Security](docs/security.md)** - Security best practices
195
- - **[Examples](examples/)** - Complete working examples
382
+ ## 🆘 Support
196
383
 
197
- ## Examples
384
+ - **Documentation**: Comprehensive guides in the [docs/](docs/) directory
385
+ - **Issues**: [GitHub Issues](https://github.com/radioactive-labs/flow_chat/issues)
386
+ - **Discussions**: [GitHub Discussions](https://github.com/radioactive-labs/flow_chat/discussions)
198
387
 
199
- See the [examples directory](examples/) for complete implementations:
388
+ ## 🏢 Commercial Support
200
389
 
201
- - **[USSD Controller](examples/ussd_controller.rb)** - Full USSD implementation
202
- - **[WhatsApp Controller](examples/whatsapp_controller.rb)** - Basic WhatsApp setup
203
- - **[Multi-tenant WhatsApp](examples/multi_tenant_whatsapp_controller.rb)** - Advanced WhatsApp
204
- - **[Background Jobs](examples/whatsapp_message_job.rb)** - Async message processing
205
- - **[Simulator Controller](examples/simulator_controller.rb)** - Testing setup
390
+ FlowChat is developed by [Radioactive Labs](https://github.com/radioactive-labs). Commercial support, custom development, and consulting services are available.
206
391
 
207
- ## License
392
+ ---
208
393
 
209
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
394
+ **Ready to build amazing conversational experiences?** Check out the [Getting Started Guide](docs/getting-started.md) to create your first FlowChat application.
data/Rakefile CHANGED
@@ -1,5 +1,9 @@
1
1
  require "bundler/gem_tasks"
2
2
  require "rake/testtask"
3
+ require "standard/rake"
4
+
5
+ # Load custom rake tasks
6
+ Dir.glob("lib/tasks/**/*.rake").each { |r| load r }
3
7
 
4
8
  Rake::TestTask.new(:test) do |t|
5
9
  t.libs << "test"
@@ -7,4 +11,4 @@ Rake::TestTask.new(:test) do |t|
7
11
  t.test_files = FileList["test/**/*_test.rb"]
8
12
  end
9
13
 
10
- task default: :test
14
+ task default: %i[test standard]