2.4 KiB
2.4 KiB
Quick Start Guide - SMS Gateway API
This guide will help you get the SMS Gateway API up and running quickly.
Prerequisites
Ensure you have the following installed:
- Ruby 3.4.7
- PostgreSQL 14+
- Redis 7+
- Bundler 2.x
Step-by-Step Setup
1. Install Dependencies
bundle install
2. Set Up Database
# Create databases
bin/rails db:create
# Run migrations
bin/rails db:migrate
# Seed sample data (includes API keys and test gateways)
bin/rails db:seed
⚠️ IMPORTANT: After seeding, you'll see API keys printed. Save these immediately as they won't be shown again!
3. Start Redis
If Redis isn't running:
redis-server
4. Start Sidekiq (Background Jobs)
In a separate terminal:
bundle exec sidekiq
5. Start Rails Server
bin/rails server
The API will be available at http://localhost:3000
Quick Test
Test the Health Check
curl http://localhost:3000/up
Should return 200 OK.
Send a Test SMS
Replace YOUR_API_KEY with the API key from the seed output:
curl -X POST http://localhost:3000/api/v1/sms/send \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"to": "+1234567890",
"message": "Test message from SMS Gateway API"
}'
Check System Stats
curl http://localhost:3000/api/v1/admin/stats \
-H "Authorization: Bearer YOUR_API_KEY"
Next Steps
- Read the full API documentation in
README.md - Set up an Android gateway device using the gateway API key from seeds
- Configure webhooks for real-time SMS notifications
- Integrate OTP functionality into your application
Common Issues
Redis Connection Error
Make sure Redis is running:
redis-cli ping
Should return PONG.
Database Connection Error
Check your PostgreSQL is running and accessible:
psql -d my_smsa_pio_development
Sidekiq Not Processing Jobs
Ensure Sidekiq is running:
bundle exec sidekiq
Development Workflow
- Console:
bin/rails console - Routes:
bin/rails routes | grep api - Logs:
tail -f log/development.log - Sidekiq Web UI: Add to routes and visit
/sidekiq
Getting Help
- Check
README.mdfor complete API documentation - Check
CLAUDE.mdfor development guidance - Review logs in
log/development.logandlog/sidekiq.log
Happy coding! 🚀