A serverless WhatsApp-based CV review bot using Firebase Cloud Functions, Twilio's WhatsApp API, and Stripe for payments.
Sherlock Bot allows users to:
- Upload their CV (PDF/DOCX) via WhatsApp
- Choose between Basic (free) or Advanced (paid) reviews
- Receive insights directly on WhatsApp
- Process payments seamlessly with Stripe
- Get detailed CV improvement recommendations
The project uses a serverless architecture built on Firebase:
- Firebase Cloud Functions: Handles webhooks, processing, and business logic
- Firebase Firestore: Stores user sessions and review results
- Firebase Storage: Securely stores CV files temporarily
- Twilio WhatsApp API: Provides the messaging interface
- Stripe: Handles payment processing
sherlock-bot/
│
├── functions/ # Firebase Cloud Functions
│ ├── index.js # Main entry point
│ ├── src/
│ │ ├── config/ # Configuration files
│ │ ├── controllers/ # Request handlers
│ │ ├── services/ # Business logic
│ │ ├── utils/ # Utility functions
│ │ └── models/ # Data models
│ │
│ ├── package.json # Node.js dependencies
│ └── .env.example # Environment variables template
│
├── firebase.json # Firebase configuration
├── firestore.rules # Security rules for Firestore
├── firestore.indexes.json # Indexes for Firestore queries
├── storage.rules # Security rules for Firebase Storage
│
├── scripts/ # Deployment scripts
│
├── .github/ # GitHub Actions workflows
│ └── workflows/
│ └── deploy.yml # CI/CD pipeline
│
├── docs/ # Documentation
│
└── README.md # Project overview
- Firebase account with Blaze (pay-as-you-go) plan
- Twilio account with WhatsApp API access
- Stripe account for payment processing
- Node.js (v16 or higher)
- Firebase CLI
-
Clone the repository
git clone https://github.com/yourusername/sherlock-bot.git cd sherlock-bot -
Create a Firebase project
firebase login firebase projects:create sherlock-bot-xyz firebase use sherlock-bot-xyz
-
Install dependencies
cd functions npm install -
Configure environment variables
cp .env.example .env # Edit .env with your API keys and configuration -
Deploy to Firebase
cd .. ./scripts/deploy.sh -
Configure Twilio webhook
- In your Twilio console, set up the WhatsApp Sandbox
- Configure the webhook URL to point to your Cloud Function
https://us-central1-sherlock-bot-xyz.cloudfunctions.net/api/webhook -
Configure Stripe webhook
- In your Stripe dashboard, set up a webhook
- Configure the endpoint to point to your Cloud Function
https://us-central1-sherlock-bot-xyz.cloudfunctions.net/api/payment-webhook- Select the
checkout.session.completedevent
Once set up, users can interact with the bot by:
- Sending "Hi" or "Review CV" to your Twilio WhatsApp number
- Choosing between Basic or Advanced review
- Uploading their CV document
- Receiving review feedback directly in WhatsApp
-
Start the Firebase emulators:
firebase emulators:start
-
Set up Twilio to work with your local environment:
- Use ngrok to expose your local server
ngrok http 5001
- Update your Twilio webhook URL to point to the ngrok URL
- Create new service files in
functions/src/services/ - Extend controllers in
functions/src/controllers/ - Update security rules as needed in
firestore.rulesandstorage.rules
Files are automatically deleted after 24 hours using a scheduled Cloud Function. This ensures data privacy and compliance.
Use Firebase Console to monitor:
- Function invocations and errors
- Storage usage
- Firestore operations
MIT License - See LICENSE for details.
For questions or support, please contact your-email@example.com
